Skip to content
Snippets Groups Projects
Commit 60649387 authored by Steve Ryan's avatar Steve Ryan
Browse files

add module for docker containers

parent 65ed1386
No related branches found
No related tags found
No related merge requests found
package Site::DockerPs;
use strict;
use warnings;
use base 'Resmon::Module';
use Resmon::ExtComm qw(run_command);
=pod
=head1 NAME
Site::DockerPs - Check current docker VM status
=head1 SYNOPSIS
Site::DockerPs {
check_ps : docker_path => /usr/bin/docker
}
=head1 DESCRIPTION
This module retrieves VM statistics.
=head1 CONFIGURATION
=over
=item check_name
Arbitrary name of the check.
=item docker_path
Optional path to the docker executable.
=back
=head1 METRICS
=over
=item active
=item inactive
=back
=cut
sub handler {
my $self = shift;
my $config = $self->{'config'};
my $docker_path = $config->{'docker_path'} || 'docker';
my $output_active = run_command("$docker_path ps");
my $output_inactive = run_command("$docker_path ps --filter 'status=exited'");
my %metrics = (
"active" => $output_active,
"inactive" => $output_inactive,
);
return \%metrics;
};
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment