mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 18:07:20 +00:00
More housecleaning.
Collapse some categories; remove duplicates; move plugins in where they belong, remove files that are not really plugins at all.
This commit is contained in:
parent
4e3ef5b93e
commit
0a1524f27f
45 changed files with 0 additions and 1337 deletions
140
plugins/network/dns/bind95_
Executable file
140
plugins/network/dns/bind95_
Executable file
|
@ -0,0 +1,140 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright Jean-Samuel Reynaud <js.reynaud@free.fr>
|
||||
# Licenced under GPL v2
|
||||
#
|
||||
# We use this script to produce graph with munin for dns requests
|
||||
# This script must have his name start with bind95_
|
||||
# bind95_ : Global bind statistic
|
||||
# bind95_test.com : Bind statistic for test.com zone (no view)
|
||||
# bind95_test.com@internal : Bind statistic for test.com zone (view internal)
|
||||
# This version work with bind 9.5
|
||||
#
|
||||
# Thanks for Benjamin Pineau for perl cleaning and corrections
|
||||
#
|
||||
# You should have to add the following lines to you plugin configuration
|
||||
# (/etc/munin/plugin-conf.d/munin-node):
|
||||
#[bind95_*]
|
||||
#user root
|
||||
#stat_file /var/cache/bind/named.stats
|
||||
#rndc /usr/sbin/rndc
|
||||
#
|
||||
#
|
||||
# Magic markers
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
# change those to reflect your bind configuration (use plugin configuration)
|
||||
# stat file
|
||||
my $stat_file = $ENV{'stat_file'} || "/var/cache/bind/named.stats";
|
||||
# rndc path
|
||||
my $rndc = $ENV{'rndc'} || "/usr/sbin/rndc";
|
||||
|
||||
|
||||
my $domain = $0;
|
||||
if ($domain =~ m/^.*bind95_[\w\d\._\-]+@[\w\d\._\-]+?$/) {
|
||||
$domain =~ s/^.*bind95_([\w\d\._\-]*)@([\w\d\._\-]+)?$/$1 (view: $2)/;
|
||||
} elsif ($domain =~ m/^.*bind95_[\w\d\._\-]+$/) {
|
||||
$domain =~ s/^.*bind95_([\w\d\._\-]+)$/$1/;
|
||||
} else {
|
||||
$domain = "View: _bind";
|
||||
}
|
||||
|
||||
my @counters = (
|
||||
'IPv4 requests received',
|
||||
'requests with EDNS(0) received',
|
||||
'TCP requests received',
|
||||
'auth queries rejected',
|
||||
'recursive queries rejected',
|
||||
'transfer requests rejected',
|
||||
'update requests rejected',
|
||||
'responses sent',
|
||||
'truncated responses sent',
|
||||
'responses with EDNS(0) sent',
|
||||
'queries resulted in successful answer',
|
||||
'queries resulted in authoritative answer',
|
||||
'queries resulted in non authoritative answer',
|
||||
'queries resulted in referral answer',
|
||||
'queries resulted in nxrrset',
|
||||
'queries resulted in SERVFAIL',
|
||||
'queries resulted in NXDOMAIN',
|
||||
'queries caused recursion',
|
||||
'duplicate queries received',
|
||||
'queries dropped',
|
||||
'other query failures',
|
||||
'requested transfers completed',
|
||||
'transfer requests succeeded',
|
||||
'IPv4 notifies sent',
|
||||
'IPv4 notifies received',
|
||||
'notifies rejected',
|
||||
'IPv4 SOA queries sent',
|
||||
'IPv4 IXFR requested'
|
||||
);
|
||||
|
||||
|
||||
# Parse the statistic file
|
||||
sub parseFile {
|
||||
my $dom = shift @_;
|
||||
open(IN,"<$stat_file") or die "Can't open $stat_file : $!";
|
||||
my $current_zone = "";
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
my $l = $_;
|
||||
|
||||
if ($l =~ /\[/ ) {
|
||||
$l =~ s/\[//g;
|
||||
$l =~ s/\]//g;
|
||||
$current_zone = $l;
|
||||
} else {
|
||||
$l =~ s/^ *//g;
|
||||
if ($l =~ /^[0-9]/ && $current_zone eq $domain) {
|
||||
my ($val,$desc) = split(' ',$l,2);
|
||||
if (grep { $desc eq $_ } @counters) {
|
||||
printf "%s.value %u\n",md5_hex($desc),$val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Config mode
|
||||
if ( defined($ARGV[0]) && $ARGV[0] eq "config" ) {
|
||||
printf "graph_title Dns requests %s\n",($domain eq "View: _bind" ? " all domains":$domain);
|
||||
printf "graph_vlabel requests/s\n";
|
||||
printf "graph_category network\n";
|
||||
printf "graph_info This graph display dns requests for %s\n",($domain eq "View: _bind" ? "all domains":$domain);
|
||||
|
||||
foreach(@counters) {
|
||||
my $s = $_;
|
||||
printf "%s.label %s\n",md5_hex($s),$s;
|
||||
printf "%s.type DERIVE\n",md5_hex($s);
|
||||
printf "%s.min 0\n",md5_hex($s);
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( defined($ARGV[0]) && $ARGV[0] eq "autoconf" ) {
|
||||
if (! -f $stat_file) {
|
||||
printf "Unable to file bind stat file on %s",$stat_file;
|
||||
exit 1;
|
||||
}
|
||||
if (! -f $rndc) {
|
||||
printf "Unable to file rndc tool (configured : %s)",$rndc;
|
||||
exit 1;
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Remove old stat file
|
||||
unlink ($stat_file);
|
||||
# Ask to bind to build new one
|
||||
`$rndc stats`;
|
||||
# Parse the stat file and return result
|
||||
parseFile($domain);
|
115
plugins/network/dns/bind_
Executable file
115
plugins/network/dns/bind_
Executable file
|
@ -0,0 +1,115 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright Jean-Samuel Reynaud <js.reynaud@free.fr>
|
||||
# Licenced under GPL v2
|
||||
#
|
||||
# We use this script to produce graph with munin for dns requests
|
||||
# This script must have his name start with bind_
|
||||
# bind_ : Global bind statistic
|
||||
# bind_test.com : Bind statistic for test.com zone
|
||||
#
|
||||
# "env.bind_stat_file" is the path to the bind statistic file
|
||||
# (/var/cache/bind/named.stats by default).
|
||||
#
|
||||
# "env.bind_rndc" is the path to the rndc tool
|
||||
# (/usr/sbin/rndc by default).
|
||||
#
|
||||
# Thanks for Benjamin Pineau for perl cleaning and correction in non root
|
||||
# running
|
||||
# Thanks to Immanuel Klinkenberg for adding config parameter by using munin config
|
||||
#
|
||||
# Magic markers
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# change those to reflect your bind configuration
|
||||
# stat file
|
||||
my $stat_file = # DB directory
|
||||
defined $ENV{'bind_stat_file'} ? $ENV{'bind_stat_file'} : '/var/cache/bind/named.stats';
|
||||
# rndc path
|
||||
my $rndc = # rndc path
|
||||
defined $ENV{'bind_rndc'} ? $ENV{'bind_rndc'} : '/usr/sbin/rndc';
|
||||
|
||||
my $lst = { "success" => 1,
|
||||
"referral" => 1,
|
||||
"nxrrset" => 1,
|
||||
"nxdomain" => 1,
|
||||
"recursion" => 1,
|
||||
"failure" => 1};
|
||||
|
||||
my $domain = $0;
|
||||
$domain =~ s/^.*bind_([\w\d\._\-]*)$/$1/;
|
||||
|
||||
|
||||
# Parse the statistic file
|
||||
sub parseFile {
|
||||
my $dom = shift @_;
|
||||
open(IN,"<$stat_file") or die "Can't open $stat_file : $!";
|
||||
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
my ($type,$count,$zone) = split(/ /,$_);
|
||||
$zone = defined($zone) ? $zone : "";
|
||||
if ($zone eq $dom) {
|
||||
if (defined $lst->{$type}) {
|
||||
# only keep the latest occurence for each value
|
||||
$lst->{$type} = $count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
close(IN);
|
||||
printf "%s.value %u\n", $_, $lst->{$_} foreach (keys %$lst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Config mode
|
||||
if ( defined($ARGV[0]) && $ARGV[0] eq "config" ) {
|
||||
printf "graph_title Dns requests %s\n",($domain eq "" ? " all domains":$domain);
|
||||
printf "graph_vlabel requests/s\n";
|
||||
printf "graph_category network\n";
|
||||
printf "graph_info This graph display dns requests for %s\n",($domain eq "" ? " all domains":$domain);
|
||||
printf "success.label Success\n";
|
||||
printf "success.type COUNTER\n";
|
||||
|
||||
printf "referral.label Referral\n";
|
||||
printf "referral.type COUNTER\n";
|
||||
|
||||
printf "nxrrset.label Nx RR set\n";
|
||||
printf "nxrrset.type COUNTER\n";
|
||||
|
||||
printf "nxdomain.label NX domain\n";
|
||||
printf "nxdomain.type COUNTER\n";
|
||||
|
||||
printf "recursion.label Recursion\n";
|
||||
printf "recursion.type COUNTER\n";
|
||||
|
||||
printf "failure.label Failure\n";
|
||||
printf "failure.type COUNTER\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( defined($ARGV[0]) && $ARGV[0] eq "autoconf" ) {
|
||||
if (! -f $stat_file) {
|
||||
printf "Unable to file bind stat file on %s",$stat_file;
|
||||
exit 1;
|
||||
}
|
||||
if (! -f $rndc) {
|
||||
printf "Unable to file rndc tool (configured : %s)",$rndc;
|
||||
exit 1;
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Remove old stat file
|
||||
unlink ($stat_file);
|
||||
# Ask to bind to build new one
|
||||
`$rndc stats`;
|
||||
# Parse the stat file and return result
|
||||
parseFile($domain);
|
185
plugins/network/dns/dnsresponse_
Executable file
185
plugins/network/dns/dnsresponse_
Executable file
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dnsresponse - Plugin to monitor DNS resolution times.
|
||||
"Poor man's smokeping" :)
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Any unix system.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
The following shows the default configuration.
|
||||
|
||||
[dnsresponse_*]
|
||||
env.site www.google.com
|
||||
env.times 20
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin shows the average and median times taken to resolve a site.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf,suggest
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
$Id: dnsresponse_ 61 2009-04-14 09:11:00Z stsimb $
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (c) 2009 by Sotiris Tsimbonis.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $DEBUG=0;
|
||||
my $site = exists $ENV{'site'} ? $ENV{'site'} : "www.google.com";
|
||||
my $times = exists $ENV{'times'} ? $ENV{'times'} : "20";
|
||||
my $resconf="/etc/resolv.conf";
|
||||
|
||||
use File::Basename;
|
||||
my $basename=basename($0);
|
||||
my $scriptname;
|
||||
my $dnsip;
|
||||
($scriptname, $dnsip) = split("_", $basename);
|
||||
print "DBG: target dns ip $dnsip\n" if ($DEBUG>0);
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
print "graph_title $dnsip DNS response time\n";
|
||||
print "graph_vlabel milliseconds\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_category Other\n";
|
||||
print "graph_info Time taken by $dnsip to resolve $site $times times.\n";
|
||||
#my @val = ("min", "avg", "median", "max");
|
||||
my @val = ("avg", "median", "stddev");
|
||||
my $value;
|
||||
foreach $value ( @val ) {
|
||||
if ($value eq "stddev") {
|
||||
print "$value.info Standard deviation (variance).\n";
|
||||
} else {
|
||||
print "$value.info $value time taken by $dnsip to resolve $site $times times.\n";
|
||||
}
|
||||
print "$value.label $value\n";
|
||||
# print "$value.type DERIVE\n";
|
||||
# print "$value.min 0\n";
|
||||
# print "$value.warning 100\n";
|
||||
# print "$value.critical 600\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) {
|
||||
my $ret;
|
||||
if (! eval "require Net::DNS;") { $ret .= "Net::DNS not found. "; }
|
||||
if (! eval "require Time::HiRes;") { $ret .= "Time::HiRes not found. "; }
|
||||
if (! -s $resconf) { $ret .= "$resconf not found. "; }
|
||||
if ($ret) {
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "suggest" ) {
|
||||
if (-s $resconf) {
|
||||
open (FILE, "< $resconf") || die "Could not open $resconf: $!\n";
|
||||
my $line;
|
||||
while ($line = <FILE>) {
|
||||
if ($line =~ /^nameserver/) {
|
||||
my $ns; my $ip;
|
||||
($ns, $ip) = split(" ", $line);
|
||||
print "$ip\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
} else {
|
||||
print "ERROR reading $resconf\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
use Time::HiRes qw ( gettimeofday tv_interval );
|
||||
use Net::DNS;
|
||||
|
||||
my $res = Net::DNS::Resolver->new(
|
||||
nameservers => [$dnsip],
|
||||
recurse => 1,
|
||||
debug => $DEBUG,
|
||||
);
|
||||
|
||||
my $i;
|
||||
my @restimes;
|
||||
for ($i=1; $i<=$times; $i++) {
|
||||
my $t0 = [gettimeofday];
|
||||
my $answer = $res->send($site);
|
||||
my $elapsed = tv_interval ($t0);
|
||||
push(@restimes, $elapsed);
|
||||
print "DBG: count $i elapsed $elapsed\n" if ($DEBUG>0);
|
||||
}
|
||||
|
||||
|
||||
@restimes=sort(@restimes);
|
||||
|
||||
#my $min=$restimes[0]*1000;
|
||||
my $average=mean(@restimes)*1000;
|
||||
my $median=median(@restimes)*1000;
|
||||
my $stddev=std_dev_ref_sum(@restimes)*1000;
|
||||
#my $max=$restimes[$times-1]*1000;
|
||||
|
||||
#print "min.value $min\n";
|
||||
print "avg.value $average\n";
|
||||
print "median.value $median\n";
|
||||
print "stddev.value $stddev\n";
|
||||
#print "max.value $max\n";
|
||||
|
||||
sub mean {
|
||||
my $result;
|
||||
foreach (@_) { $result += $_ }
|
||||
return $result / @_;
|
||||
}
|
||||
|
||||
sub median {
|
||||
my @ar = @_;
|
||||
my $elements = scalar(@ar);
|
||||
return $ar[(int($elements-1)/2)];
|
||||
# if ($elements % 2) {
|
||||
# return $ar[($elements-1)/2];
|
||||
# } else {
|
||||
# return ($ar[($elements-1)/2-0.5]+$ar[($elements-1)/2+0.5])/2;
|
||||
# }
|
||||
}
|
||||
|
||||
# Standard Deviance function from http://www.linuxjournal.com/article/6540
|
||||
sub std_dev_ref_sum {
|
||||
my @ar = @_;
|
||||
my $elements = scalar @ar;
|
||||
my $sum = 0;
|
||||
my $sumsq = 0;
|
||||
|
||||
foreach (@ar) {
|
||||
$sum += $_;
|
||||
$sumsq += ($_ **2);
|
||||
}
|
||||
|
||||
return sqrt( $sumsq/$elements - (($sum/$elements) ** 2));
|
||||
}
|
41
plugins/network/dns/pdns_errors
Executable file
41
plugins/network/dns/pdns_errors
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor PowerDNS performance
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns dump"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Power DNS errors'
|
||||
echo 'graph_args -l 0 --base 1000'
|
||||
echo 'graph_vlabel numbers of'
|
||||
echo 'graph_category Power DNS'
|
||||
echo 'graph_info This graph shows Power DNS performance on the machine.'
|
||||
echo 'corrupt_packets.label corrupt packets'
|
||||
echo 'corrupt_packets.type DERIVE'
|
||||
echo 'corrupt_packets.min 0'
|
||||
echo 'corrupt_packets.info Number of corrupt packets received'
|
||||
echo 'servfail_packets.label servfail packets'
|
||||
echo 'servfail_packets.type DERIVE'
|
||||
echo 'servfail_packets.min 0'
|
||||
echo 'servfail_packets.info Number of times a server-failed packet was sent out'
|
||||
echo 'timedout_packets.label timedout packets'
|
||||
echo 'timedout_packets.type DERIVE'
|
||||
echo 'timedout_packets.min 0'
|
||||
echo 'timedout_packets.info Number of packets which weren not answered within timeout set'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep corrupt'\|'servfail'\|'timedout | sed 's/-/_/g'
|
34
plugins/network/dns/pdns_latency
Executable file
34
plugins/network/dns/pdns_latency
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor PowerDNS performance
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Power DNS latency'
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel usec'
|
||||
echo 'graph_category Power DNS'
|
||||
echo 'graph_info This graph shows Power DNS latency on the machine.'
|
||||
echo 'latency.label latency'
|
||||
echo 'latency.info Average number of microseconds needed to answer a question'
|
||||
echo 'latency.type GAUGE'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
echo "latency.value $($command latency | awk -F= '{print $2}')"
|
35
plugins/network/dns/pdns_qsize
Executable file
35
plugins/network/dns/pdns_qsize
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor PowerDNS performance
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Power DNS database queue'
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel number of waiting queries'
|
||||
echo 'graph_category Power DNS'
|
||||
echo 'graph_info This graph shows Power DNS database performance on the machine.'
|
||||
echo 'qsize.label qsize'
|
||||
echo 'qsize.info Number of questions waiting for database attention'
|
||||
echo 'qsize.type GAUGE'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
echo "qsize.value $($command qsize_q | awk -F= '{print $2}')"
|
||||
|
53
plugins/network/dns/pdns_queries
Executable file
53
plugins/network/dns/pdns_queries
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor PowerDNS performance
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns dump"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Power DNS queries'
|
||||
echo 'graph_args -l 0 --base 1000'
|
||||
echo 'graph_vlabel numbers of'
|
||||
echo 'graph_category Power DNS'
|
||||
echo 'graph_info This graph shows Power DNS performance on the machine.'
|
||||
echo 'recursing_answers.label recursing answers'
|
||||
echo 'recursing_answers.type DERIVE'
|
||||
echo 'recursing_answers.min 0'
|
||||
echo 'recursing_answers.info Number of recursive answers sent out'
|
||||
echo 'recursing_questions.label recursing queries'
|
||||
echo 'recursing_questions.type DERIVE'
|
||||
echo 'recursing_questions.min 0'
|
||||
echo 'recursing_questions.info Number of queries sent to recursor'
|
||||
echo 'tcp_answers.label tcp answers'
|
||||
echo 'tcp_answers.type DERIVE'
|
||||
echo 'tcp_answers.min 0'
|
||||
echo 'tcp_answers.info Number of answers sent out over TCP'
|
||||
echo 'tcp_queries.label tcp queries'
|
||||
echo 'tcp_queries.type DERIVE'
|
||||
echo 'tcp_queries.min 0'
|
||||
echo 'tcp_queries.info Number of TCP queries received'
|
||||
echo 'udp_answers.label udp answers'
|
||||
echo 'udp_answers.type DERIVE'
|
||||
echo 'udp_answers.min 0'
|
||||
echo 'udp_answers.info Number of answers sent out over UDP'
|
||||
echo 'udp_queries.label udp queries'
|
||||
echo 'udp_queries.type DERIVE'
|
||||
echo 'udp_queries.min 0'
|
||||
echo 'udp_queries.info Number of UDP queries received'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
$command | sed 's/=\([0-9]\+\),/.value \1\n/g' | grep udp-'\|'recursing'\|'tcp | sed 's/-/_/g'
|
48
plugins/network/dns/pdns_rel
Executable file
48
plugins/network/dns/pdns_rel
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor PowerDNS performance
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
command="/etc/init.d/pdns show"
|
||||
state_file=/var/lib/munin/plugin-state/pdns_rel.state
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Power DNS Packet Cache Performance'
|
||||
echo 'graph_args -l 0 --upper-limit 100 --base 1000'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category Power DNS'
|
||||
echo 'graph_info This graph shows the Power DNS packet cache performance on the machine.'
|
||||
echo 'packetcache_hitrate.label packet cache hitrate'
|
||||
echo 'packetcache_hitrate.type GAUGE'
|
||||
echo 'packetcache_hitrate.min 0'
|
||||
echo 'packetcache_hitrate.max 100'
|
||||
echo 'packetcache_hitrate.info Hits on the packets cache'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
hits=$($command packetcache-hit | awk -F= '{print $2}')
|
||||
queries=$($command udp-queries | awk -F= '{print $2}')
|
||||
old_hits=$(cat $state_file | head -n1)
|
||||
old_queries=$(cat $state_file | tail -n1)
|
||||
|
||||
if [ -f $state_file ] && [ $(ls -l --time-style=+%s $state_file | awk '{print $6}') -gt $(date --date="7 minutes ago" +%s) ] ; then
|
||||
d_hits=$(($hits - $old_hits))
|
||||
d_queries=$(($queries - $old_queries))
|
||||
if [ $d_queries -gt 0 ] ; then
|
||||
echo packetcache_hitrate.value $(( $d_hits * 100 / $d_queries ))
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $hits > $state_file
|
||||
echo $queries >> $state_file
|
Loading…
Add table
Add a link
Reference in a new issue