(Implementing SNMP on Windows 2000)
SNMP on Windows 2000
Basic SNMP Monitoring Enhanced (Performance Counter) Monitoring
Paul SImmonson's Windows 2000 PerfMon to MRTG Web Page
As always, I recommend installing the SNMP service after the OS, but before any service packs or additional applications. This ensures that applications that check for the presence of SNMP before installing SNMP support, do so. There are some applications (i.e. IIS and SQL), that will not install SNMP support if the service is not installed (and in some cases, running)!
To install the SNMP on Windows 2000, perform the following;
Click Start -> Settings -> Control Panels and double-click Add/Remove Programs.
Click the Add/Remove Windows Components button.
Click Management and Monitoring Tools and click the Details button.
Press the Simple Network Management Protocol check box and click Ok.
Click Next, and after the wizard finishes installing click Finished.
The SNMP agent also allows for remote administration of Windows 2000 computers. If you have installed DHCP, IIS, or WINS on your network (and the appropriate agents are installed and configure on those systems, SNMP will allow you to monitor those services through the management software (or even from an OS prompt using SNMPUTIL.EXE or the GUI SNMPUTILG.EXE.
When you install SNMP, you add performance counters to TCP/IP and can view these performance counters in Performance Monitor. Performance Monitor will then start counting;
Active TCP/IP Connections
Total Network Interface bps
Well, one of the nice things about Win2K is that straight out of the box (once you have installed SNMP) you get support for the MIB-2 Host MIB (.18.104.22.168.2.1.25). Specifically, you can extract such information as System (uptime, etc), Memory (used and total), Disk (type (FAT/NTFS), used and total), Processor Utilization, Software running (i.e services), software installed (as in Control Panel/Add-Remove Software), Users Connected and more! Sounds good huh?
So... how do you get access to these counters? Well, you must either a) know the OID you want to query to get the information you want (FAT CHANCE!), or b) you download the appropriate MIBs so you can browse the tree using your favorite MIB browser. I support option b. See next paragraph!
Here's what I do. I use getif (I still use 2.2 due to some MIB compile problems I found). Then, I use the MIBS.ZIP file I assembled. It contains (among others) the RFC MIBS that will allow you to browse the MIB-2 objects made available once SNMP is installed in Win2K. Simply download and install getif, then unzip the files in MIBS.ZIP into the getif/MIBS directory. Making sure that getif is not running, delete the .index file and start getif again. At this point you should be able to browse the MIB-2 tree like so:
Now, using the OIDs provided by getif, you should be able to create/modify a MRTG cfg file to collect information you want. Simple huh? Take note that some sub-trees of MIB-2-HOST may not be accessible to getif (because not all branches of the HOST tree are supported by Windows 2000).
Well, it has taken awhile, but I have been running SNMP4W2K for awhile now, and it seems quite stable. I am monitoring a slough of stats (see the MRTG Page, and choose Live Stats). There appear to be some counters that simply will not extract into the PERFMIB.MIB, and a few that need a fast system in order to respond in time. However, MANY stats work fine, and with the base Windows 2000 MIBS, SNMP4W2K can be used as a mechanism to collect a considerable number of stats.
I want to make sure that I work all the bugs (or as many as I can find) out of the MIB and install/configure processes before I release SNMP4W2K. It is my goal to make this as painless as possible (and so far it has been a bit of a pain!). Once I get it all ironed out, you will see it here. Remember, this is essentially an unsupported (by MS) hack, that modifies the registry, and installs an additional (mostly compatible) MS SNMP extension agent (called PERFMIB.DLL).
How does the PERFMIB Hack Work: Basically, in order to get Windows 2000 to recognize SNMP4W2K's PERMIB.MIB, we must modify HKEY_LOCAL_MACHINE hive of the registry. We do this by adding an additional SNMP extension agent (called SNMP4W2K), which points to system32\perfmib.dll. The matching MIB.BIN from SNMP4W2K must be in the system32 directory as well, since there is code inside PERFMIB.MIB that references it to get a list of all the other OIDs that have been compiled with mibcc.exe.
Once you have installed the SNMP service, and installed SNMP4W2K, you will have access to the statistics shown here.
I have worked hard to compile a stable release, but as always (especially with "retro-fitted code") there is the possibility of problems cropping up. With this new version, you SHOULD be able to compile it in most NMS that accept SNMPv1 MIBs. I painstakingly edited the MIB and removed all the syntax errors graciously added by mibcc.exe.
There are some counter stats that do not work properly or at all on Windows 2000. I have tried to include only those that do.
Remember, ALWAYS back up your registry before you play with it! Be Safe!!
Meantime, until I get SNMP4W2K packaged and uploaded, play around with the MIB-2 OIDs!! If you want to install SNMP4NT, use the processes and procedures described from SNMP4NT, but I recommend backing up your MIB.BIN from the system32 directory. Press here to jump to the SNMP4NT Download Page.
Another way to get performance statistics from Windows 2000 (and Window NT for that matter) is to use the Windows NT/2000 Performance Monitor tool, have it dump data to a file, and process that file, and feed the results to MRTG using a helper script.
Paul Simmonson has put together a great page on how to collect Windows 2000 performance statistics. Essentially, he shows you how to:
Set up Win2K PerfMon to monitor resources and dump them into a log file.
Run a perl script to read them in and create an MRTG config file.
Run another PERL script to read this log file, and create an MRTG log file.
(all of this without SNMP! Cool huh?)
Check out his web site at http://www.wn.com.au/psimmo/
To return the the main page, click the logo!