Graph Windows performance counters with MRTG
MRTG is a really great tool that creates trending graphs for just about anything. This page shows you how to use MRTG to create trend graphs for your Windows Performance counters.
Drill down into each graph and see Daily, Weekly, Monthly and Yearly graphs.
1. MRTG.
2. ActiveState Perl.
3. bbMrtgPerf.vbs - Save this script in the BBClient\ext directory (.cfg file maker and extension for BB).
4. getlog.pl - Save this script in MRTG's bin directory, it collects the statistics for MRTG.
Procedures:
(default: C:\Inetpub\wwwroot)
mkdir C:\Inetpub\wwwroot\perfgraphs\machine2
mkdir C:\Inetpub\wwwroot\perfgraphs\...






Create the MRTG configuration file
Now that you're collecting performance data in a comma sepeated file you can use MRTG to create really cool looking graphs on that data. To do so, you must create an MRTG configuration file and you'll need a script to use as an extension for Big Brother.Here's a script to create the MRTG config file and an extension for Big Brother rolled up into one download.
bbMrtgPerf.vbs C:\Inetpub\wwwroot\PERFGRAPHS\machine1 machine1_000001.csv machine1

Executing that command will create a machine1.cfg file and machine1.html file in the directory specified.

Now you need to routinely execute the mrtg.pl script against your configuration file so the graphs will continue to update. To do this, I recommend creating a .vbs script and have Task Scheduler execute the script every minute, something like:
Const HIDDEN_WINDOW = 12
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("cmd.exe /c C:\mrtg-2.16.2\bin\mrtg.pl C:\Inetpub\wwwroot\PERFGRAPHS\machine001\machine001.cfg", null, objConfig, intProcessID)
Download example VBScript machine001.vbs
Save the .vbs file in the MRTG WorkDir (C:\Inetpub\wwwroot\PERFGRAPHS\machine1) and run it from Task Scheduler:




