Skip to content

Commit

Permalink
add -z
Browse files Browse the repository at this point in the history
  • Loading branch information
VVelox committed Jul 20, 2024
1 parent 80bc102 commit b2a4f4a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions snmp/poudriere
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ poudriere - LibreNMS JSON style SNMP extend for monitoring Poudriere
=head1 SYNOPSIS
poudriere [B<-w>] [B<-b>] [B<-o> <cache base>] [B<-a>]x
poudriere [B<-w>] [B<-b>] [B<-o> <cache base>] [B<-a>] [B<-z>]
poudriere --help|-h
Expand Down Expand Up @@ -38,6 +38,11 @@ Write the results out.
Print out the compressed data if GZip+Base64 is smaller.
=head2 -z
Zero the stats from `poudriere status` if it the status for a jail/ports/set
set is not not building.
=head2 -o <cache base>
Where to write the results to. Defaults to '/var/cache/poudriere.json',
Expand Down Expand Up @@ -120,11 +125,13 @@ my $compress;
my $version;
my $help;
my $history;
my $zero_non_build;
GetOptions(
a => \$history,
'o=s' => \$cache_base,
w => \$write,
b => \$compress,
z => \$zero_non_build,
v => \$version,
version => \$version,
h => \$help,
Expand Down Expand Up @@ -291,6 +298,17 @@ if ( $? == 0 ) {
$found->{FETCH}, $found->{REMAIN}, $found->{TIME}, $found->{LOGS}
) = split( / +/, $status_split[$status_split_int], 14 );

if ( $zero_non_build && $found->{STATUS} !~ /build/ ) {
$found->{QUEUE} = 0;
$found->{BUILT} = 0;
$found->{FAIL} = 0;
$found->{SKIP} = 0;
$found->{IGNORE} = 0;
$found->{FETCH} = 0;
$found->{REMAIN} = 0;
$found->{TIME} = 0;
}

if ( $found->{STATUS} ne 'done' ) {
$data->{not_done} = 1;
}
Expand Down Expand Up @@ -345,7 +363,7 @@ if ( $? == 0 ) {
if ( $item eq 'TIME' ) {
$found->{$item} = time_to_seconds( $found->{$item} );
}
if ( $item =~ /^\d+$/ ) {
if ( $found->{$item} =~ /^\d+$/ ) {
$data->{stats}{$item} += $found->{$item};
}
}
Expand Down

0 comments on commit b2a4f4a

Please sign in to comment.