mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-08 17:06:05 +02:00
feat(podman-restapi): new plugin for Podman (#5427)
Co-authored-by: omercier <32134301+omercier@users.noreply.github.com> Refs: CTOR-187
This commit is contained in:
parent
3469fc328d
commit
b9986d6478
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"pkg_name": "centreon-plugin-Applications-Podman-Restapi",
|
||||
"pkg_summary": "Centreon Plugin",
|
||||
"plugin_name": "centreon_podman_restapi.pl",
|
||||
"files": [
|
||||
"centreon/plugins/script_custom.pm",
|
||||
"apps/podman/restapi/"
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
322
src/apps/podman/restapi/custom/api.pm
Normal file
322
src/apps/podman/restapi/custom/api.pm
Normal file
@ -0,0 +1,322 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::custom::api;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::http;
|
||||
use centreon::plugins::misc;
|
||||
use JSON::XS;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = {};
|
||||
bless $self, $class;
|
||||
|
||||
if (!defined($options{output})) {
|
||||
print "Class Custom: Need to specify 'output' argument.\n";
|
||||
exit 3;
|
||||
}
|
||||
if (!defined($options{options})) {
|
||||
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
|
||||
$options{output}->option_exit();
|
||||
}
|
||||
|
||||
if (!defined($options{noptions})) {
|
||||
$options{options}->add_options(arguments => {
|
||||
'hostname:s' => { name => 'hostname' },
|
||||
'port:s' => { name => 'port' },
|
||||
'proto:s' => { name => 'proto' },
|
||||
'url-path:s' => { name => 'url_path' },
|
||||
'timeout:s' => { name => 'timeout' }
|
||||
});
|
||||
# curl --cacert /path/to/ca.crt --cert /path/to/podman.crt --key /path/to/podman.key https://localhost:8080/v5.0.0/libpod/info
|
||||
# curl --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock 'http://d/v5.0.0/libpod/pods/stats?namesOrIDs=blog' | jq
|
||||
}
|
||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||
|
||||
$self->{output} = $options{output};
|
||||
$self->{http} = centreon::plugins::http->new(%options, default_backend => 'curl');
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub set_options {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{option_results} = $options{option_results};
|
||||
}
|
||||
|
||||
sub set_defaults {}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? $self->{option_results}->{hostname} : '';
|
||||
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'https';
|
||||
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 443;
|
||||
$self->{url_path} = (defined($self->{option_results}->{url_path})) ? $self->{option_results}->{url_path} : '/v5.0.0/libpod/';
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 30;
|
||||
|
||||
if ($self->{hostname} eq '') {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to specify hostname option.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{http}->set_options(%{$self->{option_results}});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub json_decode {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$options{content} =~ s/\r//mg;
|
||||
my $decoded;
|
||||
eval {
|
||||
$decoded = JSON::XS->new->utf8->decode($options{content});
|
||||
};
|
||||
if ($@) {
|
||||
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
sub build_options_for_httplib {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{option_results}->{hostname} = $self->{hostname};
|
||||
$self->{option_results}->{port} = $self->{port};
|
||||
$self->{option_results}->{proto} = $self->{proto};
|
||||
$self->{option_results}->{timeout} = $self->{timeout};
|
||||
}
|
||||
|
||||
sub settings {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->build_options_for_httplib();
|
||||
$self->{http}->add_header(key => 'Accept', value => 'application/json');
|
||||
$self->{http}->set_options(%{$self->{option_results}});
|
||||
}
|
||||
|
||||
sub request {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $endpoint = $options{full_endpoint};
|
||||
if (!defined($endpoint)) {
|
||||
$endpoint = $self->{url_path} . $options{endpoint};
|
||||
}
|
||||
|
||||
$self->settings();
|
||||
|
||||
my $content = $self->{http}->request(
|
||||
method => $options{method},
|
||||
url_path => $endpoint,
|
||||
get_param => $options{get_param},
|
||||
header => [
|
||||
'Accept: application/json'
|
||||
],
|
||||
warning_status => '',
|
||||
unknown_status => '',
|
||||
critical_status => ''
|
||||
);
|
||||
|
||||
my $decoded = $self->json_decode(content => $content);
|
||||
if (!defined($decoded)) {
|
||||
$self->{output}->add_option_msg(short_msg => 'Error while retrieving data (add --debug option for detailed message)');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
sub system_info {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->request(
|
||||
endpoint => 'info',
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
sub list_containers {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->request(
|
||||
endpoint => 'containers/json',
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
my $containers = {};
|
||||
foreach my $container (@{$results}) {
|
||||
$containers->{$container->{Id}} = {
|
||||
Name => $container->{Names}->[0],
|
||||
PodName => $container->{PodName},
|
||||
State => $container->{State}
|
||||
};
|
||||
}
|
||||
|
||||
return $containers;
|
||||
}
|
||||
|
||||
sub list_pods {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->request(
|
||||
endpoint => 'pods/json',
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
my $pods = {};
|
||||
foreach my $pod (@{$results}) {
|
||||
$pods->{$pod->{Id}} = {
|
||||
Name => $pod->{Name},
|
||||
Status => $pod->{Status}
|
||||
};
|
||||
}
|
||||
|
||||
return $pods;
|
||||
}
|
||||
|
||||
sub get_pod_infos {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $inspect = $self->request(
|
||||
endpoint => 'pods/' . $options{pod_name} . '/json',
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
my $stats = $self->request(
|
||||
endpoint => 'pods/stats?namesOrIDs=' . $options{pod_name},
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
my $pod = {
|
||||
cpu => 0,
|
||||
memory => 0,
|
||||
running_containers => 0,
|
||||
stopped_containers => 0,
|
||||
paused_containers => 0,
|
||||
state => @{$inspect}[0]->{State}
|
||||
};
|
||||
|
||||
foreach my $container (@{$inspect->[0]->{Containers}}) {
|
||||
$pod->{running_containers}++ if ($container->{State} eq 'running');
|
||||
$pod->{stopped_containers}++ if ($container->{State} eq 'exited');
|
||||
$pod->{paused_containers}++ if ($container->{State} eq 'paused');
|
||||
}
|
||||
|
||||
foreach my $container (@{$stats}) {
|
||||
my $cpu = $container->{CPU};
|
||||
if ($cpu =~ /^(\d+\.\d+)%/) {
|
||||
$pod->{cpu} += $1;
|
||||
}
|
||||
my $memory = $container->{MemUsage};
|
||||
if ($memory =~ /^(\d+\.?\d*)([a-zA-Z]+)/) {
|
||||
$memory = centreon::plugins::misc::convert_bytes(value => $1, unit => $2);
|
||||
}
|
||||
$pod->{memory} += $memory;
|
||||
}
|
||||
|
||||
return $pod;
|
||||
}
|
||||
|
||||
sub get_container_infos {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $stats = $self->request(
|
||||
endpoint => 'containers/stats?stream=false&containers=' . $options{container_name},
|
||||
method => 'GET'
|
||||
);
|
||||
|
||||
my $containers = $self->list_containers();
|
||||
my $state;
|
||||
foreach my $container_id (sort keys %{$containers}) {
|
||||
if ($containers->{$container_id}->{Name} eq $options{container_name}) {
|
||||
$state = $containers->{$container_id}->{State};
|
||||
}
|
||||
}
|
||||
|
||||
my $container = {
|
||||
cpu_usage => $stats->{Stats}->[0]->{CPU},
|
||||
memory_usage => $stats->{Stats}->[0]->{MemUsage},
|
||||
io_read => $stats->{Stats}->[0]->{BlockInput},
|
||||
io_write => $stats->{Stats}->[0]->{BlockOutput},
|
||||
network_in => $stats->{Stats}->[0]->{NetInput},
|
||||
network_out => $stats->{Stats}->[0]->{NetOutput},
|
||||
state => $state
|
||||
};
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Podman REST API.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Podman Rest API custom mode.
|
||||
To connect to the API with a socket, you must add the following command:
|
||||
C<--curl-opt="CURLOPT_UNIX_SOCKET_PATH => 'PATH_TO_THE_SOCKET'">
|
||||
If you use a certificate, you must add the following commands:
|
||||
C<--curl-opt="CURLOPT_CAINFO = 'PATH_TO_THE_CA_CERTIFICATE'">
|
||||
C<--curl-opt="CURLOPT_SSLCERT => 'PATH_TO_THE_CERTIFICATE'">
|
||||
C<--curl-opt="CURLOPT_SSLKEY => 'PATH_TO_THE_KEY'">
|
||||
|
||||
=head1 REST API OPTIONS
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Podman Rest API hostname.
|
||||
|
||||
=item B<--port>
|
||||
|
||||
Port used (Default: 443)
|
||||
|
||||
=item B<--proto>
|
||||
|
||||
Specify https if needed (Default: 'https')
|
||||
|
||||
=item B<--url-path>
|
||||
|
||||
Set path to get Podman Rest API information (Default: '/v5.0.0/libpod/')
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Set timeout in seconds (Default: 30)
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<custom>.
|
||||
|
||||
=cut
|
247
src/apps/podman/restapi/mode/containerusage.pm
Normal file
247
src/apps/podman/restapi/mode/containerusage.pm
Normal file
@ -0,0 +1,247 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::mode::containerusage;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'container', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{container} = [
|
||||
{ label => 'cpu-usage',
|
||||
nlabel => 'podman.container.cpu.usage.percent',
|
||||
set => {
|
||||
key_values => [ { name => 'cpu_usage' } ],
|
||||
output_template => 'CPU: %.2f%%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu',
|
||||
value => 'cpu_usage',
|
||||
template => '%.2f',
|
||||
unit => '%',
|
||||
min => 0,
|
||||
max => 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'memory-usage',
|
||||
nlabel => 'podman.container.memory.usage.bytes',
|
||||
set => {
|
||||
key_values => [ { name => 'memory_usage' } ],
|
||||
output_template => 'Memory: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'memory',
|
||||
value => 'memory_usage',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'read-io',
|
||||
nlabel => 'podman.container.io.read',
|
||||
set => {
|
||||
key_values => [ { name => 'io_read' } ],
|
||||
output_template => 'Read : %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'read.io',
|
||||
value => 'io_read',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'write-io',
|
||||
nlabel => 'podman.container.io.write',
|
||||
set => {
|
||||
key_values => [ { name => 'io_write' } ],
|
||||
output_template => 'Write : %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'write.io',
|
||||
value => 'io_write',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'network-in',
|
||||
nlabel => 'podman.container.network.in',
|
||||
set => {
|
||||
key_values => [ { name => 'network_in' } ],
|
||||
output_template => 'Network in: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'network_in',
|
||||
value => 'network_in',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'network-out',
|
||||
nlabel => 'podman.container.network.out',
|
||||
set => {
|
||||
key_values => [ { name => 'network_out' } ],
|
||||
output_template => 'Network out: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'network_out',
|
||||
value => 'network_out',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'state',
|
||||
type => 2,
|
||||
warning_default => '%{state} =~ /Paused/',
|
||||
critical_default => '%{state} =~ /Exited/',
|
||||
set => {
|
||||
key_values => [ { name => 'state' } ],
|
||||
output_template => 'State: %s',
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'container-name:s' => { name => 'container_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (centreon::plugins::misc::is_empty($self->{option_results}->{container_name})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify --container-name option.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $container = $options{custom}->get_container_infos(
|
||||
container_name => $self->{option_results}->{container_name}
|
||||
);
|
||||
|
||||
$self->{container} = $container;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check container usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--container-name>
|
||||
|
||||
Container name.
|
||||
|
||||
=item B<--warning-cpu-usage>
|
||||
|
||||
Threshold warning for CPU usage.
|
||||
|
||||
=item B<--critical-cpu-usage>
|
||||
|
||||
Threshold critical for CPU usage.
|
||||
|
||||
=item B<--warning-memory-usage>
|
||||
|
||||
Threshold warning for memory usage.
|
||||
|
||||
=item B<--critical-memory-usage>
|
||||
|
||||
Threshold critical for memory usage.
|
||||
|
||||
=item B<--warning-read-io>
|
||||
|
||||
Threshold warning for read IO.
|
||||
|
||||
=item B<--critical-read-io>
|
||||
|
||||
Threshold critical for read IO.
|
||||
|
||||
=item B<--warning-write-io>
|
||||
|
||||
Threshold warning for write IO.
|
||||
|
||||
=item B<--critical-write-io>
|
||||
|
||||
Threshold critical for write IO.
|
||||
|
||||
=item B<--warning-network-in>
|
||||
|
||||
Threshold warning for network in.
|
||||
|
||||
=item B<--critical-network-in>
|
||||
|
||||
Threshold critical for network in.
|
||||
|
||||
=item B<--warning-network-out>
|
||||
|
||||
Threshold warning for network out.
|
||||
|
||||
=item B<--critical-network-out>
|
||||
|
||||
Threshold critical for network out.
|
||||
|
||||
=item B<--warning-container-state>
|
||||
|
||||
Define the conditions to match for the state to be WARNING (default: C<'%{state} =~ /Paused/'>).
|
||||
You can use the following variables: C<%{state}>
|
||||
|
||||
=item B<--critical-container-state>
|
||||
|
||||
Define the conditions to match for the state to be CRITICAL (default: C<'%{state} =~ /Exited/'>).
|
||||
You can use the following variables: C<%{state}>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
94
src/apps/podman/restapi/mode/listcontainers.pm
Normal file
94
src/apps/podman/restapi/mode/listcontainers.pm
Normal file
@ -0,0 +1,94 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::mode::listcontainers;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $containers = $options{custom}->list_containers();
|
||||
foreach my $container_id (sort keys %{$containers}) {
|
||||
$self->{output}->output_add(long_msg => '[id = ' . $container_id . "]" .
|
||||
" [name = '" . $containers->{$container_id}->{Name} . "']" .
|
||||
" [pod = '" . $containers->{$container_id}->{PodName} . "']" .
|
||||
" [state = '" . $containers->{$container_id}->{State} . "']"
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'Containers:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => [ 'id', 'name', 'pod', 'state' ]);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $containers = $options{custom}->list_containers();
|
||||
foreach my $container_id (sort keys %{$containers}) {
|
||||
$self->{output}->add_disco_entry(name => $containers->{$container_id}->{Name},
|
||||
pod => $containers->{$container_id}->{PodName},
|
||||
state => $containers->{$container_id}->{State},
|
||||
id => $container_id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List containers.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
92
src/apps/podman/restapi/mode/listpods.pm
Normal file
92
src/apps/podman/restapi/mode/listpods.pm
Normal file
@ -0,0 +1,92 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::mode::listpods;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $pods = $options{custom}->list_pods();
|
||||
foreach my $pod_id (sort keys %{$pods}) {
|
||||
$self->{output}->output_add(long_msg => '[id = ' . $pod_id . "]" .
|
||||
" [name = '" . $pods->{$pod_id}->{Name} . "']" .
|
||||
" [status = '" . $pods->{$pod_id}->{Status} . "']"
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'Pods:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => [ 'id', 'name', 'status' ]);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $pods = $options{custom}->list_pods();
|
||||
foreach my $pod_id (sort keys %{$pods}) {
|
||||
$self->{output}->add_disco_entry(name => $pods->{$pod_id}->{Name},
|
||||
state => $pods->{$pod_id}->{Status},
|
||||
id => $pod_id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List pods.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
224
src/apps/podman/restapi/mode/podstatus.pm
Normal file
224
src/apps/podman/restapi/mode/podstatus.pm
Normal file
@ -0,0 +1,224 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::mode::podstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'pod', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{pod} = [
|
||||
{ label => 'cpu-usage',
|
||||
nlabel => 'podman.pod.cpu.usage.percent',
|
||||
set => {
|
||||
key_values => [ { name => 'cpu' } ],
|
||||
output_template => 'CPU: %.2f%%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu',
|
||||
value => 'cpu',
|
||||
template => '%.2f',
|
||||
unit => '%',
|
||||
min => 0,
|
||||
max => 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'memory-usage',
|
||||
nlabel => 'podman.pod.memory.usage.bytes', set => {
|
||||
key_values => [ { name => 'memory' } ],
|
||||
output_template => 'Memory: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'memory',
|
||||
value => 'memory',
|
||||
template => '%s',
|
||||
unit => 'B',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'running-containers',
|
||||
nlabel => 'podman.pod.containers.running.count',
|
||||
set => {
|
||||
key_values => [ { name => 'containers_running' } ],
|
||||
output_template => 'Running containers: %s',
|
||||
perfdatas => [
|
||||
{ label => 'containers_running',
|
||||
value => 'containers_running',
|
||||
template => '%s',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'stopped-containers',
|
||||
nlabel => 'podman.pod.containers.stopped.count',
|
||||
set => {
|
||||
key_values => [ { name => 'containers_stopped' } ],
|
||||
output_template => 'Stopped containers: %s',
|
||||
perfdatas => [
|
||||
{ label => 'containers_stopped',
|
||||
value => 'containers_stopped',
|
||||
template => '%s',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'paused-containers',
|
||||
nlabel => 'podman.pod.containers.paused.count',
|
||||
set => {
|
||||
key_values => [ { name => 'containers_paused' } ],
|
||||
output_template => 'Paused containers: %s',
|
||||
perfdatas => [
|
||||
{ label => 'containers_paused',
|
||||
value => 'containers_paused',
|
||||
template => '%s',
|
||||
min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'state',
|
||||
type => 2,
|
||||
warning_default => '%{state} =~ /Exited/',
|
||||
critical_default => '%{state} =~ /Degraded/',
|
||||
set => {
|
||||
key_values => [ { name => 'state' } ],
|
||||
output_template => 'State: %s',
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
'pod-name:s' => { name => 'pod_name' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (centreon::plugins::misc::is_empty($self->{option_results}->{pod_name})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify --pod-name option.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $result = $options{custom}->get_pod_infos(
|
||||
pod_name => $self->{option_results}->{pod_name}
|
||||
);
|
||||
|
||||
$self->{pod} = {
|
||||
cpu => $result->{cpu},
|
||||
memory => $result->{memory},
|
||||
containers_running => $result->{running_containers},
|
||||
containers_stopped => $result->{stopped_containers},
|
||||
containers_paused => $result->{paused_containers},
|
||||
state => $result->{state}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check node status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--pod-name>
|
||||
|
||||
Pod name.
|
||||
|
||||
=item B<--warning-cpu-usage>
|
||||
|
||||
Threshold warning for CPU usage.
|
||||
|
||||
=item B<--critical-cpu-usage>
|
||||
|
||||
Threshold critical for CPU usage.
|
||||
|
||||
=item B<--warning-memory-usage>
|
||||
|
||||
Threshold warning for memory usage.
|
||||
|
||||
=item B<--critical-memory-usage>
|
||||
|
||||
Threshold critical for memory usage.
|
||||
|
||||
=item B<--warning-running-containers>
|
||||
|
||||
Threshold warning for running containers.
|
||||
|
||||
=item B<--critical-running-containers>
|
||||
|
||||
Threshold critical for running containers.
|
||||
|
||||
=item B<--warning-stopped-containers>
|
||||
|
||||
Threshold warning for stopped containers.
|
||||
|
||||
=item B<--critical-stopped-containers>
|
||||
|
||||
Threshold critical for stopped containers.
|
||||
|
||||
=item B<--warning-paused-containers>
|
||||
|
||||
Threshold warning for paused containers.
|
||||
|
||||
=item B<--critical-paused-containers>
|
||||
|
||||
Threshold critical for paused containers.
|
||||
|
||||
=item B<--warning-state>
|
||||
|
||||
Define the conditions to match for the state to be WARNING (default: C<'%{state} =~ /Exited/'>).
|
||||
You can use the following variables: C<%{state}>
|
||||
|
||||
=item B<--critical-state>
|
||||
|
||||
Define the conditions to match for the state to be CRITICAL (default: C<'%{state} =~ /Degraded/'>).
|
||||
You can use the following variables: C<%{state}>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
240
src/apps/podman/restapi/mode/systemstatus.pm
Normal file
240
src/apps/podman/restapi/mode/systemstatus.pm
Normal file
@ -0,0 +1,240 @@
|
||||
#
|
||||
# Copyright 2025 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::mode::systemstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'system', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{system} = [
|
||||
{ label => 'cpu-usage',
|
||||
nlabel => 'podman.system.cpu.usage.percent',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'cpu_usage' }
|
||||
],
|
||||
output_template => 'CPU: %.2f%%',
|
||||
perfdatas => [
|
||||
{ label => 'cpu',
|
||||
template => '%.2f',
|
||||
min => 0,
|
||||
max => 100,
|
||||
unit => '%' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'memory-usage',
|
||||
nlabel => 'podman.system.memory.usage.bytes',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'memory_usage' }
|
||||
],
|
||||
output_template => 'Memory: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'memory',
|
||||
template => '%s',
|
||||
min => 0,
|
||||
unit => 'B' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'swap-usage',
|
||||
nlabel => 'podman.system.swap.usage.bytes',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'swap_usage' }
|
||||
],
|
||||
output_template => 'Swap: %s%s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ label => 'swap',
|
||||
template => '%s',
|
||||
min => 0,
|
||||
unit => 'B' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'containers-running',
|
||||
nlabel => 'podman.system.containers.running.count',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'running_containers' },
|
||||
{ name => 'total_containers' }
|
||||
],
|
||||
output_template => 'Running containers: %s',
|
||||
perfdatas => [
|
||||
{ label => 'running_containers',
|
||||
template => '%s',
|
||||
min => 0,
|
||||
max => 'total_containers',
|
||||
unit => '' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'containers-stopped',
|
||||
nlabel => 'podman.system.containers.stopped.count',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'stopped_containers' },
|
||||
{ name => 'total_containers' }
|
||||
],
|
||||
output_template => 'Stopped containers: %s',
|
||||
perfdatas => [
|
||||
{ label => 'stopped_containers',
|
||||
template => '%s',
|
||||
min => 0,
|
||||
max => 'total_containers',
|
||||
unit => '' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'uptime',
|
||||
nlabel => 'podman.system.uptime.seconds',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'uptime' }
|
||||
],
|
||||
output_template => 'Uptime: %s s',
|
||||
perfdatas => [
|
||||
{ label => 'uptime',
|
||||
template => '%s',
|
||||
min => 0,
|
||||
unit => 's' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $options{custom}->system_info();
|
||||
|
||||
my $uptime_string = $results->{host}->{uptime};
|
||||
my $uptime = 0;
|
||||
if ($uptime_string =~ /(\d+)h/) {
|
||||
$uptime += $1 * 3600;
|
||||
}
|
||||
if ($uptime_string =~ /(\d+)m/) {
|
||||
$uptime += $1 * 60;
|
||||
}
|
||||
if ($uptime_string =~ /(\d+)s/) {
|
||||
$uptime += $1;
|
||||
}
|
||||
|
||||
$self->{system} = {
|
||||
cpu_usage => $results->{host}->{cpuUtilization}->{userPercent} + $results->{host}->{cpuUtilization}->{systemPercent},
|
||||
memory_usage => $results->{host}->{memTotal} - $results->{host}->{memFree},
|
||||
swap_usage => $results->{host}->{swapTotal} - $results->{host}->{swapFree},
|
||||
running_containers => $results->{store}->{containerStore}->{running},
|
||||
stopped_containers => $results->{store}->{containerStore}->{stopped},
|
||||
total_containers => $results->{store}->{containerStore}->{number},
|
||||
uptime => $uptime
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check Podman system status.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-cpu-usage>
|
||||
|
||||
Threshold warning in percent for CPU usage.
|
||||
|
||||
=item B<--critical-cpu-usage>
|
||||
|
||||
Threshold critical in percent for CPU usage.
|
||||
|
||||
=item B<--warning-memory-usage>
|
||||
|
||||
Threshold warning in bytes for memory usage.
|
||||
|
||||
=item B<--critical-memory-usage>
|
||||
|
||||
Threshold critical in bytes for memory usage.
|
||||
|
||||
=item B<--warning-swap-usage>
|
||||
|
||||
Threshold warning in bytes for swap usage.
|
||||
|
||||
=item B<--critical-swap-usage>
|
||||
|
||||
Threshold critical in bytes for swap usage.
|
||||
|
||||
=item B<--warning-containers-running>
|
||||
|
||||
Threshold warning for the number of running containers.
|
||||
|
||||
=item B<--critical-containers-running>
|
||||
|
||||
Threshold critical for the number of running containers.
|
||||
|
||||
=item B<--warning-containers-stopped>
|
||||
|
||||
Threshold warning for the number of stopped containers.
|
||||
|
||||
=item B<--critical-containers-stopped>
|
||||
|
||||
Threshold critical for the number of stopped containers.
|
||||
|
||||
=item B<--warning-uptime>
|
||||
|
||||
Threshold warning for uptime in seconds.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Threshold critical for uptime in seconds.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
53
src/apps/podman/restapi/plugin.pm
Normal file
53
src/apps/podman/restapi/plugin.pm
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright 2024 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package apps::podman::restapi::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$self->{modes} = {
|
||||
'container-usage' => 'apps::podman::restapi::mode::containerusage',
|
||||
'list-containers' => 'apps::podman::restapi::mode::listcontainers',
|
||||
'list-pods' => 'apps::podman::restapi::mode::listpods',
|
||||
'pod-status' => 'apps::podman::restapi::mode::podstatus',
|
||||
'system-status' => 'apps::podman::restapi::mode::systemstatus'
|
||||
};
|
||||
|
||||
$self->{custom_modes}->{api} = 'apps::podman::restapi::custom::api';
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Podman and containers through its HTTPS Rest API (https://docs.podman.io/en/latest/_static/api.html).
|
||||
|
||||
=cut
|
62
tests/apps/podman/restapi/containerusage.robot
Normal file
62
tests/apps/podman/restapi/containerusage.robot
Normal file
@ -0,0 +1,62 @@
|
||||
*** Settings ***
|
||||
Documentation Test the Podman container-usage mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}podman.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::podman::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=container-usage
|
||||
... --hostname=${HOSTNAME}
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Container usage ${tc}
|
||||
[Documentation] Check the container usage
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... --container-name=wordpress
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} OK: CPU: 0.11%, Memory: 10.85MB, Read : 435.65MB, Write : 941.43MB, Network in: 1006.00B, Network out: 2.10KB, State: running | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 2 --warning-cpu-usage=0.1 WARNING: CPU: 0.11% | 'podman.container.cpu.usage.percent'=0.11%;0:0.1;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 3 --critical-cpu-usage=0.1 CRITICAL: CPU: 0.11% | 'podman.container.cpu.usage.percent'=0.11%;;0:0.1;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 4 --warning-memory-usage=10000000 WARNING: Memory: 10.85MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;0:10000000;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 5 --critical-memory-usage=10000000 CRITICAL: Memory: 10.85MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;0:10000000;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 6 --warning-read-io=200000000 WARNING: Read : 435.65MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;0:200000000;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 7 --critical-read-io=400000000 CRITICAL: Read : 435.65MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;0:400000000;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 8 --warning-write-io=500000000 WARNING: Write : 941.43MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;0:500000000;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 9 --critical-write-io=750000000 CRITICAL: Write : 941.43MB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;0:750000000;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
|
||||
Container usage ${tc}
|
||||
[Documentation] Check the container usage
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... --container-name=wordpress
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 10 --warning-network-in=500 WARNING: Network in: 1006.00B | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;0:500;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 11 --critical-network-in=1000 CRITICAL: Network in: 1006.00B | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;0:1000;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 12 --warning-network-out=1000 WARNING: Network out: 2.10KB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;0:1000;;0;
|
||||
... 13 --critical-network-out=2000 CRITICAL: Network out: 2.10KB | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;0:2000;0;
|
||||
... 14 --warning-state='\\\%{state} =~ /running/' WARNING: State: running | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
||||
... 15 --critical-state='\\\%{state} =~ /running/' CRITICAL: State: running | 'podman.container.cpu.usage.percent'=0.11%;;;0;100 'podman.container.memory.usage.bytes'=11374592B;;;0; 'podman.container.io.read'=456812354B;;;0; 'podman.container.io.write'=987156423B;;;0; 'podman.container.network.in'=1006B;;;0; 'podman.container.network.out'=2146B;;;0;
|
36
tests/apps/podman/restapi/listcontainers.robot
Normal file
36
tests/apps/podman/restapi/listcontainers.robot
Normal file
@ -0,0 +1,36 @@
|
||||
*** Settings ***
|
||||
Documentation Test the Podman list-containers mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}podman.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::podman::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=list-containers
|
||||
... --hostname=${HOSTNAME}
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
*** Test Cases ***
|
||||
List-Containers ${tc}
|
||||
[Documentation] Check list-containers results
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Regexp ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} ^Containers: (\\\\n\\\\[.*\\\\]){3}\\\\Z
|
||||
... 2 --disco-show \\\\<\\\\?xml version="1.0" encoding="utf-8"\\\\?\\\\>\\\\n\\\\<data\\\\>(\\\\n\\\\s*\\\\<label .*\\\\/\\\\>){3}\\\\n\\\\<\\\\/data\\\\>
|
||||
... 3 --disco-format \\\\<\\\\?xml version="1.0" encoding="utf-8"\\\\?\\\\>\\\\n\\\\<data\\\\>(\\\\n\\\\s*\\\\<element\\\\>.*\\\\<\\\\/element\\\\>){4}\\\\n\\\\<\\\\/data\\\\>
|
36
tests/apps/podman/restapi/listpods.robot
Normal file
36
tests/apps/podman/restapi/listpods.robot
Normal file
@ -0,0 +1,36 @@
|
||||
*** Settings ***
|
||||
Documentation Test the Podman list-pods mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}podman.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::podman::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=list-pods
|
||||
... --hostname=${HOSTNAME}
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
*** Test Cases ***
|
||||
List-Pods ${tc}
|
||||
[Documentation] Check list-pods results
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Regexp ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} ^Pods: (\\\\n\\\\[.*\\\\]){2}\\\\Z
|
||||
... 2 --disco-show \\\\<\\\\?xml version="1.0" encoding="utf-8"\\\\?\\\\>\\\\n\\\\<data\\\\>(\\\\n\\\\s*\\\\<label .*\\\\/\\\\>){2}\\\\n\\\\<\\\\/data\\\\>
|
||||
... 3 --disco-format \\\\<\\\\?xml version="1.0" encoding="utf-8"\\\\?\\\\>\\\\n\\\\<data\\\\>(\\\\n\\\\s*\\\\<element\\\\>.*\\\\<\\\\/element\\\\>){3}\\\\n\\\\<\\\\/data\\\\>
|
257
tests/apps/podman/restapi/podman.json
Normal file
257
tests/apps/podman/restapi/podman.json
Normal file
@ -0,0 +1,257 @@
|
||||
{
|
||||
"uuid": "213bb6ee-47d9-4256-a740-ee7472fb871a",
|
||||
"lastMigration": 32,
|
||||
"name": "Podman",
|
||||
"endpointPrefix": "",
|
||||
"latency": 0,
|
||||
"port": 3000,
|
||||
"hostname": "",
|
||||
"folders": [],
|
||||
"routes": [
|
||||
{
|
||||
"uuid": "f390a04c-57ee-49dc-a35a-62b296e75cdb",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/info",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "b885b4f3-683d-4974-b055-e64505c73b97",
|
||||
"body": "{\n \"host\": {\n \"arch\": \"amd64\",\n \"buildahVersion\": \"1.28.2\",\n \"cgroupManager\": \"systemd\",\n \"cgroupVersion\": \"v2\",\n \"cgroupControllers\": [\n \"cpu\",\n \"memory\",\n \"pids\"\n ],\n \"conmon\": {\n \"package\": \"conmon_2.1.6+ds1-1_amd64\",\n \"path\": \"/usr/bin/conmon\",\n \"version\": \"conmon version 2.1.6, commit: unknown\"\n },\n \"cpus\": 2,\n \"cpuUtilization\": {\n \"userPercent\": 0.11,\n \"systemPercent\": 1.08,\n \"idlePercent\": 98.81\n },\n \"distribution\": {\n \"distribution\": \"debian\",\n \"version\": \"12\",\n \"codename\": \"bookworm\"\n },\n \"eventLogger\": \"journald\",\n \"hostname\": \"deb12\",\n \"idMappings\": {\n \"gidmap\": [\n {\n \"container_id\": 0,\n \"host_id\": 1000,\n \"size\": 1\n },\n {\n \"container_id\": 1,\n \"host_id\": 100000,\n \"size\": 65536\n }\n ],\n \"uidmap\": [\n {\n \"container_id\": 0,\n \"host_id\": 1000,\n \"size\": 1\n },\n {\n \"container_id\": 1,\n \"host_id\": 100000,\n \"size\": 65536\n }\n ]\n },\n \"kernel\": \"6.1.0-15-amd64\",\n \"logDriver\": \"journald\",\n \"memFree\": 82362368,\n \"memTotal\": 2062614528,\n \"networkBackend\": \"netavark\",\n \"ociRuntime\": {\n \"name\": \"crun\",\n \"package\": \"crun_1.8.1-1+deb12u1_amd64\",\n \"path\": \"/usr/bin/crun\",\n \"version\": \"crun version 1.8.1\\ncommit: f8a096be060b22ccd3d5f3ebe44108517fbf6c30\\nrundir: /run/user/1000/crun\\nspec: 1.0.0\\n+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL\"\n },\n \"os\": \"linux\",\n \"remoteSocket\": {\n \"path\": \"unix:/run/user/1000/podman/podman.sock\",\n \"exists\": true\n },\n \"serviceIsRemote\": false,\n \"security\": {\n \"apparmorEnabled\": false,\n \"capabilities\": \"CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT\",\n \"rootless\": true,\n \"seccompEnabled\": true,\n \"seccompProfilePath\": \"/usr/share/containers/seccomp.json\",\n \"selinuxEnabled\": false\n },\n \"slirp4netns\": {\n \"executable\": \"/usr/bin/slirp4netns\",\n \"package\": \"slirp4netns_1.2.0-1_amd64\",\n \"version\": \"slirp4netns version 1.2.0\\ncommit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383\\nlibslirp: 4.7.0\\nSLIRP_CONFIG_VERSION_MAX: 4\\nlibseccomp: 2.5.4\"\n },\n \"swapFree\": 11401342,\n \"swapTotal\": 84237968,\n \"uptime\": \"14h 34m 45.00s (Approximately 0.58 days)\",\n \"linkmode\": \"dynamic\"\n },\n \"store\": {\n \"configFile\": \"/home/vagrant/.config/containers/storage.conf\",\n \"containerStore\": {\n \"number\": 6,\n \"paused\": 1,\n \"running\": 3,\n \"stopped\": 2\n },\n \"graphDriverName\": \"vfs\",\n \"graphOptions\": {},\n \"graphRoot\": \"/home/vagrant/.local/share/containers/storage\",\n \"graphRootAllocated\": 20956397568,\n \"graphRootUsed\": 18267197440,\n \"graphStatus\": {},\n \"imageCopyTmpDir\": \"/var/tmp\",\n \"imageStore\": {\n \"number\": 4\n },\n \"runRoot\": \"/run/user/1000/containers\",\n \"volumePath\": \"/home/vagrant/.local/share/containers/storage/volumes\"\n },\n \"registries\": {},\n \"plugins\": {\n \"volume\": [\n \"local\"\n ],\n \"network\": [\n \"bridge\",\n \"macvlan\"\n ],\n \"log\": [\n \"k8s-file\",\n \"none\",\n \"passthrough\",\n \"journald\"\n ],\n \"authorization\": null\n },\n \"version\": {\n \"APIVersion\": \"4.3.1\",\n \"Version\": \"4.3.1\",\n \"GoVersion\": \"go1.19.8\",\n \"GitCommit\": \"\",\n \"BuiltTime\": \"Thu Jan 1 00:00:00 1970\",\n \"Built\": 0,\n \"OsArch\": \"linux/amd64\",\n \"Os\": \"linux\"\n }\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "9b757a53-25b9-4a95-a43b-8a6ba3be1344",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/containers/json",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "73f68e6e-2cbd-4770-9988-ac132f41ed27",
|
||||
"body": "[\n {\n \"AutoRemove\": false,\n \"Command\": null,\n \"Created\": \"2025-01-28T10:46:54.159993093Z\",\n \"CreatedAt\": \"\",\n \"Exited\": false,\n \"ExitedAt\": 1738080827,\n \"ExitCode\": 0,\n \"Id\": \"89325e86fd779dda83c0189d01a0802351da38d05e4312932b11eef239c9935d\",\n \"Image\": \"localhost/podman-pause:4.3.1-0\",\n \"ImageID\": \"376c7556c90714e22370636dc094d03c860301ee72b4c4d5a1bc1ad91a015293\",\n \"IsInfra\": true,\n \"Labels\": {\n \"io.buildah.version\": \"1.28.2\"\n },\n \"Mounts\": [],\n \"Names\": [\n \"adc8d2ac5d64-infra\"\n ],\n \"Namespaces\": {},\n \"Networks\": [\n \"podman\"\n ],\n \"Pid\": 1326,\n \"Pod\": \"adc8d2ac5d64a38d9073f0c87f5137891a039c91ed8b7335c051528a0643046c\",\n \"PodName\": \"blog\",\n \"Ports\": [\n {\n \"host_ip\": \"\",\n \"container_port\": 80,\n \"host_port\": 8080,\n \"range\": 1,\n \"protocol\": \"tcp\"\n }\n ],\n \"Size\": null,\n \"StartedAt\": 1738241694,\n \"State\": \"running\",\n \"Status\": \"\"\n },\n {\n \"AutoRemove\": false,\n \"Command\": [\n \"apache2-foreground\"\n ],\n \"Created\": \"2025-01-28T10:47:41.119207776Z\",\n \"CreatedAt\": \"\",\n \"Exited\": false,\n \"ExitedAt\": 1738080828,\n \"ExitCode\": 0,\n \"Id\": \"ad7efe36dbceffde5dabeec4205501b599118bb427fc2305903ab42cf6fbe7a8\",\n \"Image\": \"docker.io/library/wordpress:latest\",\n \"ImageID\": \"c012b71a41fc3c0c778ba2d120c275cc75f5181852be1bff3402eb21d5a758de\",\n \"IsInfra\": false,\n \"Labels\": null,\n \"Mounts\": [\n \"/var/www/html\"\n ],\n \"Names\": [\n \"wordpress\"\n ],\n \"Namespaces\": {},\n \"Networks\": [],\n \"Pid\": 1331,\n \"Pod\": \"adc8d2ac5d64a38d9073f0c87f5137891a039c91ed8b7335c051528a0643046c\",\n \"PodName\": \"blog\",\n \"Ports\": [\n {\n \"host_ip\": \"\",\n \"container_port\": 80,\n \"host_port\": 8080,\n \"range\": 1,\n \"protocol\": \"tcp\"\n }\n ],\n \"Size\": null,\n \"StartedAt\": 1738241695,\n \"State\": \"running\",\n \"Status\": \"\"\n },\n {\n \"AutoRemove\": false,\n \"Command\": [\n \"httpd-foreground\"\n ],\n \"Created\": \"2025-01-28T10:48:15.222853918Z\",\n \"CreatedAt\": \"\",\n \"Exited\": false,\n \"ExitedAt\": 1738080827,\n \"ExitCode\": 0,\n \"Id\": \"480587ac39c4d852ec5cf8899d9a44788d32422f728679a7fa198723c23e3c35\",\n \"Image\": \"docker.io/library/httpd:latest\",\n \"ImageID\": \"f7d8bafbd9a9fc570c19628411a8441e8dc6697aa43c0c0cd863544f44fc4fb1\",\n \"IsInfra\": false,\n \"Labels\": null,\n \"Mounts\": [\n \"/usr/local/apache2/htdocs\"\n ],\n \"Names\": [\n \"httpd\"\n ],\n \"Namespaces\": {},\n \"Networks\": [],\n \"Pid\": 1443,\n \"Pod\": \"\",\n \"PodName\": \"\",\n \"Ports\": [\n {\n \"host_ip\": \"\",\n \"container_port\": 80,\n \"host_port\": 8081,\n \"range\": 1,\n \"protocol\": \"tcp\"\n }\n ],\n \"Size\": null,\n \"StartedAt\": 1738241724,\n \"State\": \"running\",\n \"Status\": \"\"\n }\n]",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "f8ac568a-c7e9-4116-9a2c-9de982ca9950",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/pods/json",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "08d5f43b-3ae6-43d5-9996-5d7356a6da67",
|
||||
"body": "[\n {\n \"Cgroup\": \"user.slice\",\n \"Containers\": [\n {\n \"Id\": \"89325e86fd779dda83c0189d01a0802351da38d05e4312932b11eef239c9935d\",\n \"Names\": \"adc8d2ac5d64-infra\",\n \"Status\": \"running\"\n },\n {\n \"Id\": \"ad7efe36dbceffde5dabeec4205501b599118bb427fc2305903ab42cf6fbe7a8\",\n \"Names\": \"wordpress\",\n \"Status\": \"running\"\n },\n {\n \"Id\": \"fb20d214ce01fadfe16ef1a90781bfb494e4a1811e796c26f976782990352b28\",\n \"Names\": \"mysql\",\n \"Status\": \"exited\"\n }\n ],\n \"Created\": \"2025-01-28T10:46:54.146102881Z\",\n \"Id\": \"adc8d2ac5d64a38d9073f0c87f5137891a039c91ed8b7335c051528a0643046c\",\n \"InfraId\": \"89325e86fd779dda83c0189d01a0802351da38d05e4312932b11eef239c9935d\",\n \"Name\": \"blog\",\n \"Namespace\": \"\",\n \"Networks\": [\n \"podman\"\n ],\n \"Status\": \"Degraded\",\n \"Labels\": {}\n },\n {\n \"Cgroup\": \"user.slice\",\n \"Containers\": [\n {\n \"Id\": \"89325e86fd779dda83c0189d01a0802351da38d05e4312932b11eef239c9935d\",\n \"Names\": \"adc8d2ac5d64-infra2\",\n \"Status\": \"running\"\n },\n {\n \"Id\": \"ad7efe36dbceffde5dabeec4205501b599118bb427fc2305903ab42cf6fbe7a8\",\n \"Names\": \"wordpress2\",\n \"Status\": \"running\"\n },\n {\n \"Id\": \"fb20d214ce01fadfe16ef1a90781bfb494e4a1811e796c26f976782990352b28\",\n \"Names\": \"mysql2\",\n \"Status\": \"exited\"\n }\n ],\n \"Created\": \"2025-01-28T10:46:54.146102881Z\",\n \"Id\": \"adc8d2ac5d64a38d9073f0c87f5137891a039c91ed8b7335c051528a0643046d\",\n \"InfraId\": \"89325e86fd779dda83c0189d01a0802351da38d05e4312932b11eef239c9935d\",\n \"Name\": \"blog2\",\n \"Namespace\": \"\",\n \"Networks\": [\n \"podman\"\n ],\n \"Status\": \"Degraded\",\n \"Labels\": {}\n }\n]",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "29a8645f-5b09-44e3-a9af-130eb8674342",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/pods/stats",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "f6d96ff7-cc6e-468e-b284-cd3646d6bde9",
|
||||
"body": "[\n {\n \"CPU\": \"0.00%\",\n \"MemUsage\": \"49.15kB / 2.052GB\",\n \"MemUsageBytes\": \"48KiB / 1.911GiB\",\n \"Mem\": \"0.00%\",\n \"NetIO\": \"4.718kB / 1.188kB\",\n \"BlockIO\": \"-- / --\",\n \"PIDS\": \"1\",\n \"Pod\": \"5de0484a9d3b\",\n \"CID\": \"465c966f5696\",\n \"Name\": \"5de0484a9d3b-infra\"\n },\n {\n \"CPU\": \"1.43%\",\n \"MemUsage\": \"450MB / 2.052GB\",\n \"MemUsageBytes\": \"429.1MiB / 1.911GiB\",\n \"Mem\": \"21.93%\",\n \"NetIO\": \"4.718kB / 1.188kB\",\n \"BlockIO\": \"0B / 123.9kB\",\n \"PIDS\": \"35\",\n \"Pod\": \"5de0484a9d3b\",\n \"CID\": \"b9434955e2b8\",\n \"Name\": \"mysql\"\n },\n {\n \"CPU\": \"0.03%\",\n \"MemUsage\": \"9.363MB / 2.052GB\",\n \"MemUsageBytes\": \"8.93MiB / 1.911GiB\",\n \"Mem\": \"0.46%\",\n \"NetIO\": \"4.718kB / 1.188kB\",\n \"BlockIO\": \"3.047MB / 82.37MB\",\n \"PIDS\": \"6\",\n \"Pod\": \"5de0484a9d3b\",\n \"CID\": \"bde2cd1fa1af\",\n \"Name\": \"wordpress\"\n }\n]",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "842a425b-7697-4c8d-8caf-1cd394c7fecc",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/pods/:podName/json",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "3b686944-9296-46ea-bfee-9ccdd90683f9",
|
||||
"body": "[\n {\n \"Id\": \"5de0484a9d3bd4d2f0626292c6734fcf7de9059f6a6802298ed80c3c46b7207a\",\n \"Name\": \"{{urlParam 'podName'}}\",\n \"Created\": \"2025-02-04T09:21:22.076484809+01:00\",\n \"CreateCommand\": [\n \"podman\",\n \"pod\",\n \"create\",\n \"--name\",\n \"blog\",\n \"--infra\",\n \"--publish\",\n \"8080:80\",\n \"--network\",\n \"bridge\"\n ],\n \"ExitPolicy\": \"continue\",\n \"State\": {{#if (eq (urlParam 'podName') 'blog')}}\"Running\"{{else}}\"Degraded\"{{/if}},\n \"Hostname\": \"\",\n \"CreateCgroup\": true,\n \"CgroupParent\": \"user.slice\",\n \"CgroupPath\": \"user.slice/user-501.slice/user@501.service/user.slice/user-libpod_pod_5de0484a9d3bd4d2f0626292c6734fcf7de9059f6a6802298ed80c3c46b7207a.slice\",\n \"CreateInfra\": true,\n \"InfraContainerID\": \"465c966f56967d1e2cee42b8af6271375483875d1547e8a41238c5dbca9d91c4\",\n \"InfraConfig\": {\n \"PortBindings\": {\n \"80/tcp\": [\n {\n \"HostIp\": \"0.0.0.0\",\n \"HostPort\": \"8080\"\n }\n ]\n },\n \"HostNetwork\": false,\n \"StaticIP\": \"\",\n \"StaticMAC\": \"\",\n \"NoManageResolvConf\": false,\n \"DNSServer\": null,\n \"DNSSearch\": null,\n \"DNSOption\": null,\n \"NoManageHosts\": false,\n \"HostAdd\": null,\n \"Networks\": [\n \"podman\"\n ],\n \"NetworkOptions\": null,\n \"pid_ns\": \"private\",\n \"userns\": \"host\",\n \"uts_ns\": \"private\"\n },\n \"SharedNamespaces\": [\n \"uts\",\n \"ipc\",\n \"net\"\n ],\n \"NumContainers\": 3,\n \"Containers\": [\n {\n \"Id\": \"465c966f56967d1e2cee42b8af6271375483875d1547e8a41238c5dbca9d91c4\",\n \"Name\": \"5de0484a9d3b-infra\",\n \"State\": \"running\"\n },\n {\n \"Id\": \"b9434955e2b87c64e1d3b1ffb85768a9639486593765120c286cfebb2b04c830\",\n \"Name\": \"mysql\",\n \"State\": \"running\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a053\",\n \"Name\": \"wordpress\",\n \"State\": \"running\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a054\",\n \"Name\": \"run\",\n \"State\": \"running\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a053\",\n \"Name\": \"wordpress\",\n \"State\": \"running\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a063\",\n \"Name\": \"exit1\",\n \"State\": \"exited\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a064\",\n \"Name\": \"exit2\",\n \"State\": \"exited\"\n },\n {\n \"Id\": \"bde2cd1fa1aff866cf5edd03d84677ed86792c9f1898861567ce4b1a1ca0a073\",\n \"Name\": \"paused\",\n \"State\": \"paused\"\n }\n ],\n \"LockNumber\": 0\n }\n]",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
},
|
||||
{
|
||||
"uuid": "2f0c354c-a680-43a3-a970-e3621adba882",
|
||||
"type": "http",
|
||||
"documentation": "",
|
||||
"method": "get",
|
||||
"endpoint": "v5.0.0/libpod/containers/stats",
|
||||
"responses": [
|
||||
{
|
||||
"uuid": "54839cdf-a8d4-4c21-b034-a9938ff776c7",
|
||||
"body": "{\n \"Error\": null,\n \"Stats\": [\n {\n \"AvgCPU\": 0.10607938362643086,\n \"ContainerID\": \"76337a902ae6dbb440fb859574308d722046a9ced85d8bd012f203d28113b9b4\",\n \"Name\": \"wordpress\",\n \"PerCPU\": null,\n \"CPU\": 0.10607938362643086,\n \"CPUNano\": 859483000,\n \"CPUSystemNano\": 734368,\n \"SystemNano\": 1738829137318320000,\n \"MemUsage\": 11374592,\n \"MemLimit\": 2062614528,\n \"MemPerc\": 0.5514647475614018,\n \"NetInput\": 1006,\n \"NetOutput\": 2146,\n \"BlockInput\": 456812354,\n \"BlockOutput\": 987156423,\n \"PIDs\": 6,\n \"UpTime\": 859483000,\n \"Duration\": 859483000\n }\n ]\n}",
|
||||
"latency": 0,
|
||||
"statusCode": 200,
|
||||
"label": "",
|
||||
"headers": [],
|
||||
"bodyType": "INLINE",
|
||||
"filePath": "",
|
||||
"databucketID": "",
|
||||
"sendFileAsBody": false,
|
||||
"rules": [],
|
||||
"rulesOperator": "OR",
|
||||
"disableTemplating": false,
|
||||
"fallbackTo404": false,
|
||||
"default": true,
|
||||
"crudKey": "id",
|
||||
"callbacks": []
|
||||
}
|
||||
],
|
||||
"responseMode": null
|
||||
}
|
||||
],
|
||||
"rootChildren": [
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "f390a04c-57ee-49dc-a35a-62b296e75cdb"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "9b757a53-25b9-4a95-a43b-8a6ba3be1344"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "f8ac568a-c7e9-4116-9a2c-9de982ca9950"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "29a8645f-5b09-44e3-a9af-130eb8674342"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "842a425b-7697-4c8d-8caf-1cd394c7fecc"
|
||||
},
|
||||
{
|
||||
"type": "route",
|
||||
"uuid": "2f0c354c-a680-43a3-a970-e3621adba882"
|
||||
}
|
||||
],
|
||||
"proxyMode": false,
|
||||
"proxyHost": "",
|
||||
"proxyRemovePrefix": false,
|
||||
"tlsOptions": {
|
||||
"enabled": false,
|
||||
"type": "CERT",
|
||||
"pfxPath": "",
|
||||
"certPath": "",
|
||||
"keyPath": "",
|
||||
"caPath": "",
|
||||
"passphrase": ""
|
||||
},
|
||||
"cors": true,
|
||||
"headers": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"key": "Access-Control-Allow-Origin",
|
||||
"value": "*"
|
||||
},
|
||||
{
|
||||
"key": "Access-Control-Allow-Methods",
|
||||
"value": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS"
|
||||
},
|
||||
{
|
||||
"key": "Access-Control-Allow-Headers",
|
||||
"value": "Content-Type, Origin, Accept, Authorization, Content-Length, X-Requested-With"
|
||||
}
|
||||
],
|
||||
"proxyReqHeaders": [
|
||||
{
|
||||
"key": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"proxyResHeaders": [
|
||||
{
|
||||
"key": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"data": [],
|
||||
"callbacks": []
|
||||
}
|
60
tests/apps/podman/restapi/podstatus.robot
Normal file
60
tests/apps/podman/restapi/podstatus.robot
Normal file
@ -0,0 +1,60 @@
|
||||
*** Settings ***
|
||||
Documentation Test the Podman pod-status mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}podman.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::podman::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=pod-status
|
||||
... --hostname=${HOSTNAME}
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
Pod status ${tc}
|
||||
[Documentation] Check the pod status
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... --pod-name=blog
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} OK: CPU: 1.46%, Memory: 459.41MB, Running containers: 5, Stopped containers: 2, Paused containers: 1, State: Running | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 2 --warning-cpu-usage=1 WARNING: CPU: 1.46% | 'podman.pod.cpu.usage.percent'=1.46%;0:1;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 3 --critical-cpu-usage=1 CRITICAL: CPU: 1.46% | 'podman.pod.cpu.usage.percent'=1.46%;;0:1;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 4 --warning-memory-usage=250000000 WARNING: Memory: 459.41MB | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;0:250000000;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 5 --critical-memory-usage=400000000 CRITICAL: Memory: 459.41MB | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;0:400000000;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 6 --warning-running-containers=3 WARNING: Running containers: 5 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;0:3;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 7 --critical-running-containers=3 CRITICAL: Running containers: 5 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;0:3;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 8 --warning-stopped-containers=0 WARNING: Stopped containers: 2 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;0:0;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 9 --critical-stopped-containers=1 CRITICAL: Stopped containers: 2 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;0:1;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 10 --warning-paused-containers=0 WARNING: Paused containers: 1 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;0:0;;0;
|
||||
... 11 --critical-paused-containers=0 CRITICAL: Paused containers: 1 | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;0:0;0;
|
||||
|
||||
Pod status ${tc}
|
||||
[Documentation] Check the pod status
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... --pod-name=degreded
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 12 --warning-state='\\\%{state} =~ /Degraded/' --critical-state='\\\%{state} =~ /Exited/' WARNING: State: Degraded | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
||||
... 13 --warning-state='\\\%{state} =~ /Exited/' --critical-state='\\\%{state} =~ /Degraded/' CRITICAL: State: Degraded | 'podman.pod.cpu.usage.percent'=1.46%;;;0;100 'podman.pod.memory.usage.bytes'=481727346.688B;;;0; 'podman.pod.containers.running.count'=5;;;0; 'podman.pod.containers.stopped.count'=2;;;0; 'podman.pod.containers.paused.count'=1;;;0;
|
46
tests/apps/podman/restapi/systemstatus.robot
Normal file
46
tests/apps/podman/restapi/systemstatus.robot
Normal file
@ -0,0 +1,46 @@
|
||||
*** Settings ***
|
||||
Documentation Test the Podman system-status mode
|
||||
|
||||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
|
||||
|
||||
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||
Suite Teardown Stop Mockoon
|
||||
Test Timeout 120s
|
||||
|
||||
*** Variables ***
|
||||
${MOCKOON_JSON} ${CURDIR}${/}podman.json
|
||||
|
||||
${cmd} ${CENTREON_PLUGINS}
|
||||
... --plugin=apps::podman::restapi::plugin
|
||||
... --custommode=api
|
||||
... --mode=system-status
|
||||
... --hostname=${HOSTNAME}
|
||||
... --port=${APIPORT}
|
||||
... --proto=http
|
||||
|
||||
|
||||
*** Test Cases ***
|
||||
System status ${tc}
|
||||
[Documentation] Check the system status
|
||||
[Tags] apps podman restapi
|
||||
|
||||
${command} Catenate
|
||||
... ${cmd}
|
||||
... ${extraoptions}
|
||||
|
||||
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||
|
||||
Examples: tc extraoptions expected_result --
|
||||
... 1 ${EMPTY} OK: CPU: 1.19%, Memory: 1.84GB, Swap: 69.46MB, Running containers: 3, Stopped containers: 2, Uptime: 52440 s | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 2 --warning-cpu-usage=0.5 WARNING: CPU: 1.19% | 'podman.system.cpu.usage.percent'=1.19%;0:0.5;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 3 --critical-cpu-usage=1 CRITICAL: CPU: 1.19% | 'podman.system.cpu.usage.percent'=1.19%;;0:1;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 4 --warning-memory-usage=1000000000 WARNING: Memory: 1.84GB | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;0:1000000000;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 5 --critical-memory-usage=1500000000 CRITICAL: Memory: 1.84GB | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;0:1500000000;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 6 --warning-swap-usage=25000000 WARNING: Swap: 69.46MB | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;0:25000000;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 7 --critical-swap-usage=50000000 CRITICAL: Swap: 69.46MB | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;0:50000000;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 8 --warning-containers-running=@2:4 WARNING: Running containers: 3 | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;@2:4;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 9 --critical-containers-running=@0:4 CRITICAL: Running containers: 3 | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;@0:4;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 10 --warning-containers-stopped=@1:2 WARNING: Stopped containers: 2 | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;@1:2;;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 11 --critical-containers-stopped=@2:6 CRITICAL: Stopped containers: 2 | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;@2:6;0;6 'podman.system.uptime.seconds'=52440s;;;0;
|
||||
... 12 --warning-uptime=@:60000 WARNING: Uptime: 52440 s | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;@0:60000;;0;
|
||||
... 13 --critical-uptime=@:120000 CRITICAL: Uptime: 52440 s | 'podman.system.cpu.usage.percent'=1.19%;;;0;100 'podman.system.memory.usage.bytes'=1980252160B;;;0; 'podman.system.swap.usage.bytes'=72836626B;;;0; 'podman.system.containers.running.count'=3;;;0;6 'podman.system.containers.stopped.count'=2;;;0;6 'podman.system.uptime.seconds'=52440s;;@0:120000;0;
|
@ -199,6 +199,7 @@ partiallyActive
|
||||
perfdata
|
||||
physicaldrive
|
||||
PKCS1
|
||||
Podman
|
||||
powershell
|
||||
powershell.exe
|
||||
PPID
|
||||
|
Loading…
x
Reference in New Issue
Block a user