|
|
| Author |
Message |
rfxn
Joined: 08 Jun 2007 Posts: 12
|
Posted: Fri Jun 08, 2007 11:48 am Post subject: Ping Graph and Custom Icons |
|
|
Is there a way to get weathermap to display an icon for different values within a ping graph (DS ping). I would like to display a checkmark icon next to certain nodes if ping is below X value and a caution icon if the ping is above X value.
I have a very rough idea how this would be done but all my efforts so far to materialize it have come up less than successful. Any help would be greatly appreciated.
Currently iv settled for just placing little static icons next to certain nodes and setting overlib values on them to the ping graphs.
| Description: |
|
| Filesize: |
66.36 KB |
| Viewed: |
5371 Time(s) |

|
|
|
| Back to top |
|
 |
rfxn
Joined: 08 Jun 2007 Posts: 12
|
Posted: Sat Jun 09, 2007 5:58 pm Post subject: |
|
|
After much toying with different setups and finally figuring out how to alternate an image based on the value of datasource, I concluded that text based labels with alternating colors/custom scales was more informative at a glance.
Here is the final version of my in production weathermap. Note that the pktloss values use a custom scale such that 0-1% is green and 1-100% is red (no tolerance for any pkt loss on the network). The latency uses a scale that alternates over 3 colors, green for 0-6ms, yellow for 7 to 10ms and red for 10ms and higher (i had to play with the maxvalue and scale percentages to ge this just right). Then the cpu scale is straight forward using 3 colors as well - green, yellow red - 0-25, 25-50 and 50-100 respective. Likewise of course overlibs and infourls are set on everything, for the gateway to internet link im aggregating the values of the core1 and core2 targets and for the bk-lan link im aggregating the private interface targets for our backup servers.
| Description: |
|
| Filesize: |
78.35 KB |
| Viewed: |
5342 Time(s) |

|
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Sun Jun 10, 2007 10:44 am Post subject: Re: Ping Graph and Custom Icons |
|
|
| rfxn wrote: | Is there a way to get weathermap to display an icon for different values within a ping graph (DS ping). I would like to display a checkmark icon next to certain nodes if ping is below X value and a caution icon if the ping is above X value.
I have a very rough idea how this would be done but all my efforts so far to materialize it have come up less than successful. Any help would be greatly appreciated.
Currently iv settled for just placing little static icons next to certain nodes and setting overlib values on them to the ping graphs. |
Without writing a post-processing plugin (which is completely undocumented), the way to do this will be a bodge:
When a value matches a scale, the internal 'key name' of that scale is stored in inscalekey (and outscalekey). Since it's predictable (the name is lowvalue_highvalue, for example, 1_10 for 1%->10%) you can use it in the filename for your icon, so:
| Code: |
ICON latency_{node:this:inscalekey}.png
|
and an icon called something like latency_1_10.png would do it, with the right scale. Obviously this will also change the colour of the label, but if you had a scale that looked like:
| Code: |
SCALE 0 1 255 255 255
SCALE 1 15 255 255 255
SCALE 15 30 255 255 255
SCALE 30 50 255 255 255
SCALE 50 100 255 255 255
|
Then you could get that scalekey, and not actually change the label's colour.
Told you it was a bodge.
Nice to see a map with a lot of 0.9 features in it though!
One last thing worth mentioning with all that: the {node:this:...} can just as easily be {node:nodename:....}, so you could hide all the actual latency values offscreen (POSITION 10000 10000) if you want a neater map with just the checkmarks. The editor would even less useful in that situation though.
|
|
| Back to top |
|
 |
Goatmilker
Joined: 08 May 2007 Posts: 22 Location: Brussels
|
Posted: Mon Jun 18, 2007 4:44 am Post subject: |
|
|
Hi rfxn,
It would be nice to have an example how you did these labels with the latency/packet loss.
Much appreciated,
Lieven
|
|
| Back to top |
|
 |
Mika2006 Cacti User
Joined: 03 May 2007 Posts: 165
|
Posted: Wed Jun 20, 2007 7:22 am Post subject: |
|
|
yes!
up
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
|
| Back to top |
|
 |
Goatmilker
Joined: 08 May 2007 Posts: 22 Location: Brussels
|
Posted: Wed Jun 27, 2007 4:28 am Post subject: |
|
|
Yup, I came across that link earlier on... however still few questions:
1) How can I see the value behind the comma? (ex: I now see value 10 instead of 10.99 which I prefer to see.)
This is what I'm using now
| Code: | NODE test
LABEL {node:this:bandwidth_in:%d}ms
ICON images/6500.png
TARGET gauge:/var/www/html/rra/{node:this:name_id}.rrd:ping:- |
2) How can I use the Availability and Current (ms) values under Console>(Management)Devices? Instead of creating a ping graph to each device I rather would like to use this ping value to monitor response times.
Thanks in advance,
Lieven
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Wed Jun 27, 2007 4:59 am Post subject: |
|
|
| Goatmilker wrote: | Yup, I came across that link earlier on... however still few questions:
|
Not too sure how, because I wrote it in response to your question, but anyway...
| Goatmilker wrote: |
1) How can I see the value behind the comma? (ex: I now see value 10 instead of 10.99 which I prefer to see.)
This is what I'm using now
| Code: | NODE test
LABEL {node:this:bandwidth_in:%d}ms
ICON images/6500.png
TARGET gauge:/var/www/html/rra/{node:this:name_id}.rrd:ping:- |
|
The %d is forcing the value to an integer. So you'd want just {node:this:bandwidth_in} to allow the normal number formatting to happen.
| Goatmilker wrote: |
2) How can I use the Availability and Current (ms) values under Console>(Management)Devices? Instead of creating a ping graph to each device I rather would like to use this ping value to monitor response times. |
You can't currently, but that's a good idea. The cactihost DS plugin already looks up host information to get the state of the host. It would be easy to add the other information too. So I'll do that in the next version.
|
|
| Back to top |
|
 |
