| Cheshire Cat Computing http://www.steveshipway.org/forum/ |
|
| DOS external script as MRTG Target[] returns bad values http://www.steveshipway.org/forum/viewtopic.php?f=11&t=4343 |
Page 1 of 1 |
| Author: | efourage [ Tue Jun 07, 2011 11:41 pm ] |
| Post subject: | DOS external script as MRTG Target[] returns bad values |
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 |
|
| Author: | stevesh [ Wed Jun 08, 2011 10:47 am ] |
| Post subject: | Re: DOS external script as MRTG Target[] returns bad values |
Clearly, your external script is not producing the output that MRTG expects. The first thing to do is to remove the 'DEL' line at the end of the script temporarily. Then you will be able to view the file after it has run and verify that it is producing the output you expect. I think probably your script is not working as you expect -- have you tried running it from the command line to verify it works ? |
|
| Author: | efourage [ Wed Jun 08, 2011 9:03 pm ] |
| Post subject: | Re: DOS external script as MRTG Target[] returns bad values |
| Author: | efourage [ Thu Jun 09, 2011 5:15 am ] |
| Post subject: | Re: DOS external script as MRTG Target[] returns bad values |
| Author: | stevesh [ Fri Jun 10, 2011 3:58 pm ] |
| Post subject: | Re: DOS external script as MRTG Target[] returns bad values |
You can, but it is not simple. If you are using Routers2 v2.22 or later, there is the 'secondary axis' option -- you can define a userdefined graph over the two targets and define a scaleshift to convert the two axis for display. This is rather complex to do... there is an example in the docs showing how to use this to display temperatures in degC and degF at the same time. If not using RRD then you cannot do it. |
|
| Page 1 of 1 | All times are UTC + 12 hours [ DST ] |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|