Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jun 27, 2017 10:53 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Display Bandwith usage and status
PostPosted: Thu Aug 11, 2016 2:30 am 
Offline
Cacti User

Joined: Wed Dec 07, 2011 9:19 am
Posts: 191
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
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.3


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Mon Apr 03, 2017 4:57 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
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


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Mon Apr 03, 2017 6:51 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 2:53 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
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 ?


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 3:41 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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:
# 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 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 3:47 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
The alternative I mentioned in my first reply, if you already have a target on the nodes as well is something like this:

Code:
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 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 5:20 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
Thank a lot, I'll try later and give you some news.


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 10:08 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
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:
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


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Tue Apr 04, 2017 2:05 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Wed Apr 05, 2017 3:44 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
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) ?


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Wed Apr 05, 2017 4:07 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: Display Bandwith usage and status
PostPosted: Wed Apr 05, 2017 4:25 am 
Offline

Joined: Mon Apr 03, 2017 4:48 am
Posts: 9
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. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group