Change graph colour with thold?

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
squeak
Posts: 27
Joined: Fri Nov 26, 2010 5:59 pm

Change graph colour with thold?

Post by squeak »

Hi Guys,

I'm sure i have seen this done somewhere, but can't seem to find it by searching.

Can you tell me if it's possible to have thold change the graph colour (background or border) when a threshold is breached?

I need to visually highlight graphs which are cycling through a display using the 'cycle' plugin.

Thanks in advance for any suggestions!
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Change graph colour with thold?

Post by noname »

How about this way?

Enable "Toggle Threshold VRULES On":
Image

Image

But I'm not sure whether this option will work with cycle plugin..
squeak
Posts: 27
Joined: Fri Nov 26, 2010 5:59 pm

Re: Change graph colour with thold?

Post by squeak »

Hi'ya,

Thanks for that, that does indeed still work when used with Cycle, however, it's not really 'visual' enough for what we need. I've got to get someone's attention very quickly as soon as a threshold is crossed and really need to trigger a large colour-change or similar. Do you (or anyone else) know of a way to get more of an impact out of a threshold breach?

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

Re: Change graph colour with thold?

Post by noname »

Hmm... Then, how about like this?

Image

Additional code for 'plugins/thold/setup.php':

Code: Select all

function thold_rrd_graph_graph_options ($g) {
	...
	
	// If the latest status is not normal, change background color of the graph
	$last_stat = db_fetch_cell("SELECT status FROM plugin_thold_log WHERE graph_id = $id ORDER BY time DESC LIMIT 1");
	if ($last_stat != ST_RESTORAL && $last_stat != ST_NOTIFYRS) {
		$g['graph_opts'] .= '--color BACK#FFAAAA' . RRD_NL;
	}

	return $g;
}
// Tested on thold-v0.4.9-3 / Cacti 0.8.7i-PIA-3.1, but not fully verified
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests