Thresholding / Alerting Plugin - Official Q/A Thread
Moderators: Developers, Moderators
I have been using Cacti for a while now but I have just added the latest version of the plugin architecture and threshold 0.3.0. I have got everything working ok and emails going outbound.
The only problem I am experiencing is that the graph appears to be broken in the email. At first I though it was a Microsoft Outlook problem but not only have I sent my images to download but I am experiencing the same problem using Google mail via their web portal and when I download the attachment from webmin it will not open as it is empty.
I have put the URL from the HTML email (as listed below) in the browser directly and I get cacti appear but it has a "validation error" in the page as you can see from below.
HTML email content:
<a href=https://192.168.1.7/graph.php?local_gra ... r><br><img src='cid:be7eafcc850ee3ab431ec2c57eefff49'>
<BR>
<P><FONT SIZE=2>--<BR>
No virus found in this incoming message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.1.405 / Virus Database: 268.12.2/441 - Release Date: 07/09/2006<BR>
</FONT> </P>
<P><FONT SIZE=2 FACE="Arial"> </FONT> </P>
Can you help please as I have been through all the Threshold messages and can not find anything?
Thanks.
The only problem I am experiencing is that the graph appears to be broken in the email. At first I though it was a Microsoft Outlook problem but not only have I sent my images to download but I am experiencing the same problem using Google mail via their web portal and when I download the attachment from webmin it will not open as it is empty.
I have put the URL from the HTML email (as listed below) in the browser directly and I get cacti appear but it has a "validation error" in the page as you can see from below.
HTML email content:
<a href=https://192.168.1.7/graph.php?local_gra ... r><br><img src='cid:be7eafcc850ee3ab431ec2c57eefff49'>
<BR>
<P><FONT SIZE=2>--<BR>
No virus found in this incoming message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.1.405 / Virus Database: 268.12.2/441 - Release Date: 07/09/2006<BR>
</FONT> </P>
<P><FONT SIZE=2 FACE="Arial"> </FONT> </P>
Can you help please as I have been through all the Threshold messages and can not find anything?
Thanks.
- Attachments
-
- cacti threshold email.JPG (33.8 KiB) Viewed 16751 times
The validation error was because you pasted the html code into the url also, you just need the url. https://192.168.1.7/graph.php?local_gra ... 3&rra_id=1
Is there an attachment in the email? There doesn't appear to be from what I can see. Is your antivirus or the baracudda spam filter stripping the attachment?
Is there an attachment in the email? There doesn't appear to be from what I can see. Is your antivirus or the baracudda spam filter stripping the attachment?
I think that it maybe a permissions issue of some description but I am not sure where or how. I am running the following:
Linux RH9.0
httpd-2.0.40
php-4.2.2
Cacti-0.8.6h
Cactid-0.8.6g
Plugin-Arch for 0.8.6h
Threshold-0.3.0
I am assuming these images are in the mysql database. I get the graph displayed under the threshold management when I click on the threshold template that I have activated. So it just appears to be an email issue?
Linux RH9.0
httpd-2.0.40
php-4.2.2
Cacti-0.8.6h
Cactid-0.8.6g
Plugin-Arch for 0.8.6h
Threshold-0.3.0
I am assuming these images are in the mysql database. I get the graph displayed under the threshold management when I click on the threshold template that I have activated. So it just appears to be an email issue?
I have now ruled out a permissions issue as I have had everything running as root with max permissions to everything including using the root user in the mysql database but still the problem persists. I have also tried sending the mails using the PHP, sendmail and SMTP options and that has no effect. I them configured the email to go to a local user and used the webmin tool via the sendmail plugin to read the email and I get the png image as an attachment but when I open it its broken. I have since built a second Cacti system on another Linux server to use as a test bed and I have the same problem there as well with Threshold and Reports plugins.
Has anyone else had anything similar with Threshold or the Reports plugins?
Does anyone know where do the images that get attached to the email to be sent out live within the file or database systems?
Has anyone else had anything similar with Threshold or the Reports plugins?
Does anyone know where do the images that get attached to the email to be sent out live within the file or database systems?
Thanks for helping out, this is starting to give me a headache. I have attached the text file for you to see.
I wonder is there anyway to stop Threshold from sending these altogether?
I wonder is there anyway to stop Threshold from sending these altogether?
- Attachments
-
- 43-png.txt
- (15.18 KiB) Downloaded 624 times
Sending Alerts via THOLD without Attachment
I have never had a problem with the Graph being generated properly. However I disabled the attachments as I use this for SMS like messages to my cell phone. Sprint (10digit#@messaging.sprintpcs.com) restricts the number of characters in the subject and will not deliver the message with the attachment. I resolved this by editing this file:
thold-functions.php
Around line 571:
$mail->Subject = $subject;
$mail->Body = $message . '<br>';
$mail->AltBody = strip_tags($subject . "\n" . $message); // Added by Crosscut
$mail->CreateHeader();
/* Commented out by Crosscut
if (is_array($filename)) {
foreach($filename as $val) {
$graph_data_array = array("output_flag"=> RRDTOOL_OUTPUT_STDOUT);
$data = rrdtool_function_graph($val['local_graph_id'], $val['rra_id'], $graph_data_array);
if ($data != "") {
$cid = md5(uniqid(time()));
$mail->AddStringEmbedAttachment($data, $val['filename'].'.png', $cid, 'base64', $val['mimetype']); // optional name
$mail->Body .= "<br><br><img src='cid:$cid'>";
} else {
$mail->Body .= "<br><img src='" . $val['file'] . "'>";
$mail->Body .= "<br>Could not open!<br>" . $val['file'];
}
}
$mail->AttachAll();
}
*/
I simply commented out the attachment function and concatenated the message body with the subject so I could see the entire subject as SprintPCS limits the SUBJECT characters and it gets cut off. Hope this helps. Perhaps this attachment section could be converted into an if statement looking for a configuration option which enables or disables the inclusion of an attachment.
thold-functions.php
Around line 571:
$mail->Subject = $subject;
$mail->Body = $message . '<br>';
$mail->AltBody = strip_tags($subject . "\n" . $message); // Added by Crosscut
$mail->CreateHeader();
/* Commented out by Crosscut
if (is_array($filename)) {
foreach($filename as $val) {
$graph_data_array = array("output_flag"=> RRDTOOL_OUTPUT_STDOUT);
$data = rrdtool_function_graph($val['local_graph_id'], $val['rra_id'], $graph_data_array);
if ($data != "") {
$cid = md5(uniqid(time()));
$mail->AddStringEmbedAttachment($data, $val['filename'].'.png', $cid, 'base64', $val['mimetype']); // optional name
$mail->Body .= "<br><br><img src='cid:$cid'>";
} else {
$mail->Body .= "<br><img src='" . $val['file'] . "'>";
$mail->Body .= "<br>Could not open!<br>" . $val['file'];
}
}
$mail->AttachAll();
}
*/
I simply commented out the attachment function and concatenated the message body with the subject so I could see the entire subject as SprintPCS limits the SUBJECT characters and it gets cut off. Hope this helps. Perhaps this attachment section could be converted into an if statement looking for a configuration option which enables or disables the inclusion of an attachment.
-
- Posts: 4
- Joined: Wed Nov 01, 2006 4:16 pm
I'm having the same problem mentioned by someone in an earlier post, but I haven't seen an response or a solution.
The check-thold.php script is not running after the polling process. I have tried both cmd.php and cactid for the Poller Type, but it doesn't make any difference. If I run check-thold.php manually then thresholds/alerts are processed.
Can anyone suggest where the problem might be? I can't figure out where check-thold.php is being called from as part of the polling process.
The check-thold.php script is not running after the polling process. I have tried both cmd.php and cactid for the Poller Type, but it doesn't make any difference. If I run check-thold.php manually then thresholds/alerts are processed.
Can anyone suggest where the problem might be? I can't figure out where check-thold.php is being called from as part of the polling process.
cigamit would know for sure, but I think the check-thold.php is being called by a do_hook("poller_bottom") statement at the end of the poller.php script. It looks like the poller_bottom hooks are populated by the setup.php script. In the setup.php script it looks like poller_bottom is configured to call a function named "thold_poller_bottom". This function basically runs PHP and executes the check-thold.php script.cngarrison wrote:I can't figure out where check-thold.php is being called from as part of the polling process.
What OS are you using for Cacit? It looks like the thold_poller_bottom function runs a little differently based on unix and non-unix OS's. Nothing huge, just a string conversion is done on non-unix OS's.
-
- Posts: 4
- Joined: Wed Nov 01, 2006 4:16 pm
The "thold_poller_bottom" function calls the "exec_background" function which I found in "lib/poller.php". That function does "file_exists($filename)" and my PHP Binary is set to "/usr/local/bin/php -d safe_mode=Off" so the file_exists test fails.warnesj wrote:In the setup.php script it looks like poller_bottom is configured to call a function named "thold_poller_bottom". This function basically runs PHP and executes the check-thold.php script.
I have commented out the file_exists check and check-thold.php is running now. So, what is the correct fix for this?
Should I be setting the safe_mode directive somewhere else? Or should the 'exec_background' function be more flexible with its file_exists check?
I'm running Cacti on a Red Hat Linux (RHEL) box.warnesj wrote:What OS are you using for Cacit? It looks like the thold_poller_bottom function runs a little differently based on unix and non-unix OS's.
grouping by device
is it possible to group thresholds by device? much easier to look at. thanks.
-
- Posts: 21
- Joined: Wed Feb 14, 2007 8:46 pm
Executing a script when a threshold is breached?
We have been using Cacti and the Thold plugin in our organization for around two years now, and everything works just fine; and now we want to be rid completely of our old MRTG setup.
And the only pending issue is the execution of scripts (mainly for sending snmp traps) when a threshold is breached; from what we know, the only external command that can be executed from thold is to send an email notification; is there anyway we could configure a script execution to go along with that outgoing email? A drop down box with a list of scripts to execute from a certain file system route would be the best solution.
Anyone can let me know where in the thold plugin the email notification takes please so i may code the necessary changes?
Thanks in advance.
And the only pending issue is the execution of scripts (mainly for sending snmp traps) when a threshold is breached; from what we know, the only external command that can be executed from thold is to send an email notification; is there anyway we could configure a script execution to go along with that outgoing email? A drop down box with a list of scripts to execute from a certain file system route would be the best solution.
Anyone can let me know where in the thold plugin the email notification takes please so i may code the necessary changes?
Thanks in advance.
Who is online
Users browsing this forum: No registered users and 3 guests