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

added Packages, Vms resmon modules

parent 3abbaa74
No related branches found
No related tags found
No related merge requests found
package Site::Packages;
use strict;
use warnings;
use base 'Resmon::Module';
use Resmon::ExtComm qw(run_command);
=pod
=head1 NAME
Site::Packages - Find updated packages
=head1 SYNOPSIS
Site:Packages {
check_pkgs : updatefile_path => /var/local/csdupdates
}
=head1 DESCRIPTION
This module queries csdupdates to find possible package updates
=head1 CONFIGURATION
=over
=item check_name
The check name is descriptive only in this check. It is not used for anything.
Some checks use the check_name as part of the configuration, such as
free space checks that specify the filesystem to use.
=back
=head1 METRICS
=over
=item total
Shows all available package updates
=item security
Shows available sercurity updates
=back
=cut
sub handler {
my $self = shift;
my $config = $self->{'config'};
my $pkgs_path = $config->{'update_filepath'} || '/var/local/csdupdates';
my $output_total = run_command("grep -Po '(?<=^Total:)\\w*\$' $pkgs_path");
my $output_security = run_command("grep -Po '(?<=^Security:)\\w*\$' $pkgs_path");
my %metrics = (
"total" => $output_total,
"security" => $output_security,
);
return \%metrics;
};
1;
package Site::Vms;
use strict;
use warnings;
use base 'Resmon::Module';
use Resmon::ExtComm qw(run_command);
=pod
=head1 NAME
Core::Vms - Check current KVM VM status
=head1 SYNOPSIS
Site::Vms {
check_vms : virsh_path => /usr/bin/virsh
}
=head1 DESCRIPTION
This module retrieves VM statistics.
=head1 CONFIGURATION
=over
=item check_name
Arbitrary name of the check.
=item virsh_path
Optional path to the virsh executable.
=back
=head1 METRICS
=over
=item active
=item inactive
=back
=cut
sub handler {
my $self = shift;
my $config = $self->{'config'};
my $virsh_path = $config->{'virsh_path'} || 'virsh';
my $output_active = run_command("$virsh_path list --name");
my $output_inactive = run_command("$virsh_path list --name --inactive");
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