How to select IP address in graph title with |query_ifIP|
Moderators: Developers, Moderators
How to select IP address in graph title with |query_ifIP|
When an interface has more than one IP address (i.e. sub interfaces) on it, is it possible to select which IP gets displayed with the |query_ifIP| part of the data source. By default it seems to display the last IP address, when the IPs are listed in ascending numerical order. However, I want to display a different IP address from the list. I looked at the interface.xml file and I see this section:
<ifIP>
<name>IP Address</name>
<method>walk</method>
<source>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.4.20.1.2</oid>
</ifIP>
If I do an snmpwalk on the server in question, with this OID, then I get the list of IP addresses noted above. Can I somehow select which one to display in the graph title?
<ifIP>
<name>IP Address</name>
<method>walk</method>
<source>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.4.20.1.2</oid>
</ifIP>
If I do an snmpwalk on the server in question, with this OID, then I get the list of IP addresses noted above. Can I somehow select which one to display in the graph title?
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
|host_hostname| or if you want the IP of an interface on a Data Query. It would be |query_ifIP|
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
The reply does not appear to me to answer the question. As I have the same issue, here's another attempt at a query.
On the box in question, ifconfig reports (in part):
The traffic graph has a title of
which results in a title on the graph of "... 172.17.5.129 (egiga0)". Clearly (to me), it would be much better to report a title of "... 172.17.5.1 (egiga0)".
None of the queries or XML files have been altered from the default installation.
On the box in question, ifconfig reports (in part):
Code: Select all
egiga0 Link encap:Ethernet HWaddr 00:06:CF:00:3C:1A
inet addr:172.17.5.1 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2468591 errors:0 dropped:0 overruns:0 frame:0
TX packets:11126718 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:4000
RX bytes:490504146 (467.7 MiB) TX bytes:501601179 (478.3 MiB)
Interrupt:32
egiga0:1001 Link encap:Ethernet HWaddr 00:06:CF:00:3C:1A
inet addr:172.17.5.129 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:32
Code: Select all
|host_description| - Traffic - |query_ifIP| (|query_ifDescr|)
None of the queries or XML files have been altered from the default installation.
Last edited by DaveClose on Wed Oct 15, 2008 4:36 pm, edited 1 time in total.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please consider this one http://docs.cacti.net/?q=node/232
Pay attention to the Suggested Value section
Reinhard
Pay attention to the Suggested Value section
Reinhard
The suggested values are all already filled-in in a way that corresponds to what I wrote earlier. That is, the suggested values for name and title include the actual values in use. The value used for title is the second of three.
If the sequence of suggested values for title are in some sort of priority order, then why is the second one being used? That indicates to me that changing the order won't change anything. But even if it would, the other alternatives do not include query_ifIP, which is a value I would like to have included.
Note, I'm not complaining about the use if query_ifIP. I like that. What I want is for the query to return the primary value, not the value of a sub-interface.
If the sequence of suggested values for title are in some sort of priority order, then why is the second one being used? That indicates to me that changing the order won't change anything. But even if it would, the other alternatives do not include query_ifIP, which is a value I would like to have included.
Note, I'm not complaining about the use if query_ifIP. I like that. What I want is for the query to return the primary value, not the value of a sub-interface.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Sorry for missing this part. But as you are graphing the sub-interface (IMHO), query_ifIP will show this IP. It is only possible to add query_* variables that belong to the line you've checked when "Creating Graphs for this Host"DaveClose wrote:The suggested values are all already filled-in in a way that corresponds to what I wrote earlier. That is, the suggested values for name and title include the actual values in use. The value used for title is the second of three.
If the sequence of suggested values for title are in some sort of priority order, then why is the second one being used? That indicates to me that changing the order won't change anything. But even if it would, the other alternatives do not include query_ifIP, which is a value I would like to have included.
Note, I'm not complaining about the use if query_ifIP. I like that. What I want is for the query to return the primary value, not the value of a sub-interface.
Reinhard
Not sure where you got the idea that I was graphing the sub-interface. The sub-interface doesn't even appear on the graphs creation page. I don't know how I would select it if I wanted to.Reinhard wrote:But as you are graphing the sub-interface (IMHO), query_ifIP will show this IP. It is only possible to add query_* variables that belong to the line you've checked when "Creating Graphs for this Host"
I'm trying to, and succeeded to, graph the traffic on the wire for the physical interface. It has a primary OS interface and a sub-interface, both of which have IP addresses. I'm just trying to get the query to report the primary address.
I know I could just delete the |query_ifIP| and type in the correct value. But I've got lots of these and that would be both tedious and unreliable.
Last edited by DaveClose on Wed Oct 15, 2008 4:35 pm, edited 1 time in total.
Here's a portion of that section. Note that the Description column lists the primary interface name (egiga0), not the sub-interface name (egiga0:1001), though it does show the address of the sub-interface. There is no entry on the page which lists the address of the primary interface.gandalf wrote:Now I'm getting completely confused. I may not get it because my time does not allow to dive too deep into every post. So please post a screenshot of the interface section when hitting "Create Graphs for this Host". I hope to get the idea, then (anonymize all secret information)
Reinhard
It appears to me that, when collecting information for this page, Cacti is using the last interface discovered of all those with identical initial names, or the last discovered with the same MAC address.
I doubt that explicitly adding the primary interface to this list, if that can be done, would be any easier than just changing the title to have the right address. Since this list is automatically created when I create the host, it seems to me that it ought to automatically choose the primary interfaces.
- Attachments
-
- data-query.png (20.55 KiB) Viewed 6382 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Now I understand better. As a last issue, please visit "System Utilities -> View Poller Cache", filter for that host and post the entry pertaining to that very interface.
Your assumption about "picking the last entry" may be correct.
As a test, please reindex this query by pressing the green circle next to the data query and see, if the Poller Cache (from above) has changed.
Reinhard
Your assumption about "picking the last entry" may be correct.
As a test, please reindex this query by pressing the green circle next to the data query and see, if the Poller Cache (from above) has changed.
Reinhard
This thread seems to have gone stale, but it seems odd to me that more people haven't encountered this and want a solution.
I'm currently setting up graphing for a cluster with multiple virtual interfaces on eth0 (at any given time it might even have a different number of interfaces). The IP address shown in the graph title is, as the OP noted, that configured on the last virtual interface, e.g. eth0:8. This is unlikely to be What You Want.
Only the primary interfaces exist in IF-MIB::ifTable, and Cacti composits these with a value derived from the oid of an entry in IP-MIB::ipAddrTable using a regexp, and all the retrieved values do go into the snmp cache, distinguished only by OID:
except that host_snmp_cache's primary key is (host_id, snmp_query_id, field_name, snmp_index) so all |query_ifIP|s for one index clash, oid is effectively ignored, and the last wins. Perhaps it should be reworked so that the first one wins, as that will generally be the one assigned to the "physical" interface?
regards,
jmb
I'm currently setting up graphing for a cluster with multiple virtual interfaces on eth0 (at any given time it might even have a different number of interfaces). The IP address shown in the graph title is, as the OP noted, that configured on the last virtual interface, e.g. eth0:8. This is unlikely to be What You Want.
Only the primary interfaces exist in IF-MIB::ifTable, and Cacti composits these with a value derived from the oid of an entry in IP-MIB::ipAddrTable using a regexp, and all the retrieved values do go into the snmp cache, distinguished only by OID:
Code: Select all
REPLACE INTO host_snmp_cache
(host_id,snmp_query_id,field_name,field_value,snmp_index,oid)
VALUES ('$host_id','$snmp_query_id','$field_name','$value','$snmp_index','$oid')
regards,
jmb
Who is online
Users browsing this forum: No registered users and 7 guests