Hi,
I'm writing a script which generates a top ten traffic interface list for a device in our Cacti database. I already have the list with the SNMP index. Is there a way to get the interface description from the index without making an addtinal SNMP request ?
Regards,
Christian
Translate interface index to description
Moderators: Developers, Moderators
-
- Posts: 11
- Joined: Mon Jan 09, 2012 10:32 am
- Contact:
Re: Translate interface index to description
If you're good with SQL:
You may want to do something slightly different but poking around the SQL is pretty easy.
Code: Select all
SELECT field_value FROM host_snmp_cache WHERE host_id='74' AND host_snmp_cache.snmp_index=3 AND field_name='ifDescr'
RRDtool 'n Stuff: http://blog.anthonyhurst.com/
-
- Posts: 11
- Joined: Mon Jan 09, 2012 10:32 am
- Contact:
Re: Translate interface index to description
If you want to use other data just do this to see all available stuff for that interface. Note that you need the hostname. (look at the host table to get the id)
I picked random values. for this example
Code: Select all
SELECT * FROM host_snmp_cache WHERE host_id='74' AND host_snmp_cache.snmp_index='3'
RRDtool 'n Stuff: http://blog.anthonyhurst.com/
Re: Translate interface index to description
Hi,
thank you for your response, it was a good starting point. I found out that I actually had only the local_data_id, not the SNMP id. So the complete solution for my problem is:
first SELECT with local_data_id:
SELECT local_data_id,rrd_name,rrd_path,host_id,arg1 FROM poller_item WHERE local_data_id = 3753;
(extract host_id and snmp_index from result)
second SELECT with host_id and snmp_index:
mysql> SELECT field_value FROM host_snmp_cache WHERE host_id = 61 AND field_name = 'ifAlias' AND snmp_index = 2;
Christian
thank you for your response, it was a good starting point. I found out that I actually had only the local_data_id, not the SNMP id. So the complete solution for my problem is:
first SELECT with local_data_id:
SELECT local_data_id,rrd_name,rrd_path,host_id,arg1 FROM poller_item WHERE local_data_id = 3753;
(extract host_id and snmp_index from result)
second SELECT with host_id and snmp_index:
mysql> SELECT field_value FROM host_snmp_cache WHERE host_id = 61 AND field_name = 'ifAlias' AND snmp_index = 2;
Christian
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Translate interface index to description
1st link of my sig now has updated SQL table layout, see last chapter. In case you're using MySQL designer, the required tables are provided as well
R.
R.
Who is online
Users browsing this forum: No registered users and 1 guest