[smokeping-users] possible bug: smokeping running under cgi

Morris, Christopher Christopher.Morris at sabre-holdings.com
Thu Mar 31 21:57:53 CEST 2011


I did a brief search on the archives but didn't see this issue addressed.

I wrote a simple cgi in bash that helps manage the smokeping tool.  The cgi starts/stops/restarts smokeping.

I noticed when I started smokeping via cgi, it would run for a while but then crash after a few minutes.

After a bit of trial and error (thinking there was a problem with my startup method) I discovered that smokeping was throwing an error:

$ cat logfile.1766
Thu Mar 31 12:22:17 2011 - Smokeping version 2.004002 successfully launched.
Thu Mar 31 12:22:17 2011 - Not entering multiprocess mode for just a single probe.
Thu Mar 31 12:22:17 2011 - FPing: probing 13 targets with step 300 s and offset 176 s.
Thu Mar 31 12:23:15 2011 - Use of uninitialized value in division (/) at /opt/smokeping/lib/Smokeping/probes/FPing.pm line 149, <GEN2> line 1.

Thu Mar 31 12:23:15 2011 - Illegal division by zero at /opt/smokeping/lib/Smokeping/probes/FPing.pm line 149, <GEN2> line 1.

Line number 149 is this statement:

  @times = map {sprintf "%.10e", $_ / $self->{pingfactor}} sort {$a <=> $b} grep /^\d/, @times;

Examining the FPing.pm library I see that $self->{pingfactor} is not defined if the script is run as a CGI in "sub new($$$)" routine.  This routine appears to figure out what the 'pingfactor' is for the fping binary if this is not run as a CGI.

I modified the code so that it goes ahead and runs/executes the body of "sub new($$$)" even if the script is run as a CGI.  So far it has not seemed to cause any problems with the output/results of the utility.

Thanks



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20110331/8e5b404e/attachment-0001.htm 


More information about the smokeping-users mailing list