[mrtg] Using a script as target under Windows
cdstock at ccis.edu
Wed Jul 15 15:03:30 CEST 2009
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> 18.104.22.168.22.214.171.124.126.96.36.199.9 | grep "INTEGER: 4" -c
to receive the number of calls in use. I then created a .BAT file with the following contents:
snmpwalk -v 2c -c <public> <ip address> 188.8.131.52.184.108.40.206.220.127.116.11.9 | grep "INTEGER: 4" -c > inuse.txt
echo Calls in progress
to generate the four lines of output expected by MRTG. A MRTG config file was then edited with a target definition of:
YLegend[ccvg01_current_calls]: Current Calls
Legend1[ccvg01_current_calls]: Current Calls
Legend3[ccvg01_current_calls]: Maximum observed current calls
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,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mrtg