(plugin) network::viptela::snmp (#3471)
This commit is contained in:
parent
baf918689d
commit
eacd3c4927
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-ffanged 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 network::viptela::snmp::mode::components::fan;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fan");
|
||||
$self->{components}->{fan} = { name => 'fan', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'fan'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'fan');
|
||||
my $instance = 'fan.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"fan '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'fan', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("fan '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::components::led;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking led");
|
||||
$self->{components}->{led} = { name => 'led', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'led'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'led');
|
||||
my $instance = 'led.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'led', instance => $instance));
|
||||
$self->{components}->{led}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"led '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'led', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("led '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fnimged 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 network::viptela::snmp::mode::components::nim;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking nim");
|
||||
$self->{components}->{nim} = { name => 'nim', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'nim'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'nim');
|
||||
my $instance = 'nim.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'nim', instance => $instance));
|
||||
$self->{components}->{nim}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"nim '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'nim', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("nim '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fpemged 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 network::viptela::snmp::mode::components::pem;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking pem");
|
||||
$self->{components}->{pem} = { name => 'pem', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'pem'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'pem');
|
||||
my $instance = 'pem.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'pem', instance => $instance));
|
||||
$self->{components}->{pem}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"pem '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'pem', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("pem '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fpimged 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 network::viptela::snmp::mode::components::pim;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking pim");
|
||||
$self->{components}->{pim} = { name => 'pim', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'pim'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'pim');
|
||||
my $instance = 'pim.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'pim', instance => $instance));
|
||||
$self->{components}->{pim}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"pim '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'pim', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("pim '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,82 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::components::temperature;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = { name => 'temperatures', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'temperature'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'temperature');
|
||||
my $instance = 'temperature.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
my $measure = '-';
|
||||
$measure = $1 if ($_->{measure} =~ /(\d+)\s+degrees\s+C/);
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"temperature '%s' status is '%s' [instance: %s, value: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance,
|
||||
$measure
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'temperature', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("temperature '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
|
||||
next if ($measure eq '-');
|
||||
|
||||
($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $_->{measure});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("temperature '%s' is '%s' C", $_->{name}, $measure)
|
||||
);
|
||||
}
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => 'hardware.temperature.celsius',
|
||||
unit => 'C',
|
||||
instances => $_->{name},
|
||||
value => $measure,
|
||||
warning => $warn,
|
||||
critical => $crit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fusbged 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 network::viptela::snmp::mode::components::usb;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub load {}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking usb");
|
||||
$self->{components}->{usb} = { name => 'usb', total => 0, skip => 0 };
|
||||
return if ($self->check_filter(section => 'usb'));
|
||||
|
||||
my ($exit, $warn, $crit, $checked);
|
||||
foreach (@{$self->{results}}) {
|
||||
next if ($_->{type} ne 'usb');
|
||||
my $instance = 'usb.' . $_->{name};
|
||||
next if ($self->check_filter(section => 'usb', instance => $instance));
|
||||
$self->{components}->{usb}->{total}++;
|
||||
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"usb '%s' status is '%s' [instance: %s]",
|
||||
$_->{name},
|
||||
$_->{status},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
$exit = $self->get_severity(label => 'default', section => 'usb', value => $_->{status});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("usb '%s' status is '%s'", $_->{name}, $_->{status})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,237 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::controlconnections;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
use Socket;
|
||||
|
||||
sub connection_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking control connection [public: %s] [private: %s] [type: %s]",
|
||||
$options{instance_value}->{publicIp},
|
||||
$options{instance_value}->{privateIp},
|
||||
$options{instance_value}->{type}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_connection_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking control connection [public: %s] [private: %s] [type: %s] ",
|
||||
$options{instance_value}->{publicIp},
|
||||
$options{instance_value}->{privateIp},
|
||||
$options{instance_value}->{type}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_global_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'Number of control connections ';
|
||||
}
|
||||
|
||||
my $map_status = {
|
||||
0 => 'down', 1 => 'connect', 2 => 'handshake', 3 => 'trying',
|
||||
4 => 'challenge', 5 => 'challengeResp', 6 => 'challengeAck',
|
||||
7 => 'up', 8 => 'tearDown'
|
||||
};
|
||||
my $map_type = {
|
||||
0 => 'unknown', 1 => 'vedge', 2 => 'vhub',
|
||||
3 => 'vsmart', 4 => 'vbond', 5 => 'vmanage',
|
||||
6 => 'ztp', 7 => 'vcontainer'
|
||||
};
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
|
||||
{ name => 'connections', type => 3, cb_prefix_output => 'prefix_connection_output', cb_long_output => 'connection_long_output',
|
||||
indent_long_output => ' ', message_multiple => 'All control connections are ok',
|
||||
group => [
|
||||
{ name => 'status', type => 0, skipped_code => { -10 => 1 } }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'connnections-detected', display_ok => 0, nlabel => 'control.connections.detected.count', set => {
|
||||
key_values => [ { name => 'detected' } ],
|
||||
output_template => 'detected: %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
foreach (values %$map_status) {
|
||||
push @{$self->{maps_counters}->{global}},
|
||||
{ label => 'connections-' . lc($_), display_ok => 0, nlabel => 'control.connections.' . $_ . '.count', set => {
|
||||
key_values => [ { name => $_ } ],
|
||||
output_template => $_ . ': %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$self->{maps_counters}->{status} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
critical_default => '%{status} !~ /up|connect/',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'status' }, { name => 'type' },
|
||||
{ name => 'publicIp' }, { name => 'privateIp' }
|
||||
],
|
||||
output_template => "status: %s",
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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 => {
|
||||
'filter-public-ip:s' => { name => 'filter_public_ip' },
|
||||
'filter-private-ip:s' => { name => 'filter_private_ip' },
|
||||
'filter-type:s' => { name => 'filter_type' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{global} = { detected => 0 };
|
||||
foreach (values %$map_status) {
|
||||
$self->{global}->{$_} = 0;
|
||||
}
|
||||
|
||||
my $oid_status = '.1.3.6.1.4.1.41916.4.2.2.1.15'; # controlConnectionsState
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_status,
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{connections} = {};
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
$oid =~ /^$oid_status\.(\d+\.(\d+)\.\d+\.\d+\.(.*))$/;
|
||||
my $instance = $1;
|
||||
my $type = $map_type->{$2};
|
||||
my @addr = split(/\./, $3);
|
||||
my ($publicIp, $privateIp);
|
||||
|
||||
if ($addr[0] == 4) {
|
||||
$privateIp = $addr[1] . '.' . $addr[2] . '.' . $addr[3] . '.' . $addr[4] . ':' . $addr[5];
|
||||
}
|
||||
if ($addr[6] == 4) {
|
||||
$publicIp = $addr[7] . '.' . $addr[8] . '.' . $addr[9] . '.' . $addr[10] . ':' . $addr[11];
|
||||
}
|
||||
|
||||
next if (defined($self->{option_results}->{filter_public_ip}) && $self->{option_results}->{filter_public_ip} ne '' &&
|
||||
$publicIp !~ /$self->{option_results}->{filter_public_ip}/);
|
||||
next if (defined($self->{option_results}->{filter_private_ip}) && $self->{option_results}->{filter_private_ip} ne '' &&
|
||||
$privateIp !~ /$self->{option_results}->{filter_private_ip}/);
|
||||
next if (defined($self->{option_results}->{filter_type}) && $self->{option_results}->{filter_type} ne '' &&
|
||||
$type !~ /$self->{option_results}->{filter_type}/);
|
||||
|
||||
$self->{connections}->{$instance} = {
|
||||
publicIp => $publicIp,
|
||||
privateIp => $privateIp,
|
||||
type => $type,
|
||||
status => {
|
||||
publicIp => $publicIp,
|
||||
privateIp => $privateIp,
|
||||
type => $type,
|
||||
status => $map_status->{ $snmp_result->{$oid} }
|
||||
}
|
||||
};
|
||||
$self->{global}->{detected}++;
|
||||
$self->{global}->{ $map_status->{ $snmp_result->{$oid} } }++;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check control connections.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-public-ip>
|
||||
|
||||
Filter connections by public ip address.
|
||||
|
||||
=item B<--filter-private-ip>
|
||||
|
||||
Filter connections by private ip address.
|
||||
|
||||
=item B<--filter-type>
|
||||
|
||||
Filter connections by type.
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set unknown threshold for status.
|
||||
Can used special variables like: %{status}, %{type}, %{privateIp}, %{publicIp}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{status}, %{type}, %{privateIp}, %{publicIp}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} !~ /up|connect/').
|
||||
Can used special variables like: %{status}, %{type}, %{privateIp}, %{publicIp}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'connnections-detected', 'connections-challengeack',
|
||||
'connections-handshake', 'connections-challenge', 'connections-teardown',
|
||||
'connections-challengeresp', 'connections-up', 'connections-connect',
|
||||
'connections-trying', 'connections-down'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,86 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::cpu ;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'cpu-utilization', nlabel => 'cpu.utilization.percentage', set => {
|
||||
key_values => [ { name => 'cpu_util' } ],
|
||||
output_template => 'Cpu utilization: %.2f%%',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_cpu_idle = '.1.3.6.1.4.1.41916.11.1.16.0'; # systemStatusCpuIdle
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [$oid_cpu_idle],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
$self->{global} = {
|
||||
cpu_util => 100 - $snmp_result->{$oid_cpu_idle}
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check cpu.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'cpu-utilization' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,129 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::disk;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
sub custom_disk_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"Disk total: %s %s used: %s %s (%.2f%%) free: %s %s (%.2f%%)",
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total}),
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used}),
|
||||
$self->{result_values}->{prct_used},
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free}),
|
||||
$self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'disk', type => 0 }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{disk} = [
|
||||
{ label => 'usage', nlabel => 'disk.usage.bytes', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_disk_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'usage-free', display_ok => 0, nlabel => 'disk.free.bytes', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_disk_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'usage-prct', display_ok => 0, nlabel => 'disk.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'free' }, { name => 'used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_disk_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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) = @_;
|
||||
|
||||
my $oid_free = '.1.3.6.1.4.1.41916.11.1.25.0'; # systemStatusDiskAvail
|
||||
my $oid_total = '.1.3.6.1.4.1.41916.11.1.23.0'; # systemStatusDiskSize
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [$oid_free, $oid_total],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
my ($total, $free);
|
||||
$total = centreon::plugins::misc::convert_bytes(value => $1, unit => $2 . 'B')
|
||||
if ($snmp_result->{$oid_total} =~ /(\d+)\s*(\S+)/);
|
||||
$free = centreon::plugins::misc::convert_bytes(value => $1, unit => $2 . 'B')
|
||||
if ($snmp_result->{$oid_free} =~ /(\d+)\s*(\S+)/);
|
||||
|
||||
$self->{disk} = {
|
||||
total => $total,
|
||||
used => $total - $free,
|
||||
free => $free,
|
||||
prct_free => $free * 100 / $total,
|
||||
prct_used => 100 - ($free * 100 / $total)
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check disk usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,299 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::gretunnels;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
use Socket;
|
||||
|
||||
sub custom_packets_perfdata {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
nlabel => $self->{nlabel},
|
||||
instances => [
|
||||
$self->{result_values}->{sourceIp},
|
||||
$self->{result_values}->{destIp}
|
||||
],
|
||||
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 tunnel_long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"checking gre tunnel [src: %s] [dst: %s]",
|
||||
$options{instance_value}->{sourceIp},
|
||||
$options{instance_value}->{destIp}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_tunnel_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
"gre tunnel [src: %s] [dst: %s] ",
|
||||
$options{instance_value}->{sourceIp},
|
||||
$options{instance_value}->{destIp}
|
||||
);
|
||||
}
|
||||
|
||||
sub prefix_global_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'Number of gre tunnels ';
|
||||
}
|
||||
|
||||
sub prefix_packet_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return 'packets ';
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'global', type => 0, cb_prefix_output => 'prefix_global_output' },
|
||||
{ name => 'tunnels', type => 3, cb_prefix_output => 'prefix_tunnel_output', cb_long_output => 'tunnel_long_output',
|
||||
indent_long_output => ' ', message_multiple => 'All gre tunnels are ok',
|
||||
group => [
|
||||
{ name => 'status', type => 0, skipped_code => { -10 => 1 } },
|
||||
{ name => 'packet', type => 0, cb_prefix_output => 'prefix_packet_output', skipped_code => { -10 => 1 } },
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{global} = [
|
||||
{ label => 'gretunnels-detected', display_ok => 0, nlabel => 'gre_tunnels.detected.count', set => {
|
||||
key_values => [ { name => 'detected' } ],
|
||||
output_template => 'detected: %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gretunnels-up', display_ok => 0, nlabel => 'gre_tunnels.operational.up.count', set => {
|
||||
key_values => [ { name => 'oper_up' } ],
|
||||
output_template => 'up: %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gretunnels-down', display_ok => 0, nlabel => 'gre_tunnels.operational.down.count', set => {
|
||||
key_values => [ { name => 'oper_down' } ],
|
||||
output_template => 'down: %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'gretunnels-invalid', display_ok => 0, nlabel => 'gre_tunnels.operational.invalid.count', set => {
|
||||
key_values => [ { name => 'oper_invalid' } ],
|
||||
output_template => 'invalid: %s',
|
||||
perfdatas => [
|
||||
{ template => '%s', min => 0 }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{status} = [
|
||||
{
|
||||
label => 'status',
|
||||
type => 2,
|
||||
critical_default => '%{adminState} eq "up" and %{operState} ne "up"',
|
||||
set => {
|
||||
key_values => [
|
||||
{ name => 'adminState' }, { name => 'operState' },
|
||||
{ name => 'sourceIp' }, { name => 'destIp' }
|
||||
],
|
||||
output_template => "status: %s",
|
||||
closure_custom_perfdata => sub { return 0; },
|
||||
closure_custom_threshold_check => \&catalog_status_threshold_ng
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{packet} = [
|
||||
{ label => 'gretunnel-packets-in', nlabel => 'gre_tunnel.packets.in.count', set => {
|
||||
key_values => [ { name => 'packetsIn', diff => 1 }, { name => 'sourceIp' }, { name => 'destIp' } ],
|
||||
output_template => 'in: %s',
|
||||
closure_custom_perfdata => $self->can('custom_packets_perfdata')
|
||||
}
|
||||
},
|
||||
{ label => 'gretunnel-packets-out', nlabel => 'gre_tunnel.packets.out.count', set => {
|
||||
key_values => [ { name => 'packetsOut', diff => 1 }, { name => 'sourceIp' }, { name => 'destIp' } ],
|
||||
output_template => 'out: %s',
|
||||
closure_custom_perfdata => $self->can('custom_packets_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-src-ip:s' => { name => 'filter_src_ip' },
|
||||
'filter-dest-ip:s' => { name => 'filter_dest_ip' }
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
my $map_status = {
|
||||
0 => 'down', 1 => 'up', 2 => 'invalid'
|
||||
};
|
||||
|
||||
my $mapping_name = {
|
||||
sourceIp => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.3' }, # tunnelGreKeepalivesSourceIp
|
||||
destIp => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.4' } # tunnelGreKeepalivesDestIp
|
||||
};
|
||||
my $mapping = {
|
||||
adminState => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.5', map => $map_status }, # tunnelGreKeepalivesAdminState
|
||||
operState => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.6', map => $map_status }, # tunnelGreKeepalivesOperState
|
||||
packetsOut => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.10' }, # tunnelGreKeepalivesTxPackets
|
||||
packetsIn => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.11' } # tunnelGreKeepalivesRxPackets
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if ($options{snmp}->is_snmpv1()) {
|
||||
$self->{output}->add_option_msg(short_msg => 'Need to use SNMP v2c or v3.');
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{global} = { detected => 0, oper_up => 0, oper_down => 0, oper_invalid => 0 };
|
||||
$self->{tunnels} = {};
|
||||
|
||||
my $oid_tunnelTable = '.1.3.6.1.4.1.41916.4.5.2'; # tunnelGreKeepalivesTable
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_tunnelTable,
|
||||
start => $mapping_name->{sourceIp}->{oid},
|
||||
end => $mapping_name->{destIp}->{oid},
|
||||
nothing_quit => 1
|
||||
);
|
||||
foreach my $oid (keys %$snmp_result) {
|
||||
next if ($oid !~ /^$mapping_name->{sourceIp}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping_name, results => $snmp_result, instance => $instance);
|
||||
$result->{sourceIp} = inet_ntoa($result->{sourceIp});
|
||||
$result->{destIp} = inet_ntoa($result->{destIp});
|
||||
|
||||
next if (defined($self->{option_results}->{filter_src_ip}) && $self->{option_results}->{filter_src_ip} ne '' &&
|
||||
$result->{sourceIp} !~ /$self->{option_results}->{filter_src_ip}/);
|
||||
next if (defined($self->{option_results}->{filter_dest_ip}) && $self->{option_results}->{filter_dest_ip} ne '' &&
|
||||
$result->{destIp} !~ /$self->{option_results}->{filter_dest_ip}/);
|
||||
|
||||
$self->{tunnels}->{$instance} = {
|
||||
%$result,
|
||||
status => $result,
|
||||
packet => $result
|
||||
};
|
||||
}
|
||||
|
||||
return if (scalar(keys %{$self->{tunnels}}) <= 0);
|
||||
|
||||
$options{snmp}->load(
|
||||
oids => [
|
||||
map($_->{oid}, values(%$mapping))
|
||||
],
|
||||
instances => [ map($_, keys %{$self->{tunnels}}) ],
|
||||
instance_regexp => '^(.*)$'
|
||||
);
|
||||
$snmp_result = $options{snmp}->get_leef();
|
||||
|
||||
foreach (keys %{$self->{tunnels}}) {
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $_);
|
||||
|
||||
$self->{tunnels}->{$_}->{status}->{adminState} = $result->{adminState};
|
||||
$self->{tunnels}->{$_}->{status}->{operState} = $result->{operState};
|
||||
|
||||
$self->{tunnels}->{$_}->{packet}->{packetsOut} = $result->{packetsOut};
|
||||
$self->{tunnels}->{$_}->{packet}->{packetsIn} = $result->{packetsIn};
|
||||
|
||||
$self->{global}->{detected}++;
|
||||
$self->{global}->{ 'oper_' . $result->{operState} }++;
|
||||
}
|
||||
|
||||
$self->{cache_name} = 'viptela_' . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .
|
||||
md5_hex(
|
||||
(defined($self->{option_results}->{filter_counters}) ? $self->{option_results}->{filter_counters} : 'all') .
|
||||
(defined($self->{option_results}->{filter_src_ip}) ? $self->{option_results}->{filter_src_ip} : 'all') .
|
||||
(defined($self->{option_results}->{filter_dest_ip}) ? $self->{option_results}->{filter_dest_ip} : 'all')
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check GRE tunnels.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--filter-src-ip>
|
||||
|
||||
Filter tunnels by source ip address.
|
||||
|
||||
=item B<--filter-dest-ip>
|
||||
|
||||
Filter tunnels by destination ip address.
|
||||
|
||||
=item B<--unknown-status>
|
||||
|
||||
Set unknown threshold for status.
|
||||
Can used special variables like: %{adminState}, %{operState}, %{sourceIp}, %{destIp}
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{adminState}, %{operState}, %{sourceIp}, %{destIp}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{adminState} eq "up" and %{operState} ne "up"').
|
||||
Can used special variables like: %{adminState}, %{operState}, %{sourceIp}, %{destIp}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'gretunnels-detected', 'gretunnels-up', 'gretunnels-down', 'gretunnels-invalid',
|
||||
'gretunnel-packets-in', 'gretunnel-packets-out'.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,135 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::hardware;
|
||||
|
||||
use base qw(centreon::plugins::templates::hardware);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
$self->{thresholds} = {
|
||||
default => [
|
||||
['ok', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['failed', 'CRITICAL']
|
||||
]
|
||||
};
|
||||
|
||||
$self->{components_path} = 'network::viptela::snmp::mode::components';
|
||||
$self->{components_module} = ['fan', 'led', 'nim', 'pem', 'pim', 'temperature', 'usb'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $map_status = {
|
||||
0 => 'ok', 1 => 'down', 2 => 'failed'
|
||||
};
|
||||
my $map_type = {
|
||||
0 => 'temperature', 1 => 'fan', 2 => 'pem', 3 => 'pim', 4 => 'usb', 5 => 'led', 6 => 'nim'
|
||||
};
|
||||
my $mapping = {
|
||||
status => { oid => '.1.3.6.1.4.1.41916.3.1.2.1.4', map => $map_status }, # hardwareEnvironmentStatus
|
||||
measure => { oid => '.1.3.6.1.4.1.41916.3.1.2.1.5' } # hardwareEnvironmentMeasurement
|
||||
};
|
||||
my $table = '.1.3.6.1.4.1.41916.3.1.2'; # hardwareEnvironmentTable
|
||||
|
||||
$self->{results} = [];
|
||||
my $snmp_result = $options{snmp}->get_table(oid => $table, start => $mapping->{status}->{oid});
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping->{status}->{oid}\.(\d+).(\d+)\.(.*?)\.(\d+)$/);
|
||||
my $type = $map_type->{$1};
|
||||
my $instance = $1 . '.' . $2 . '.' . $3 . '.' . $4;
|
||||
my $result = $options{snmp}->map_instance(
|
||||
mapping => $mapping,
|
||||
results => $snmp_result,
|
||||
instance => $1 . '.' . $2 . '.' . $3 . '.' . $4
|
||||
);
|
||||
push @{$self->{results}}, {
|
||||
name => $self->{output}->decode(join('', map(chr($_), split(/\./, $3)))),
|
||||
type => $type,
|
||||
status => $result->{status},
|
||||
measure => $result->{measure}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check hardware.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'fan', 'led', 'nim', 'pem', 'pim', 'temperature', 'usb'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
Exclude some parts (comma seperated list) (Example: --filter=temperature)
|
||||
Can also exclude specific instance: --filter=temperature,Board
|
||||
|
||||
=item B<--no-component>
|
||||
|
||||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,[instance,]status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='temperature,OK,down'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold for 'temperature' (syntax: type,regexp,threshold)
|
||||
Example: --warning='temperature,.*,40'
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold for 'temperature' (syntax: type,regexp,threshold)
|
||||
Example: --critical='temperature,.*,50'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,182 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::interfaces;
|
||||
|
||||
use base qw(snmp_standard::mode::interfaces);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check interfaces.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--add-global>
|
||||
|
||||
Check global port statistics (By default if no --add-* option is set).
|
||||
|
||||
=item B<--add-status>
|
||||
|
||||
Check interface status.
|
||||
|
||||
=item B<--add-duplex-status>
|
||||
|
||||
Check duplex status (with --warning-status and --critical-status).
|
||||
|
||||
=item B<--add-traffic>
|
||||
|
||||
Check interface traffic.
|
||||
|
||||
=item B<--add-errors>
|
||||
|
||||
Check interface errors.
|
||||
|
||||
=item B<--add-cast>
|
||||
|
||||
Check interface cast.
|
||||
|
||||
=item B<--add-speed>
|
||||
|
||||
Check interface speed.
|
||||
|
||||
=item B<--add-volume>
|
||||
|
||||
Check interface data volume between two checks (not supposed to be graphed, useful for BI reporting).
|
||||
|
||||
=item B<--check-metrics>
|
||||
|
||||
If the expression is true, metrics are checked (Default: '%{opstatus} eq "up"').
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
|
||||
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds.
|
||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||
'in-ucast', 'in-bcast', 'in-mcast', 'out-ucast', 'out-bcast', 'out-mcast',
|
||||
'speed' (b/s).
|
||||
|
||||
=item B<--units-traffic>
|
||||
|
||||
Units of thresholds for the traffic (Default: 'percent_delta') ('percent_delta', 'bps', 'counter').
|
||||
|
||||
=item B<--units-errors>
|
||||
|
||||
Units of thresholds for errors/discards (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
|
||||
|
||||
=item B<--units-cast>
|
||||
|
||||
Units of thresholds for communication types (Default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'counter').
|
||||
|
||||
=item B<--nagvis-perfdata>
|
||||
|
||||
Display traffic perfdata to be compatible with nagvis widget.
|
||||
|
||||
=item B<--interface>
|
||||
|
||||
Set the interface (number expected) ex: 1,2,... (empty means 'check all interface').
|
||||
|
||||
=item B<--name>
|
||||
|
||||
Allows to use interface name with option --interface instead of interface oid index (Can be a regexp)
|
||||
|
||||
=item B<--speed>
|
||||
|
||||
Set interface speed for incoming/outgoing traffic (in Mb).
|
||||
|
||||
=item B<--speed-in>
|
||||
|
||||
Set interface speed for incoming traffic (in Mb).
|
||||
|
||||
=item B<--speed-out>
|
||||
|
||||
Set interface speed for outgoing traffic (in Mb).
|
||||
|
||||
=item B<--map-speed-dsl>
|
||||
|
||||
Get interface speed configuration for interface type 'adsl' and 'vdsl2'.
|
||||
|
||||
Syntax: --map-speed-dsl=interface-src-name,interface-dsl-name
|
||||
|
||||
E.g: --map-speed-dsl=Et0.835,Et0-vdsl2
|
||||
|
||||
=item B<--force-counters64>
|
||||
|
||||
Force to use 64 bits counters only. Can be used to improve performance.
|
||||
|
||||
=item B<--force-counters32>
|
||||
|
||||
Force to use 32 bits counters (even in snmp v2c and v3). Should be used when 64 bits counters are buggy.
|
||||
|
||||
=item B<--reload-cache-time>
|
||||
|
||||
Time in minutes before reloading cache file (default: 180).
|
||||
|
||||
=item B<--oid-filter>
|
||||
|
||||
Choose OID used to filter interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-display>
|
||||
|
||||
Choose OID used to display interface (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr).
|
||||
|
||||
=item B<--oid-extra-display>
|
||||
|
||||
Add an OID to display.
|
||||
|
||||
=item B<--display-transform-src>
|
||||
|
||||
Regexp src to transform display value.
|
||||
|
||||
=item B<--display-transform-dst>
|
||||
|
||||
Regexp dst to transform display value.
|
||||
|
||||
=item B<--show-cache>
|
||||
|
||||
Display cache interface datas.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,121 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::listgretunnels;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Socket;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
my $map_status = {
|
||||
0 => 'down', 1 => 'up', 2 => 'invalid'
|
||||
};
|
||||
my $mapping = {
|
||||
sourceIp => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.3' }, # tunnelGreKeepalivesSourceIp
|
||||
destIp => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.4' }, # tunnelGreKeepalivesDestIp
|
||||
adminState => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.5', map => $map_status }, # tunnelGreKeepalivesAdminState
|
||||
operState => { oid => '.1.3.6.1.4.1.41916.4.5.2.1.6', map => $map_status } # tunnelGreKeepalivesOperState
|
||||
};
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $oid_table = '.1.3.6.1.4.1.41916.4.5.2'; # tunnelGreKeepalivesTable
|
||||
my $snmp_result = $options{snmp}->get_table(
|
||||
oid => $oid_table,
|
||||
start => $mapping->{sourceIp}->{oid},
|
||||
end => $mapping->{operState}->{oid}
|
||||
);
|
||||
my $results = {};
|
||||
foreach (keys %$snmp_result) {
|
||||
next if (! /^$mapping->{sourceIp}->{oid}\.(.*)$/);
|
||||
|
||||
$results->{$1} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $1);
|
||||
$results->{$1}->{sourceIp} = inet_ntoa($results->{$1}->{sourceIp});
|
||||
$results->{$1}->{destIp} = inet_ntoa($results->{$1}->{destIp});
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->manage_selection(snmp => $options{snmp});
|
||||
foreach my $instance (sort keys %$results) {
|
||||
$self->{output}->output_add(long_msg =>
|
||||
join('', map("[$_: " . $results->{$instance}->{$_} . ']', keys(%$mapping)))
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'List gre tunnels:'
|
||||
);
|
||||
$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 => [keys %$mapping]);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $results = $self->manage_selection(snmp => $options{snmp});
|
||||
foreach (sort keys %$results) {
|
||||
$self->{output}->add_disco_entry(
|
||||
%{$results->{$_}}
|
||||
);
|
||||
}
|
||||
}
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List GRE tunnels.
|
||||
|
||||
=over 8
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,189 @@
|
|||
#
|
||||
# Copyright 2022 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and alarm 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 network::viptela::snmp::mode::memory;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub custom_usage_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return sprintf(
|
||||
'Ram total: %s %s used (-buffers/cache): %s %s (%.2f%%) free: %s %s (%.2f%%)',
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{total}),
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{used}),
|
||||
$self->{result_values}->{prct_used},
|
||||
$self->{perfdata}->change_bytes(value => $self->{result_values}->{free}),
|
||||
$self->{result_values}->{prct_free}
|
||||
);
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{maps_counters_type} = [
|
||||
{ name => 'ram', type => 0, skipped_code => { -10 => 1 } }
|
||||
];
|
||||
|
||||
$self->{maps_counters}->{ram} = [
|
||||
{ label => 'usage', nlabel => 'memory.usage.bytes', set => {
|
||||
key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', set => {
|
||||
key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, max => 'total', unit => 'B', cast_int => 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => {
|
||||
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'prct_free' }, { name => 'total' } ],
|
||||
closure_custom_output => $self->can('custom_usage_output'),
|
||||
perfdatas => [
|
||||
{ template => '%.2f', min => 0, max => 100, unit => '%' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'buffer', nlabel => 'memory.buffer.bytes', set => {
|
||||
key_values => [ { name => 'buffers' } ],
|
||||
output_template => 'buffer: %s %s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => 'B' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'cached', nlabel => 'memory.cached.bytes', set => {
|
||||
key_values => [ { name => 'cached' } ],
|
||||
output_template => 'cached: %s %s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => 'B' }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ label => 'shared', nlabel => 'memory.shared.bytes', set => {
|
||||
key_values => [ { name => 'memShared' } ],
|
||||
output_template => 'Shared: %s %s',
|
||||
output_change_bytes => 1,
|
||||
perfdatas => [
|
||||
{ template => '%d', min => 0, unit => 'B' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
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) = @_;
|
||||
|
||||
my $mapping = {
|
||||
total => { oid => '.1.3.6.1.4.1.41916.11.1.17' }, # systemStatusMemTotal
|
||||
used => { oid => '.1.3.6.1.4.1.41916.11.1.18' }, # systemStatusMemUsed
|
||||
free => { oid => '.1.3.6.1.4.1.41916.11.1.19' }, # systemStatusMemFree
|
||||
buffers => { oid => '.1.3.6.1.4.1.41916.11.1.20' }, # systemStatusMemBuffers
|
||||
cached => { oid => '.1.3.6.1.4.1.41916.11.1.21' } # systemStatusMemCached
|
||||
};
|
||||
|
||||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
|
||||
nothing_quit => 1
|
||||
);
|
||||
|
||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0);
|
||||
|
||||
my $used = $result->{used};
|
||||
$used -= (defined($result->{cached}) ? $result->{cached} : 0) - (defined($result->{buffers}) ? $result->{buffers} : 0);
|
||||
$used *= 1024;
|
||||
|
||||
$result->{total} *= 1024;
|
||||
|
||||
$self->{ram} = {
|
||||
total => $result->{total},
|
||||
used => $used,
|
||||
free => $result->{total} - $used,
|
||||
prct_used => $used * 100 / $result->{total},
|
||||
prct_free => 100 - ($used * 100 / $result->{total}),
|
||||
cached => $result->{cached} * 1024,
|
||||
buffers => $result->{buffers} * 1024
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check memory usage.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-usage>
|
||||
|
||||
Warning threshold on used memory (in B).
|
||||
|
||||
=item B<--critical-usage>
|
||||
|
||||
Critical threshold on used memory (in B)
|
||||
|
||||
=item B<--warning-usage-prct>
|
||||
|
||||
Warning threshold on used memory (in %).
|
||||
|
||||
=item B<--critical-usage-prct>
|
||||
|
||||
Critical threshold on percentage used memory (in %)
|
||||
|
||||
=item B<--warning-usage-free>
|
||||
|
||||
Warning threshold on free memory (in B).
|
||||
|
||||
=item B<--critical-usage-free>
|
||||
|
||||
Critical threshold on free memory (in B)
|
||||
|
||||
=item B<--warning-*> B<--critical-*>
|
||||
|
||||
Thresholds (in B) on other metrics where '*' can be:
|
||||
buffer, cached
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -0,0 +1,77 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::mode::uptime;
|
||||
|
||||
use base qw(snmp_standard::mode::uptime);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
bless $self, $class;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Check system uptime.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--warning-uptime>
|
||||
|
||||
Threshold warning.
|
||||
|
||||
=item B<--critical-uptime>
|
||||
|
||||
Threshold critical.
|
||||
|
||||
=item B<--add-sysdesc>
|
||||
|
||||
Display system description.
|
||||
|
||||
=item B<--force-oid>
|
||||
|
||||
Can choose your oid (numeric format only).
|
||||
|
||||
=item B<--check-overload>
|
||||
|
||||
Uptime counter limit is 4294967296 and overflow.
|
||||
With that option, we manage the counter going back. But there is a few chance we can miss a reboot.
|
||||
|
||||
=item B<--reboot-window>
|
||||
|
||||
To be used with check-overload option. Time in milliseconds (Default: 5000)
|
||||
You increase the chance of not missing a reboot if you decrease that value.
|
||||
|
||||
=item B<--unit>
|
||||
|
||||
Select the unit for performance data and thresholds. May be 's' for seconds, 'm' for minutes,
|
||||
'h' for hours, 'd' for days, 'w' for weeks. Default is seconds
|
||||
|
||||
=back
|
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# Copyright 2022 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 network::viptela::snmp::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_snmp);
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{modes} = {
|
||||
'control-connections' => 'network::viptela::snmp::mode::controlconnections',
|
||||
'cpu' => 'network::viptela::snmp::mode::cpu',
|
||||
'disk' => 'network::viptela::snmp::mode::disk',
|
||||
'gre-tunnels' => 'network::viptela::snmp::mode::gretunnels',
|
||||
'hardware' => 'network::viptela::snmp::mode::hardware',
|
||||
'interfaces' => 'network::viptela::snmp::mode::interfaces',
|
||||
'list-gre-tunnels' => 'network::viptela::snmp::mode::listgretunnels',
|
||||
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||
'memory' => 'network::viptela::snmp::mode::memory',
|
||||
'uptime' => 'network::viptela::snmp::mode::uptime'
|
||||
};
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Viptela in SNMP.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue