[mrtg] MRTG with perl and shell scripts

Amol Sapkal amolsapkal at coolgoose.com
Thu Jul 10 04:04:24 MEST 2003


Hi all,
I am not exactly sure if the problem I am facing is a Perl/Shell/MRTG problem.

I am calling a Perl script in a MRTG config file, which in turn calls another shell script (!
#/bin/bash)




My config entires:


The Perl file(drops_latency_alien_site) contans this entry, which calls shell for executing telnet:

@data_collector = `./telnet_alien_site 2>/dev/null`; 

The shell script ("telnet_alien_site") runs without errors, when run on prompt. Also, the Perl 
script gives the desired output when run by hand. Output of Perl script(drops_latency_alien_site):

[root at box pingers]# /usr/local/mrtg-2/pingers/drops_latency_alien_site
344
100
0
0[root at box pingers]#
-----------------------------

When I run the MRTG on the config file, I get the desired entry in the log file (without any errors 
thrown back to the prompt):

1057797600 91 26 344 100 << WHEN MRTG IS RUN BY HAND, I SEE A *correct* UPDATE
-----------------------------

The configs in the MRTG.cfg file:

Target[alien_site]: `perl /usr/local/mrtg-2/pingers/drops_latency_alien_site`
PageTop[alien_site]: <center><H2>Latency and Packet Loss graph for the Alien site <BR>
MaxBytes[alien_site]: 1000000
Options[alien_site]: gauge,growright,nopercent
Title[alien_site]: Latency and Packet Loss for alien site
Ylegend[alien_site]: Response vs success rate
ShortLegend[alien_site]: Units
Legend1[alien_site]:&nbsp; Latency in ms end-to-end on Alien Site
Legend2[alien_site]:&nbsp; Success Rate in percentage (20 packets)
Legend3[alien_site]:
Legend4[alien_site]:
LegendI[alien_site]:&nbsp;Latency:&nbsp
LegendO[alien_site]:&nbsp;Success Rate:&nbsp  

-------------------------------

The problem is occuring when MRTG runs in the normal way-cron. This is what I get in the logs:

1057798228 0 0
1057798228 0 0 0 0
1057797925 0 0 0 0 << No entries
1057797900 0 0 0 0 << No entries
1057797600 91 26 344 100 << WHEN MRTG IS RUN BY HAND, I SEE AN UPDATE
1057797300 0 0 0 0  

--------------------------------

Please note that the shell scrip 'sleeps' for 10 seconds, to let the telnet finish its job. Is this 
causing a problem? Does MRTG has a default dead time-out?

In Options[alien_site], I tried using absolute too.

Can anyone help?
Cheers,

Amol Sapkal
--------------------------
Temperament is not destiny

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list