Current Value Not Resetting when Device goes down

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
kelbyc
Cacti User
Posts: 52
Joined: Mon Nov 28, 2005 8:50 am

Current Value Not Resetting when Device goes down

Post by kelbyc »

I have created thresholds which are working correctly, however, when the device goes completely down Cacti is not setting the data source value to 0 or to blank. Instead it is retaining the last good value until the device becomes available again. I'm trying to use THold to alert me when these devices go down but since the current value never resets the low threshold is never crossed. The dead host notifications will work as well but I only want to monitor certain devices on my network and not all of them. I have over 300 devices and at times there is a flood of emails if I turn dead notifications on. Is there a way to make the current value change to 0 or blank if the host is dead or is there a way to only monitor certain devices and send dead host notifications to those rather than all devices in Cacti?

KC
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Current Value Not Resetting when Device goes down

Post by noname »

Probably Cacti doesn't regard unknown data as 0 (like as MRTG's "unknaszero" option).
kelbyc wrote:... is there a way to only monitor certain devices and send dead host notifications to those rather than all devices in Cacti?
Though I didn't verify them,
1) manage plugin
2) nmid + nmidUpDownMonitor
See also: http://forums.cacti.net/viewtopic.php?p=215701#p215701

- or -

3) Try this modification to thold plugin (for thold-0.4.4-41 or 43)

Code: Select all

> diff -u thold/includes/polling.php.org thold/includes/polling.php
--- thold/includes/polling.php.org      Mon Feb 14 23:04:46 2011
+++ thold/includes/polling.php  Wed Aug 31 20:12:03 2011
@@ -174,6 +174,11 @@
                                        }
                                }
                                $host = db_fetch_row('SELECT * FROM host WHERE id = ' . $id);
+                               if (api_plugin_is_enabled('monitor')) {
+                                       if ($host['monitor'] != 'on') {
+                                               continue;
+                                       }
+                               }
                                if ($host['status'] == HOST_UP) {
                                        $snmp_system = '';
                                        $snmp_hostname = '';
@@ -288,6 +293,11 @@
                                        continue;
                                }
                        }
+                       if (api_plugin_is_enabled('monitor')) {
+                               if ($host['monitor'] != 'on') {
+                                       continue;
+                               }
+                       }

                        $downtime = time() - strtotime($host['status_rec_date']);
                        $downtime_days = floor($downtime/86400);
@@ -351,6 +361,12 @@
                                if (plugin_maint_check_cacti_host ($host['id'])) {
                                        continue;
                                }
+                       }
+                       if (api_plugin_is_enabled('monitor')) {
+                               $monitor = db_fetch_cell('SELECT monitor FROM host WHERE id = ' . $host['id']);
+                               if ($monitor != 'on') {
+                                       continue;
+                               }
                        }
                        $failed[] = $host['id'];
                }
If you enabled monitor plugin, alerting will be skipped for the host whose "Monitor Host" checkbox is off.
kelbyc
Cacti User
Posts: 52
Joined: Mon Nov 28, 2005 8:50 am

Re: Current Value Not Resetting when Device goes down

Post by kelbyc »

Thanks for the help! The polling.php solution worked great. Now I am only monitoring the devices I need to monitor instead of all of them. My only last request would be how I can set it up to only alert if the device has failed for 2 polling cycles instead of just 1. I tried to attach the modified polling file but I couldn't seem to find an extension that the BB would accept.
kelbyc
Cacti User
Posts: 52
Joined: Mon Nov 28, 2005 8:50 am

Re: Current Value Not Resetting when Device goes down

Post by kelbyc »

I am having an issue now. I'm only getting the recovering email that says the device Returned from the down state. Any idea why I'm not getting the initial email saying the device is down?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Current Value Not Resetting when Device goes down

Post by noname »

kelbyc wrote:I'm only getting the recovering email that says the device Returned from the down state. Any idea why I'm not getting the initial email saying the device is down?
Though I'm not sure about it, what is stored in 'thold_failed_hosts' ?

Code: Select all

mysql> select * from settings where name = "thold_failed_hosts";
On trial, set empty value for it if some host-ids were stored.
kelbyc
Cacti User
Posts: 52
Joined: Mon Nov 28, 2005 8:50 am

Re: Current Value Not Resetting when Device goes down

Post by kelbyc »

I actually realized it is sending the correct message, it just has the wrong subject. I edited poller.php and now it actually says Down instead of recovering in the email. I'm getting both the down and recovering emails now correctly. Thanks for your help!
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Current Value Not Resetting when Device goes down

Post by noname »

kelbyc wrote:I actually realized it is sending the correct message, it just has the wrong subject. I edited poller.php and now it actually says Down instead of recovering in the email. I'm getting both the down and recovering emails now correctly.
Hmm, it looks like this case, but anyway congratulations!
- http://forums.cacti.net/viewtopic.php?f=17&t=41838
leolovemary
Posts: 1
Joined: Mon Oct 10, 2011 1:34 am

Re: Current Value Not Resetting when Device goes down

Post by leolovemary »

Any idea why I'm not getting the initial email saying the device is down?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Current Value Not Resetting when Device goes down

Post by TheWitness »

Make sure you've first tested the e-mails settings under Console->Settings->Mail/DNS

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests