<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I did a brief search on the archives but didn’t see
this issue addressed.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I wrote a simple cgi in bash that helps manage the smokeping
tool. The cgi starts/stops/restarts smokeping.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I noticed when I started smokeping via cgi, it would run for
a while but then crash after a few minutes.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>After a bit of trial and error (thinking there was a problem
with my startup method) I discovered that smokeping was throwing an error:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>$ cat logfile.1766<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>Thu Mar 31 12:22:17
2011 - Smokeping version 2.004002 successfully launched.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>Thu Mar 31 12:22:17
2011 - Not entering multiprocess mode for just a single probe.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>Thu Mar 31 12:22:17
2011 - FPing: probing 13 targets with step 300 s and offset 176 s.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>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.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>Thu Mar 31 12:23:15
2011 - Illegal division by zero at /opt/smokeping/lib/Smokeping/probes/FPing.pm
line 149, <GEN2> line 1.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal>Line number 149 is this statement:<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'> @times = map
{sprintf "%.10e", $_ / $self->{pingfactor}} sort {$a <=> $b}
grep /^\d/, @times;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal>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.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thanks<o:p></o:p></p>
<p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>