librenms-plugins / Weathermap

MIT License
64 stars 51 forks source link

Feature Request: Label color change depending on node UP/DOWN status #63

Open rickard-tpo opened 4 years ago

rickard-tpo commented 4 years ago

Hello! I don't know if anyone is actively maintaining this plugin, but I have (what I believe is) a small feature request.

It would be cool having the labels changing color depending on the node being up or down on in LibreNMS, similar to how it looks in Mikrotik The Dude.

I believe it is the LABELBGCOLOR option mentioned in the Weathermap's documentation (https://network-weathermap.com/manual/0.97b/pages/config-reference.html#NODE_COLORS) which needs to be intergrated with the LibreNMS macros.device_up/down macro.

andrewdkennedy1 commented 2 years ago

I've achieved this with the following

https://github.com/andrewdkennedy1/Weathermap/blob/master/lib/datasources/WeatherMapDataSource_libreAPI.php

anishresthanish commented 1 year ago

I've achieved this with the following

https://github.com/andrewdkennedy1/Weathermap/blob/master/lib/datasources/WeatherMapDataSource_libreAPI.php

Hi, could you help tell me how to add this to librenms.

wayneleetw commented 1 year ago

I put under the node with TARGET libreAPI:hostname USESCALE updown out my label only show red color.. and if i turn the node server down the color still red...

andrewdkennedy1 commented 1 year ago

Here's a full example of a node in my conf

NODE cs-bmp-boff1-se.network
        LABEL cs-bmp-boff1-se
        INFOURL /device/device=354/
        NOTES {node:this:libreAPI_sysDescr}<br>{node:this:libreAPI_version}<br>{node:this:libreAPI_IP}<br>{node:this:libreAPI_MAC}<br>{node:this:libreAPI_serial}<br>{node:this:libreAPI_uptime}
        OVERLIBGRAPH /graph.php?height=100&width=512&device=354&type=device_bits&legend=no
        ICON 80 80 images/WorkgroupSwitch.png
        TARGET libreAPI:{node:this:name}
        USESCALE updown out percent
        LABELOFFSET 0 10
        POSITION 700 1050

I think you're missing percent at the end of your USESCALE line.

Also dont remember if hostname works the way you're using it. I target them with {node:this:name}

wayneleetw commented 1 year ago

Hi Andrew,

Thanks for the reply, I put the percent in the conf. but still have the same. I am thinking will it be the TARGET libreAPI:hostname issue? I also try to put my node IP as my hostname but it is not working. This is my config for node, could you take a look? many thanks!!!

NODE 21 LABEL 172.18.1.5 INFOURL http://librenms.mydomain.local/device/device=21/ OVERLIBGRAPH http://librenms.mydomain.local/graph.php?height=100&width=512&device=21&type=device_bits&legend=no ICON images/Host.png TARGET libreAPI:172.18.1.5 USESCALE updown out percent POSITION 771 94

andrewdkennedy1 commented 1 year ago

Did you make an api key and update the plug-in file with it?

function ReadData($targetstring, &$map, &$item)
    {
        //created and set via http://librenms/api-access
        $weatherapikey = "d8f3e7b79d20e6f41c715e7abcfffaa5";
        $librenmsurl = "http://librenms";
        //set the above to match your env
wayneleetw commented 1 year ago

Did you make an api key and update the plug-in file with it?

function ReadData($targetstring, &$map, &$item)
    {
        //created and set via http://librenms/api-access
        $weatherapikey = "d8f3e7b79d20e6f41c715e7abcfffaa5";
        $librenmsurl = "http://librenms";
        //set the above to match your env

you are right, I missed the part... thank you, my label is working fine now!!

geethreeforce commented 9 months ago

I have the same issue. Generated the api-key configured the datasource: WeatherMapDataSource_libreAPI.php

Modified my configs/weathermap.conf file

SCALE updown 0 0 255 0 0 SCALE updown 0.5 1 255 255 255

And added: USESCALE updown out percent TARGET libreAPI:{node:this:name}

Yet all my nodes are now coloring red. There's one thing. Access to my librenms environment is https enforced.
Could the issue be caused because of this?

G2Net commented 3 months ago

It's all red for me too. I'm looking for a solution for weeks, but the documentation is barely existent for this plugin... ApiKey created, WeatherMapDataSource_libreAPI.php configured, and netmap.conf have: ` SCALE updown 0 0 255 80 80 SCALE updown 0.5 1 90 255 100

NODE node02823 LABEL SW01_PAE_6730 ICON images/Router.png TARGET libreAPI:{node:this:name} USESCALE updown out percent POSITION 960 1600 `

Any help please? I'm kinda stuck at this point...