mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
bind95_: report 0 values for not found lines
This commit is contained in:
parent
31db64fefe
commit
fd2fb560fb
1 changed files with 61 additions and 21 deletions
|
@ -2,27 +2,58 @@
|
||||||
#
|
#
|
||||||
# Copyright Jean-Samuel Reynaud <js.reynaud@free.fr>
|
# Copyright Jean-Samuel Reynaud <js.reynaud@free.fr>
|
||||||
# Licensed under GPL v2
|
# Licensed under GPL v2
|
||||||
#
|
|
||||||
# We use this script to produce graph with munin for dns requests
|
=head1 NAME
|
||||||
# This script must have his name start with bind95_
|
|
||||||
# bind95_ : Global bind statistic
|
bind95_ - Graph dns requests by type
|
||||||
# bind95_test.com : Bind statistic for test.com zone (no view)
|
|
||||||
# bind95_test.com@internal : Bind statistic for test.com zone (view internal)
|
=head1 DESCRIPTION
|
||||||
# This version work with bind 9.5
|
|
||||||
#
|
We use this script to produce graph with munin for dns requests.
|
||||||
# Thanks for Benjamin Pineau for perl cleaning and corrections
|
|
||||||
#
|
This version work with bind 9.5
|
||||||
# You should have to add the following lines to you plugin configuration
|
|
||||||
# (/etc/munin/plugin-conf.d/munin-node):
|
Thanks to Benjamin Pineau for perl cleaning and corrections
|
||||||
#[bind95_*]
|
|
||||||
#user root
|
=head1 CONFIGURATION
|
||||||
#stat_file /var/cache/bind/named.stats
|
|
||||||
#rndc /usr/sbin/rndc
|
This script must have his name start with bind95_
|
||||||
#
|
|
||||||
#
|
=over 2
|
||||||
# Magic markers
|
|
||||||
#%# family=auto
|
bind95_ : Global bind statistic
|
||||||
#%# capabilities=autoconf
|
bind95_test.com : Bind statistic for test.com zone (no view)
|
||||||
|
bind95_test.com@internal : Bind statistic for test.com zone (view internal)
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
You should have to add the following lines to you plugin configuration
|
||||||
|
(/etc/munin/plugin-conf.d/munin-node):
|
||||||
|
|
||||||
|
=over 2
|
||||||
|
|
||||||
|
[bind95_*]
|
||||||
|
user root
|
||||||
|
stat_file /var/cache/bind/named.stats
|
||||||
|
rndc /usr/sbin/rndc
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 MAGIC MARKERS
|
||||||
|
|
||||||
|
#%# family=auto
|
||||||
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
Jean-Samuel Reynaud <js.reynaud@free.fr>
|
||||||
|
Andreas Perhab <a.perhab@wtioit.at>
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
GPLv2
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -78,6 +109,7 @@ my @counters = (
|
||||||
|
|
||||||
# Parse the statistic file
|
# Parse the statistic file
|
||||||
sub parseFile {
|
sub parseFile {
|
||||||
|
my @printed_counters = ();
|
||||||
my $dom = shift @_;
|
my $dom = shift @_;
|
||||||
open(IN,"<$stat_file") or die "Can't open $stat_file : $!";
|
open(IN,"<$stat_file") or die "Can't open $stat_file : $!";
|
||||||
my $current_zone = "";
|
my $current_zone = "";
|
||||||
|
@ -95,11 +127,19 @@ sub parseFile {
|
||||||
my ($val,$desc) = split(' ',$l,2);
|
my ($val,$desc) = split(' ',$l,2);
|
||||||
if (grep { $desc eq $_ } @counters) {
|
if (grep { $desc eq $_ } @counters) {
|
||||||
printf "%s.value %u\n",md5_hex($desc),$val;
|
printf "%s.value %u\n",md5_hex($desc),$val;
|
||||||
|
push @printed_counters, $desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(IN);
|
close(IN);
|
||||||
|
foreach(@counters) {
|
||||||
|
my $desc = $_;
|
||||||
|
my @already_printed = grep { $desc eq $_ } @printed_counters;
|
||||||
|
if (!@already_printed) {
|
||||||
|
printf "%s.value 0\n", md5_hex($desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue