Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Aug 17, 2017 2:44 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Using the Alias (IF-MIB) in a LABEL
PostPosted: Fri Nov 18, 2016 11:57 am 
Offline

Joined: Wed Mar 30, 2016 4:23 pm
Posts: 13
I've tried, but can't seem to find a way to use the interface alias as collected by Cacti as the label on a node, I was thinking this would work, but didn't
LABEL {node:this:alias}

Is there a way?

(Maybe a way to limit the number of characters displayed (concat it) would be ace too! :-)


Top
 Profile  
 
 Post subject: Re: Using the Alias (IF-MIB) in a LABEL
PostPosted: Fri Nov 18, 2016 12:05 pm 
Offline
Cacti User

Joined: Mon May 31, 2010 9:26 am
Posts: 127
Hello,
Using this code :

NODE link-ra-gi2
LABEL {node:this:snmp_in_raw}
LABELOFFSET E
LABELOUTLINECOLOR none
TARGET snmp:{node:this:community}:{node:this:ip}:.1.3.6.1.2.1.31.1.1.1.18.{node:this:interface}:-
POSITION 660 443
SET community test
SET ip 172.25.232.33
SET interface 3

Will graph the description you have on that specified interface. I think is what you want.


Top
 Profile  
 
 Post subject: Re: Using the Alias (IF-MIB) in a LABEL
PostPosted: Fri Nov 18, 2016 6:34 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5117
Location: United Kingdom
Or, if you are already using cacti traffic data for that interface in your map (e.g. for a link connected to this node), then you can either use the dsstats: plugin or enable poller_output support ("SET rrd_use_poller_output 1" at the top of the map file). Both of those take a couple of polls to get going, but after that they will automatically populate a bunch of data as new variables, taken from the Cacti snmp cache.

In theory, it should run a bit faster than reading rrd files the normal way, too.

There's more description of the variables and poller_output mode in the manual:
http://network-weathermap.com/manual/0.98/pages/targets.html#rrd

So after that, you'd be able to use:

LABEL {link:relatedlinkname:cacti_ifAlias}

where relatedlinkname is the link that is using the traffic stats for the relevant interface.

_________________
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: Using the Alias (IF-MIB) in a LABEL
PostPosted: Mon Nov 21, 2016 4:24 am 
Offline

Joined: Wed Mar 30, 2016 4:23 pm
Posts: 13
Thanks Howie, LABEL {link:relatedlinkname:cacti_ifAlias} is what I was after!

Is there a way con concat the string so as to make it a fixed number of characters long?


Top
 Profile  
 
 Post subject: Re: Using the Alias (IF-MIB) in a LABEL
PostPosted: Tue Nov 22, 2016 5:37 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5117
Location: United Kingdom
The formatting bit on the end, that is normally used for numbers, is passed straight through to PHP's sprintf() function, if it's not for %k or %t. So you can use the stuff documented here. It's not very intuitive for strings, but I got this to work:

LABEL {node:this:blahblah:%-0.10s}

To get a left-justified string of 0-10 characters, padded with spaces.

_________________
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  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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