Supppresion window

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
bkejser
Posts: 15
Joined: Wed Aug 17, 2011 7:25 am

Supppresion window

Post by bkejser »

Hi

One of my monitored hosts run a process during off hours that rails the CPU for roughly 30 minutes at the same time every day. Is it possible to configure cacti to not send notification for this specific host and data template during this period?

Thanks
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Supppresion window

Post by BSOD2600 »

Cacti does not send notifications, the thold plugin does. As such, this is a thold specific question and the post is getting moved the appropriate forum.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Supppresion window

Post by noname »

This is a definitely dirty workaround, and not tested at all.. :P

In 'plugins/thold/thold_functions.php', try to modify thold_check_threshold() function.

Original (0.4.4-43):

Code: Select all

function thold_check_threshold ($rra_id, $data_id, $name, $currentval, $cdef) {
	...
	$alert_exempt = read_config_option('alert_exempt');
	/* check for exemptions */
	$weekday = date('l');
	if (($weekday == 'Saturday' || $weekday == 'Sunday') && $alert_exempt == 'on') {
		return;
	}

	/* Get all the info about the item from the database */
	$item = db_fetch_assoc("SELECT * FROM thold_data WHERE thold_enabled = 'on' AND data_id = " . $data_id);

	/* Return if the item doesn't exist, which means its disabled */
	if (!isset($item[0]))
		return;
	$item = $item[0];

	/* Check for the weekend exemption on the threshold level */
	if (($weekday == 'Saturday' || $weekday == 'Sunday') && $item['exempt'] == 'on') {
		return;
	}
	...
Modify the latter part ("Check for the weekend exemption...") as follows:

Code: Select all

	/* Check for the particular exemption on the threshold level */
	$exempt_period = date('G') * 100 + date('i');  // "hhmm"
	if (($exempt_period >= 1200 && $exempt_period <= 1300) && $item['exempt'] == 'on') {
		return;
	}
This will exclude threshold check at lunch time. :)

And then, enable "Weekend Exemption" on particular threshold settings you want. (Don't change "Default Alerting Options" in Settings)
Image

Of course, only 1 set of exemption can be specified.
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Supppresion window

Post by TheWitness »

Dirty hack for sure. We need to do this a bit more elegantly, like Jimmy's new Maintenance plugin.

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 1 guest