Package: munin-plugins-extra Version: 2.0.21-2 Severity: minor Tags: patch Dear Maintainer,
The dhcpd3 plugin fails to count lease upper-bounds for dhcpd.conf files that have multiple 'range' directives in a single 'subnet' block. Example dhcpd.conf: subnet 192.168.254.0 netmask 255.255.254.0 { pool { range 192.168.254.100 192.168.254.199; allow members of "subnet254"; } pool { range 192.168.255.100 192.168.255.199; allow members of "subnet255"; } } Example munin-run output: $ DEBUG=1 munin-run --debug --pidebug dhcpd3 config # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Processing plugin configuration from /etc/munin/plugin-conf.d/zlocal # Setting /rgid/ruid/ to /111/65534/ # Setting /egid/euid/ to /111 111/65534/ # Setting up environment # Environment leasefile = /var/lib/dhcp/dhcpd.leases # Environment configfile = /etc/dhcp/dhcpd.conf # About to run '/etc/munin/plugins/dhcpd3 config' # DEBUG: CONFIGFILE == /etc/dhcp/dhcpd.conf # DEBUG: LEASEFILE == /var/lib/dhcp/dhcpd.leases # DEBUG: Found a subnet: 192_168_254_0__23 # DEBUG: range 192.168.254.100 -> 192.168.254.199 # DEBUG: limit for 192_168_254_0__23 is 100 graph_title dhcp leases graph_args --base 1000 -v leases -l 0 graph_order 192_168_254_0__23 192_168_254_0__23.info 192.168.254.0/23 192_168_254_0__23.label 192.168.254.0/23 192_168_254_0__23.min 0 192_168_254_0__23.max 100 192_168_254_0__23.warning 90 192_168_254_0__23.critical 95 Attached is a patch which tweaks dhcpd.conf file parsing to enable counting of multiple 'range' directives. Example munin-run output after the patch: $ DEBUG=1 munin-run --debug --pidebug dhcpd3 config # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Processing plugin configuration from /etc/munin/plugin-conf.d/zlocal # Setting /rgid/ruid/ to /111/65534/ # Setting /egid/euid/ to /111 111/65534/ # Setting up environment # Environment leasefile = /var/lib/dhcp/dhcpd.leases # Environment configfile = /etc/dhcp/dhcpd.conf # About to run '/etc/munin/plugins/dhcpd3 config' # DEBUG: CONFIGFILE == /etc/dhcp/dhcpd.conf # DEBUG: LEASEFILE == /var/lib/dhcp/dhcpd.leases # DEBUG: Found a subnet: 192_168_254_0__23 # DEBUG: range 192.168.254.100 -> 192.168.254.199 # DEBUG: limit for 192_168_254_0__23 is 100 # DEBUG: range 192.168.255.100 -> 192.168.255.199 # DEBUG: limit for 192_168_254_0__23 is 200 graph_title dhcp leases graph_args --base 1000 -v leases -l 0 graph_order 192_168_254_0__23 192_168_254_0__23.info 192.168.254.0/23 192_168_254_0__23.label 192.168.254.0/23 192_168_254_0__23.min 0 192_168_254_0__23.max 200 192_168_254_0__23.warning 180 192_168_254_0__23.critical 190 Thanks! -- System Information: Debian Release: jessie/sid APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing'), (50, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 3.14-1-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages munin-plugins-extra depends on: ii munin-common 2.0.21-2 ii perl 5.18.2-4 munin-plugins-extra recommends no packages. Versions of packages munin-plugins-extra suggests: ii libnet-netmask-perl 1.9019-1 ii libnet-telnet-perl 3.04-1 ii python 2.7.6-2 -- no debconf information -- Gerald Turner <gtur...@unzane.com> Encrypted mail preferred! OpenPGP: 4096R / CA89 B27A 30FA 66C5 1B80 3858 EC94 2276 FDB8 716D
--- /usr/share/munin/plugins/dhcpd3 2014-05-11 05:53:22.000000000 -0700 +++ /etc/munin/plugins/dhcpd3 2014-06-09 15:25:37.515783482 -0700 @@ -169,15 +169,16 @@ print "# DEBUG: Found a subnet: $name\n" if $DEBUG; } if($name && /^\}$/) { - print "# DEBUG: End of subnet... NO RANGE?\n" if $DEBUG; - delete($leases{$name}); + if(!exists $limits{$name}) { + print "# DEBUG: End of subnet... NO RANGE?\n" if $DEBUG; + delete($leases{$name}); + } $name = ""; } if($name && /range\s+((?:\d+\.){3}\d+)\s+((?:\d+\.){3}\d+)/) { print "# DEBUG: range $1 -> $2\n" if $DEBUG; $limits{$name} += &rangecount($1, $2); print "# DEBUG: limit for $name is " . $limits{$name} . "\n" if $DEBUG; - $name = ""; } if(/^include \"([^\"]+)\";/) { my $includefile = $1;
pgpSHpa5KlN7j.pgp
Description: PGP signature