[mrtg] threshold forking/spawning

avinash phogat avinash_phogat at hotmail.com
Mon Jan 5 09:04:59 MET 2004


Hi all

I am facing problem in seeting threshold for mrtg , i am using redhat7.2 and 
mrtg version is 2.9.29

I think i am facing problem in forking/spawning part of the process.

my script is as under
begin script>

#!/usr/bin/perl
# file thresh.pl
use Mail::Internet;

my($timestr, $param, $thresh, $value, $logfile, $now, $result, $in_name,
$link_name);
  $timestr = localtime(time);
  $param = $ARGV[0];
  $thresh = $ARGV[1];
  $value = $ARGV[2];
  $thdesc = $ENV{'THRESH_DESC'};
  $logfile = "/home/www/mrtg/threshold/thresh.sh";
  $now = `date`;
  $result = $value * 8 / 1024;


my $head = Mail::Header->new;
$head->add(From => 'ThreshMAN <avinash_phogat at hotmail.com>');
$head->add(ReplyTo => 'Netgroups <avinash_phogat at hotmail.com>');
$head->add(To   => 'Netgroups <avinash_phogat at hotmail.com>');
$head->add(Subject => "THRESHOLD ALERT:  $thdesc ($param) is above $thresh
bandwidth threshold");

my $body = <<END;
Device          : $thdesc ($param)
Threshold Value : $thresh
Current Value   : $result kbps
Date/Time       : $now

$mail = Mail::Internet->new(Header => $head,
                            Body   => [$body],
                            Modify => 1);

# Mail it.
if ($thdesc !~ /(thernet)/) { print $mail->send('sendmail'); }

# Log it.
if ($thresh > $value) { $abovebelow = "below"; }
                 else { $abovebelow = "above"; }

$message .= "$thdesc ($param) ($result kbps) is $abovebelow threshold
($thresh)";

open(LOG, ">>$logfile");
print LOG "$timestr $message\n";
close(LOG);


exit(0);
pls suggest me what shall i do
pls do the needful
thanks in advance
Avinash

_________________________________________________________________
Free transactions in any ATM across India. 
http://server1.msn.co.in/msnleads/suvidha/dec03.asp?type=hottag Click here.

--
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