Goatmilker
Joined: 08 May 2007 Posts: 22 Location: Brussels
|
Posted: Wed Jun 27, 2007 6:48 am Post subject: |
|
|
Thanks a lot Howie!
By removing the %d I got back the "whole 9 numbers" after the comma but your explanation about the integer gave me the hint where to look for, so I finally found that {node:this:bandwidth_in:%.2f} gives me the 2 digits after the comma, which is exactly what I need!
btw, I got a few days off so yesterday I found the URL while this forum was down...
Regards,
Lieven
|
|
| Back to top |
|
 |
StarLog Cacti User
Joined: 02 Jun 2007 Posts: 128
|
Posted: Wed Jun 27, 2007 9:33 am Post subject: |
|
|
rfxn,
are you able to post a few snippets or the entire config for us noobs to gleam some ideas of your code.?
Thanks
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Wed Jun 27, 2007 6:02 pm Post subject: |
|
|
| Howie wrote: | | You can't currently, but that's a good idea. The cactihost DS plugin already looks up host information to get the state of the host. It would be easy to add the other information too. So I'll do that in the next version. |
I've added this feature in the SVN version. You can download just that one file from:
http://www.network-weathermap.com/svn/repos/trunk/lib/datasources/
if you like. I don't recommend downloading the whole SVN version - the RRD data source and Weathermap.class.php don't work fully right now.
The new variable names (like 'state') are: cacti_hostname, cacti_description, cacti_curtime, cacti_avgtime, cacti_mintime, cacti_maxtime, cacti_availability, cacti_faildate, cacti_recdate. So you can use TARGET cactihost:33 to get the current state, response time and availability of host #33 in your cacti install, then LABEL Avail: {node:this:cacti_availability}% or similar, to display the availability.
This will be in 0.93 when it is released.
|
|
| Back to top |
|
 |
Goatmilker
Joined: 08 May 2007 Posts: 22 Location: Brussels
|
Posted: Thu Jun 28, 2007 4:09 am Post subject: |
|
|
Good morning Howie,
I've adjust the WeatherMapDataSource_cactihost.php file but upon recalculating my maps I get the next error.
| Code: | | Fatal error: Cannot redeclare class weathermapdatasource:weathermapdatasource_cactihost in /var/www/html/plugins/weathermap/lib/datasources/WeatherMapDataSource_cactihost.php on line 3 |
not sure how to solve this... I guess renaming the class won't be the solution?
Regards,
Lieven
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Thu Jun 28, 2007 4:18 am Post subject: |
|
|
| Goatmilker wrote: | Good morning Howie,
I've adjust the WeatherMapDataSource_cactihost.php file but upon recalculating my maps I get the next error.
| Code: | | Fatal error: Cannot redeclare class weathermapdatasource:weathermapdatasource_cactihost in /var/www/html/plugins/weathermap/lib/datasources/WeatherMapDataSource_cactihost.php on line 3 |
not sure how to solve this... I guess renaming the class won't be the solution?
Regards,
Lieven |
Umm. is it a case-sensitive issue? You should have only this cactihost file, and not the original one... this sounds like somehow you have something like Weathermapdatasource and WeatherMapDataSource, for example, so there are two files containing the same class.
|
|
| Back to top |
|
 |
Goatmilker
Joined: 08 May 2007 Posts: 22 Location: Brussels
|
Posted: Thu Jun 28, 2007 5:22 am Post subject: |
|
|
| Howie wrote: |
...so there are two files containing the same class. |
Exactly! I renamed the existing WeatherMapDataSource_cactihost.php file (you'll never know it might become useful ) so I deleted it and the problem is fixed.
One remark. If I use a scale to change to LABEL collor it won't be using it correctly. for example I got an availability of 99,99608 and it's in red.
| Code: | SCALE aval 0 97 255 0 0
SCALE aval 97 98 255 192 0
SCALE aval 98 99 240 240 0
SCALE aval 99 100 0 240 0 |
if I scale down the first 2 rules as below it shows me the 2nd collor. Seems it got a value "2"?
| Code: |
SCALE aval 0 2 255 0 0
SCALE aval 2 98 255 192 0
SCALE aval 98 99 240 240 0
SCALE aval 99 100 0 240 0 |
Regards,
Lieven
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Thu Jun 28, 2007 5:28 am Post subject: |
|
|
| That's true. The actual 'bandwidth data' for the TARGET is still the state of the host (up, down, recovering etc). You won't be able to use any of the new variables with a SCALE.
|
|
| Back to top |
|
 |
|