From 6a7c04e5498271f293d77b5a1a7b0db1694216a5 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Wed, 4 Oct 2023 19:30:54 -0500 Subject: [PATCH] add -w to dhcp (#492) --- snmp/dhcp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snmp/dhcp b/snmp/dhcp index 66466c2..4617903 100755 --- a/snmp/dhcp +++ b/snmp/dhcp @@ -58,6 +58,10 @@ for reporting purposes. Default is 'cidr'. +=head2 -w + +Write the the output to this file. + =head1 Return JSON Data Hash - .all_networks.cur :: Current leases for all networks @@ -106,9 +110,10 @@ use MIME::Base64; use IO::Compress::Gzip qw(gzip $GzipError); use Net::ISC::DHCPd::Leases; use Net::ISC::DHCPd::Config; +use File::Slurp; my %opts; -getopts( 'l:Zdpc:n:', \%opts ); +getopts( 'l:Zdpc:n:w:', \%opts ); if ( !defined( $opts{n} ) ) { $opts{n} = 'cidr'; @@ -533,4 +538,8 @@ if ( $opts{Z} ) { print $toReturn; +if ($opts{w}) { + write_file($opts{w}, $toReturn); +} + exit;