X-Git-Url: http://git.rot13.org/?p=angular-mojolicious.git;a=blobdiff_plain;f=scripts%2Fsnmp-printer.pl;h=e9553c5007df67d2a0b421665a770d54efba4393;hp=d12504d4d4133f288fc21e787abfe3f1917afba7;hb=fd9e02eede3cad95516e5cefa25e7a0ed849b380;hpb=4c716811ae1a0413fa2c75b7c9817b507dc6356d diff --git a/scripts/snmp-printer.pl b/scripts/snmp-printer.pl index d12504d..e9553c5 100755 --- a/scripts/snmp-printer.pl +++ b/scripts/snmp-printer.pl @@ -28,6 +28,9 @@ sub iso_datetime { return sprintf "%04d-%02d-%02dT%02d:%02d:%02d", $y+1900, $m, $d, $hh, $mm, $ss; } +my $log_path = join('.', $dir, (split(/T/,iso_datetime,2))[0], 'json'); +open(my $log, '>>', $log_path) || die "$log_path: $!"; + my $debug = $ENV{DEBUG} || 0; my $community = 'public'; @@ -150,5 +153,9 @@ foreach my $host ( $resp->hosts ) { print "$host = ",dump($status); save_json $host => $status; $collected->{$host} = $status; + + print $log encode_json($status),"\n"; } +close($log); +warn "# log $log_path ", -s $log_path, " bytes\n";