Display Bandwith usage and status

Support questions about the Network Weather Map plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
Rno
Cacti User
Posts: 350
Joined: Wed Dec 07, 2011 9:19 am

Display Bandwith usage and status

#1 Post by Rno » Thu Aug 11, 2016 2:30 am

I try to display the status of my link and the bandwidth usage.

I was able to change the color of my node depending of the Up/Down status, but I try to find a way to have this information on a link.

Is it possible to have something like the bandwidth taken from the TARGET, and a comment taken from a cactithold:tholdid ?

Or having the bandwidth in text only and the color of the link itself based on the up/down of the link(port of a switch) ?
CentOS
Production
Cacti 0.8.8h
Spine 0.8.8h
PIA 3.1
Aggregate 0.75
Monitor 1.3
Settings 0.71
Weathermap 0.98
Thold 0.5
rrdclean 0.41

Own plugin: LinkDiscovery 0.45, Map 0.37

Test
Cacti 1.2.6
Spine 1.2.6
thold 1.0.6
monitor 2.3.5
php 7.2.11
mariadb 5.5.56
Own plugin:
ExtendDB 1.1.2
LinkDiscovery 1.2.6
Map 1.2.6

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#2 Post by VictorJ » Mon Apr 03, 2017 4:57 am

I'm also interested by this topic. I'm want to have the bandwidth in text only and the color of the link itself based on the up/down

User avatar
Howie
Cacti Guru User
Posts: 5336
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Display Bandwith usage and status

#3 Post by Howie » Mon Apr 03, 2017 6:51 am

To change the link colour, do exactly the same as you did for the node - add the target and use a custom scale. (I'm assuming you didn't use coloured icons)

The way I prefer to do this kind of thing is to have one node per switch port, so you can use the node for the up/down state, and still have bandwidth on the link.

I've been trying to move all the internal code to allow for more than two 'channels' of data, but you can't yet specify that in the configuration. So, you can have additional data, but you need another item (node/link) to collect the target. I like the idea of thold state on the link comment :-) My use case was to have the interface error-rate available - same kind of thing.

But right now:

You can refer to data on another node: {node:thatnode:bandwidth_in}

And the node can be hidden (make a position negative), and have another TARGET.

It's clunky but it does work.
Weathermap 0.98 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!)

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#4 Post by VictorJ » Tue Apr 04, 2017 2:53 am

Thank for replying, but I'm not sure to totally understand how to do it.

Actually I use LibreNMS with the plugin PhpWeathermap (0.97) pre-integreted.

Can you share me a procedure to follow or docs detailled ?
Is there no problem to do this on libreNMS/PHPWeathermap ?

User avatar
Howie
Cacti Guru User
Posts: 5336
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Display Bandwith usage and status

#5 Post by Howie » Tue Apr 04, 2017 3:41 am

It doesn't make any difference to this procedure, assuming you already have the data for up/down. I don't know how that works in LibreNMS. I will assume it's in an rrd file.

Code: Select all

# scale with value of 2 for down (red) and 1 for up (green)
SCALE updown 0.5 1.5 0 255 0
SCALE updown 1.5 2.5 255 0 0

NODE node1
  POSITION 100 100
  LABEL node1

NODE node2
  POSITION 200 300
  USESCALE none
  LABEL node2
  TARGET some_other_rrd_for_traffic:traffic_in:traffic_out

LINK link1
  NODES node1 node2
  USESCALE updown
  TARGET my_interface_state_rrd_node1.rrd:value:-  my_interface_state_rrd_node2.rrd:-:value
  INCOMMENT {node:node2:bandwidth_in:%k}
  OUTCOMMENT {node:node2:bandwidth_out:%k}
So that's two nodes, and a link between. The link uses a new scale called 'updown' that changes the colour depending on the interface states. The standard ifOperStatus SNMP variable is 2 for down and 1 for up.

I am also collecting the 'in' and 'out' values for the link from different RRD files, since that's most likely how they are stored by the nms. That's why the TARGET for the link has two filenames there, and why the DS names are written differently at the end. The first is the 'in' value, and the second for 'out'. That will colour the two arrows on the link.

Finally, to get the bandwidth as well, you need something else with a target to collect that data, because you've already used the target on the link. So on node2, we say "USESCALE none" so that it isn't coloured based on the data, and then add another TARGET for the bandwidth we want on the link. Back on the link, you can add that as a comment down the side of the link arrows, referring to node2's data.
Weathermap 0.98 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!)

User avatar
Howie
Cacti Guru User
Posts: 5336
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Display Bandwith usage and status

#6 Post by Howie » Tue Apr 04, 2017 3:47 am

The alternative I mentioned in my first reply, if you already have a target on the nodes as well is something like this:

Code: Select all

NODE hidden_node_1
  POSITION -200 -200
  TARGET the_extra.rrd

LINK link1
    {as before}
    INCOMMENT {node:hidden_node_1:bandwidth_in}
In the future, I want to get to the stage that there's in and out (as now), and then other channels of data per item... say, data2, data3 etc (with in as data0 and out as data1), and targets can assign to any channel. But we aren't there yet!
Weathermap 0.98 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!)

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#7 Post by VictorJ » Tue Apr 04, 2017 5:20 am

Thank a lot, I'll try later and give you some news.

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#8 Post by VictorJ » Tue Apr 04, 2017 10:08 am

So I test this with no result. Do I have to replace value with something ? I not sure about the syntax.
I tested rrd.int_status too.

Code: Select all

SCALE updown 0.5 1.5 0 255 0
SCALE updown 1.5 2.5 255 0 0


LINK 4-1
        USESCALE updown
        TARGET ./MYIPHOST/port-id265.rrd:value:- ./MYIPHOST/port-id33.rrd:-:value
        NODES 4 1

User avatar
Howie
Cacti Guru User
Posts: 5336
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Display Bandwith usage and status

#9 Post by Howie » Tue Apr 04, 2017 2:05 pm

Yes, value should be the ds name from your rrd files. The log file should have an error with the possible names in it.
Weathermap 0.98 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!)

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#10 Post by VictorJ » Wed Apr 05, 2017 3:44 am

In LibreNMS, port status isn't store in rrd. I can use the API to get port status but the value is up/down and not decimals. Do a way exist to use SCALE with string ? Can I use Target to get my API information (with curl) ?

User avatar
Howie
Cacti Guru User
Posts: 5336
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Display Bandwith usage and status

#11 Post by Howie » Wed Apr 05, 2017 4:07 am

VictorJ wrote:In LibreNMS, port status isn't store in rrd. I can use the API to get port status but the value is up/down and not decimals. Do a way exist to use SCALE with string ? Can I use Target to get my API information (with curl) ?
Then you would need to write a datasource plugin. That would make the HTTP request, and return a numeric value to weathermap. It would be worth checking if someone else has already written one though. It sounds like it would be a fairly common request. New datasource plugins are not very complex to write if you know a little PHP - the dbplug example is probably a good starting point.

I would have said I will include it in a future release, but it looks like LibreNMS has forked from weathermap 0.97 anyway, so you'd never see it.
Weathermap 0.98 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!)

VictorJ
Posts: 13
Joined: Mon Apr 03, 2017 4:48 am

Re: Display Bandwith usage and status

#12 Post by VictorJ » Wed Apr 05, 2017 4:25 am

Thank you for all those informations. I'll look for the datasource plugin and share it if I succed.

LibreNMS stay on version 0.97 of phpweathermap for the moment but when version 1 will be out they will implement it. :)

Post Reply