Host & Link Status Monitoring in Weathermap

In weathermap link utilization is working fine.
I want to monitor host and link status. For example, if host is up = green, down = red, error = orange. same for links also. After hours of googling came up with following for host status.

#scale definiation
    SCALE updown 0    0      0 255   0  
    SCALE updown 0    30   255 255   0  
    SCALE updown 30   100  255   0   0  

#under node
   TARGET fping:hostname
   USESCALE updown out percent

But it always shows green even libre says host is down. Can anybody guide what might be wrong ? Also like to know how to monitor port status in Weathermap.

TIA

Old post, but this was bugging me recently and I ended up doing the below. I tried fping and even tried altering the datasource plugin to understand it better but never got any luck.

Below I have white for normal, red if no ping stats. Added the actual number (latency ms) in a label for testing below it as an option too:

image image

Define an updown scale, then use it along with a target that directly references the ping-perf.rrd of the host in question. When the host is down, the RRD ends up with NaN and that translates to 0 when extracted and displayed:

SCALE updown 0 0  255 0 0
SCALE updown 0 10000 255 255 255

NODE BLAH-SW01
        LABEL BLAH-SW01
        INFOURL /device/device=63/
        OVERLIBGRAPH /graph.php?height=100&width=512&device=63&type=device_bits&legend=no
        ICON 80 80 images/WorkgroupSwitch.png
        LABELOFFSET 0 25
        POSITION 178 521
        USESCALE updown in
        TARGET gauge:./BLAH-SW01/ping-perf.rrd:ping:-

# if you want the number for debugging/validation:
NODE BLAH-SW01-LATENCY
        LABEL {node:this:inpercent:%k}
        POSITION 178 570
        USESCALE updown in
        TARGET gauge:./BLAH-SW01/ping-perf.rrd:ping:-

If you wanted to graduate the latency values in to a colour scale, you could do that too.

2 Likes

Excellent! Thank you for sharing. This is what Iā€™ve been looking for.
I had it working and then I updated to the latest build and it seems the logic for getting the RRD path changed somewhere between the old version I was running and the most current.

Is this configuration you shared still working on the latest build?

Post update all the nodes I had setup using your example return the following now

ā€¦had no valid data, according to WeatherMapDataSource_rrd

EDIT:

Upon further investigation it appears it may be due to the fact that Iā€™m running rrdcached

Iā€™ve found some relevant information here
Remote RRDCached support in clustered environment? Ā· Issue #48 Ā· librenms-plugins/Weathermap Ā· GitHub and here No data on graphs when RRDCached is enabled Ā· Issue #71 Ā· librenms-plugins/Weathermap Ā· GitHub

EDIT 2:

https://github.com/librenms/librenms/blob/master/doc/Extensions/RRDCached-Security.md

I setup a ngix proxy for the sock and tried to do some testing by running the command manually

/usr/bin/rrdtool fetch dumbswitch.network/ping-perf.rrd LAST --start now-800 --end now -d localhost:42217

Got

ā€˜ā€˜ERROR: request: internal error while talking to rrdcachedā€™ā€™

So I tailed the nginx log and found

2021/09/03 12:40:10 [crit] 606660#606660: *2757 connect() to unix:/run/rrdcached.sock failed (13: Permission denied) while connecting to upstream, client: 10.250.1.153, server: 0 .0.0.0:42217, upstream: ā€œunix:/run/rrdcached.sockā€, bytes from/to client:0/0, bytes from/to upstream:0/0

Which lead me to the permissions of the files in /var/run/rrdcached

Once I changed the permissions on those files everything worked!

Well done for getting to the bottom of that rabbit hole! :+1:

Iā€™m glad itā€™s working and that someone else was able to confirm it. It continues to work for the latest 0.98a version.

After playing around with it some more I wasnā€™t convinced it was the right fit for me, rrdcache seemed to throw a wrench into this method. I wanted to leverage the LibrenmsAPI for device status so I ended up writing a datasource plugin that does just that. I think itā€™s more true to reflect exactly what you would see in the librenms dashboard availability map regardless of what your RRD environment looks like.

I made a pull request on the plugin , hereā€™s the file if anyone is interested.

1 Like

Thank you for this code.
I was looking for something like this to easily color code the map.
I had originally assumed that that was what the weathermap would do, until everything stayed the same color regardless of connection.

Thanks!

edit WeatherMapDataSource_fping.php

and change:
$this->fping_cmd = ā€œ/usr/local/sbin/fpingā€;

to:
$this->fping_cmd = ā€œ/usr/sbin/fpingā€;

and you should start seeing colors

OlĆ” Consegue me auxiliar nessa configuraĆ§Ć£o?