It's funny actually. I was doing exactly that when I received the notice of a new reply to this thread.
I still seem to be a bit stuck on a couple of items, and it's quite possible I'm just not doing this correctly. I've read through the linked references, and through the tutorial (for creating OID targets) but they really aren't that helpful. Decent for a general reference, but nothing specific.
On one of my hosts, I have the following added to snmpd.conf:
Code: Select all
extend .1.3.6.1.4.1.2021.51 showname /bin/sh /tmp/var-cmd.sh name
extend .1.3.6.1.4.1.2021.52 showcpu /bin/sh /tmp/var-cmd.sh cpu
extend .1.3.6.1.4.1.2021.53 showmem /bin/sh /tmp/var-cmd.sh mem
extend .1.3.6.1.4.1.2021.54 showtmem /bin/sh /tmp/var-cmd.sh tmem
from my cacti box, I can run the following:
Code: Select all
cacti snmp_queries # snmpwalk -c public -v1 vm3 .1.3.6.1.4.1.2021.51
UCD-SNMP-MIB::ucdavis.51.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1.2.8.115.104.111.119.110.97.109.101 = STRING: "/bin/sh"
UCD-SNMP-MIB::ucdavis.51.2.1.3.8.115.104.111.119.110.97.109.101 = STRING: "/tmp/var-cmd.sh name"
UCD-SNMP-MIB::ucdavis.51.2.1.4.8.115.104.111.119.110.97.109.101 = ""
UCD-SNMP-MIB::ucdavis.51.2.1.5.8.115.104.111.119.110.97.109.101 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.51.2.1.6.8.115.104.111.119.110.97.109.101 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1.7.8.115.104.111.119.110.97.109.101 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1.20.8.115.104.111.119.110.97.109.101 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.51.2.1.21.8.115.104.111.119.110.97.109.101 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.3.1.1.8.115.104.111.119.110.97.109.101 = STRING: "squid-brk"
UCD-SNMP-MIB::ucdavis.51.3.1.2.8.115.104.111.119.110.97.109.101 = STRING: "squid-brk
watchtower4
kbtcsibkup1
gentoo_cacti"
UCD-SNMP-MIB::ucdavis.51.3.1.3.8.115.104.111.119.110.97.109.101 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.51.3.1.4.8.115.104.111.119.110.97.109.101 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.4.1.2.8.115.104.111.119.110.97.109.101.1 = STRING: "squid-brk"
UCD-SNMP-MIB::ucdavis.51.4.1.2.8.115.104.111.119.110.97.109.101.2 = STRING: "watchtower4"
UCD-SNMP-MIB::ucdavis.51.4.1.2.8.115.104.111.119.110.97.109.101.3 = STRING: "kbtcsibkup1"
UCD-SNMP-MIB::ucdavis.51.4.1.2.8.115.104.111.119.110.97.109.101.4 = STRING: "gentoo_cacti"
I've modified the interfaces.xml file heavily, and used the OID specific to the group of data I'm looking for:
Code: Select all
snmpwalk -On -c public -v1 vm3 .1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101
.1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101.1 = STRING: "squid-brk"
.1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101.2 = STRING: "watchtower4"
.1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101.3 = STRING: "kbtcsibkup1"
.1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101.4 = STRING: "gentoo_cacti"
XML file:
Code: Select all
<interface>
<name>Get VMWare Guest Stats</name>
<description>Queries a host for a list of monitorable guest VMs</description>
<index_order>vmDescr:vmCPU:vmMem:vmTMem</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<vmDescr>
<name>Guest Name</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.51.4.1.2.8.115.104.111.119.110.97.109.101</oid>
</vmDescr>
<vmCPU>
<name>CPU Load</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.52.4.1.2.7.115.104.111.119.99.112.117</oid>
</vmCPU>
<vmMem>
<name>% MemoryType</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.53.4.1.2.7.115.104.111.119.109.101.109</oid>
</vmMem>
<vmTMem>
<name>Total Memory</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.54.4.1.2.8.115.104.111.119.116.109.101.109</oid>
</vmTMem>
</fields>
</interface>
Now, when I add the XML in Cacti, and add the data query to a host, I get the following error:
Code: Select all
Notice: Undefined index: oid_index in /usr/share/webapps/cacti/0.8.7a/htdocs/lib/data_query.php on line 167
Notice: Undefined index: oid_index in /usr/share/webapps/cacti/0.8.7a/htdocs/lib/data_query.php on line 172
Warning: Cannot modify header information - headers already sent by (output started at /usr/share/webapps/cacti/0.8.7a/htdocs/lib/data_query.php:167) in /usr/share/webapps/cacti/0.8.7a/htdocs/host.php on line 129
I'm sure this is probably due to a malformed XML file.
So thats where I'm at. Looking for feed back, happy to share once I'm finished.
For those interested, this is the start of a VMWare server guest monitoring template.
Cheers,
joey