From 490945440b668dd9700b3ea25d5571c682ce6307 Mon Sep 17 00:00:00 2001 From: omercier Date: Thu, 20 Mar 2025 11:29:56 +0100 Subject: [PATCH 1/4] fix(ci): add missing image + fix path for tests on noble --- .github/actions/test-plugins/action.yml | 4 +++- .github/docker/testing/Dockerfile.testing-plugins-alma8 | 2 +- .github/docker/testing/Dockerfile.testing-plugins-alma9 | 2 +- .github/docker/testing/Dockerfile.testing-plugins-bookworm | 2 +- .github/docker/testing/Dockerfile.testing-plugins-bullseye | 2 +- .github/docker/testing/Dockerfile.testing-plugins-jammy | 2 +- .github/docker/testing/Dockerfile.testing-plugins-noble | 4 ++-- .github/workflows/plugins.yml | 4 ++-- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/actions/test-plugins/action.yml b/.github/actions/test-plugins/action.yml index bbcf5bfd76..ac24b7d1c6 100644 --- a/.github/actions/test-plugins/action.yml +++ b/.github/actions/test-plugins/action.yml @@ -24,4 +24,6 @@ runs: - name: Install, test and remove plugin shell: bash - run: python3 .github/scripts/test-all-plugins.py ${{ inputs.package-extension }} ${{ inputs.plugin-list }} + run: | + [[ -f /.venv/bin/activate ]] && source /.venv/bin/activate + python3 .github/scripts/test-all-plugins.py ${{ inputs.package-extension }} ${{ inputs.plugin-list }} diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 index 22d2d9c07a..71abc16087 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma8 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -12,7 +12,7 @@ dnf clean all dnf install -y python3.11 python3.11-pip pip3.11 install robotframework robotframework-examples # Install snmpsim -pip3.11 install snmpsim-lextudio +pip3.11 install snmpsim # Install node curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 index d5cead3a20..95edbe7640 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-alma9 +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -12,7 +12,7 @@ dnf clean all dnf install -y python3.11 python3.11-pip pip3.11 install robotframework robotframework-examples # Install snmpsim -pip3.11 install snmpsim-lextudio +pip3.11 install snmpsim # Install node curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm index f5e70048ea..48d6e00221 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bookworm +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -28,7 +28,7 @@ apt-get install -y python3-dev python3-pip rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED pip3 install robotframework robotframework-examples # Install snmpsim -pip3 install snmpsim-lextudio +pip3 install snmpsim # Install nodejs curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye index 171240fb7f..87700be3ac 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-bullseye +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -27,7 +27,7 @@ apt-get update apt-get install -y python3 python3-dev python3-pip pip3 install robotframework robotframework-examples # Install snmpsim -pip3 install snmpsim-lextudio +pip3 install snmpsim # Install nodejs curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy index 0678ac512b..7519cd7103 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-jammy +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -27,7 +27,7 @@ apt-get update apt-get install -y python3 python3-dev python3-pip pip3 install robotframework robotframework-examples # Install snmpsim -pip3 install snmpsim-lextudio +pip3 install snmpsim # Install nodejs curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ diff --git a/.github/docker/testing/Dockerfile.testing-plugins-noble b/.github/docker/testing/Dockerfile.testing-plugins-noble index 77260b47ff..4b89178e3d 100644 --- a/.github/docker/testing/Dockerfile.testing-plugins-noble +++ b/.github/docker/testing/Dockerfile.testing-plugins-noble @@ -29,9 +29,9 @@ python3 -m venv .venv source .venv/bin/activate # Install Robotframework apt-get install -y python3 python3-dev python3-pip -.venv/bin/pip3 install robotframework robotframework-examples +pip3 install robotframework robotframework-examples # Install snmpsim -.venv/bin/pip3 install snmpsim-lextudio +pip3 install snmpsim # Install nodejs curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index e4d67fe5b8..2052a609d2 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -98,7 +98,7 @@ jobs: strategy: fail-fast: false matrix: - image: [unit-tests-alma8, unit-tests-alma9, unit-tests-bullseye, unit-tests-bullseye-arm64, unit-tests-bookworm, unit-tests-jammy] + image: [unit-tests-alma8, unit-tests-alma9, unit-tests-bullseye, unit-tests-bullseye-arm64, unit-tests-bookworm, unit-tests-jammy, unit-tests-noble] include: - runner_name: ubuntu-24.04 - package_extension: rpm @@ -317,7 +317,7 @@ jobs: strategy: fail-fast: false matrix: - image: [testing-plugins-alma8, testing-plugins-alma9, testing-plugins-jammy, testing-plugins-bullseye, testing-plugins-bookworm] + image: [testing-plugins-alma8, testing-plugins-alma9, testing-plugins-jammy, testing-plugins-bullseye, testing-plugins-bookworm, testing-plugins-noble, testing-plugins-bullseye-arm64] include: - runner_name: ubuntu-24.04 - package_extension: rpm From 805ad2b0018ba9ab3459d1bd4fd408e843b094a9 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 17 Jul 2025 05:04:15 -0400 Subject: [PATCH 2/4] wip --- .../deb.json | 5 + .../pkg.json | 10 + .../rpm.json | 5 + src/apps/java/camel/jmx/mode/listroutes.pm | 122 +++++++++ src/apps/java/camel/jmx/mode/routes.pm | 254 ++++++++++++++++++ src/apps/java/camel/jmx/plugin.pm | 49 ++++ 6 files changed, 445 insertions(+) create mode 100644 packaging/centreon-plugin-Applications-Apache-Camel-Jmx/deb.json create mode 100644 packaging/centreon-plugin-Applications-Apache-Camel-Jmx/pkg.json create mode 100644 packaging/centreon-plugin-Applications-Apache-Camel-Jmx/rpm.json create mode 100644 src/apps/java/camel/jmx/mode/listroutes.pm create mode 100644 src/apps/java/camel/jmx/mode/routes.pm create mode 100644 src/apps/java/camel/jmx/plugin.pm diff --git a/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/deb.json b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/deb.json new file mode 100644 index 0000000000..41a67333c3 --- /dev/null +++ b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/deb.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "libjmx4perl-perl" + ] +} diff --git a/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/pkg.json b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/pkg.json new file mode 100644 index 0000000000..8832f310fa --- /dev/null +++ b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/pkg.json @@ -0,0 +1,10 @@ +{ + "pkg_name": "centreon-plugin-Applications-Apache-Camel-Jmx", + "pkg_summary": "Centreon Plugin to monitor Apache Camel using JMX protocol", + "plugin_name": "centreon_apache_camel_jmx.pl", + "files": [ + "centreon/plugins/script_custom.pm", + "centreon/common/protocols/jmx/", + "apps/java/camel/jmx/" + ] +} diff --git a/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/rpm.json b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/rpm.json new file mode 100644 index 0000000000..5d2a81f7a8 --- /dev/null +++ b/packaging/centreon-plugin-Applications-Apache-Camel-Jmx/rpm.json @@ -0,0 +1,5 @@ +{ + "dependencies": [ + "perl(JMX::Jmx4Perl)" + ] +} \ No newline at end of file diff --git a/src/apps/java/camel/jmx/mode/listroutes.pm b/src/apps/java/camel/jmx/mode/listroutes.pm new file mode 100644 index 0000000000..697cb7ca82 --- /dev/null +++ b/src/apps/java/camel/jmx/mode/listroutes.pm @@ -0,0 +1,122 @@ +# +# Copyright 2025 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::java::camel::jmx::jmx::mode::listroutes; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; + +my @mapping = ('name', 'context', 'state'); + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $options{options}->add_options(arguments => { + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $request = [ + { + mbean => 'org.apache.camel:context=*,name=*,type=routes', + attributes => [ + { name => 'State' } + ] + } + ]; + my $datas = $options{custom}->get_attributes(request => $request); + + my $results = {}; + foreach my $mbean (keys %$datas) { + my ($name, $context); + + $name = $1 if ($mbean =~ /name=(.*?)(?:,|$)/); + $context = $1 if ($context =~ /context=(.*?)(?:,|$)/); + $name =~ s/^"(.*)"$/$1/; + $context =~ s/^"(.*)"$/$1/; + + $results->{$name} = { name => $name, context => $context, state => $datas->{$mbean}->{State} }; + } + + return $results; +} + +sub run { + my ($self, %options) = @_; + + my $results = $self->manage_selection(custom => $options{custom}); + foreach my $name (sort keys %$results) { + $self->{output}->output_add(long_msg => + join('', map("[$_ = " . $results->{$name}->{$_} . ']', @mapping)) + ); + } + + $self->{output}->output_add( + severity => 'OK', + short_msg => 'List routes:' + ); + $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 => [@mapping]); +} + +sub disco_show { + my ($self, %options) = @_; + + my $results = $self->manage_selection(custom => $options{custom}); + foreach (sort keys %$results) { + $self->{output}->add_disco_entry( + %{$results->{$_}} + ); + } +} + +1; + +__END__ + +=head1 MODE + +List routes. + +=over 8 + +=back + +=cut + diff --git a/src/apps/java/camel/jmx/mode/routes.pm b/src/apps/java/camel/jmx/mode/routes.pm new file mode 100644 index 0000000000..e0532a83ec --- /dev/null +++ b/src/apps/java/camel/jmx/mode/routes.pm @@ -0,0 +1,254 @@ +# +# Copyright 2025 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::java::camel::jmx::jmx::mode::routes; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; +use Digest::MD5 qw(md5_hex); +use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); + +sub custom_exchange_perfdata { + my ($self) = @_; + + my $instances = []; + foreach (@{$self->{instance_mode}->{custom_perfdata_instances}}) { + push @$instances, $self->{result_values}->{$_}; + } + + $self->{output}->perfdata_add( + nlabel => $self->{nlabel}, + instances => $instances, + value => $self->{result_values}->{ $self->{key_values}->[0]->{name} }, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}), + min => 0 + ); +} + +sub custom_status_output { + my ($self, %options) = @_; + + return sprintf( + 'state: %s [statistics enabled: %s]', + $self->{result_values}->{state}, + $self->{result_values}->{statisticsEnabled} + ); +} + +sub route_long_output { + my ($self, %options) = @_; + + return "checking route '" . $options{instance} . "'"; +} + +sub prefix_route_output { + my ($self, %options) = @_; + + return "Route '" . $options{instance} . "' "; +} + +sub prefix_exchange_output { + my ($self, %options) = @_; + + return "number of exchanges "; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'routes', type => 3, cb_prefix_output => 'prefix_route_output', cb_long_output => 'route_long_output', indent_long_output => ' ', message_multiple => 'All routes are ok', + group => [ + { name => 'global', type => 0, skipped_code => { -10 => 1 } }, + { name => 'exchanges', type => 0, cb_prefix_output => 'prefix_exchange_output', skipped_code => { -10 => 1 } } + ] + } + ]; + + $self->{maps_counters}->{global} = [ + { label => 'status', type => 2, warning_default => '%{statisticsEnabled} eq "no" || %{state} =~ /suspend/i', set => { + key_values => [ { name => 'state' }, { name => 'statisticsEnabled' }, { name => 'name' }, { name => 'context' } ], + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => \&catalog_status_threshold_ng + } + } + ]; + + $self->{maps_counters}->{exchanges} = [ + { label => 'exchanges-completed', nlabel => 'route.exchanges.completed.count', set => { + key_values => [ { name => 'completed', diff => 1 }, { name => 'name' }, { name => 'context' } ], + output_template => 'completed: %s', + closure_custom_perfdata => $self->can('custom_exchange_perfdata') + } + }, + { label => 'exchanges-failed', nlabel => 'route.exchanges.failed.count', set => { + key_values => [ { name => 'failed', diff => 1 }, { name => 'name' }, { name => 'context' } ], + output_template => 'failed: %s', + closure_custom_perfdata => $self->can('custom_exchange_perfdata') + } + }, + { label => 'exchanges-inflight', nlabel => 'route.exchanges.inflight.count', set => { + key_values => [ { name => 'inFlight', diff => 1 }, { name => 'name' }, { name => 'context' } ], + output_template => 'inflight: %s', + closure_custom_perfdata => $self->can('custom_exchange_perfdata') + } + } + ]; +} + +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-name:s' => { name => 'filter_name' }, + 'filter-context:s' => { name => 'filter_context' }, + 'custom-perfdata-instances:s' => { name => 'custom_perfdata_instances' } + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + if (!defined($self->{option_results}->{custom_perfdata_instances}) || $self->{option_results}->{custom_perfdata_instances} eq '') { + $self->{option_results}->{custom_perfdata_instances} = '%(name)'; + } + + $self->{custom_perfdata_instances} = $self->custom_perfdata_instances( + option_name => '--custom-perfdata-instances', + instances => $self->{option_results}->{custom_perfdata_instances}, + labels => { name => 1, context => 1 } + ); +} + +sub manage_selection { + my ($self, %options) = @_; + + my $request = [ + { + mbean => 'org.apache.camel:context=*,name=*,type=routes', + attributes => [ + { name => 'StatisticsEnabled' }, { name => 'State' }, + { name => 'ExchangesInflight' }, { name => 'ExchangesFailed' }, + { name => 'ExchangesCompleted' } + ] + } + ]; + + my $result = $options{custom}->get_attributes(request => $request, nothing_quit => 1); + + $self->{cache_name} = 'apache_camel_' . $self->{mode} . '_' . + md5_hex( + $options{custom}->get_connection_info() . '_' . + (defined($self->{option_results}->{filter_counters}) ? $self->{option_results}->{filter_counters} : '') . '_' . + (defined($self->{option_results}->{filter_name}) ? $self->{option_results}->{filter_name} : '') . '_' . + (defined($self->{option_results}->{filter_context}) ? $self->{option_results}->{filter_context} : '') + ); + + $self->{routes} = {}; + foreach my $mbean (keys %$result) { + my ($name, $context); + + $name = $1 if ($mbean =~ /name=(.*?)(?:,|$)/); + $context = $1 if ($context =~ /context=(.*?)(?:,|$)/); + $name =~ s/^"(.*)"$/$1/; + $context =~ s/^"(.*)"$/$1/; + + next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && + $name !~ /$self->{option_results}->{filter_name}/); + next if (defined($self->{option_results}->{filter_context}) && $self->{option_results}->{filter_context} ne '' && + $context !~ /$self->{option_results}->{filter_context}/); + + $self->{routes}->{$name} = { + global => { + context => $context, + name => $name, + state => $result->{$mbean}->{'State'}, + statisticsEnabled => $result->{$mbean}->{'StatisticsEnabled'} =~ /true|1/i ? 'yes' : 'no' + }, + exchanges => { + context => $context, + name => $name, + inFlight => $result->{$mbean}->{'ExchangesInflight'}, + failed => $result->{$mbean}->{'ExchangesFailed'}, + completed => $result->{$mbean}->{'ExchangesCompleted'} + } + }; + } + + if (scalar(keys %{$self->{routes}}) <= 0) { + $self->{output}->output_add(short_msg => 'no routes found'); + } +} + +1; + +__END__ + +=head1 MODE + +Check routes. + +=over 8 + +=item B<--filter-name> + +Filter routes by name (can be a regexp). + +=item B<--filter-context> + +Filter routes by context (can be a regexp). + +=item B<--custom-perfdata-instances> + +Define perfdatas instance (default: '%(name)') + +=item B<--unknown-status> + +Define the conditions to match for the status to be UNKNOWN. +You can use the following variables: %{state}, %{statisticsEnabled}, %{name}, %{context} + +=item B<--warning-status> + +Define the conditions to match for the status to be WARNING (default: '%{statisticsEnabled} eq "no" || %{state} =~ /suspend/i'). +You can use the following variables: %{state}, %{statisticsEnabled}, %{name}, %{context} + +=item B<--critical-status> + +Define the conditions to match for the status to be CRITICAL. +You can use the following variables: %{state}, %{statisticsEnabled}, %{name}, %{context} + +=item B<--warning-*> B<--critical-*> + +Thresholds. +Can be: +'exchanges-completed', 'exchanges-failed', 'exchanges-inflight'. + +=back + +=cut diff --git a/src/apps/java/camel/jmx/plugin.pm b/src/apps/java/camel/jmx/plugin.pm new file mode 100644 index 0000000000..9f535bad89 --- /dev/null +++ b/src/apps/java/camel/jmx/plugin.pm @@ -0,0 +1,49 @@ +# +# Copyright 2025 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::java::camel::jmx::plugin; + +use strict; +use warnings; +use base qw(centreon::plugins::script_custom); + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{modes} = { + 'routes' => 'apps::java::camel::jmx::mode::routes', + 'list-routes' => 'apps::java::camel::jmx::mode::listroutes' + }; + + $self->{custom_modes}->{jolokia} = 'centreon::common::protocols::jmx::custom::jolokia'; + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Apache Camel in JMX. Need Jolokia agent. + +=cut From fd4250030edaa428ee3d70d1a25afff91feb291f Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 17 Jul 2025 05:13:07 -0400 Subject: [PATCH 3/4] wip --- src/apps/java/camel/jmx/mode/routes.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/java/camel/jmx/mode/routes.pm b/src/apps/java/camel/jmx/mode/routes.pm index e0532a83ec..fb9cd78ad5 100644 --- a/src/apps/java/camel/jmx/mode/routes.pm +++ b/src/apps/java/camel/jmx/mode/routes.pm @@ -109,7 +109,7 @@ sub set_counters { } }, { label => 'exchanges-inflight', nlabel => 'route.exchanges.inflight.count', set => { - key_values => [ { name => 'inFlight', diff => 1 }, { name => 'name' }, { name => 'context' } ], + key_values => [ { name => 'inFlight' }, { name => 'name' }, { name => 'context' } ], output_template => 'inflight: %s', closure_custom_perfdata => $self->can('custom_exchange_perfdata') } From 2f568964f45dba08882fb0e734fb185c3024ba08 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 17 Jul 2025 06:13:01 -0400 Subject: [PATCH 4/4] fix --- src/apps/java/camel/jmx/mode/listroutes.pm | 6 ++++-- src/apps/java/camel/jmx/mode/routes.pm | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apps/java/camel/jmx/mode/listroutes.pm b/src/apps/java/camel/jmx/mode/listroutes.pm index 697cb7ca82..fc25090d30 100644 --- a/src/apps/java/camel/jmx/mode/listroutes.pm +++ b/src/apps/java/camel/jmx/mode/listroutes.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package apps::java::camel::jmx::jmx::mode::listroutes; +package apps::java::camel::jmx::mode::listroutes; use base qw(centreon::plugins::mode); @@ -61,9 +61,11 @@ sub manage_selection { my ($name, $context); $name = $1 if ($mbean =~ /name=(.*?)(?:,|$)/); - $context = $1 if ($context =~ /context=(.*?)(?:,|$)/); + $context = $1 if ($mbean =~ /context=(.*?)(?:,|$)/); $name =~ s/^"(.*)"$/$1/; + $name =~ s/<.*?>//g; $context =~ s/^"(.*)"$/$1/; + $context =~ s/<.*?>//g; $results->{$name} = { name => $name, context => $context, state => $datas->{$mbean}->{State} }; } diff --git a/src/apps/java/camel/jmx/mode/routes.pm b/src/apps/java/camel/jmx/mode/routes.pm index fb9cd78ad5..a3135be9a8 100644 --- a/src/apps/java/camel/jmx/mode/routes.pm +++ b/src/apps/java/camel/jmx/mode/routes.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package apps::java::camel::jmx::jmx::mode::routes; +package apps::java::camel::jmx::mode::routes; use base qw(centreon::plugins::templates::counter); @@ -175,9 +175,11 @@ sub manage_selection { my ($name, $context); $name = $1 if ($mbean =~ /name=(.*?)(?:,|$)/); - $context = $1 if ($context =~ /context=(.*?)(?:,|$)/); + $context = $1 if ($mbean =~ /context=(.*?)(?:,|$)/); $name =~ s/^"(.*)"$/$1/; + $name =~ s/<.*?>//g; $context =~ s/^"(.*)"$/$1/; + $content =~ s/<.*?>//g; next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/);