How to: installing SNMP service and
append additional MIB files on Windows 2000/2003
Installing the SNMP service on the system you want to monitor.
1. Click “Start” button.
2. From the Start menu choose “Settings” > “Control Panel” (screenshot)
3. Double-click on “Add/Remove Programs”.
4. In the left panel of the Add/Remove Programs dialog, click on “Add/Remove Windows Components”.
5. Scroll down and find “Management and Monitoring Tools”
(screenshot)
6. Double-click on “Management and Monitoring Tools”.(screenshot)
7. Select the “Simple Network Management Protocol” check box, and then click “OK”.
8. Click “Next”.
9. If installation files dialog appears, enter path to you windows 2000 CD files.
(screenshot)
10. When the installation complete, Click “Finish”.
Now your SNMP service installed and running!
Adding a MIB file to the installed SNMP service
Microsoft SNMP service allow extend default MIB(Management Information Base) via extension agent DLL. This DLL must export at least two functions SnmpExtensionInit and SnmpExtensionQuery.
Function SnmpExtensionInit called by the SNMP service soon after loading our extension agent DLL. These function usually initialize values of our MIB table and MIB prefix for first supported region. SnmpExtensionQuery function called, when SNMP service receive client request started with our MIB prefix.
Lets look on example of extension agent DLL from article [1]. MIB prefix for this DLL is .1.3.6.1.4.1.15. SnmpExtensionInit initialize own MIB with three nodes
- About(.1.3.6.1.4.1.15.0.0.1) - this is a read only node, which gives out the author's name.
- Name(.1.3.6.1.4.1.15.0.0.2) - string variable with read and write access.
- Age (.1.3.6.1.4.1.15.0.0.3) - integer variable with read and write access.
For the installation of the extension agent DLL(MyAgent.dll in our example), you need to do the following actions:
1. Click on “Start” button.
2. From Start menu choose “Run…”, in appeared dialog enter “regedit” , then click “OK”.
(screenshot)
3. In left panel expand “My computer” folder by double-clicking on it.
4. In appeared list, expand “HKEY_LOCAL_MACHINE” folder.
5. Then do same with “SYSTEM”.
6. Find out “CurrentControlSet” and also expand them.
7. Expand “Services”.
8. Then “SNMP”.
9. Again expand “Parameters”.
10. And click on “ExtensionAgents” record.
11. You will see in right panel something like
“1"="SOFTWARE\Microsoft\LANManagerMIB2Agent\CurrentVersion"
"2"="SOFTWARE\Microsoft\RFC1156Agent\CurrentVersion"
…
"13"="SOFTWARE\Microsoft\IASAgent\CurrentVersion".
12. Click on mouse right-button in right panel and select “New”, then “String value”.
13. Enter next value in grow order, for our example its will be “14 , then press enter.
14. Press Enter again, and in appeared “Edit String” dialog, enter: “SOFTWARE\SNMP\CurrentVersion”.
(screenshot 1 and screenshot 2)
15. Scroll up and double-click on “System” folder in left panel.
16. Expand “Software” folder.
17. Then click to “Software” folder.
18. Click on mouse right-button and select “New”, then click on “Key”.
(screenshot)
19. Enter “SNMP”, and press “Enter”.
20. In right panel, click on mouse right-button.
21. Select “New”, Then click on “Key”.
22. Enter “CurrentVersion”, and press “Enter”.
23. Click on “CurrentVersion”.
24. In right panel, click on mouse right-button and select “New”, then click on “String
Value”.
25. Enter “Pathname” and press “Enter”.
26. Press “Enter” again, and in appeared dialog enter path where MyAgent.dll located,
for example: “C:\tmp\MyAgent.dll”, then press “Enter”.
(screenshot)
27. Close Registry Editor by pressing ALT+F4.
Now needed restart SNMP service:
1. Click on “Start” button.
2. From Start menu choose “Settings” -> “Control Panel”
3. Then double-click on “Administrative Tools”
4. Double-click on “Services”.
5. Click Right-button on “SNMP Service”
6. From the popup menu, choose “Restart”(screenshot)
Now SNMP extension agent DLL installed, and additional MIB, which consist of three nodes, activated.
Testing with the additional MIB file
For testing you need an SNMP client. You can use the Snmputil.exe tool from windows2000 resource kit CD. Or download it from here. Open console window by click on “Start” button and choosing “Run…”. In appeared dialog enter “cmd.exe”, then clicking “OK”. In console enter :
snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.1
snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.2
snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.3
Information from all three nodes in our extended MIB will shown:
C:\tmp\snmp_add_mib>snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.1
Variable = .iso.org.dod.internet.private.enterprises.15.0.0.1
Value = String Author : Ramanan.T
C:\tmp\snmp_add_mib>snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.2
Variable = .iso.org.dod.internet.private.enterprises.15.0.0.2
Value = String Your Name
C:\tmp\snmp_add_mib>snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.3
Variable = .iso.org.dod.internet.private.enterprises.15.0.0.3
Value = Integer32 0
If was some error during SNMP extension agent DLL initialization, you will see:
C:\tmp\snmp_add_mib>snmputil get 127.0.0.1 public .1.3.6.1.4.1.15.0.0.1
Error: errorStatus=2, errorIndex=1
Which means what additional MIB was not correctly installed.
References
Article with test agent.
http://www.codeproject.com/script/admentor/include/ServeAdHTML.aspx?C=False&id=786
SNMP test tool
http://www.wtcs.org/snmp4tpc/FILES/Tools/SNMPUTIL/SNMPUTIL.zip
Copy of the agent and the utility on Woodstone's server.