[mrtg] 2.9.10 not graphing every host/variable

Archive User archive at xpedite.com
Thu Mar 22 18:39:16 MET 2001


I am attempting to gather dns stats data from 55 dns 
servers on my network. It appears to be working great
except mrtg doesnt appear to be graphing some hosts/variables
for no reason (data does increase). If I run the script I
use to generate these stats manually the numbers do increase
but mrtg always shows an empty graph/or 0 results. 

I am graphing two variables.. RQ and RNXD (for those of you 
familiar with bind stats). Each of these numbers are 
counters which just keep increasing over time. They are 
reset only when the dns server is restarted from scratch. 

The numbers increase every time on all hosts but mrtg
is ignoring the following hosts for some wierd reason. 

int-ns2   mrqadns1   flmrdns1   comix   devbldr  republix 
atlantix  int-cfdns1 int-cfdns2

It is also not graphing anything for the RNXD variable 
on ~80% of the hosts even though this variable increases
all the time (not by much however). 

I turned on all the debugging in the mrtg perl script 
but I didnt spot anything that would be an error. 
And it looks like the correct info is being passed to

I am running mrtg on a redhat 7.0 linux server.

Any ideas? Below are the scripts and a sample config entry
I am using.. 

Thanks for any help you can offer.. 

Target[int-ns2.dns]: `/usr/local/mrtg-2/bin/mrtg-dns -s 
int-ns2.xpedite.com -p 7260`
MaxBytes[int-ns2.dns]: 100000000
Title[int-ns2.dns]:  Int-ns2 - Dns stats
PageTop[int-ns2.dns]: <H1>Int-ns2 - Dns stats</H1>
Options[int-ns2.dns]: growright, noinfo, nopercent, integer
YLegend[int-ns2.dns]: Queries/Sec
WithPeak[int-ns2.dns]: dwmy
LegendI[int-ns2.dns]: &nbsp;Sucessful:
LegendO[int-ns2.dns]: &nbsp;Failed:
ShortLegend[int-ns2.dns]: Queries/Sec


# This script runs on each dns server on port 7260 and is
# started up by inetd

rm /var/named/named.stats
/usr/local/sbin/ndc stats >/dev/null 2>&1 
sleep 1
cat /var/named/named.stats | tail -3 | head -1


# This was someone elses smtp checking script which I 
# mundged into this horrible beast. 
# Sorry.. his name is escaping me at the moment. 

# This script is called by mrtg to gather the stats

use Socket;
use Getopt::Long;

$Getopt::Long::ignorecase = 0;

use vars qw($server $sourceport $dnsrq1 $dnsrfail1);

GetOptions("port=i"        => \$sourceport,
           "server=s"      => \$server,
           "<>"            => \&Usage);

$server     = '' unless $server;
$sourceport = '' unless $sourceport;

Usage() unless ($server && $sourceport);

($dnsrq1, $dnsrfail1) = GetNewStats($server, $sourceport);

# We dont care about uptime.. (noinfo) so we just put in a 
# bogus one for every host thats constant. 

print $dnsrq1,"\n",$dnsrfail1,"\n","11:51am  up 6 days, 19:13,  6 users,
load average: 0.66, 0.57, 0.47\n",$server,"\n";

sub GetNewStats {
    my($server, $sourceport) = @_;
    my(@output, $port, $proto, $iaddr, $paddr, $curqueue);
    if ( $server eq "localhost" ) {
        @output = `/usr/local/bin/queue-depth`;
    } else {
        if ($sourceport =~ /\D/) {
            $port = getservbyname ($sourceport, 'tcp');
         } else {
            $port = $sourceport;
        die "$0: Bad port \"$sourceport\"" unless ($port);
        $proto = getprotobyname ('tcp') || die "$0: Bad prototype tcp";

        $iaddr = inet_aton($server) or die "$0: no host \"$server\"";
        $paddr = sockaddr_in($port, $iaddr);

        socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "$0: socket 
error $!";
        connect (SOCK, $paddr) or die "$0: connect error $!";

        while (<SOCK>) {
            push(@output, $_);
        close(SOCK) || warn "$0: socket close error $!";

        foreach (@output) {
        ($dnsrfail, $dnsrq) = (split)[1,15];

    return ($dnsrq, $dnsrfail);
}   # End GetNewStats().

sub Usage {

   my $option = shift;

   print STDERR "See Michael Cunningham \n";

} # End Usage().


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