On Friday 16 November 2007 00:09, Jeff Pang wrote:
>
> Many thanks to John W. Krahn, the monagt was upgraded, fixed some
> bugged or not good code.
> If there's any other problem, please let me know.
> I have used mon and nagios for system monitor, but both them are not
> easy to configure for.
> Then I got the code by Angel, and with her permision I maintain the
> code. Also I post her orginal document on the web (cn language only):
>
> http://home.arcor.de/pangj/monpub/perl_monitor.pdf

To reiterate again.

>From the monagt program:

     196     open (STDIN, "</dev/null");
     197     open (STDOUT, ">/dev/null");
     198     open (STDERR,">&STDOUT");
     199 
     200     chdir $rundir;

     210     open (HDW,">>",$log_file);
     211     flock (HDW,LOCK_EX);
     212     print HDW $time,"  ",join ' ',@_,"\n";
     213     flock (HDW,LOCK_UN);
     214     close HDW;

     220     open (HDW,">>",$err_log);
     221     print HDW $time,"  ",@_;
     222     close HDW;

     229     open (HDW,">>",$err_log);
     230     print HDW $time,"  ",@_;
     231     close HDW;

     242     chdir $rundir;
     243     unlink $pid_file;

     494     unlink $pid_file if $$ == $parent_pid;

You should *always* check the return value of system functions like 
open(), flock(), seek(), chdir(), unlink(), etc.



     474                     $ip =~ /^172\.32\./ or

According to RFC 1918:

<quote>
3. Private Address Space

   The Internet Assigned Numbers Authority (IANA) has reserved the
   following three blocks of the IP address space for private internets:

     10.0.0.0        -   10.255.255.255  (10/8 prefix)
     172.16.0.0      -   172.31.255.255  (172.16/12 prefix)
</quote>

/^172\.32\./ is outside of the range of 172.16.0.0 - 172.31.255.255.




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to