#336 new "stats" command for netdisco-do

This commit is contained in:
Oliver Gorwits
2017-08-21 21:04:59 +01:00
parent d8f8db938e
commit c34ed61d35
5 changed files with 106 additions and 57 deletions

View File

@@ -124,6 +124,12 @@ unless ($action) {
return ('done', 'Generated monitor data.');
}
use App::Netdisco::Util::Statistics ();
sub stats {
App::Netdisco::Util::Statistics::update_stats();
return ('done', 'Updated statistics.');
}
sub show {
my ($self, $job) = @_;
my ($device, $port, $extra) = map {$job->$_} qw/device port extra/;
@@ -397,6 +403,10 @@ pass an SQL statement in the C<-e> option then it will be executed.
~netdisco/bin/netdisco-do psql -e 'SELECT ip, dns FROM device'
~netdisco/bin/netdisco-do psql -e 'COPY (SELECT ip, dns FROM device) TO STDOUT WITH CSV HEADER'
=head2 stats
Updates Netdisco's statistics on number of devices, nodes, etc, for today.
=head2 location
Set the SNMP location field on the device (specified with C<-d>). Pass the