commit
f70d5f6703
|
@ -194,6 +194,12 @@ sub request_api {
|
|||
warning_status => '', unknown_status => '', critical_status => '%{http_code} < 200 or %{http_code} >= 300'
|
||||
);
|
||||
|
||||
# Some content may be strangely returned, for example : "[{\"Category\":\"provider\",\"Count\":1}]"
|
||||
if ($content =~ /^"(\[.*\])"$/) {
|
||||
$content = $1;
|
||||
$content =~ s/\\"/"/g;
|
||||
}
|
||||
|
||||
my $decoded;
|
||||
eval {
|
||||
$decoded = JSON::XS->new->utf8->decode($content);
|
||||
|
@ -240,6 +246,20 @@ sub api_system_status {
|
|||
return $status;
|
||||
}
|
||||
|
||||
sub internal_update_checker {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $status = $self->request_api(method => 'GET', url_path =>'/api/UpdateChecker/GetFromParams');
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub api_update_checker {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $status = $self->internal_update_checker();
|
||||
return $status;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -117,6 +117,7 @@ sub manage_selection {
|
|||
|
||||
my $single = $options{custom}->api_single_status();
|
||||
my $system = $options{custom}->api_system_status();
|
||||
my $update = $options{custom}->api_update_checker();
|
||||
|
||||
$self->{service} = {};
|
||||
foreach my $item (keys %$single) {
|
||||
|
@ -134,6 +135,10 @@ sub manage_selection {
|
|||
display => 'HasUnregisteredSystemExtensions',
|
||||
health => $system->{HasUnregisteredSystemExtensions} ? 'false' : 'true',
|
||||
};
|
||||
$self->{service}->{HasUpdatesAvailable} = {
|
||||
display => 'HasUpdatesAvailable',
|
||||
health => scalar(@$update) ? 'false' : 'true',
|
||||
};
|
||||
|
||||
$self->{global} = {
|
||||
calls_active => $system->{CallsActive},
|
||||
|
@ -153,7 +158,7 @@ Check system health
|
|||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Set unknown threshold for status.
|
||||
Can used special variables like: %{health}, %{display}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
|
Loading…
Reference in New Issue