- Version 0.2 (03/06/2008) : added a note about snmpd.conf file creation
- Version 0.1 (03/04/2008) : intial release
This HowTo will explain how to install and configure the Net-SNMP agent for Windows, as a "subagent" of the Microsoft SNMP agent, to graph the output of custom scripts.
As the time of writing, the latest version of Net-SNMP available is 5.4.1 (published on 07/27/2007).
Chapter I: Getting Net-SNMP binaries
Net-SNMP 5.4.1 for Windows can be downloaded here.
There's even an SSL version.
Once the file is downloaded, you just have to run the installer :
You then have to accept the license :
Next, you have to choose which type of agent you want to run :
- as a standard agent
- as a "subagent" of the Microsoft SNMP agent
Next, choose an installation directory (C:\usr by default) :
Next, select an existing or a new Start menu folder :
The installer then copies the files :
Once installed, you have to register the Net-SNMP service
Chapter II: Configuring the Net-SNMP agent
The Windows SNMP service must be installed, but the service must be disabled.
Depending on where you've installed Net-SNMP, the main configuration file (snmpd.conf) will be located in <path>\etc\snmp (by default, C:\usr\etc\snmp).
The snmpd.conf has to be created.
Please note that you need to restart the "Net-SNMP Agent" service whenever you modify snmpd.conf !
The minimum configuration is this one :
Code: Select all
rocommunity public
Code: Select all
C:\usr\bin>snmpwalk.exe -v 1 -c public localhost sysdesc
SNMPv2-MIB::sysDescr.0 = STRING: Hardware: x86 Family 6 Model 9 Stepping 5 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.1 (Build 2600 Uniprocessor Free)
Code: Select all
C:\usr\bin>snmpwalk.exe -v 1 -c public localhost versiontag
UCD-SNMP-MIB::versionTag.0 = STRING: 5.4.1
At this point, you can use the "Windows XP/2000/2003" host template in Cacti, to graph CPU usage, disk drives usage, network bandwidth, etc.
Chapter III: Extending the Net-SNMP agent
A great functionnality of Net-SNMP is that you can "extend" it.
Let's run the C:\temp\foo.cmd script :
Code: Select all
C:\temp\foo.cmd
123
Code: Select all
exec foo c:\temp\foo.cmd
- output of the script : ucdavis.extTable.extEntry.extOutput
- exit status : ucdavis.extTable.extEntry.extResult
- command : ucdavis.extTable.extEntry.extCommand
Code: Select all
C:\temp>snmpwalk.exe -v 1 -c public localhost exttable
UCD-SNMP-MIB::extIndex.1 = INTEGER: 1
UCD-SNMP-MIB::extNames.1 = STRING: foo
UCD-SNMP-MIB::extCommand.1 = STRING: c:\temp\foo.cmd
UCD-SNMP-MIB::extResult.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1 = STRING: 123
UCD-SNMP-MIB::extErrFix.1 = INTEGER: noError(0)
UCD-SNMP-MIB::extErrFixCmd.1 = STRING:
As "foo" is our first exec directive, add ".1" at the end of the OID.
In Cacti, use the "SNMP - Generic OID Template" like this :
Voila ! Result of the C:\temp\foo.cmd script is now graphed in Cacti.