(plugin) apps::monitoring::linux::nodeexporter - correct paths and disco keys name

This commit is contained in:
lchrdn 2022-07-12 15:34:48 +02:00 committed by GitHub
parent 5fe4edadc5
commit 894f98f3a0
8 changed files with 22 additions and 22 deletions

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::cpu; package apps::monitoring::nodeexporter::linux::mode::cpu;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::listinterfaces; package apps::monitoring::nodeexporter::linux::mode::listinterfaces;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);
@ -52,7 +52,7 @@ sub manage_selection {
foreach my $data (@{$raw_metrics->{$metric}->{data}}) { foreach my $data (@{$raw_metrics->{$metric}->{data}}) {
$self->{interfaces}->{$data->{dimensions}->{device}}->{name} = $data->{dimensions}->{device}; $self->{interfaces}->{$data->{dimensions}->{device}}->{name} = $data->{dimensions}->{device};
$self->{interfaces}->{$data->{dimensions}->{device}}->{state} = ($data->{value} == 1) ? "up" : "down" ; $self->{interfaces}->{$data->{dimensions}->{device}}->{status} = ($data->{value} == 1) ? "up" : "down" ;
} }
} }
} }
@ -62,8 +62,8 @@ sub run {
$self->manage_selection(%options); $self->manage_selection(%options);
foreach my $interface (sort keys %{$self->{interfaces}}) { foreach my $interface (sort keys %{$self->{interfaces}}) {
$self->{output}->output_add(long_msg => '[interface = ' . $interface . "]" . $self->{output}->output_add(long_msg => '[name = ' . $interface . "]" .
"[state = '" . $self->{interfaces}->{$interface}->{state} . "']" "[status = '" . $self->{interfaces}->{$interface}->{status} . "']"
); );
} }
@ -76,7 +76,7 @@ sub run {
sub disco_format { sub disco_format {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['interface', 'state']); $self->{output}->add_disco_format(elements => ['name', 'status']);
} }
sub disco_show { sub disco_show {
@ -85,8 +85,8 @@ sub disco_show {
$self->manage_selection(%options); $self->manage_selection(%options);
foreach my $interface (sort keys %{$self->{interfaces}}) { foreach my $interface (sort keys %{$self->{interfaces}}) {
$self->{output}->add_disco_entry( $self->{output}->add_disco_entry(
interface => $self->{interfaces}->{$interface}->{name}, name => $self->{interfaces}->{$interface}->{name},
state => $self->{interfaces}->{$interface}->{state}, status => $self->{interfaces}->{$interface}->{status},
); );
} }
} }

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::liststorages; package apps::monitoring::nodeexporter::linux::mode::liststorages;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::load; package apps::monitoring::nodeexporter::linux::mode::load;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::memory; package apps::monitoring::nodeexporter::linux::mode::memory;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::storage; package apps::monitoring::nodeexporter::linux::mode::storage;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::mode::traffic; package apps::monitoring::nodeexporter::linux::mode::traffic;
use base qw(centreon::plugins::templates::counter); use base qw(centreon::plugins::templates::counter);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);

View File

@ -18,7 +18,7 @@
# limitations under the License. # limitations under the License.
# #
package apps::monitoring::nodeexporter::plugin; package apps::monitoring::nodeexporter::linux::plugin;
use strict; use strict;
use warnings; use warnings;
@ -31,13 +31,13 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{$self->{modes}} = ( %{$self->{modes}} = (
'cpu' => 'apps::monitoring::nodeexporter::mode::cpu', 'cpu' => 'apps::monitoring::nodeexporter::linux::mode::cpu',
'list-interfaces' => 'apps::monitoring::nodeexporter::mode::listinterfaces', 'list-interfaces' => 'apps::monitoring::nodeexporter::linux::mode::listinterfaces',
'list-storages' => 'apps::monitoring::nodeexporter::mode::liststorages', 'list-storages' => 'apps::monitoring::nodeexporter::linux::mode::liststorages',
'load' => 'apps::monitoring::nodeexporter::mode::load', 'load' => 'apps::monitoring::nodeexporter::linux::mode::load',
'memory' => 'apps::monitoring::nodeexporter::mode::memory', 'memory' => 'apps::monitoring::nodeexporter::linux::mode::memory',
'storage' => 'apps::monitoring::nodeexporter::mode::storage', 'storage' => 'apps::monitoring::nodeexporter::linux::mode::storage',
'traffic' => 'apps::monitoring::nodeexporter::mode::traffic' 'traffic' => 'apps::monitoring::nodeexporter::linux::mode::traffic'
); );
$self->{custom_modes}{web} = 'centreon::common::monitoring::openmetrics::custom::web'; $self->{custom_modes}{web} = 'centreon::common::monitoring::openmetrics::custom::web';
@ -50,6 +50,6 @@ __END__
=head1 PLUGIN DESCRIPTION =head1 PLUGIN DESCRIPTION
Check host metrics based on node exporter's metrics. Check Linux OS-based host metrics based on node exporter's metrics.
=cut =cut