How to make |query_ifAlias| not appear if null

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

Moderators: Developers, Moderators

Post Reply
Caracarn
Posts: 17
Joined: Thu Nov 27, 2008 6:30 pm

How to make |query_ifAlias| not appear if null

Post by Caracarn »

Hello, some of the interfaces on my switches have labels describing the equipment attached to them and some don't. I use |query_ifAlias| to display these descriptions and it works great, but if a port doesnt have a description instead of just leaving that part of the graph title blank it actually displays |query_ifAlias| in the port description, which is stupid.

How can I tell it to drop this field if blank/empty/null? It kind of defeats the purpose of making the whole process automatic if I have to go back and edit this value out of fields that don't have a description.

Any help appreciated! :D
tuux1598g
Posts: 9
Joined: Fri Sep 05, 2008 4:15 am

Post by tuux1598g »

Not sure how to explain this well, but here goes...

Under Data Queries, find the relevant data query for the graph with this problem and then click on the relevant 'Associated Graph Templates' - under suggested values for the graph template you will need to put two titles, one with the |query_ifAlias| and one without:

title |host_description|#|query_ifName| (|query_ifAlias|) - Traffic
title |host_description|#|query_ifName| - Traffic

Then under Graph Templates for this graph, make sure 'Use Per-Graph Value' is checked for the Title. This will cause Cacti to use the first title in the data query list if all values are available, falling back to the next favoured alternative (can be more than just two as in above example) if not.
Caracarn
Posts: 17
Joined: Thu Nov 27, 2008 6:30 pm

Post by Caracarn »

Brilliant, thanks for your help that fixed the problem.

:D
drh
Posts: 17
Joined: Mon Jan 26, 2009 10:34 am

Post by drh »

Check this post with reply from Gandalf. Helped me today as I was wondering why graph titles did not get updated when adding the |query_ifAlias| to it.
http://forums.cacti.net/about12752.html
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests