[mrtg] Using a script as target under Windows

Stock, David cdstock at ccis.edu
Wed Jul 15 15:03:30 CEST 2009


Hello all,

We would like to monitor the current number of calls in our Cisco Voice Gateways with MRTG.  While Cisco TAC has stated that there is no OID counter or gauge for the number of calls in progress or the number of completed calls for either a PRI or the gateway as a whole, they were able to help me find an OID to query to receive the state of the lines.  With that OID, from a command prompt I can run:
                snmpwalk -v 2c -c <public> <ip address> 1.3.6.1.2.1.10.21.1.3.1.1.9 | grep "INTEGER: 4"  -c
to receive the number of calls in use.  I then created a .BAT file with the following contents:
@echo off
snmpwalk -v 2c -c <public> <ip address> 1.3.6.1.2.1.10.21.1.3.1.1.9 | grep "INTEGER: 4" -c > inuse.txt
type inuse.txt
type inuse.txt
echo 0
echo Calls in progress
del inuse.txt
to generate the four lines of output expected by MRTG.  A MRTG config file was then edited with a target definition of:
                Target[ccvg01_current_calls]: `\mrtg\scripts\testcalls.bat`
YLegend[ccvg01_current_calls]:  Current Calls
ShortLegend[ccvg01_current_calls]: %
Legend1[ccvg01_current_calls]: Current Calls
Legend2[ccvg01_current_calls]: .
Legend3[ccvg01_current_calls]: Maximum observed current calls
Legend4[ccvg01_current_calls]: .
LegendI[ccvg01_current_calls]: Calls:
LegendO[ccvg01_current_calls]: Calls:
WithPeak[ccvg01_current_calls]: ywm
MaxBytes[ccvg01_current_calls]: 780
Title[ccvg01_current_calls]: Current calls for CCVG01.ccis.edu
Options[ccvg01_current_calls]: growright, gauge, unknaszero, noo, nopercent
PageTop[ccvg01_current_calls]: <h1>Current calls for CCVG01.ccis.edu</h1>

If I manually run MRTG with this config file, it runs properly and the log file is updated with the number of calls in progress on the voice gateway, but when I add this config file to my master script which is called from the Windows scheduler invalid information is received by mrtg (-1 displays in the two data columns of the log file).

Does anyone know what I'm missing in this puzzle, or a better way to monitor the in use &/or completed calls on a Cisco Voice Gateway?  I realize I should look to moving my installation to a linux platform with RRD, but that project is still a couple of months off at this point.  I have tried changing the target to `cmd /c \mrtg\scripts\testcalls.bat` and `%comspec% /c \mrtg\scripts\testcalls.bat` and while both of those variations work fine when perl/mrtg are manually started, they do not run as desired from the master script.

The scheduled task is running under the credentials of a local computer administrator.  The voice gateway in question is a Cisco 2851 router running Advanced IP Services v12.4(3f).

Thanks in advance for any assistance you can provide,
David Stock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20090715/58e5a895/attachment-0001.html 


More information about the mrtg mailing list