Change icon/colour when node down/up

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Change icon/colour when node down/up

Post by EAleg »

Hello guys, i found the articles, wheres says about changes colours and icons, but cannot understand how this make... :(

For example:
https://forum.network-weathermap.com/t/ ... r-nodes/34

Quote:

SCALE cactiupdown 0 0.5 192 192 192 disabled
SCALE cactiupdown 0.5 1.5 255 0 0 down
SCALE cactiupdown 1.5 2.5 0 0 255 recovering
SCALE cactiupdown 2.5 3.5 0 255 0 up
SCALE cactiupdown 4.5 5.5 128 128 128 unknown

NODE mynode
POSITION 100 100
TARGET cactihost:22
USESCALE cactiupdown in
ICON images/state_{node:this:inscaletag}.png



And, when i want that node came red (icons have changed), i must type:
SCALE cactidown 1.0 - 1.5 255 0 0 Down
SCALE cactiup 2.0 - 2.5 0 255 0 Up

Its rigth?

NODE city1
POSITION 150 100
TARGET cactihost:35
USESCALE cactiupdown
ICON images/state_{node:this:inscaletag}.png
USESCALE cactiup
ICON images/state_{nodeup:this:inscaletag}.png


And how will the card know that the host is not available?
Draw a line, but instead of speed, specify (attach) a ping command or something ...
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

1) There should not any - in the SCALE lines.
2) do you have any images called state_Up.png and state_Down.png in your images folder?

What happens is that weathermap gets the status from cacti for the node #35. That is a number between 0 and 5. You can see the list here: https://network-weathermap.com/manual/0 ... #cactihost

So you need to make a scale that matches those numbers:

Code: Select all

SCALE cactiupdown 0 0.5 192 192 192 disabled
SCALE cactiupdown 0.5 1.5 255 0 0 down
SCALE cactiupdown 1.5 2.5 0 0 255 recovering
SCALE cactiupdown 2.5 3.5 0 255 0 up
SCALE cactiupdown 4.5 5.5 128 128 128  unknown
When the value from the status matches one of these lines, it sets the colour of the node to the colour (e.g. 192,192,192 - grey).

BUT - it also sets node:this:inscaletag to the text at the end of the line "disabled"

So you can use that in the ICON filename, and it will try to find an ICON file called images/state_disabled.png

You need to make those images for the 5 different states.

If you only want the text label to change colour instead - just use "ICON none" and the label colour by itself will change. You don't need any image files for that.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Okaaa-y, then, how cacti will know if node down? (not from links) For example, i cannot ping the node. What and where i must type?


Thank you Howie for help. :)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

Nothing. If the node doesn't answer Cacti's SNMP requests, Cacti marks it as 'down'. Look in the Manage..Devices screen. That is what cactihost: looks at.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Once again, if i want that the node will red (without change icon), when down, i must type:


SCALE cactiupdown 0.5 1.5 255 0 0
SCALE cactiupdown 2.5 3.5 0 255 0 up

NODE 332
POSITION 1524 1002
USESCALE cactidown in (or, what i must type?, maybe just cactiupdown?)
TARGET (where i can find this value? and why i must type this value?)

As I understand it, each node has its own table with a color (in my case, for all), then I go to the node and indicate this table with colors. That's how I understand it ...
USESCALE cactidown. the first we indicate the command to use, and the second the name of this table.

If there is an example, please throw it off, you have good examples.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

For a node I think USESCALE will default to 'in' anyway. For a link, you usually just say the scale name. Weathermap takes the 'in' value and changes that to a colour for half of the link arrow. Then it takes the 'out' value and turns that into the colour for the other half. A Node only has one colour, so it only uses one value to decide that colour - that's what the 'in' is for. For the cactihost: datasource, it's the 'in' value that contains the device status.

The cactihost:xx number comes from the Cacti Manage Devices page. If you click on a device, you can see the device ID in the URL. It might also be in the main list of devices, I don't have Cacti to check. But each device in Cacti has a number, starting with 1 for the cacti host, usually.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Something is wrong arrhh... well:
i have 2 nodes 520 and 457
here's configuration

NODE 520
LABEL city1
INFOURL https://example/1/device/device=520/
ICON images/Router.png
TARGET https://example/graph.php.g8ufdgjdifgjfff=no
USESCALE downcacti in percent
POSITION 100 150

NODE 457
LABEL city1
INFOURL https://example/1/device/device=457/
ICON images/Router.png
TARGET https://example/graph.php.g8ufdgjdifgjfff=no
USESCALE downcacti in percent
POSITION 256 450

SCALE downcacti 0 0.5 192 192 192
SCALE downcacti 0.5 1.5 255 0 0
SCALE downcacti 1.5 2.5 0 0 255
SCALE downcacti 2.5 3.5 0 255 0
SCALE downcacti 4.5 5.5 128 128 128



Nodes working fine, but they (both) have greu colour, why? )=
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

You can't use a URL as a target.

Rule 0: Check the logs!

You will have warnings about those TARGETs saying that they aren't valid.

The first ones you posted "TARGET cactihost:22" is the right format. You just need to put in the correct host ID.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Howie wrote: Fri Aug 21, 2020 6:33 am You can't use a URL as a target.

Rule 0: Check the logs!

You will have warnings about those TARGETs saying that they aren't valid.

The first ones you posted "TARGET cactihost:22" is the right format. You just need to put in the correct host ID.
Then I wrote as an example (= I didn't understand how to find it, sry

When i press on node i can see
position
internal label
label
info url
"hover" graph url
icon filename
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Howie, good day, can You tell me please, how we can change length of link? Example below


Sorry, solved
Attachments
Untitled2_20200828143855.png
Untitled2_20200828143855.png (145.66 KiB) Viewed 8411 times
Last edited by EAleg on Fri Aug 28, 2020 6:47 am, edited 1 time in total.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

SPLITPOS
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
EAleg
Cacti User
Posts: 51
Joined: Wed Jun 10, 2020 3:56 am

Re: Change icon/colour when node down/up

Post by EAleg »

Howie wrote: Fri Aug 28, 2020 6:41 amSPLITPOS
Thank you, got it. But, when i set up value (i want to hide transfer data), something wrong with my arrow..
Attachments
Untitled3_20200831083144.png
Untitled3_20200831083144.png (148.08 KiB) Viewed 8393 times
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Change icon/colour when node down/up

Post by Howie »

Oh change length of link to ZERO?

There is a special mode for that:

Code: Select all

LINKSTYLE oneway
BWLABELPOS 50 50
https://network-weathermap.com/manual/0 ... _LINKSTYLE
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests