mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-30 09:05:19 +02:00
fix(office365): out of range error (#3088)
This commit is contained in:
parent
a6f087fdea
commit
2cd0d87f5e
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_users',
|
label => 'active_users',
|
||||||
|
@ -36,8 +36,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_mailboxes', nlabel => 'exchange.mailboxes.active.count',
|
label => 'active_mailboxes', nlabel => 'exchange.mailboxes.active.count',
|
||||||
|
@ -80,19 +80,20 @@ sub set_counters {
|
|||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
closure_custom_threshold_check => \&catalog_status_threshold
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{features} = [
|
$self->{maps_counters}->{features} = [
|
||||||
{ label => 'status', set => {
|
{ label => 'status', set => {
|
||||||
key_values => [ { name => 'status' }, { name => 'service_name' }, { name => 'feature_name' } ],
|
key_values => [ { name => 'status' }, { name => 'service_name' }, { name => 'feature_name' } ],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
closure_custom_output => $self->can('custom_status_output'),
|
closure_custom_output => $self->can('custom_status_output'),
|
||||||
closure_custom_perfdata => sub { return 0; },
|
closure_custom_perfdata => sub { return 0; },
|
||||||
closure_custom_threshold_check => \&catalog_status_threshold,
|
closure_custom_threshold_check => \&catalog_status_threshold
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_sites', nlabel => 'onedrive.sites.active.count',
|
label => 'active_sites', nlabel => 'onedrive.sites.active.count',
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_users',
|
label => 'active_users',
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_sites', nlabel => 'sharepoint.sites.active.count',
|
label => 'active_sites', nlabel => 'sharepoint.sites.active.count',
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_users', nlabel => 'sharepoint.users.active.count',
|
label => 'active_users', nlabel => 'sharepoint.users.active.count',
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_devices',
|
label => 'active_devices',
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_users',
|
label => 'active_users',
|
||||||
|
@ -35,14 +35,17 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(label => 'active_devices', nlabel => 'teams.devices.active.count',
|
$self->{output}->perfdata_add(
|
||||||
value => $self->{result_values}->{active},
|
label => 'active_devices', nlabel => 'teams.devices.active.count',
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options),
|
value => $self->{result_values}->{active},
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}, %total_options),
|
||||||
unit => 'devices', min => 0, max => $self->{result_values}->{total});
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}, %total_options),
|
||||||
|
unit => 'devices', min => 0, max => $self->{result_values}->{total}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_active_threshold {
|
sub custom_active_threshold {
|
||||||
@ -52,21 +55,26 @@ sub custom_active_threshold {
|
|||||||
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
if ($self->{instance_mode}->{option_results}->{units} eq '%') {
|
||||||
$threshold_value = $self->{result_values}->{prct_active};
|
$threshold_value = $self->{result_values}->{prct_active};
|
||||||
}
|
}
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $threshold_value,
|
my $exit = $self->{perfdata}->threshold_check(
|
||||||
threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' },
|
value => $threshold_value,
|
||||||
{ label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
|
threshold => [
|
||||||
|
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||||
|
{ label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' }
|
||||||
|
]
|
||||||
|
);
|
||||||
return $exit;
|
return $exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub custom_active_output {
|
sub custom_active_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $msg = sprintf("Active devices on %s : %d/%d (%.2f%%)",
|
my $msg = sprintf(
|
||||||
$self->{result_values}->{report_date},
|
"Active devices on %s : %d/%d (%.2f%%)",
|
||||||
$self->{result_values}->{active},
|
$self->{result_values}->{report_date},
|
||||||
$self->{result_values}->{total},
|
$self->{result_values}->{active},
|
||||||
$self->{result_values}->{prct_active});
|
$self->{result_values}->{total},
|
||||||
|
$self->{result_values}->{prct_active}
|
||||||
|
);
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,63 +111,58 @@ sub set_counters {
|
|||||||
closure_custom_threshold_check => $self->can('custom_active_threshold'),
|
closure_custom_threshold_check => $self->can('custom_active_threshold'),
|
||||||
closure_custom_perfdata => $self->can('custom_active_perfdata')
|
closure_custom_perfdata => $self->can('custom_active_perfdata')
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{global} = [
|
$self->{maps_counters}->{global} = [
|
||||||
{ label => 'windows', nlabel => 'teams.devices.windows.count', set => {
|
{ label => 'windows', nlabel => 'teams.devices.windows.count', set => {
|
||||||
key_values => [ { name => 'windows' } ],
|
key_values => [ { name => 'windows' } ],
|
||||||
output_template => 'Windows: %d',
|
output_template => 'Windows: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'windows', value => 'windows', template => '%d',
|
{ label => 'windows', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'mac', nlabel => 'teams.devices.mac.count', set => {
|
{ label => 'mac', nlabel => 'teams.devices.mac.count', set => {
|
||||||
key_values => [ { name => 'mac' } ],
|
key_values => [ { name => 'mac' } ],
|
||||||
output_template => 'Mac: %d',
|
output_template => 'Mac: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'mac', value => 'mac', template => '%d',
|
{ label => 'mac', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'web', nlabel => 'teams.devices.web.count', set => {
|
{ label => 'web', nlabel => 'teams.devices.web.count', set => {
|
||||||
key_values => [ { name => 'web' } ],
|
key_values => [ { name => 'web' } ],
|
||||||
output_template => 'Web: %d',
|
output_template => 'Web: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'web', value => 'web', template => '%d',
|
{ label => 'web', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'ios', nlabel => 'teams.devices.ios.count', set => {
|
{ label => 'ios', nlabel => 'teams.devices.ios.count', set => {
|
||||||
key_values => [ { name => 'ios' } ],
|
key_values => [ { name => 'ios' } ],
|
||||||
output_template => 'iOS: %d',
|
output_template => 'iOS: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'ios', value => 'ios', template => '%d',
|
{ label => 'ios', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'android-phone', nlabel => 'teams.devices.android.count', set => {
|
{ label => 'android-phone', nlabel => 'teams.devices.android.count', set => {
|
||||||
key_values => [ { name => 'android_phone' } ],
|
key_values => [ { name => 'android_phone' } ],
|
||||||
output_template => 'Android Phone: %d',
|
output_template => 'Android Phone: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'android_phone', value => 'android_phone', template => '%d',
|
{ label => 'android_phone', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'windows-phone', nlabel => 'teams.devices.windowsphone.count', set => {
|
{ label => 'windows-phone', nlabel => 'teams.devices.windowsphone.count', set => {
|
||||||
key_values => [ { name => 'windows_phone' } ],
|
key_values => [ { name => 'windows_phone' } ],
|
||||||
output_template => 'Windows Phone: %d',
|
output_template => 'Windows Phone: %d',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'windows_phone', value => 'windows_phone', template => '%d',
|
{ label => 'windows_phone', template => '%d', min => 0 }
|
||||||
min => 0 },
|
]
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ sub custom_active_perfdata {
|
|||||||
$total_options{cast_int} = 1;
|
$total_options{cast_int} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;
|
if ($self->{result_values}->{report_date} =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/) {
|
||||||
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
$self->{output}->perfdata_add(label => 'perfdate', value => timelocal(0,0,12,$3,$2-1,$1-1900));
|
||||||
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'active_users',
|
label => 'active_users',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user