net-snmp_command.xml goes in <cacti_dir>/resource/snmp_queries
You'll need to create a new a Data Query and point it to the xml file you just put there. Contents are displayed below. Once the data query is created, you can associate it with a host (Polling Hosts -> Associated Data Queries), and it will pull all of the external commands as well as their output over, allowing you to make perty graphs
I haven't included any data templates with this because it can be used for just about anything, but it's a starting point.
Code: Select all
<interface>
<name>Get Data from Script Commands</name>
<oid_index>.1.3.6.1.4.1.2021.8.1.1</oid_index>
<fields>
<cmdIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.8.1.1</oid>
</cmdIndex>
<cmdName>
<name>Command Name</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.8.1.2</oid>
</cmdName>
<Command>
<name>Command</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.8.1.3</oid>
</Command>
<cmdReturnCode>
<name>Return Code</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2021.8.1.100</oid>
</cmdReturnCode>
<cmdOutput>
<name>Output</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2021.8.1.101</oid>
</cmdOutput>
<cmdErrorCode>
<name>Error Code</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2021.8.1.102</oid>
</cmdErrorCode>
<cmdErrorHandler>
<name>Error Handler</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2021.8.1.103</oid>
</cmdErrorHandler>
</fields>
</interface>
My config (snmpd.conf):
Code: Select all
....
interface eth0 6 1000000000
interface eth1 6 1000000000
exec Downloads /usr/local/sbin/getbytes 1:10
exec Website /usr/local/sbin/getbytes 1:20
exec Total /usr/local/sbin/getbytes 1:1
.....
Code: Select all
.1.3.6.1.4.1.2021.8.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.2021.8.1.1.2 = INTEGER: 2
.1.3.6.1.4.1.2021.8.1.1.3 = INTEGER: 3
.1.3.6.1.4.1.2021.8.1.2.1 = STRING: Downloads
.1.3.6.1.4.1.2021.8.1.2.2 = STRING: Website
.1.3.6.1.4.1.2021.8.1.2.3 = STRING: Total
.1.3.6.1.4.1.2021.8.1.3.1 = STRING: /usr/local/sbin/getbytes 1:10
.1.3.6.1.4.1.2021.8.1.3.2 = STRING: /usr/local/sbin/getbytes 1:20
.1.3.6.1.4.1.2021.8.1.3.3 = STRING: /usr/local/sbin/getbytes 1:1
.1.3.6.1.4.1.2021.8.1.100.1 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.100.2 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.100.3 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.101.1 = STRING: 761781376699
.1.3.6.1.4.1.2021.8.1.101.2 = STRING: 933523212201
.1.3.6.1.4.1.2021.8.1.101.3 = STRING: 1695410939529
.1.3.6.1.4.1.2021.8.1.102.1 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.102.2 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.102.3 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.103.1 = STRING:
.1.3.6.1.4.1.2021.8.1.103.2 = STRING:
.1.3.6.1.4.1.2021.8.1.103.3 = STRING: