1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

dhcp-pool: implement autoconf

This commit is contained in:
Kim B. Heino 2021-04-01 16:30:16 +03:00 committed by Lars Kruse
parent ced47decaf
commit 341de2c2b9

View file

@ -29,6 +29,9 @@
# config (required)
#
# Version 1.0, 2-12-2008
#
#%# family=auto
#%# capabilities=autoconf
use POSIX;
use Time::Local;
@ -38,7 +41,17 @@ my $CONFFILE = exists $ENV{'conffile'} ? $ENV{'conffile'} : "/etc/dhcpd.conf";
my $LEASEFILE = exists $ENV{'leasefile'} ? $ENV{'leasefile'} : "/var/lib/dhcp/dhcpd.leases";
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) {
if (-e ${CONFFILE} and -e ${LEASEFILE}) {
my %pools;
%pools = determine_pools();
if (%pools) {
print "yes\n";
} else {
print "no (no pools defined in config)\n";
}
} else {
print "no (no config or lease file)\n";
}
}
elsif ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
my (%pools, $start, $label);