[mrtg] DNS stats script not returning results
John Oliver
joliver at john-oliver.net
Fri Dec 12 02:08:13 MET 2003
I'm using this script for DNS:
#!/usr/bin/perl
$hostname = "ns\.sdsitehosting\.net";
$uptime = `uptime`;
$uptime =~ /up (.*?),/;
$uptime = $1;
$start =`/usr/local/sbin/rndc stats`;
$log ="/var/named/named.stats";
@stat = `tail -n 15 $log`;
$last_success = $stat[0];
$last_success =~ tr/^[0-9]\ file://cd;
$last_failure = $stat[5];
$last_failure =~ tr/^[0-9]\ file://cd;
$latest_success = $stat[8];
$latest_success =~ tr/^[0-9]\ file://cd;
$latest_failure = $stat[13];
$latest_failure =~ tr/^[0-9]\ file://cd;
$success = $latest_success - $last_success;
unless ($success eq "0"){ $success ++; }
$failure = $latest_failure - $last_failure;
unless ($failure eq "0"){ $failure ++; }
print "$success\n$failure\n$uptime\n$hostname\n";
exit;
Machine is Red Hat 7.2 bind is 9.2.3rc4 installed from source.
Running it gets me:
[joliver at ns joliver]$ /usr/local/mrtg-2/bin/stat.pl
0
0
151 days
ns.sdsitehosting.net
What's wrong with that script?
--
John Oliver, CCNA http://www.john-oliver.net/
Linux/UNIX/network consulting http://www.john-oliver.net/resume/
* * * * * * * * * * * * * * *
Contribute to the SpamCon Legal Fund!! http://www.spamcon.org/legalfund/
--
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