Using the Alias (IF-MIB) in a LABEL

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
skeffling
Posts: 13
Joined: Wed Mar 30, 2016 4:23 pm

Using the Alias (IF-MIB) in a LABEL

Post by skeffling »

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! :-)
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: Using the Alias (IF-MIB) in a LABEL

Post by Atreides »

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.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Using the Alias (IF-MIB) in a LABEL

Post by Howie »

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. ... s.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.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!)
skeffling
Posts: 13
Joined: Wed Mar 30, 2016 4:23 pm

Re: Using the Alias (IF-MIB) in a LABEL

Post by skeffling »

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?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Using the Alias (IF-MIB) in a LABEL

Post by Howie »

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.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 5 guests