SNMP MRTG for Windows HowTo is a guideline to install and see some performance metrics from windows nodes through mrtg.
 
Internet is full of great guides for Linux/Routers/UNIX mrtg integrations
 
On the other hand, there aren’t many performance metric tools for windows. In this example we will see how we can see / create some CPU / processes running / network performance metrics in windows 2000/2003.

 
 
 
 
 
    First we must start / configure snmp service for windows 2000/2003 server (example hostname: winserver). We make sure from add/remove windows components that snmp is installed OK (Management and Monitoring Tools/ Simple Network Management).

    Then from Administrative tools / Services / SNMP Service / Security Tab we add the community we want (example: public) with READ ONLY rights. We also check that the IP of the computer we will collect the snmp information is in the tab Accept SNMP packets from these hosts. After we make the necessary changes, we restart the snmp service.

    Now from the snmp collector machine (we used a Linux server with net-snmp packages installed) we can try the communication:

 
 
# snmpwalk -t 5 -c public -v 1 winserver
 
 
    If communication was successful, you must see a lot of information in your screen. We also can try specific snmpget commands like this one to get the system name:
 
 
# snmpget -t 5 -c public -v 1 WINSERVER sysName.0
SNMPv2-MIB::sysName.0 = STRING: WINSERVER 

    We can now create the first cfg file that contains most of the network information with cfgmaker / indexmaker command (change your_path with the output path you want):

 


# mkdir /your_path/WINSERVER
# cfgmaker --output=/etc/mrtg/WINSERVER.cfg --global "workdir: /your_path/WINSERVER" \
-ifref=ip --global 'options[_]: growright,bits' public@WINSERVER
# env LANG=C mrtg /etc/mrtg/WINSERVER.cfg
# indexmaker --output=/your_path/WINSERVER/index.html /etc/mrtg/WINSERVER.cfg --title="WINSERVER MRTG"

 

 

    If everything was OK, if you have apache’s webroot to /your_path , if you point from Linux server the browser to http://localhost/WINSERVER/index.html you should see the first network performance metrics.

 

 

 

For the other metrics (CPU, processes etc.) we must create a file /etc/mrtg/WINSERVER.info.cfg like this one:

 


# File: /etc/mrtg/server-info.cfg
#
# Configuration file for non bandwidth server statistics
#
#
# Define global options
#
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt

workdir: /your_path/WINSERVER

######################################################################
# System: WINSERVER
# Description: Hardware: x86 Family 15 Model 2 Stepping 9 AT/AT COMPATIBLE -
# Software: Windows 2000 Version 5.0 (Build 2195 Multiprocessor Free)
# Contact:
# Location:
######################################################################

#
# CPU Load Monitoring
#

Target[server.cpu]: ( .1.3.6.1.2.1.25.3.3.1.2.1&.1.3.6.1.2.1.25.3.3.1.2.1:public@WINSERVER ) / 1
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: <H1>CPU Load - System</H1>
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: CPU Utilization
Legend1[server.cpu]: Current CPU percentage load
LegendI[server.cpu]: Used
LegendO[server.cpu]:
Options[server.cpu]: growright,nopercent,gauge
Unscaled[server.cpu]: ymwd

#
# System Processes Info
#

Target[server.processes]: .1.3.6.1.2.1.25.1.6.0&.1.3.6.1.2.1.25.1.6.0:public@WINSERVER
## Target[server.processes]: hrSystemProcesses.0&hrSystemProcesses.0:public@WINSERVER
Title[server.processes]: Current Processes Running
PageTop[server.processes]: <H1>Current Processes Running</H1>
MaxBytes[server.processes]: 1000
ShortLegend[server.processes]: procs
YLegend[server.processes]: Current Processes Running
Legend1[server.processes]: Processes
LegendI[server.processes]: Running
LegendO[server.processes]:
Options[server.processes]: growright,nopercent,gauge

#
# User Sessions Info
#

Target[server.users]: .1.3.6.1.2.1.25.1.5.0&.1.3.6.1.2.1.25.1.5.0:public@WINSERVER
## Target[server.users]: hrSystemNumUsers.0&hrSystemNumUsers.0:public@WINSERVER
Title[server.users]: Current Users Sessions
PageTop[server.users]: <H1>Current Users Sessions</H1>
MaxBytes[server.users]: 10000
ShortLegend[server.users]: Sessions
YLegend[server.users]: Current Users Sessions
Legend1[server.users]: Users Sessions
LegendI[server.users]: Sessions
LegendO[server.users]:
Options[server.users]: growright,nopercent,gauge

#
# Established TCP Connections
#

Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:public@WINSERVER
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: <H1>Established TCP Connections</H1>
MaxBytes[server.estabcons]: 10000000000
ShortLegend[server.estabcons]: c/s
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In
LegendO[server.estabcons]:
Legend1[server.estabcons]: Established connections
Legend2[server.estabcons]:
Options[server.estabcons]: growright,nopercent,gauge

#
# New TCP Connection Monitoring (per minute)
#

Target[server.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:public@WINSERVER
Title[server.newconns]: Newly Created TCP Connections
PageTop[server.newconns]: <H1>New TCP Connections</H1>
MaxBytes[server.newconns]: 10000000000
ShortLegend[server.newconns]: c/s
YLegend[server.newconns]: Conns / Min
LegendI[server.newconns]: In
LegendO[server.newconns]: Out
Legend1[server.newconns]: New inbound connections
Legend2[server.newconns]: New outbound connections
Options[server.newconns]: growright,nopercent,perminute

 

    Mind the line: Target[server.cpu]. This example machine has 1 CPU, so if for example we have a server with 4 CPUs this line should be:

Target[server.cpu]: ( .1.3.6.1.2.1.25.3.3.1.2.1&.1.3.6.1.2.1.25.3.3.1.2.1:public@WINSERVER 
+ .1.3.6.1.2.1.25.3.3.1.2.2&.1.3.6.1.2.1.25.3.3.1.2.2:public@WINSERVER
+ .1.3.6.1.2.1.25.3.3.1.2.3&.1.3.6.1.2.1.25.3.3.1.2.3:public@WINSERVER
+ .1.3.6.1.2.1.25.3.3.1.2.4&.1.3.6.1.2.1.25.3.3.1.2.4:public@WINSERVER ) / 4

Now we must issue the commands:

 

# env LANG=C mrtg /etc/mrtg/WINSERVER.info.cfg
# indexmaker --output=/your_path/WINSERVER/index.html /etc/mrtg/WINSERVER.info.cfg --title="WINSERVER MRTG"

 

CPU Load – System

 

 

 

 

 

 

Current Processes Running

Current Users Sessions

Established TCP Connections

 

New TCP Connections

 

 

    In order to have MRTG performance metrics taken every 5 minutes we must make a shell script (ex./usr/local/bin/cronmrtg) and add this as a cron entry: 

 


# cat /usr/local/bin/cronmrtg

#!/bin/bash
env LANG=C /usr/bin/mrtg /etc/mrtg/WINSERVER.cfg
env LANG=C /usr/bin/mrtg /etc/mrtg/WINSERVER.info.cfg

# chmod +x /usr/local/bin/cronmrtg

# crontab -l
0-59/5 * * * * /usr/local/bin/cronmrtg