Cacti/plugin_monitor

When sending emails, monitor reports config variable not found

bmfmancini opened this issue · 2 comments

Hey Guys

I have been seeing these errors in the log

2019/11/14 16:12:23 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/monitor/poller_monitor.php[126]:process_email(), /plugins/monitor/poller_monitor.php[483]:CactiErrorHandler())
2019/11/14 16:12:23 - ERROR PHP NOTICE in Plugin 'monitor': Undefined variable: config in file: /var/www/html/cacti/plugins/monitor/poller_monitor.php on line: 483 

Below is the corresponding function where the error is showing

 if (cacti_sizeof($hosts)) {
                                foreach ($hosts as $host) {
                                        $body .= '<tr>' . PHP_EOL;
                                        $body .= '<td class="left"><a class="hyperLink" href="' . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $host['id']) . '">' . $host['description']  . '</a></td>' . PHP_EOL;

                                        $body .= '<td class="left">' . $criticalities[$host['monitor_criticality']]  . '</td>'    . PHP_EOL;
                                        $body .= '<td class="right">' . number_format_i18n($host['monitor_alert'],2) . ' ms</td>' . PHP_EOL;
                                        $body .= '<td class="right">' . number_format_i18n($host['cur_time'],2)      . ' ms</td>' . PHP_EOL;

                                        $body_txt .=
                                                $host['description'] . "\t" .
                                                $criticalities[$host['monitor_criticality']] . "\t" .
                                                number_format_i18n($host['monitor_alert'],2) . " ms\t" .
                                                number_format_i18n($host['cur_time'],2)      . " ms" . PHP_EOL;

                                        $body .= '</tr>' . PHP_EOL;
                                }
                        }

when can we have a curl option lol I hate emails

Looks good man ! thanks