[HOWTO] Install and configure the Net-SNMP agent for Windows

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Moderators, Developers

Author
Message
User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

[HOWTO] Install and configure the Net-SNMP agent for Windows

#1 Post by fmangeant » Tue Mar 04, 2008 10:33 am

  • 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 :

Image

You then have to accept the license :

Image

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
Select the second option :

Image

Next, choose an installation directory (C:\usr by default) :

Image

Next, select an existing or a new Start menu folder :

Image

The installer then copies the files :

Image

Once installed, you have to register the Net-SNMP service

Image



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
Start then the "Net-SNMP Agent" service, and query it :

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)
This OID got an anwser from the Microsoft SNMP service, whereas

Code: Select all

C:\usr\bin>snmpwalk.exe -v 1 -c public localhost versiontag
UCD-SNMP-MIB::versionTag.0 = STRING: 5.4.1
got an answer from the Net-SNMP agent.

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
Now put this in snmpd.conf :

Code: Select all

exec foo c:\temp\foo.cmd
The result of your script will be accessible under the ucdavis.extTable.extEntry tree :
  • output of the script : ucdavis.extTable.extEntry.extOutput
  • exit status : ucdavis.extTable.extEntry.extResult
  • command : ucdavis.extTable.extEntry.extCommand
You can check the result with this SNMP query :

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:
extOutput translates to .1.3.6.1.4.1.2021.8.1.101
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 :
Image
Voila ! Result of the C:\temp\foo.cmd script is now graphed in Cacti.
Last edited by fmangeant on Thu Mar 06, 2008 5:23 am, edited 1 time in total.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

No Response from localhost

#2 Post by elayaraja.s » Thu Mar 06, 2008 3:38 am

C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost sysdesc
Timeout: No Response from localhost

C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost versiontag
Timeout: No Response from localhost

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#3 Post by fmangeant » Thu Mar 06, 2008 4:03 am

Have you created snmpd.conf, and restarted the "Net-SNMP agent" service ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

Restarging Net-SNMP agent

#4 Post by elayaraja.s » Thu Mar 06, 2008 4:21 am

Sorry, I am new to this SNMP. How to restart the Net-SNMP agent" service ?
I have searched in the Windows Serive not able to find...

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#5 Post by fmangeant » Thu Mar 06, 2008 4:34 am

Have you registered the service ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

Net-SNMP agent

#6 Post by elayaraja.s » Thu Mar 06, 2008 4:49 am

1) I registered the serivice by executing registeragent.bat
2) C:\net-snmp\bin>net stop "net-snmp agent"
Output:The Net-SNMP Agent service was stopped successfully.
3) C:\net-snmp\bin>net start "net-snmp agent"
Output:The Net-SNMP Agent service was started successfully.
4) C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost versiontag
Output:Timeout: No Response from localhost
5) C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost sysdesc
Output:Timeout: No Response from localhost

Please check the output for the step 4 and 5.

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#7 Post by fmangeant » Thu Mar 06, 2008 4:51 am

Can you post the content of C:\net-snmp\etc\snmp\snmpd.conf ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

snmp.conf Content

#8 Post by elayaraja.s » Thu Mar 06, 2008 4:58 am

mibdirs C:/net-snmp/share/snmp/mibs
persistentDir C:/net-snmp/snmp/persist
tempFilePattern C:/net-snmp/temp/snmpdXXXXXX

Note: I dont have the folder name 'snmpdXXXXXX' under the path 'C:/net-snmp/temp/snmpdXXXXXX' remaining all fine.

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#9 Post by fmangeant » Thu Mar 06, 2008 4:58 am

C:\net-snmp\etc\snmp\snmpd.conf is a file which has to be created.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

Created snmpd.conf file

#10 Post by elayaraja.s » Thu Mar 06, 2008 5:05 am

Now i have created the snmpd.conf file under the path C:\net-snmp\etc\snmp\snmpd.conf .

I restarted. Again same result.

But no need to worry about tempFilePattern C:/net-snmp/temp/snmpdXXXXXX (OR) i need to change to tempFilePattern C:\net-snmp\etc\snmp\snmpd.conf

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#11 Post by fmangeant » Thu Mar 06, 2008 5:08 am

I haven't modified the snmp.conf, and it works.

Is your Microsoft SNMP agent stopped ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

Stopped & Started...

#12 Post by elayaraja.s » Thu Mar 06, 2008 5:15 am

Yes it get stopped and started.

1) C:\net-snmp\bin>net stop "net-snmp agent"
The Net-SNMP Agent service was stopped successfully.

2) C:\net-snmp\bin>net stop "net-snmp agent"
The Net-SNMP Agent service was stopped successfully.

After creating C:\net-snmp\etc\snmp\snmpd.conf no need to modify right ? Its a blank file ?

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#13 Post by fmangeant » Thu Mar 06, 2008 5:18 am

You need to install Microsoft SNMP agent, and let it stopped.

C:\net-snmp\etc\snmp\snmpd.conf has to contain something like this :

Code: Select all

rocommunity public
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

elayaraja.s
Cacti User
Posts: 137
Joined: Mon Feb 11, 2008 3:46 am

Executed.

#14 Post by elayaraja.s » Thu Mar 06, 2008 6:30 am

C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost versiontag
Output: UCD-SNMP-MIB::versionTag.0 = STRING: 5.4.1

C:\net-snmp\bin>snmpwalk.exe -v 1 -c public localhost sysdesc
Output: No output.....Its blank..
Last edited by elayaraja.s on Fri Mar 07, 2008 12:01 am, edited 1 time in total.

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#15 Post by fmangeant » Thu Mar 06, 2008 7:45 am

Did you install Net-SNMP as screenshot #3 ?
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

Post Reply