[mrtg] Re: DNS stats script not returning results
Bernardo Castilho Pinto
bernardo at ipiranga.com.br
Fri Dec 12 12:39:27 MET 2003
This script doesn´t work for bind 9. I changed it , and it's working fine in my
company.
regards,
Bernardo
-----------------script ---------------------------
#!/usr/bin/perl
$hostname = "YOUR\.DOMAIN\.";
$uptime = `uptime`;
$uptime =~ /up (.*?),/;
$uptime = $1;
$start =`/usr/sbin/rndc stats`;
$log ="/YOUR/DIRECTORY/named.stats";
@stat = `tail -n 15 $log`;
$last_success = $stat[0];
$last_success = substr ($last_success,8);
$last_failure = $stat[5];
$last_failure = substr ($last_failure,8);
$latest_success = $stat[8];
$latest_success = substr ($latest_success,8);
$latest_failure = $stat[13];
$latest_failure = substr ($latest_failure,8);
$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;
-----------------end ----------------------------------------
|+--------------------------+--------------------------------------------------|
|| John Oliver | |
|| <joliver at john-oliver.ne| Para: mrtg at list.ee.ethz.ch |
|| t> | cc: (cco: Bernardo Castilho |
|| | Pinto/CBPI) |
|| 11/12/2003 22:08 | Assunto: [mrtg] DNS stats script|
|| | not returning results |
|| Tamanho da Nota 6277 | |
|| bytes ou 6,277 Kbytes. | |
|+--------------------------+--------------------------------------------------|
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
--
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