How to display IfAlias into Graph data

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
jackouille
Cacti User
Posts: 71
Joined: Thu Apr 26, 2012 7:41 am

How to display IfAlias into Graph data

Post by jackouille »

Dear all,

I would like to add the IfAlias description after graph data.
It is NOT for title display !
Here is what I would like to find
Traffic: 1.5 Mb Interface: Internal_LAN
Traffic: 7.5 Mb Interface: WAN

Data shown after Interface might be the result from |query_ifAlias|

I saw in doc that it's possible to show data source title (http://www.cacti.net/downloads/docs/html/variables.html) but I need the IfAlias.

How could I proceed (add IfAlias within an RRD, update one PHP file to accept and translate IfAlias into the graph, or another solution) ?

Thanks in advance for your answer(s).
User avatar
Happiness0
Cacti User
Posts: 63
Joined: Wed Oct 29, 2014 5:01 am
Contact:

Re: How to display IfAlias into Graph data

Post by Happiness0 »

A solution would be to add a data source (maybe with the single OID template?) containing IfAlias, add entries in the graph template, and selecting the data source with ifAlias in the drop down menu.
jackouille
Cacti User
Posts: 71
Joined: Thu Apr 26, 2012 7:41 am

Re: How to display IfAlias into Graph data

Post by jackouille »

Yes that's a way that I investigate but while having a closer look into resource/snmp_queries I saw that IfAlias is already collected but I was not able to use it within my graph template.
Using |data_source_title| works fine but it's not value I need. It shows that it might be possible to use other names.
User avatar
Happiness0
Cacti User
Posts: 63
Joined: Wed Oct 29, 2014 5:01 am
Contact:

Re: How to display IfAlias into Graph data

Post by Happiness0 »

Please take a look at http://www.cacti.net/downloads/docs/html/variables.html, section "Data Query Fields" using |query_ifAlias| should do the trick. It works for me.
jackouille
Cacti User
Posts: 71
Joined: Thu Apr 26, 2012 7:41 am

Re: How to display IfAlias into Graph data

Post by jackouille »

Thanks Happiness0 for your answer but I tried and for me it doesn't work.
Here is what I got:
RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start='-86400' \
--end='-60' \
--title='TeleAlp-C3200 - Test Logical Upstream Channel 3/0.0/0' \
--rigid \
--base='1000' \
--height='200' \
--width='600' \
--lower-limit='15' \
--vertical-label='dBs' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a='/usr/share/cacti/rra/19/4777.rrd':'cisco_ups_snr':AVERAGE \
CDEF:cdefa='a,10,/' \
LINE2:cdefa#4668E4FF:'SNR' \
GPRINT:cdefa:LAST:'Last\:%8.2lf %s' \
GPRINT:cdefa:MIN:'Min\:%8.2lf %s' \
GPRINT:cdefa:MAX:'Max\:%8.2lf %s\n' \
GPRINT::AVERAGE:'|query_IfAlias|%8.2lf %s\n'

RRDTool Says:

ERROR: Could not parse line 'GPRINT::AVERAGE:|query_IfAlias|%8.2lf %s\n'
Attachments
Cap1.PNG
Cap1.PNG (16.04 KiB) Viewed 1585 times
User avatar
Happiness0
Cacti User
Posts: 63
Joined: Wed Oct 29, 2014 5:01 am
Contact:

Re: How to display IfAlias into Graph data

Post by Happiness0 »

Working fine on cacti 0.8.8e

Image

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start='1437462119' \
--end='1437548519' \
--title='xxxx' \
--rigid \
--base='1000' \
--height='120' \
--width='500' \
--alt-autoscale \
COMMENT:"From 2015/07/21 09\:01\:59 To 2015/07/22 09\:01\:59\c" \
COMMENT:"  \n" \
--vertical-label='bits/s' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a='xxx.rrd':'traffic_in':AVERAGE \
DEF:b='xxx.rrd':'traffic_out':AVERAGE \
CDEF:cdefb='a,8,*' \
CDEF:cdefg='b,8,*' \
AREA:a#00CF00FF:'Entrant'  \
GPRINT:cdefb:LAST:'Actuel \:%8.2lf %s'  \
GPRINT:cdefb:AVERAGE:'Moyenne \:%8.2lf %s'  \
GPRINT:cdefb:MAX:'Max \:%8.2lf %s\n'  \
COMMENT:'Total entrant\:  12.24 GB\n'  \
LINE1:b#AD3B6EFF:'Sortant'  \
GPRINT:cdefg:LAST:'Actuel \:%8.2lf %s'  \
GPRINT:cdefg:AVERAGE:'Moyenne ;%8.2lf %s'  \
GPRINT:cdefg:MAX:'Max \:%8.2lf %s\n'  \
COMMENT:'Total sortant\: 2.41 GB\n'  \
COMMENT:'ifAlias \: xxxx_1/4'
Image
jackouille
Cacti User
Posts: 71
Joined: Thu Apr 26, 2012 7:41 am

Re: How to display IfAlias into Graph data

Post by jackouille »

Bonjour Happynesss0,

Je te remercie pour ta réponse.
I updated my graph according to your one and it's better but I still did not got the right display.


PS : for your information, release 0.8.8e you are using is bugged. A new release has been published on July 20th. If you try to change Data Source within your graph you will have errors in your log and changes will not be applied. I faced this issue and updated two days ago.

Best regards from french part of Switzerland :wink:
Attachments
pic2.jpg
pic2.jpg (23.06 KiB) Viewed 1554 times
pic1.jpg
pic1.jpg (87.65 KiB) Viewed 1554 times
jackouille
Cacti User
Posts: 71
Joined: Thu Apr 26, 2012 7:41 am

Re: How to display IfAlias into Graph data

Post by jackouille »

Ok, thanks to Happyness0 for his great help I made it working.
Regarding my last issue it was displaying the IfAlias instead of the Description because field IfAlias was empty.
After performing a refresh it works perfectly !

Many thanks to Happyness0
User avatar
Happiness0
Cacti User
Posts: 63
Joined: Wed Oct 29, 2014 5:01 am
Contact:

Re: How to display IfAlias into Graph data

Post by Happiness0 »

Yes, I've done the upgrade this morning ^^ De rien
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest