diff --git a/centreon-plugins/cloud/microsoft/office365/exchange/mode/emailactivity.pm b/centreon-plugins/cloud/microsoft/office365/exchange/mode/emailactivity.pm index d1a6535d4..ecafe7b5f 100644 --- a/centreon-plugins/cloud/microsoft/office365/exchange/mode/emailactivity.pm +++ b/centreon-plugins/cloud/microsoft/office365/exchange/mode/emailactivity.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_users', diff --git a/centreon-plugins/cloud/microsoft/office365/exchange/mode/mailboxusage.pm b/centreon-plugins/cloud/microsoft/office365/exchange/mode/mailboxusage.pm index 4b228e539..ab4000a4e 100644 --- a/centreon-plugins/cloud/microsoft/office365/exchange/mode/mailboxusage.pm +++ b/centreon-plugins/cloud/microsoft/office365/exchange/mode/mailboxusage.pm @@ -36,8 +36,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_mailboxes', nlabel => 'exchange.mailboxes.active.count', diff --git a/centreon-plugins/cloud/microsoft/office365/management/mode/servicestatus.pm b/centreon-plugins/cloud/microsoft/office365/management/mode/servicestatus.pm index 752aa3617..84fd17219 100644 --- a/centreon-plugins/cloud/microsoft/office365/management/mode/servicestatus.pm +++ b/centreon-plugins/cloud/microsoft/office365/management/mode/servicestatus.pm @@ -80,19 +80,20 @@ sub set_counters { closure_custom_calc => $self->can('custom_status_calc'), closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => \&catalog_status_threshold, + closure_custom_threshold_check => \&catalog_status_threshold } - }, - ]; + } + ]; + $self->{maps_counters}->{features} = [ { label => 'status', set => { key_values => [ { name => 'status' }, { name => 'service_name' }, { name => 'feature_name' } ], closure_custom_calc => $self->can('custom_status_calc'), closure_custom_output => $self->can('custom_status_output'), closure_custom_perfdata => sub { return 0; }, - closure_custom_threshold_check => \&catalog_status_threshold, + closure_custom_threshold_check => \&catalog_status_threshold } - }, + } ]; } diff --git a/centreon-plugins/cloud/microsoft/office365/onedrive/mode/siteusage.pm b/centreon-plugins/cloud/microsoft/office365/onedrive/mode/siteusage.pm index 46bc34923..e566255e5 100644 --- a/centreon-plugins/cloud/microsoft/office365/onedrive/mode/siteusage.pm +++ b/centreon-plugins/cloud/microsoft/office365/onedrive/mode/siteusage.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_sites', nlabel => 'onedrive.sites.active.count', diff --git a/centreon-plugins/cloud/microsoft/office365/onedrive/mode/usersactivity.pm b/centreon-plugins/cloud/microsoft/office365/onedrive/mode/usersactivity.pm index 92cab1c17..e80745ee6 100644 --- a/centreon-plugins/cloud/microsoft/office365/onedrive/mode/usersactivity.pm +++ b/centreon-plugins/cloud/microsoft/office365/onedrive/mode/usersactivity.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_users', diff --git a/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/siteusage.pm b/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/siteusage.pm index 573f1681f..4ff2d7784 100644 --- a/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/siteusage.pm +++ b/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/siteusage.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_sites', nlabel => 'sharepoint.sites.active.count', diff --git a/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/usersactivity.pm b/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/usersactivity.pm index f63338377..580ce3e74 100644 --- a/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/usersactivity.pm +++ b/centreon-plugins/cloud/microsoft/office365/sharepoint/mode/usersactivity.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_users', nlabel => 'sharepoint.users.active.count', diff --git a/centreon-plugins/cloud/microsoft/office365/skype/mode/devicesusage.pm b/centreon-plugins/cloud/microsoft/office365/skype/mode/devicesusage.pm index f2bd55a16..00c83acad 100644 --- a/centreon-plugins/cloud/microsoft/office365/skype/mode/devicesusage.pm +++ b/centreon-plugins/cloud/microsoft/office365/skype/mode/devicesusage.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_devices', diff --git a/centreon-plugins/cloud/microsoft/office365/skype/mode/usersactivity.pm b/centreon-plugins/cloud/microsoft/office365/skype/mode/usersactivity.pm index 9cc57a230..e53f754cc 100644 --- a/centreon-plugins/cloud/microsoft/office365/skype/mode/usersactivity.pm +++ b/centreon-plugins/cloud/microsoft/office365/skype/mode/usersactivity.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_users', diff --git a/centreon-plugins/cloud/microsoft/office365/teams/mode/devicesusage.pm b/centreon-plugins/cloud/microsoft/office365/teams/mode/devicesusage.pm index aa8c84198..eefc06c53 100644 --- a/centreon-plugins/cloud/microsoft/office365/teams/mode/devicesusage.pm +++ b/centreon-plugins/cloud/microsoft/office365/teams/mode/devicesusage.pm @@ -35,14 +35,17 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_devices', nlabel => 'teams.devices.active.count', - value => $self->{result_values}->{active}, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options), - unit => 'devices', min => 0, max => $self->{result_values}->{total}); + $self->{output}->perfdata_add( + label => 'active_devices', nlabel => 'teams.devices.active.count', + value => $self->{result_values}->{active}, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}, %total_options), + 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 { @@ -52,21 +55,26 @@ sub custom_active_threshold { if ($self->{instance_mode}->{option_results}->{units} eq '%') { $threshold_value = $self->{result_values}->{prct_active}; } - my $exit = $self->{perfdata}->threshold_check(value => $threshold_value, - threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, - { label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]); + my $exit = $self->{perfdata}->threshold_check( + value => $threshold_value, + threshold => [ + { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, + { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } + ] + ); return $exit; - } sub custom_active_output { my ($self, %options) = @_; - my $msg = sprintf("Active devices on %s : %d/%d (%.2f%%)", - $self->{result_values}->{report_date}, - $self->{result_values}->{active}, - $self->{result_values}->{total}, - $self->{result_values}->{prct_active}); + my $msg = sprintf( + "Active devices on %s : %d/%d (%.2f%%)", + $self->{result_values}->{report_date}, + $self->{result_values}->{active}, + $self->{result_values}->{total}, + $self->{result_values}->{prct_active} + ); return $msg; } @@ -103,63 +111,58 @@ sub set_counters { closure_custom_threshold_check => $self->can('custom_active_threshold'), closure_custom_perfdata => $self->can('custom_active_perfdata') } - }, + } ]; + $self->{maps_counters}->{global} = [ { label => 'windows', nlabel => 'teams.devices.windows.count', set => { key_values => [ { name => 'windows' } ], output_template => 'Windows: %d', perfdatas => [ - { label => 'windows', value => 'windows', template => '%d', - min => 0 }, - ], + { label => 'windows', template => '%d', min => 0 } + ] } }, { label => 'mac', nlabel => 'teams.devices.mac.count', set => { key_values => [ { name => 'mac' } ], output_template => 'Mac: %d', perfdatas => [ - { label => 'mac', value => 'mac', template => '%d', - min => 0 }, - ], + { label => 'mac', template => '%d', min => 0 } + ] } }, { label => 'web', nlabel => 'teams.devices.web.count', set => { key_values => [ { name => 'web' } ], output_template => 'Web: %d', perfdatas => [ - { label => 'web', value => 'web', template => '%d', - min => 0 }, - ], + { label => 'web', template => '%d', min => 0 } + ] } }, { label => 'ios', nlabel => 'teams.devices.ios.count', set => { key_values => [ { name => 'ios' } ], output_template => 'iOS: %d', perfdatas => [ - { label => 'ios', value => 'ios', template => '%d', - min => 0 }, - ], + { label => 'ios', template => '%d', min => 0 } + ] } }, { label => 'android-phone', nlabel => 'teams.devices.android.count', set => { key_values => [ { name => 'android_phone' } ], output_template => 'Android Phone: %d', perfdatas => [ - { label => 'android_phone', value => 'android_phone', template => '%d', - min => 0 }, - ], + { label => 'android_phone', template => '%d', min => 0 } + ] } }, { label => 'windows-phone', nlabel => 'teams.devices.windowsphone.count', set => { key_values => [ { name => 'windows_phone' } ], output_template => 'Windows Phone: %d', perfdatas => [ - { label => 'windows_phone', value => 'windows_phone', template => '%d', - min => 0 }, - ], + { label => 'windows_phone', template => '%d', min => 0 } + ] } - }, + } ]; } diff --git a/centreon-plugins/cloud/microsoft/office365/teams/mode/usersactivity.pm b/centreon-plugins/cloud/microsoft/office365/teams/mode/usersactivity.pm index 8f86d90b1..ed9dd9f57 100644 --- a/centreon-plugins/cloud/microsoft/office365/teams/mode/usersactivity.pm +++ b/centreon-plugins/cloud/microsoft/office365/teams/mode/usersactivity.pm @@ -35,8 +35,9 @@ sub custom_active_perfdata { $total_options{cast_int} = 1; } - $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)); + 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 => 'active_users',