mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
+ use bytes for http size
This commit is contained in:
parent
22163bb6c2
commit
f2c9a1d03e
@ -128,18 +128,22 @@ sub run {
|
|||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
min => 0);
|
min => 0);
|
||||||
# Size check
|
# Size check
|
||||||
my $content_size = length($webcontent);
|
{
|
||||||
|
require bytes;
|
||||||
|
|
||||||
|
my $content_size = bytes::length($webcontent);
|
||||||
$exit = $self->{perfdata}->threshold_check(value => $content_size,
|
$exit = $self->{perfdata}->threshold_check(value => $content_size,
|
||||||
threshold => [ { label => 'critical-size', exit_litteral => 'critical' }, { label => 'warning-size', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical-size', exit_litteral => 'critical' }, { label => 'warning-size', exit_litteral => 'warning' } ]);
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Content size : %s", $content_size));
|
short_msg => sprintf("Content size : %s", $content_size));
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => "size",
|
$self->{output}->perfdata_add(label => "size", unit => 'B',
|
||||||
value => $content_size,
|
value => $content_size,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-size'),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-size'),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-size'),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-size'),
|
||||||
min => 0);
|
min => 0);
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
|
@ -114,18 +114,22 @@ sub run {
|
|||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
min => 0);
|
min => 0);
|
||||||
# Size check
|
# Size check
|
||||||
my $content_size = length($webcontent);
|
{
|
||||||
|
require bytes;
|
||||||
|
|
||||||
|
my $content_size = bytes::length($webcontent);
|
||||||
$exit = $self->{perfdata}->threshold_check(value => $content_size,
|
$exit = $self->{perfdata}->threshold_check(value => $content_size,
|
||||||
threshold => [ { label => 'critical-size', exit_litteral => 'critical' }, { label => 'warning-size', exit_litteral => 'warning' } ]);
|
threshold => [ { label => 'critical-size', exit_litteral => 'critical' }, { label => 'warning-size', exit_litteral => 'warning' } ]);
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Content size : %s", $content_size));
|
short_msg => sprintf("Content size : %s", $content_size));
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => "size",
|
$self->{output}->perfdata_add(label => "size", unit => 'B',
|
||||||
value => $content_size,
|
value => $content_size,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-size'),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-size'),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-size'),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-size'),
|
||||||
min => 0);
|
min => 0);
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user