Skip to content
Snippets Groups Projects
  • Mark Harrison's avatar
    97ff6b23
    Fix error when reading meminfo · 97ff6b23
    Mark Harrison authored
    On some systems, there are lines in /proc/meminfo that don't match the regex.
    Currently these cause resmon to throw an error and give a blank metric. This
    change skips those metrics rather than throwing an error.
    97ff6b23
    History
    Fix error when reading meminfo
    Mark Harrison authored
    On some systems, there are lines in /proc/meminfo that don't match the regex.
    Currently these cause resmon to throw an error and give a blank metric. This
    change skips those metrics rather than throwing an error.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Memstat.pm 4.28 KiB
package Core::Memstat;

use strict;
use warnings;

use base 'Resmon::Module';

use Resmon::ExtComm qw(run_command cache_command);

my $osname = $^O;
my $usekstat = 0;
my $kstat;
if ($osname eq 'solaris') {
    eval "use Sun::Solaris::Kstat";
    unless ($@) {
        $usekstat = 1;
        $kstat = Sun::Solaris::Kstat->new();
    }
}

=pod

=head1 NAME

Core::Memstat - Monitor memory statistics using vmstat

=head1 SYNOPSIS

 Core::Memstat {
     local : noop
 }

 Core::Memstat {
     local : vmstat_path => /usr/sbin/vmstat
 }

=head1 DESCRIPTION

This module returns statistics on active and free memory.  The type and
number of metrics returned depend on the capabilities of each platform's
respective vmstat command.

=head1 CONFIGURATION

=over

=item check_name

The check name is used for descriptive purposes only.  It is not used
for anything functional.

=item vmstat_path

Provide an alternate path to the vmstat command (optional).

=back

=head1 METRICS

The metrics returned by this module vary by OS and method used:

=head2 VMSTAT METRICS

The default/fallback method used is vmstat, which returns the following
metrics:

=over

=item actv_mem