Skip to content

Commit

Permalink
ensure quota will always be present for a total for nextcloud (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
VVelox authored Nov 25, 2024
1 parent 178931b commit 8799581
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions snmp/nextcloud
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ $tojson{encryption_enabled} = 0;
$tojson{calendars} = 0;
$tojson{multimount} = 0;
$tojson{users} = {};
$tojson{quota} = 0;

# current user
my $current_user = $ENV{LOGNAME} || $ENV{USER} || getpwuid($<);
Expand Down Expand Up @@ -246,9 +247,9 @@ foreach my $user (@users) {
'last_seen_string' => $user_info->{last_seen},
'calendars' => 0,
};
$tojson{free} = $user_info->{storage}{free};
$tojson{free} = $user_info->{storage}{free};
$tojson{total} = $user_info->{storage}{total};
$tojson{used} = $tojson{used} + $user_info->{storage}{used};
$tojson{used} = $tojson{used} + $user_info->{storage}{used};
if ( $user_info->{storage}{quota} > 0 ) {
$tojson{quota} = $tojson{quota} + $user_info->{storage}{quota};
}
Expand Down

0 comments on commit 8799581

Please sign in to comment.