Thresholding / Alerting Plugin - Official Q/A Thread

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
stu_77
Posts: 28
Joined: Wed Aug 16, 2006 8:41 pm

Post by stu_77 »

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.
Attachments
cacti threshold email.JPG
cacti threshold email.JPG (33.8 KiB) Viewed 16751 times
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

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?
stu_77
Posts: 28
Joined: Wed Aug 16, 2006 8:41 pm

Post by stu_77 »

I have had the mail sent to my gmail account with Google and I get a png attachment but when I open it its broken. Please see attached.
Attachments
gmail-attachment.JPG
gmail-attachment.JPG (26.66 KiB) Viewed 16751 times
gmail.JPG
gmail.JPG (39.24 KiB) Viewed 16751 times
stu_77
Posts: 28
Joined: Wed Aug 16, 2006 8:41 pm

Post by stu_77 »

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?
stu_77
Posts: 28
Joined: Wed Aug 16, 2006 8:41 pm

Post by stu_77 »

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?
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Hum... its been working perfectly for me for well over a year, just to rule a few things out, I will try sending one to my gmail account and see what happens.

Also, can you save the "broken" picture from gmail, and open it with a text editor and see whats inside?
stu_77
Posts: 28
Joined: Wed Aug 16, 2006 8:41 pm

Post by stu_77 »

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?
Attachments
43-png.txt
(15.18 KiB) Downloaded 624 times
crosscut
Posts: 5
Joined: Tue Aug 16, 2005 10:33 am

Sending Alerts via THOLD without Attachment

Post by crosscut »

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.
cngarrison
Posts: 4
Joined: Wed Nov 01, 2006 4:16 pm

Post by cngarrison »

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.
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

cngarrison wrote: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.

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.
cngarrison
Posts: 4
Joined: Wed Nov 01, 2006 4:16 pm

Post by cngarrison »

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.
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.

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?
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.
I'm running Cacti on a Red Hat Linux (RHEL) box.
flipflap
Cacti User
Posts: 142
Joined: Sat Jul 09, 2005 3:13 pm

grouping by device

Post by flipflap »

is it possible to group thresholds by device? much easier to look at. thanks.
idle
Cacti User
Posts: 77
Joined: Wed May 26, 2004 10:49 am
Location: Barcelona
Contact:

Post by idle »

Just downloaded last version from cactiuser.
The first function in file check-thold.php is - 'exit'.
How is that?
psycho.chicken
Posts: 21
Joined: Wed Feb 14, 2007 8:46 pm

Post by psycho.chicken »

I get this...

Table 'cacti.thold_data' doesn't exist


Ideas?
havok1977
Posts: 49
Joined: Fri Apr 08, 2005 1:41 pm

Executing a script when a threshold is breached?

Post by havok1977 »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests