diff --git a/centreon-plugins/apps/bluemind/local/mode/core.pm b/centreon-plugins/apps/bluemind/local/mode/core.pm index 29d9a9898..a266e1a23 100644 --- a/centreon-plugins/apps/bluemind/local/mode/core.pm +++ b/centreon-plugins/apps/bluemind/local/mode/core.pm @@ -82,7 +82,7 @@ sub set_counters { } }, { label => 'request-handling-mean', nlabel => 'core.request.handling.mean.milliseconds', display_ok => 0, set => { - key_values => [ { name => 'request_handling_time_mean', diff => 1 } ], + key_values => [ { name => 'request_handling_time_mean' } ], output_template => 'mean request handling: %s ms', perfdatas => [ { value => 'request_handling_time_mean_absolute', template => '%s', min => 0, unit => 'ms' } @@ -112,7 +112,7 @@ sub manage_selection { # bm-core.callsCount,status=success,meterType=Counter count=125244086 # bm-core.directory.cluster.events,meterType=Counter count=14300 my $result = $options{custom}->execute_command( - command => 'curl --unix-socket /var/run/bm-metrics/bm-core.sock http://127.0.0.1/metrics', + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-core.sock http://127.0.0.1/metrics', filter => 'bm-core\.heartbeat\.broadcast|bm-core\.handlingDuration|bm-core\.callsCount|bm-core\.directory\.cluster\.events' ); diff --git a/centreon-plugins/apps/bluemind/local/mode/eas.pm b/centreon-plugins/apps/bluemind/local/mode/eas.pm new file mode 100644 index 000000000..058038c0a --- /dev/null +++ b/centreon-plugins/apps/bluemind/local/mode/eas.pm @@ -0,0 +1,128 @@ +# +# Copyright 2020 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package apps::bluemind::local::mode::eas; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use bigint; + +sub prefix_eas_output { + my ($self, %options) = @_; + + return 'Mobile connection service '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'bm_eas', type => 0, cb_prefix_output => 'prefix_eas_output' } + ]; + + $self->{maps_counters}->{bm_eas} = [ + { label => 'responses-size-total', nlabel => 'eas.responses.size.total.count', display_ok => 0, set => { + key_values => [ { name => 'response_size', diff => 1 } ], + output_template => 'total responses size: %s %s', + output_change_bytes => 1, + perfdatas => [ + { value => 'response_size_absolute', template => '%s', min => 0, unit => 'B' } + ] + } + }, + { label => 'execution-total', nlabel => 'eas.execution.total.milliseconds', display_ok => 0, set => { + key_values => [ { name => 'execution_total', diff => 1 } ], + output_template => 'total execution: %s ms', + perfdatas => [ + { value => 'execution_total_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + }, + { label => 'execution-mean', nlabel => 'eas.execution.mean.milliseconds', set => { + key_values => [ { name => 'execution_mean' } ], + output_template => 'mean execution: %s ms', + perfdatas => [ + { value => 'execution_mean_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # bm-eas.executionTime,meterType=Timer count=23865528,totalTime=48394780739993049,mean=2027811022 + # bm-eas.responseSize,meterType=DistSum count=31508001,totalAmount=736453775233,mean=23373 + my $result = $options{custom}->execute_command( + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-eas.sock http://127.0.0.1/metrics', + filter => 'executionTime|responseSize' + ); + + $self->{bm_eas} = {}; + foreach (keys %$result) { + $self->{bm_eas}->{response_size} = $result->{$_}->{totalAmount} if (/bm-eas.responseSize/); + if (/bm-eas\.executionTime/) { + $self->{bm_eas}->{execution_total} = $result->{$_}->{totalTime} / 100000; + $self->{bm_eas}->{execution_mean} = $result->{$_}->{mean} / 100000; + } + } + + $self->{cache_name} = 'bluemind_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check mobile connection service. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='^execution' + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'responses-size-total', 'execution-total', 'execution-mean'. + +=back + +=cut diff --git a/centreon-plugins/apps/bluemind/local/mode/hps.pm b/centreon-plugins/apps/bluemind/local/mode/hps.pm new file mode 100644 index 000000000..235191345 --- /dev/null +++ b/centreon-plugins/apps/bluemind/local/mode/hps.pm @@ -0,0 +1,205 @@ +# +# Copyright 2020 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package apps::bluemind::local::mode::hps; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use bigint; + +sub prefix_hps_output { + my ($self, %options) = @_; + + return 'Authentication service '; +} +sub prefix_upstream_output { + my ($self, %options) = @_; + + return "Upstream '" . $options{instance_value}->{display} . "' "; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'bm_hps', type => 0, cb_prefix_output => 'prefix_hps_output' }, + { name => 'bm_hps_upstream', type => 1, cb_prefix_output => 'prefix_upstream_output', message_multiple => 'All upstreams are ok' } + ]; + + $self->{maps_counters}->{bm_hps} = [ + { label => 'authentication-success', nlabel => 'hps.authentication.success.count', display_ok => 0, set => { + key_values => [ { name => 'auth_success', diff => 1 } ], + output_template => 'success authentication: %s', + perfdatas => [ + { value => 'auth_success_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'authentication-failure', nlabel => 'hps.authentication.failure.count', set => { + key_values => [ { name => 'auth_failure', diff => 1 } ], + output_template => 'failure authentication: %s', + perfdatas => [ + { value => 'auth_failure_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'requests-protected', nlabel => 'hps.requests.protected.count', display_ok => 0, set => { + key_values => [ { name => 'requests_protected', diff => 1 } ], + output_template => 'protected requests: %s', + perfdatas => [ + { value => 'requests_protected_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'requests-maintenance', nlabel => 'hps.requests.maintenance.count', set => { + key_values => [ { name => 'requests_maintenance', diff => 1 } ], + output_template => 'maintenance requests: %s', + perfdatas => [ + { value => 'requests_maintenance_absolute', template => '%s', min => 0 } + ] + } + } + ]; + + $self->{maps_counters}->{bm_hps_upstream} = [ + { label => 'upstream-requests-time-total', nlabel => 'hps.upstream.requests.time.milliseconds', display_ok => 0, set => { + key_values => [ { name => 'requests_time_total', diff => 1 }, { name => 'display' } ], + output_template => 'total requests time: %s ms', + perfdatas => [ + { value => 'requests_time_total_absolute', template => '%s', min => 0, unit => 'ms', label_extra_instance => 1 } + ] + } + }, + { label => 'upstream-requests-time-mean', nlabel => 'hps.upstream.requests.time.mean.milliseconds', set => { + key_values => [ { name => 'requests_time_mean' }, { name => 'display' } ], + output_template => 'mean requests time: %s ms', + perfdatas => [ + { value => 'requests_time_mean_absolute', template => '%s', min => 0, unit => 'ms', label_extra_instance => 1 } + ] + } + }, + { label => 'upstream-requests-size-total', nlabel => 'hps.upstream.requests.size.total.bytes', display_ok => 0, set => { + key_values => [ { name => 'requests_size', diff => 1 } ], + output_template => 'total requests size: %s %s', + output_change_bytes => 1, + perfdatas => [ + { value => 'requests_size_absolute', template => '%s', min => 0, unit => 'B' } + ] + } + }, + { label => 'upstream-requests-total', nlabel => 'hps.upstream.requests.total.count', display_ok => 0, set => { + key_values => [ { name => 'requests', diff => 1 } ], + output_template => 'total requests: %s', + perfdatas => [ + { value => 'requests_absolute', template => '%s', min => 0 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + 'filter-upstream:s' => { name => 'filter_upstream' } + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # bm-hps.authCount,status=failure,meterType=Counter count=855 + # bm-hps.authCount,status=success,meterType=Counter count=11957 + # bm-hps.ftlTemplates.requests,meterType=Counter count=23064 + # bm-hps.requestsCount,kind=protected,meterType=Counter count=3080815 + # bm-hps.requestsCount,kind=maintenance,meterType=Counter count=1 + # bm-hps.upstreamRequestSize,path=/login,meterType=DistSum count=331977,totalAmount=0,mean=0 + # bm-hps.upstreamRequestTime,path=/login,meterType=Timer count=37864,totalTime=70405376220,mean=1859427 + # bm-hps.upstreamRequestsCount,path=/login,meterType=Counter count=1383 + my $result = $options{custom}->execute_command( + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-hps.sock http://127.0.0.1/metrics', + filter => 'authCount|ftlTemplates\.requests|requestsCount|upstreamRequestSize|upstreamRequestTime|upstreamRequestsCount' + ); + + $self->{bm_hps} = {}; + $self->{bm_hps_upstream} = {}; + foreach (keys %$result) { + $self->{bm_hps}->{'auth_' . $1} = $result->{$_}->{count} if (/bm-hps\.authCount.*status=(failure|success)/); + $self->{bm_hps}->{'requests_' . $1} = $result->{$_}->{count} if (/bm-hps\.requestsCount.*kind=(maintenance|protected)/); + + if (/bm-hps\.upstreamRequestTime.*path=(.*?),/) { + my $upstream = $1; + if (defined($self->{option_results}->{filter_upstream}) && $self->{option_results}->{filter_upstream} ne '' && + $upstream !~ /$self->{option_results}->{filter_upstream}/) { + $self->{output}->output_add(long_msg => "skipping upstream '" . $upstream . "': no matching filter.", debug => 1); + next; + } + + $self->{bm_hps_upstream}->{$upstream} = { + display => $upstream, + requests_time_total => $result->{$_}->{totalTime} / 100000, + requests_time_mean => $result->{$_}->{mean} / 100000, + requests_size => $result->{"bm-hps.upstreamRequestSize,path=$upstream,meterType=DistSum"}->{totalAmount}, + requests => $result->{"bm-hps.upstreamRequestsCount,path=$upstream,meterType=Counter"}->{count} + }; + } + } + + $self->{cache_name} = 'bluemind_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check authentication service. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='maintenance' + +=item B<--filter-upstream> + +Filter upstream name (can be a regexp). + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'authentication-success', 'authentication-failure', 'requests-protected', +'requests-maintenance', 'upstream-requests-time-total', 'upstream-requests-time-mean', +'upstream-requests-size-total, 'upstream-requests-total'. + +=back + +=cut diff --git a/centreon-plugins/apps/bluemind/local/mode/ips.pm b/centreon-plugins/apps/bluemind/local/mode/ips.pm new file mode 100644 index 000000000..8b7b58c66 --- /dev/null +++ b/centreon-plugins/apps/bluemind/local/mode/ips.pm @@ -0,0 +1,96 @@ +# +# Copyright 2020 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package apps::bluemind::local::mode::ips; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +sub prefix_ips_output { + my ($self, %options) = @_; + + return 'IMAP operations tracking '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'bm_ips', type => 0, cb_prefix_output => 'prefix_ips_output' } + ]; + + $self->{maps_counters}->{bm_ips} = [ + { label => 'connections-active', nlabel => 'ips.connections.active.count', set => { + key_values => [ { name => 'active_connections' } ], + output_template => 'active connections: %s', + perfdatas => [ + { value => 'active_connections_absolute', template => '%s', min => 0 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # bm-ips.activeConnections,meterType=Gauge value=718 + my $result = $options{custom}->execute_command( + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-ips.sock http://127.0.0.1/metrics', + filter => 'activeConnections' + ); + + $self->{bm_ips} = {}; + foreach (keys %$result) { + $self->{bm_ips}->{active_connections} = $result->{$_}->{value} if (/bm-ips\.activeConnections/); + } +} + +1; + +__END__ + +=head1 MODE + +Check IMAP operations tracking. + +=over 8 + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'active-connections'. + +=back + +=cut diff --git a/centreon-plugins/apps/bluemind/local/mode/lmtpd.pm b/centreon-plugins/apps/bluemind/local/mode/lmtpd.pm index 167d70c51..0a985bc71 100644 --- a/centreon-plugins/apps/bluemind/local/mode/lmtpd.pm +++ b/centreon-plugins/apps/bluemind/local/mode/lmtpd.pm @@ -73,7 +73,7 @@ sub set_counters { ] } }, - { label => 'emails-size-total', nlabel => 'lmtpd.emails.size.total.count', display_ok => 0, set => { + { label => 'emails-size-total', nlabel => 'lmtpd.emails.size.total.bytes', display_ok => 0, set => { key_values => [ { name => 'email_size', diff => 1 } ], output_template => 'total emails size: %s %s', output_change_bytes => 1, @@ -91,7 +91,7 @@ sub set_counters { } }, { label => 'sessions-duration-mean', nlabel => 'lmtpd.sessions.duration.mean.milliseconds', set => { - key_values => [ { name => 'session_duration_mean', diff => 1 } ], + key_values => [ { name => 'session_duration_mean' } ], output_template => 'mean sessions duration: %s ms', perfdatas => [ { value => 'session_duration_mean_absolute', template => '%s', min => 0, unit => 'ms' } @@ -107,7 +107,7 @@ sub set_counters { } }, { label => 'traffic-transport-latency-mean', nlabel => 'lmtpd.traffic.transport.latency.mean.milliseconds', set => { - key_values => [ { name => 'traffic_latency_mean', diff => 1 } ], + key_values => [ { name => 'traffic_latency_mean' } ], output_template => 'mean traffic transport latency: %s ms', perfdatas => [ { value => 'traffic_latency_mean_absolute', template => '%s', min => 0, unit => 'ms' } @@ -139,7 +139,7 @@ sub manage_selection { # bm-lmtpd.sessionDuration,meterType=Timer count=4941893,totalTime=1052591049892285,mean=212993492 # bm-lmtpd.traffic.transportLatency,meterType=Timer count=5017208,totalTime=272844528075000000,mean=54381745400 my $result = $options{custom}->execute_command( - command => 'curl --unix-socket /var/run/bm-metrics/bm-lmtpd.sock http://127.0.0.1/metrics', + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-lmtpd.sock http://127.0.0.1/metrics', filter => 'activeConnections|connectionCount|deliveries|emailSize|sessionDuration|traffic\.transportLatency' ); @@ -150,11 +150,11 @@ sub manage_selection { $self->{bm_lmtpd}->{connections} = $result->{$_}->{count} if (/bm-lmtpd\.connectionCount/); $self->{bm_lmtpd}->{email_size} = $result->{$_}->{totalAmount} if (/bm-lmtpd\.emailSize/); if (/bm-lmtpd\.sessionDuration/) { - $self->{bm_lmtpd}->{session_duration_total} = $result->{$_}->{totalAmount} / 100000; + $self->{bm_lmtpd}->{session_duration_total} = $result->{$_}->{totalTime} / 100000; $self->{bm_lmtpd}->{session_duration_mean} = $result->{$_}->{mean} / 100000; } if (/bm-lmtpd\.traffic\.transportLatency/) { - $self->{bm_lmtpd}->{traffic_latency_total} = $result->{$_}->{totalAmount} / 100000; + $self->{bm_lmtpd}->{traffic_latency_total} = $result->{$_}->{totalTime} / 100000; $self->{bm_lmtpd}->{traffic_latency_mean} = $result->{$_}->{mean} / 100000; } } diff --git a/centreon-plugins/apps/bluemind/local/mode/milter.pm b/centreon-plugins/apps/bluemind/local/mode/milter.pm new file mode 100644 index 000000000..a762467f5 --- /dev/null +++ b/centreon-plugins/apps/bluemind/local/mode/milter.pm @@ -0,0 +1,168 @@ +# +# Copyright 2020 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package apps::bluemind::local::mode::milter; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use bigint; + +sub prefix_milter_output { + my ($self, %options) = @_; + + return 'Milter service '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'bm_milter', type => 0, cb_prefix_output => 'prefix_milter_output' } + ]; + + $self->{maps_counters}->{bm_milter} = [ + { label => 'connections-total', nlabel => 'milter.connections.total.count', set => { + key_values => [ { name => 'connections', diff => 1 } ], + output_template => 'total connections: %s', + perfdatas => [ + { value => 'connections_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'traffic-class-inbound', nlabel => 'milter.traffic.class.inbound.count', display_ok => 0, set => { + key_values => [ { name => 'traffic_class_inbound', diff => 1 } ], + output_template => 'traffic class inbound: %s', + perfdatas => [ + { value => 'traffic_class_inbound_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'traffic-class-outbound', nlabel => 'milter.traffic.class.outbound.count', display_ok => 0, set => { + key_values => [ { name => 'traffic_class_outbound', diff => 1 } ], + output_template => 'traffic class outbound: %s', + perfdatas => [ + { value => 'traffic_class_outbound_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'traffic-size-inbound', nlabel => 'milter.traffic.size.inbound.bytes', display_ok => 0, set => { + key_values => [ { name => 'traffic_size_inbound', diff => 1 } ], + output_template => 'traffic size inbound: %s %s', + output_change_bytes => 1, + perfdatas => [ + { value => 'traffic_size_inbound_absolute', template => '%s', min => 0, unit => 'B' } + ] + } + }, + { label => 'traffic-size-outbound', nlabel => 'milter.traffic.size.outbound.bytes', display_ok => 0, set => { + key_values => [ { name => 'traffic_size_outbound', diff => 1 } ], + output_template => 'traffic size outbound: %s %s', + output_change_bytes => 1, + perfdatas => [ + { value => 'traffic_size_outbound_absolute', template => '%s', min => 0, unit => 'B' } + ] + } + }, + { label => 'sessions-duration-total', nlabel => 'milter.sessions.duration.total.milliseconds', display_ok => 0, set => { + key_values => [ { name => 'session_duration_total', diff => 1 } ], + output_template => 'total sessions duration: %s ms', + perfdatas => [ + { value => 'session_duration_total_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + }, + { label => 'sessions-duration-mean', nlabel => 'milter.sessions.duration.mean.milliseconds', set => { + key_values => [ { name => 'session_duration_mean' } ], + output_template => 'mean sessions duration: %s ms', + perfdatas => [ + { value => 'session_duration_mean_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # bm-milter.connectionsCount,meterType=Counter count=2017123 + # bm-milter.sessionDuration,meterType=Timer count=11553431,totalTime=21943249233042775,mean=1899284224 + # bm-milter.traffic.class,type=INBOUND,meterType=Counter count=1289087 + # bm-milter.traffic.class,type=OUTBOUND,meterType=Counter count=415711 + # bm-milter.traffic.size,type=INBOUND,meterType=Counter count=29063863392 + # bm-milter.traffic.size,type=OUTBOUND,meterType=Counter count=10763275492 + my $result = $options{custom}->execute_command( + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-milter.sock http://127.0.0.1/metrics', + filter => 'connectionsCount|sessionDuration|traffic\.class|traffic\.size' + ); + + $self->{bm_milter} = {}; + foreach (keys %$result) { + $self->{bm_milter}->{'traffic_class_' . lc($1)} = $result->{$_}->{count} if (/bm-milter\.traffic\.class.*type=(INBOUND|OUTBOUND)/i); + $self->{bm_milter}->{'traffic_size_' . lc($1)} = $result->{$_}->{count} if (/bm-milter\.traffic\.size.*type=(INBOUND|OUTBOUND)/i); + $self->{bm_milter}->{connections} = $result->{$_}->{count} if (/bm-milter\.connectionsCount/); + if (/bm-milter\.sessionDuration/) { + $self->{bm_milter}->{session_duration_total} = $result->{$_}->{totalTime} / 100000; + $self->{bm_milter}->{session_duration_mean} = $result->{$_}->{mean} / 100000; + } + } + + $self->{cache_name} = 'bluemind_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check milter service. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='^deliveries' + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'connections-total', 'traffic-class-inbound', 'traffic-class-outbound', +'traffic-size-inbound', 'traffic-size-outbound', 'sessions-duration-total', 'sessions-duration-mean' . + +=back + +=cut diff --git a/centreon-plugins/apps/bluemind/local/mode/webserver.pm b/centreon-plugins/apps/bluemind/local/mode/webserver.pm new file mode 100644 index 000000000..3e2aede4a --- /dev/null +++ b/centreon-plugins/apps/bluemind/local/mode/webserver.pm @@ -0,0 +1,152 @@ +# +# Copyright 2020 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package apps::bluemind::local::mode::webserver; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use bigint; + +sub prefix_webserver_output { + my ($self, %options) = @_; + + return 'Web application server '; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'bm_webserver', type => 0, cb_prefix_output => 'prefix_webserver_output' }, + ]; + + $self->{maps_counters}->{bm_webserver} = [ + { label => 'requests-time-total', nlabel => 'webserver.requests.time.milliseconds', display_ok => 0, set => { + key_values => [ { name => 'requests_time_total', diff => 1 } ], + output_template => 'total requests time: %s ms', + perfdatas => [ + { value => 'requests_time_total_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + }, + { label => 'requests-time-mean', nlabel => 'webserver.requests.time.mean.milliseconds', set => { + key_values => [ { name => 'requests_time_mean' } ], + output_template => 'mean requests time: %s ms', + perfdatas => [ + { value => 'requests_time_mean_absolute', template => '%s', min => 0, unit => 'ms' } + ] + } + }, + { label => 'requests-total', nlabel => 'webserver.requests.total.count', set => { + key_values => [ { name => 'requests', diff => 1 } ], + output_template => 'total requests: %s', + perfdatas => [ + { value => 'requests_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'requests-status-200', nlabel => 'webserver.requests.status.200.count', display_ok => 0, set => { + key_values => [ { name => 'requests_200', diff => 1 } ], + output_template => 'total 200 requests: %s', + perfdatas => [ + { value => 'requests_200_absolute', template => '%s', min => 0 } + ] + } + }, + { label => 'requests-status-304', nlabel => 'webserver.requests.status.304.count', display_ok => 0, set => { + key_values => [ { name => 'requests_304', diff => 1 } ], + output_template => 'total 304 requests: %s', + perfdatas => [ + { value => 'requests_304_absolute', template => '%s', min => 0 } + ] + } + } + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1, force_new_perfdata => 1); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # bm-webserver.appCache.requestTime,meterType=Timer count=91005,totalTime=46688008481,mean=513026 + # bm-webserver.appCache.requests,meterType=Counter count=8552 + # bm-webserver.staticFile.requests,status=200,meterType=Counter count=318881 + # bm-webserver.staticFile.requests,status=304,meterType=Counter count=3485778 + my $result = $options{custom}->execute_command( + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-webserver.sock http://127.0.0.1/metrics', + filter => 'appCache|staticFile\.requests' + ); + + $self->{bm_webserver} = {}; + foreach (keys %$result) { + $self->{bm_webserver}->{'requests_' . $1} = $result->{$_}->{count} if (/bm-webserver\.staticFile\.requests.*,status=(200|304)/); + $self->{bm_webserver}->{requests} = $result->{$_}->{count} if (/bm-webserver\.appCache\.requests/); + + if (/bm-webserver\.appCache\.requestTime/) { + $self->{bm_webserver}->{requests_time_total} = $result->{$_}->{totalTime} / 100000; + $self->{bm_webserver}->{requests_time_mean} = $result->{$_}->{mean} / 100000; + } + } + + $self->{cache_name} = 'bluemind_' . $self->{mode} . '_' . $options{custom}->get_hostname() . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check web application server. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='requests-time-mean' + +=item B<--filter-upstream> + +Filter upstream name (can be a regexp). + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: 'requests-time-total', 'requests-time-mean', 'requests-total', +'requests-status-200', 'requests-status-304'. + +=back + +=cut diff --git a/centreon-plugins/apps/bluemind/local/mode/xmpp.pm b/centreon-plugins/apps/bluemind/local/mode/xmpp.pm index 5813b598e..859d394ce 100644 --- a/centreon-plugins/apps/bluemind/local/mode/xmpp.pm +++ b/centreon-plugins/apps/bluemind/local/mode/xmpp.pm @@ -77,7 +77,7 @@ sub manage_selection { # bm-xmpp.packetsCount,type=all,meterType=Counter count=517791 # bm-xmpp.packetsCount,type=chat,meterType=Counter count=12 my $result = $options{custom}->execute_command( - command => 'curl --unix-socket /var/run/bm-metrics/bm-xmpp.sock http://127.0.0.1/metrics', + command => 'curl --unix-socket /var/run/bm-metrics/metrics-bm-xmpp.sock http://127.0.0.1/metrics', filter => 'packetsCount' ); @@ -96,7 +96,7 @@ __END__ =head1 MODE -Check instant Messaging Service. +Check instant messaging service. =over 8 diff --git a/centreon-plugins/apps/bluemind/local/plugin.pm b/centreon-plugins/apps/bluemind/local/plugin.pm index 3f136b7f1..7fb8c72db 100644 --- a/centreon-plugins/apps/bluemind/local/plugin.pm +++ b/centreon-plugins/apps/bluemind/local/plugin.pm @@ -32,9 +32,14 @@ sub new { $self->{version} = '0.1'; $self->{modes} = { - 'core' => 'apps::bluemind::local::mode::core', - 'lmtpd' => 'apps::bluemind::local::mode::lmtpd', - 'xmpp' => 'apps::bluemind::local::mode::xmpp' + 'core' => 'apps::bluemind::local::mode::core', + 'eas' => 'apps::bluemind::local::mode::eas', + 'hps' => 'apps::bluemind::local::mode::hps', + 'ips' => 'apps::bluemind::local::mode::ips', + 'lmtpd' => 'apps::bluemind::local::mode::lmtpd', + 'milter' => 'apps::bluemind::local::mode::milter', + 'webserver' => 'apps::bluemind::local::mode::webserver', + 'xmpp' => 'apps::bluemind::local::mode::xmpp' }; $self->{custom_modes}{api} = 'apps::bluemind::local::custom::api';