fix some indents
This commit is contained in:
parent
58a70c0c2c
commit
4eb7912fff
|
@ -80,7 +80,7 @@ sub manage_selection {
|
|||
next;
|
||||
}
|
||||
|
||||
if ($$row[3] == 0) {
|
||||
if ($$row[3] == 0) {
|
||||
$self->{output}->output_add(severity => 'CRITICAL',
|
||||
short_msg => sprintf("%s is not running", $$row[1]));
|
||||
next;
|
||||
|
|
|
@ -25,17 +25,17 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'temperature' => 'apps::hddtemp::remote::mode::temperature',
|
||||
'list-drives' => 'apps::hddtemp::remote::mode::listdrives',
|
||||
);
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'temperature' => 'apps::hddtemp::remote::mode::temperature',
|
||||
'list-drives' => 'apps::hddtemp::remote::mode::listdrives',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -29,12 +29,12 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'sensors' => 'apps::lmsensors::snmp::mode::sensors',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,18 +25,18 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'connections' => 'apps::nginx::serverstatus::mode::connections',
|
||||
'responsetime' => 'apps::nginx::serverstatus::mode::responsetime',
|
||||
'requests' => 'apps::nginx::serverstatus::mode::requests',
|
||||
);
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'connections' => 'apps::nginx::serverstatus::mode::connections',
|
||||
'responsetime' => 'apps::nginx::serverstatus::mode::responsetime',
|
||||
'requests' => 'apps::nginx::serverstatus::mode::requests',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,17 +25,17 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'file-cache' => 'apps::php::apc::web::mode::filecache',
|
||||
'memory' => 'apps::php::apc::web::mode::memory',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,16 +25,16 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'usage' => 'apps::php::fpm::web::mode::usage',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,19 +25,19 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'expected-content' => 'apps::protocols::http::mode::expectedcontent',
|
||||
'json-content' => 'apps::protocols::http::mode::jsoncontent',
|
||||
'response' => 'apps::protocols::http::mode::response',
|
||||
'soap-content' => 'apps::protocols::http::mode::soapcontent',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,17 +25,17 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'offset' => 'apps::protocols::ntp::mode::offset',
|
||||
'response-time' => 'apps::protocols::ntp::mode::responsetime',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,16 +25,16 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'scenario' => 'apps::sahipro::restapi::mode::scenario',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,19 +25,19 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'applications' => 'apps::tomcat::web::mode::applications',
|
||||
'connectors' => 'apps::tomcat::web::mode::connectors',
|
||||
'list-application' => 'apps::tomcat::web::mode::listapplication',
|
||||
'memory' => 'apps::tomcat::web::mode::memory',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -25,16 +25,16 @@ use warnings;
|
|||
use base qw(centreon::plugins::script_simple);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'stats' => 'apps::varnish::local::mode::stats',
|
||||
);
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -30,11 +30,10 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning', default => '' },
|
||||
"critical:s" => { name => 'critical', default => '' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
'warning:s' => { name => 'warning', default => '' },
|
||||
'critical:s' => { name => 'critical', default => '' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -47,28 +46,28 @@ sub check_options {
|
|||
($self->{crit5s}, $self->{crit1m}, $self->{crit5m}) = split /,/, $self->{option_results}->{critical};
|
||||
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warn1s', value => $self->{warn5s})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (1sec) threshold '" . $self->{warn5s} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (1sec) threshold '" . $self->{warn5s} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warn1m', value => $self->{warn1m})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (1min) threshold '" . $self->{warn1m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (1min) threshold '" . $self->{warn1m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warn5m', value => $self->{warn5m})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (5min) threshold '" . $self->{warn5m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning (5min) threshold '" . $self->{warn5m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'crit1s', value => $self->{crit5s})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (1sec) threshold '" . $self->{crit5s} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (1sec) threshold '" . $self->{crit5s} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'crit1m', value => $self->{crit1m})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'crit5m', value => $self->{crit5m})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (5min) threshold '" . $self->{crit5m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical (5min) threshold '" . $self->{crit5m} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,27 +76,27 @@ sub run {
|
|||
$self->{snmp} = $options{snmp};
|
||||
|
||||
my $oid_agentSwitchCpuProcessTotalUtilization1 = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.9.0';
|
||||
my $oid_agentSwitchCpuProcessTotalUtilization2 = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.4.0'; # oid for 6200 series
|
||||
my $oid_agentSwitchCpuProcessTotalUtilization2 = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.4.0'; # oid for 6200 series
|
||||
$self->{result} = $self->{snmp}->get_leef(oids => [ $oid_agentSwitchCpuProcessTotalUtilization1, $oid_agentSwitchCpuProcessTotalUtilization2 ],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $cpu_usage;
|
||||
if ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1} =~ /sec.*(sec|min).*(sec|min)/i)) {
|
||||
$cpu_usage = $self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1};
|
||||
} elsif ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2} =~ /sec.*(sec|min).*(sec|min)/i)) {
|
||||
$cpu_usage = $self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2};
|
||||
} else {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
my $cpu_usage;
|
||||
if ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1} =~ /sec.*(sec|min).*(sec|min)/i)) {
|
||||
$cpu_usage = $self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization1};
|
||||
} elsif ((defined($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2})) && ($self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2} =~ /sec.*(sec|min).*(sec|min)/i)) {
|
||||
$cpu_usage = $self->{result}->{$oid_agentSwitchCpuProcessTotalUtilization2};
|
||||
} else {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => sprintf("Can't get CPU information."));
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
if ($cpu_usage =~ /^.*\(\s*(\S+)%\).*\(\s*(\S+)%\).*\(\s*(\S+)%\)/) {
|
||||
my $cpu5sec = $1;
|
||||
my $cpu1min = $2;
|
||||
my $cpu5min = $3;
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
if ($cpu_usage =~ /^.*\(\s*(\S+)%\).*\(\s*(\S+)%\).*\(\s*(\S+)%\)/) {
|
||||
my $cpu5sec = $1;
|
||||
my $cpu1min = $2;
|
||||
my $cpu5min = $3;
|
||||
|
||||
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu5sec,
|
||||
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu5sec,
|
||||
threshold => [ { label => 'crit5s', 'exit_litteral' => 'critical' }, { label => 'warn5s', exit_litteral => 'warning' } ]);
|
||||
my $exit2 = $self->{perfdata}->threshold_check(value => $cpu1min,
|
||||
threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ]);
|
||||
|
@ -105,11 +104,11 @@ sub run {
|
|||
threshold => [ { label => 'crit5m', 'exit_litteral' => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]);
|
||||
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("CPU Usage: %.2f%% (5sec), %.2f%% (1min), %.2f%% (5min)",
|
||||
$cpu5sec, $cpu1min, $cpu5min));
|
||||
|
||||
$self->{output}->perfdata_add(label => "cpu_5s", unit => '%',
|
||||
$self->{output}->perfdata_add(label => "cpu_5s", unit => '%',
|
||||
value => $cpu5sec,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5s'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5s'),
|
||||
|
@ -124,10 +123,10 @@ sub run {
|
|||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'),
|
||||
min => 0, max => 100);
|
||||
} else {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
} else {
|
||||
$self->{output}->output_add(severity => 'UNKNOWN',
|
||||
short_msg => sprintf("Can't parse CPU usage."));
|
||||
}
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
|
|
|
@ -30,11 +30,10 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
});
|
||||
$options{options}->add_options(arguments => {
|
||||
'warning:s' => { name => 'warning' },
|
||||
'critical:s' => { name => 'critical' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
@ -44,12 +43,12 @@ sub check_options {
|
|||
$self->SUPER::init(%options);
|
||||
|
||||
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,29 +59,29 @@ sub run {
|
|||
my $oid_agentSwitchCpuProcessMemFree = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.1.0'; # in KB
|
||||
my $oid_agentSwitchCpuProcessMemAvailable = '.1.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.2.0'; # in KB
|
||||
|
||||
my $result = $self->{snmp}->get_leef(oids => [$oid_agentSwitchCpuProcessMemFree,
|
||||
$oid_agentSwitchCpuProcessMemAvailable],
|
||||
my $result = $self->{snmp}->get_leef(oids => [$oid_agentSwitchCpuProcessMemFree,
|
||||
$oid_agentSwitchCpuProcessMemAvailable],
|
||||
nothing_quit => 1);
|
||||
|
||||
my $memory_free = $result->{$oid_agentSwitchCpuProcessMemFree} * 1024;
|
||||
my $memory_available = $result->{$oid_agentSwitchCpuProcessMemAvailable} * 1024;
|
||||
my $memory_used = $memory_available - $memory_free;
|
||||
my $prct_used = ($memory_used / $memory_available) * 100;
|
||||
my $prct_free = ($memory_free / $memory_available) * 100;
|
||||
my $memory_free = $result->{$oid_agentSwitchCpuProcessMemFree} * 1024;
|
||||
my $memory_available = $result->{$oid_agentSwitchCpuProcessMemAvailable} * 1024;
|
||||
my $memory_used = $memory_available - $memory_free;
|
||||
my $prct_used = ($memory_used / $memory_available) * 100;
|
||||
my $prct_free = ($memory_free / $memory_available) * 100;
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
|
||||
my ($memory_used_value, $memory_used_unit) = $self->{perfdata}->change_bytes(value => $memory_used);
|
||||
my ($memory_available_value, $memory_available_unit) = $self->{perfdata}->change_bytes(value => $memory_available);
|
||||
my ($memory_free_value, $memory_free_unit) = $self->{perfdata}->change_bytes(value => $memory_free);
|
||||
my ($memory_used_value, $memory_used_unit) = $self->{perfdata}->change_bytes(value => $memory_used);
|
||||
my ($memory_available_value, $memory_available_unit) = $self->{perfdata}->change_bytes(value => $memory_available);
|
||||
my ($memory_free_value, $memory_free_unit) = $self->{perfdata}->change_bytes(value => $memory_free);
|
||||
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Memory used: %s (%.2f%%), Size: %s, Free: %s (%.2f%%)",
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Memory used: %s (%.2f%%), Size: %s, Free: %s (%.2f%%)",
|
||||
$memory_used_value . " " . $memory_used_unit, $prct_used,
|
||||
$memory_available_value . " " . $memory_available_unit,
|
||||
$memory_free_value . " " . $memory_free_unit, $prct_free));
|
||||
|
||||
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
||||
$self->{output}->perfdata_add(label => "used", unit => 'B',
|
||||
value => $memory_used,
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $memory_available, cast_int => 1),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $memory_available, cast_int => 1),
|
||||
|
|
|
@ -63,12 +63,13 @@ sub custom_metric_perfdata {
|
|||
my $extra_label = '';
|
||||
$extra_label = '_' . lc($self->{result_values}->{display}) if (!defined($options{extra_instance}) || $options{extra_instance} != 0);
|
||||
|
||||
$self->{output}->perfdata_add(label => lc($self->{result_values}->{metric}) . "_" . lc($self->{result_values}->{stat}) . $extra_label,
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'B/s' : 'B',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
);
|
||||
$self->{output}->perfdata_add(
|
||||
label => lc($self->{result_values}->{metric}) . "_" . lc($self->{result_values}->{stat}) . $extra_label,
|
||||
unit => defined($self->{instance_mode}->{option_results}->{per_sec}) ? 'B/s' : 'B',
|
||||
value => sprintf("%.2f", defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . lc($self->{result_values}->{metric}) . "-" . lc($self->{result_values}->{stat})),
|
||||
);
|
||||
}
|
||||
|
||||
sub custom_metric_output {
|
||||
|
@ -94,27 +95,29 @@ sub set_counters {
|
|||
|
||||
foreach my $statistic ('minimum', 'maximum', 'average', 'sum') {
|
||||
foreach my $metric ('ReplicationBytes') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric, stat => $statistic },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
my $entry = {
|
||||
label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
closure_custom_calc => $self->can('custom_metric_calc'),
|
||||
closure_custom_calc_extra_options => { metric => $metric, stat => $statistic },
|
||||
closure_custom_output => $self->can('custom_metric_output'),
|
||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
foreach my $metric ('ReplicationLag') {
|
||||
my $entry = { label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
output_template => $metric . ': %.2f s',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', unit => 's', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
my $entry = {
|
||||
label => lc($metric) . '-' . lc($statistic), set => {
|
||||
key_values => [ { name => $metric . '_' . $statistic }, { name => 'display' }, { name => 'stat' }, { name => 'timeframe' } ],
|
||||
output_template => $metric . ': %.2f s',
|
||||
perfdatas => [
|
||||
{ label => lc($metric) . '_' . lc($statistic), value => $metric . '_' . $statistic . '_absolute',
|
||||
template => '%.2f', unit => 's', min => 0, label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||
],
|
||||
}
|
||||
};
|
||||
push @{$self->{maps_counters}->{metric}}, $entry;
|
||||
}
|
||||
}
|
||||
|
@ -126,10 +129,10 @@ sub new {
|
|||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {
|
||||
"name:s@" => { name => 'name' },
|
||||
"node-id:s" => { name => 'node_id' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
'name:s@' => { name => 'name' },
|
||||
'node-id:s' => { name => 'node_id' },
|
||||
'filter-metric:s' => { name => 'filter_metric' },
|
||||
'per-sec' => { name => 'per_sec' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
|
Loading…
Reference in New Issue