diff --git a/apps/tomcat/jmx/mode/datasourceusage.pm b/apps/tomcat/jmx/mode/datasourceusage.pm new file mode 100644 index 000000000..eef003b5e --- /dev/null +++ b/apps/tomcat/jmx/mode/datasourceusage.pm @@ -0,0 +1,230 @@ +# +# Copyright 2017 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::tomcat::jmx::mode::datasourceusage; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); + +my $instance_mode; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'datasource', type => 1, cb_prefix_output => 'prefix_ds_output', message_multiple => 'All datasources are ok' }, + ]; + + $self->{maps_counters}->{datasource} = [ + { label => 'num-active', set => { + key_values => [ { name => 'numActive' }, { name => 'maxActive' }, { name => 'display' } ], + closure_custom_calc => $self->can('custom_usage_calc'), + closure_custom_calc_extra_options => { label_ref => 'Active', message => 'Current Num Active' }, + closure_custom_output => $self->can('custom_usage_output'), + closure_custom_threshold_check => $self->can('custom_usage_threshold'), + closure_custom_perfdata => $self->can('custom_usage_perfdata'), + } + }, + { label => 'num-idle', set => { + key_values => [ { name => 'numIdle' }, { name => 'maxIdle' }, { name => 'display' } ], + closure_custom_calc => $self->can('custom_usage_calc'), + closure_custom_calc_extra_options => { label_ref => 'Idle', message => 'Current Num Idle' }, + closure_custom_output => $self->can('custom_usage_output'), + closure_custom_threshold_check => $self->can('custom_usage_threshold'), + closure_custom_perfdata => $self->can('custom_usage_perfdata'), + } + }, + ]; +} + +sub custom_usage_perfdata { + my ($self, %options) = @_; + + my $use_th = 1; + $use_th = 0 if ($instance_mode->{option_results}->{units} eq '%' && $self->{result_values}->{max} <= 0); + + my $extra_label = ''; + $extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0); + + my $value_perf = $self->{result_values}->{used}; + my %total_options = (); + if ($instance_mode->{option_results}->{units} eq '%' && $self->{result_values}->{max} > 0) { + $total_options{total} = $self->{result_values}->{max}; + $total_options{cast_int} = 1; + } + + my $label = $self->{label}; + $label =~ s/-/_/g; + $self->{output}->perfdata_add(label => $label . $extra_label, + value => $value_perf, + warning => $use_th == 1 ? $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options) : undef, + critical => $use_th == 1 ? $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options) : undef, + min => 0, max => $self->{result_values}->{max} > 0 ? $self->{result_values}->{max} : undef); +} + +sub custom_usage_threshold { + my ($self, %options) = @_; + + # Cannot use percent without total + return 'ok' if ($self->{result_values}->{max} <= 0 && $instance_mode->{option_results}->{units} eq '%'); + my ($exit, $threshold_value); + $threshold_value = $self->{result_values}->{used}; + if ($instance_mode->{option_results}->{units} eq '%') { + $threshold_value = $self->{result_values}->{prct_used}; + } + $exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]); + return $exit; +} + +sub custom_usage_output { + my ($self, %options) = @_; + + my $msg; + if ($self->{result_values}->{max} > 0) { + $msg = sprintf("%s Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", + $self->{result_values}->{message}, $self->{result_values}->{max}, + $self->{result_values}->{used}, $self->{result_values}->{prct_used}, + $self->{result_values}->{max} - $self->{result_values}->{used}, 100 - $self->{result_values}->{prct_used}); + } else { + $msg = sprintf("%s : %s", $self->{result_values}->{message}, $self->{result_values}->{used}); + } + return $msg; +} + +sub custom_usage_calc { + my ($self, %options) = @_; + + $self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'}; + $self->{result_values}->{message} = $options{extra_options}->{message}; + $self->{result_values}->{max} = $options{new_datas}->{$self->{instance} . '_max' . $options{extra_options}->{label_ref}}; + $self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_num' . $options{extra_options}->{label_ref}}; + if ($self->{result_values}->{max} > 0) { + $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{max}; + } + + return 0; +} + +sub prefix_ds_output { + my ($self, %options) = @_; + + return "Datasource '" . $options{instance_value}->{display} . "' "; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "filter-name:s" => { name => 'filter_name' }, + "units:s" => { name => 'units', default => '%' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $instance_mode = $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # maxActive or maxTotal + $self->{request} = [ + { mbean => "*:type=DataSource,class=*,context=*,host=*,name=*", attributes => + [ { name => 'numActive' }, { name => 'numIdle' }, { name => 'maxIdle' }, { name => 'maxTotal' }, { name => 'maxActive' } ] }, + ]; + + my $result = $options{custom}->get_attributes(request => $self->{request}, nothing_quit => 1); + + $self->{datasource} = {}; + foreach my $key (keys %$result) { + $key =~ /(?:[:,])host=(.*?)(?:,|$)/; + my $ds_name = $1; + $key =~ /(?:[:,])(?:path|context)=(.*?)(?:,|$)/; + $ds_name .= '.' . $1; + $key =~ /(?:[:,])name=(.*?)(?:,|$)/; + $ds_name .= '.' . $1; + + if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $ds_name !~ /$self->{option_results}->{filter_name}/) { + $self->{output}->output_add(long_msg => "skipping '" . $ds_name . "': no matching filter.", debug => 1); + next; + } + + $self->{datasource}->{$ds_name} = { + display => $ds_name, + numActive => $result->{$key}->{numActive}, + maxActive => defined($result->{$key}->{maxTotal}) ? $result->{$key}->{maxTotal} : $result->{$key}->{maxActive}, + numIdle => $result->{$key}->{numIdle}, + maxIdle => $result->{$key}->{maxIdle}, + }; + } + + $self->{cache_name} = "tomcat_" . $self->{mode} . '_' . md5_hex($options{custom}->{url}) . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' . + (defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check data sources usage. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='num-active' + +=item B<--filter-name> + +Filter datasource name (can be a regexp). + +=item B<--warning-*> + +Threshold warning. +Can be: 'num-active', 'num-idle'. + +=item B<--critical-*> + +Threshold critical. +Can be: 'num-active', 'num-idle'. + +=item B<--units> + +Units of thresholds (Default: '%') ('%', 'absolute'). + +=back + +=cut diff --git a/apps/tomcat/jmx/mode/listdatasources.pm b/apps/tomcat/jmx/mode/listdatasources.pm new file mode 100644 index 000000000..a3bb7ee3e --- /dev/null +++ b/apps/tomcat/jmx/mode/listdatasources.pm @@ -0,0 +1,137 @@ +# +# Copyright 2017 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::tomcat::jmx::mode::listdatasources; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "filter-host:s" => { name => 'filter_host' }, + "filter-path:s" => { name => 'filter_path' }, + }); + $self->{ds} = {}; + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + $self->{request} = [ + { mbean => "*:type=DataSource,class=*,context=*,host=*,name=*", attributes => + [ { name => 'numActive' } ] }, + ]; + my $result = $options{custom}->get_attributes(request => $self->{request}); + + foreach my $mbean (keys %{$result}) { + $mbean =~ /(?:[:,])host=(.*?)(?:,|$)/; + my $host = $1; + $mbean =~ /(?:[:,])(?:path|context)=(.*?)(?:,|$)/; + my $path = $1; + $mbean =~ /(?:[:,])name=(.*?)(?:,|$)/; + my $name = $1; + + if (defined($self->{option_results}->{filter_host}) && $self->{option_results}->{filter_host} ne '' && + $host !~ /$self->{option_results}->{filter_host}/) { + $self->{output}->output_add(long_msg => "skipping '" . $host . "': no matching filter.", debug => 1); + next; + } + if (defined($self->{option_results}->{filter_path}) && $self->{option_results}->{filter_path} ne '' && + $path !~ /$self->{option_results}->{filter_path}/) { + $self->{output}->output_add(long_msg => "skipping '" . $path . "': no matching filter.", debug => 1); + next; + } + + $self->{ds}->{$host . '.' . $path} = { + host => $host, path => $path, name => $name, + }; + } +} + +sub run { + my ($self, %options) = @_; + + $self->manage_selection(%options); + foreach my $instance (sort keys %{$self->{ds}}) { + $self->{output}->output_add(long_msg => '[host = ' . $self->{ds}->{$instance}->{host} . "]" . + " [path = '" . $self->{ds}->{$instance}->{path} . "']" . + " [name = '" . $self->{ds}->{$instance}->{name} . "']" + ); + } + + $self->{output}->output_add(severity => 'OK', + short_msg => 'List data sources:'); + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['host', 'path', 'name']); +} + +sub disco_show { + my ($self, %options) = @_; + + $self->manage_selection(%options); + foreach my $instance (sort keys %{$self->{ds}}) { + $self->{output}->add_disco_entry( + %{$self->{ds}->{$instance}} + ); + } +} + +1; + +__END__ + +=head1 MODE + +List data sources. + +=over 8 + +=item B<--filter-host> + +Filter by virtual host name (can be a regexp). + +=item B<--filter-path> + +Filter by application name (can be a regexp). + +=back + +=cut + diff --git a/apps/tomcat/jmx/mode/listwebapps.pm b/apps/tomcat/jmx/mode/listwebapps.pm new file mode 100644 index 000000000..d42afc749 --- /dev/null +++ b/apps/tomcat/jmx/mode/listwebapps.pm @@ -0,0 +1,134 @@ +# +# Copyright 2017 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::tomcat::jmx::mode::listwebapps; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "filter-host:s" => { name => 'filter_host' }, + "filter-path:s" => { name => 'filter_path' }, + }); + $self->{webapps} = {}; + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + $self->{request} = [ + { mbean => "*:context=*,host=*,type=Manager", attributes => [ { name => 'activeSessions' } ] }, + { mbean => "*:path=*,host=*,type=Manager", attributes => [ { name => 'activeSessions' } ] }, + ]; + my $result = $options{custom}->get_attributes(request => $self->{request}); + + foreach my $mbean (keys %{$result}) { + $mbean =~ /(?:[:,])host=(.*?)(?:,|$)/; + my $host = $1; + $mbean =~ /(?:[:,])(?:path|context)=(.*?)(?:,|$)/; + my $path = $1; + + if (defined($self->{option_results}->{filter_host}) && $self->{option_results}->{filter_host} ne '' && + $host !~ /$self->{option_results}->{filter_host}/) { + $self->{output}->output_add(long_msg => "skipping '" . $host . "': no matching filter.", debug => 1); + next; + } + if (defined($self->{option_results}->{filter_path}) && $self->{option_results}->{filter_path} ne '' && + $path !~ /$self->{option_results}->{filter_path}/) { + $self->{output}->output_add(long_msg => "skipping '" . $path . "': no matching filter.", debug => 1); + next; + } + + $self->{webapps}->{$host . '.' . $path} = { + host => $host, path => $path, + }; + } +} + +sub run { + my ($self, %options) = @_; + + $self->manage_selection(%options); + foreach my $instance (sort keys %{$self->{webapps}}) { + $self->{output}->output_add(long_msg => '[host = ' . $self->{webapps}->{$instance}->{host} . "]" . + " [path = '" . $self->{webapps}->{$instance}->{path} . "']" + ); + } + + $self->{output}->output_add(severity => 'OK', + short_msg => 'List webapps:'); + $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1); + $self->{output}->exit(); +} + +sub disco_format { + my ($self, %options) = @_; + + $self->{output}->add_disco_format(elements => ['host', 'path']); +} + +sub disco_show { + my ($self, %options) = @_; + + $self->manage_selection(%options); + foreach my $instance (sort keys %{$self->{webapps}}) { + $self->{output}->add_disco_entry( + %{$self->{webapps}->{$instance}} + ); + } +} + +1; + +__END__ + +=head1 MODE + +List webapps. + +=over 8 + +=item B<--filter-host> + +Filter by virtual host name (can be a regexp). + +=item B<--filter-path> + +Filter by application name (can be a regexp). + +=back + +=cut + diff --git a/apps/tomcat/jmx/mode/webappssessions.pm b/apps/tomcat/jmx/mode/webappssessions.pm new file mode 100644 index 000000000..b1f36813a --- /dev/null +++ b/apps/tomcat/jmx/mode/webappssessions.pm @@ -0,0 +1,227 @@ +# +# Copyright 2017 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::tomcat::jmx::mode::webappssessions; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); + +my $instance_mode; + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'webapps', type => 1, cb_prefix_output => 'prefix_webapps_output', message_multiple => 'All webapp sessions are ok' }, + ]; + + $self->{maps_counters}->{webapps} = [ + { label => 'sessions-active', set => { + key_values => [ { name => 'activeSessions' }, { name => 'maxActiveSessions' }, { name => 'display' } ], + closure_custom_calc => $self->can('custom_usage_calc'), + closure_custom_calc_extra_options => { label_ref => 'currentThreadCount', message => 'Current Threads' }, + closure_custom_output => $self->can('custom_usage_output'), + closure_custom_threshold_check => $self->can('custom_usage_threshold'), + closure_custom_perfdata => $self->can('custom_usage_perfdata'), + } + }, + { label => 'sessions-count', set => { + key_values => [ { name => 'sessionCounter', diff => 1 }, { name => 'display' } ], + output_template => 'Sessions Count : %s', + perfdatas => [ + { label => 'sessions_count', value => 'sessionCounter_absolute', template => '%s', + min => 0, label_extra_instance => 1, instance_use => 'display_absolute' }, + ], + } + }, + ]; +} + +sub custom_usage_perfdata { + my ($self, %options) = @_; + + my $use_th = 1; + $use_th = 0 if ($instance_mode->{option_results}->{units} eq '%' && $self->{result_values}->{max} <= 0); + + my $extra_label = ''; + $extra_label = '_' . $self->{result_values}->{display} if (!defined($options{extra_instance}) || $options{extra_instance} != 0); + + my $value_perf = $self->{result_values}->{used}; + my %total_options = (); + if ($instance_mode->{option_results}->{units} eq '%' && $self->{result_values}->{max} > 0) { + $total_options{total} = $self->{result_values}->{max}; + $total_options{cast_int} = 1; + } + + my $label = $self->{label}; + $label =~ s/-/_/g; + $self->{output}->perfdata_add(label => $label . $extra_label, + value => $value_perf, + warning => $use_th == 1 ? $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options) : undef, + critical => $use_th == 1 ? $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options) : undef, + min => 0, max => $self->{result_values}->{max} > 0 ? $self->{result_values}->{max} : undef); +} + +sub custom_usage_threshold { + my ($self, %options) = @_; + + # Cannot use percent without total + return 'ok' if ($self->{result_values}->{max} <= 0 && $instance_mode->{option_results}->{units} eq '%'); + my ($exit, $threshold_value); + $threshold_value = $self->{result_values}->{used}; + if ($instance_mode->{option_results}->{units} eq '%') { + $threshold_value = $self->{result_values}->{prct_used}; + } + $exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]); + return $exit; +} + +sub custom_usage_output { + my ($self, %options) = @_; + + my $msg; + if ($self->{result_values}->{max} > 0) { + $msg = sprintf("Current Active Sessions Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", + $self->{result_values}->{max}, + $self->{result_values}->{used}, $self->{result_values}->{prct_used}, + $self->{result_values}->{max} - $self->{result_values}->{used}, 100 - $self->{result_values}->{prct_used}); + } else { + $msg = sprintf("Current Active Sessions : %s", $self->{result_values}->{used}); + } + return $msg; +} + +sub custom_usage_calc { + my ($self, %options) = @_; + + $self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'}; + $self->{result_values}->{max} = $options{new_datas}->{$self->{instance} . '_maxActiveSessions'}; + $self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_activeSessions'}; + if ($self->{result_values}->{max} > 0) { + $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{max}; + } + + return 0; +} + +sub prefix_webapps_output { + my ($self, %options) = @_; + + return "Webapp '" . $options{instance_value}->{display} . "' "; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "filter-name:s" => { name => 'filter_name' }, + "units:s" => { name => 'units', default => '%' }, + }); + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $instance_mode = $self; +} + +sub manage_selection { + my ($self, %options) = @_; + + # can be path or context + # Tomcat: Catalina:context=/xxxxx,host=localhost,type=Manager + # Jboss: jboss.web:host=localhost,path=/invoker,type=Manager + # maxActiveSessions = -1 (no limit) + $self->{request} = [ + { mbean => "*:context=*,host=*,type=Manager", attributes => [ { name => 'activeSessions' }, { name => 'sessionCounter' }, { name => 'maxActiveSessions' } ] }, + { mbean => "*:path=*,host=*,type=Manager", attributes => [ { name => 'activeSessions' }, { name => 'sessionCounter' }, { name => 'maxActiveSessions' } ] }, + ]; + + my $result = $options{custom}->get_attributes(request => $self->{request}, nothing_quit => 1); + + $self->{webapps} = {}; + foreach my $key (keys %$result) { + $key =~ /(?:[:,])host=(.*?)(?:,|$)/; + my $webapps = $1; + $key =~ /(?:[:,])(?:path|context)=(.*?)(?:,|$)/; + $webapps .= '.' . $1; + + if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $webapps !~ /$self->{option_results}->{filter_name}/) { + $self->{output}->output_add(long_msg => "skipping '" . $webapps . "': no matching filter.", debug => 1); + next; + } + + $self->{webapps}->{$webapps} = { + display => $webapps, + %{$result->{$key}} + }; + } + + $self->{cache_name} = "tomcat_" . $self->{mode} . '_' . md5_hex($options{custom}->{url}) . '_' . + (defined($self->{option_results}->{filter_counters}) ? md5_hex($self->{option_results}->{filter_counters}) : md5_hex('all')) . '_' . + (defined($self->{option_results}->{filter_name}) ? md5_hex($self->{option_results}->{filter_name}) : md5_hex('all')); +} + +1; + +__END__ + +=head1 MODE + +Check webapps session usage. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='sessions-active' + +=item B<--filter-name> + +Filter webapps name (can be a regexp). + +=item B<--warning-*> + +Threshold warning. +Can be: 'sessions-count', 'sessions-active'. + +=item B<--critical-*> + +Threshold critical. +Can be: 'sessions-count', 'sessions-active'. + +=item B<--units> + +Units of thresholds (Default: '%') ('%', 'absolute'). + +=back + +=cut diff --git a/apps/tomcat/jmx/plugin.pm b/apps/tomcat/jmx/plugin.pm index 25a5c57a6..2d732e713 100644 --- a/apps/tomcat/jmx/plugin.pm +++ b/apps/tomcat/jmx/plugin.pm @@ -34,12 +34,16 @@ sub new { 'class-count' => 'centreon::common::jvm::mode::classcount', 'connector-usage' => 'apps::tomcat::jmx::mode::connectorusage', 'cpu-load' => 'centreon::common::jvm::mode::cpuload', + 'datasource-usage' => 'apps::tomcat::jmx::mode::datasourceusage', 'fd-usage' => 'centreon::common::jvm::mode::fdusage', 'gc-usage' => 'centreon::common::jvm::mode::gcusage', + 'list-datasources' => 'apps::tomcat::jmx::mode::listdatasources', + 'list-webapps' => 'apps::tomcat::jmx::mode::listwebapps', 'load-average' => 'centreon::common::jvm::mode::loadaverage', 'memory' => 'centreon::common::jvm::mode::memory', 'memory-detailed' => 'centreon::common::jvm::mode::memorydetailed', 'threads' => 'centreon::common::jvm::mode::threads', + 'webapps-sessions' => 'apps::tomcat::jmx::mode::webappssessions', ); $self->{custom_modes}{jolokia} = 'centreon::common::protocols::jmx::custom::jolokia';