Hi,
I'm trying to set up a (MS) DOS script as a MRG Target, it "globally" works but it returns MRTG bad values.
This script calls the Win32 executable "http-ping.exe", puts the values in a txt file and then returns the content of this file to the MRTG Perl process.
The problem is that the values in the (temp) txt file are correct, but the script returns error message to the MRTG process !
Could anyone help me ?
Here's an extract of the log:
2011-06-07 12:34:10 -- WARNING: Problem with External get 'C:/scripts/http-ping/http-ping.bat':
Expected a Number for 'in' but got 'Commande ECHO d‚sactiv‚e.'
2011-06-07 12:34:10 -- WARNING: Problem with Externale get 'C:/scripts/http-ping/http-ping.bat':
Expected a Number for 'out' but got 'Commande ECHO d‚sactiv‚e.'
2011-06-07 12:34:10 -- ERROR: Target[http-ping][_IN_] ' $$target[0]{$mode} ' did not eval into defined data
2011-06-07 12:34:10 -- ERROR: Target[http-ping][_OUT_] ' $$target[0]{$mode} ' did not eval into defined data
Here's the script:
@ECHO OFF
::
:: Ecriture de la ligne resultat filtrée sur "Reply" dans result.txt:
http-ping.exe -n 1
http://intranet >result.txt
::
:: Recherche de la valeur du temps de reponse dans le fichier result.txt:
For /F "tokens=8 delims=<=ms' " %%D in ('FIND "Reply" result.txt') Do Set /A delay=%%D
For /F "tokens=7 delims=<=' " %%D in ('FIND "Lost" result.txt') Do Set /A loss=%%D
::
ECHO %delay% 1>output.txt
ECHO %loss% 1>>output.txt
ECHO 365>> output.txt
ECHO coucou>> output.txt
::
TYPE output.txt
DEL output.txt