-
Notifications
You must be signed in to change notification settings - Fork 298
new plugin Network Westermo standard network devices #5696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmorandell-pgum
wants to merge
5
commits into
centreon:develop
Choose a base branch
from
i-Vertix:network-westermo-wolverine-snmp
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9ce0a0e
initial commit
rmorandell-pgum 0cefb8b
stopwords & final refactoring
rmorandell-pgum b8cf837
nlabel and new performance data
rmorandell-pgum ead62ed
refactor cpu mode
rmorandell-pgum 46ad521
Merge branch 'centreon:develop' into network-westermo-wolverine-snmp
rmorandell-pgum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # | ||
| # Copyright 2024 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::westermo::standard::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 => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => { | ||
| key_values => [ { name => 'average_1m' } ], | ||
| output_template => '%.2f %% (1m)', | ||
| perfdatas => [ | ||
| { label => 'cpu_1m_avg', value => 'average_1m', template => '%.2f', | ||
| min => 0, max => 100, unit => '%' }, | ||
| ], | ||
| } | ||
| }, | ||
| { label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => { | ||
| key_values => [ { name => 'average_5m' } ], | ||
| output_template => '%.2f %% (5m)', | ||
| perfdatas => [ | ||
| { label => 'cpu_5m_avg', value => 'average_5m', template => '%.2f', | ||
| min => 0, max => 100, unit => '%' }, | ||
| ], | ||
| } | ||
| }, | ||
| { label => 'average-15m', nlabel => 'cpu.utilization.15m.percentage', set => { | ||
| key_values => [ { name => 'average_15m' } ], | ||
| output_template => '%.2f %% (15m)', | ||
| perfdatas => [ | ||
| { label => 'cpu_15m_avg', value => 'average_15m', 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; | ||
|
|
||
| return $self; | ||
| } | ||
|
|
||
| sub manage_selection { | ||
| my ($self, %options) = @_; | ||
|
|
||
| my $oid_cpuLoadAvg1Min = '.1.3.6.1.4.1.16177.2.1.5.3.2.1.0'; | ||
| my $oid_cpuLoadAvg5Min = '.1.3.6.1.4.1.16177.2.1.5.3.2.2.0'; | ||
| my $oid_cpuLoadAvg15Min = '.1.3.6.1.4.1.16177.2.1.5.3.2.3.0'; | ||
|
|
||
| my $snmp_result = $options{snmp}->get_leef( | ||
| oids => [ $oid_cpuLoadAvg1Min, $oid_cpuLoadAvg5Min, $oid_cpuLoadAvg15Min ], | ||
| nothing_quit => 1 | ||
| ); | ||
|
|
||
| $self->{global} = { | ||
| average_1m => $snmp_result->{$oid_cpuLoadAvg1Min}, | ||
| average_5m => $snmp_result->{$oid_cpuLoadAvg5Min}, | ||
| average_1m => $snmp_result->{$oid_cpuLoadAvg15Min}, | ||
| }; | ||
| } | ||
|
|
||
| 1; | ||
|
|
||
| __END__ | ||
|
|
||
| =head1 MODE | ||
|
|
||
| Check average cpu load. | ||
|
|
||
| =over 8 | ||
|
|
||
| =item B<--filter-counters> | ||
|
|
||
| Only display some counters (regexp can be used). | ||
| Example: C<--filter-counters='average-15m'> | ||
|
|
||
| =item B<--warning-*> | ||
|
|
||
| Warning threshold. | ||
|
|
||
| Can be: 'average-1m', 'average-5m', 'average-15m' | ||
|
|
||
| =item B<--critical-*> | ||
|
|
||
| Critical threshold. | ||
|
|
||
| Can be: 'average-1m', 'average-5m', 'average-15m' | ||
|
|
||
| =back | ||
|
|
||
| =cut | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| # | ||
| # 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 network::westermo::standard::snmp::mode::interfaces; | ||
|
|
||
| use base qw(snmp_standard::mode::interfaces); | ||
|
|
||
| use strict; | ||
| use warnings; | ||
|
|
||
| sub set_oids_label { | ||
| my ($self, %options) = @_; | ||
|
|
||
| $self->SUPER::set_oids_label(%options); | ||
| $self->{oids_label} = { | ||
| 'ifname' => | ||
| { | ||
| oid => '.1.3.6.1.4.1.16177.2.4.1.1.1.3', | ||
| get => 'reload_get_simple', | ||
| cache => 'reload_cache_index_value' | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| 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> | ||
|
|
||
| Define the conditions to match for the status to be WARNING. | ||
| You can use the following variables: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display} | ||
|
|
||
| =item B<--critical-status> | ||
|
|
||
| Define the conditions to match for the status to be CRITICAL (default: '%{admstatus} eq "up" and %{opstatus} ne "up"'). | ||
| You can use the following variables: %{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', 'deltaps', 'counter'). | ||
|
|
||
| =item B<--units-cast> | ||
|
|
||
| Units of thresholds for communication types (default: 'percent_delta') ('percent_delta', 'percent', 'delta', 'deltaps', 'counter'). | ||
|
|
||
| =item B<--nagvis-perfdata> | ||
|
|
||
| Display traffic perfdata to be compatible with NagVis widget. | ||
|
|
||
| =item B<--interface> | ||
|
|
||
| Check only the interfaces with the specified IDs (OID indexes, e.g.: 1,2,...). If empty, all interfaces will be monitored. | ||
| To filter on interface names, see --name. | ||
|
|
||
| =item B<--name> | ||
|
|
||
| With this option, the interfaces will be filtered by name (given in option --interface) instead of OID index. The name matching mode supports regular expressions. | ||
|
|
||
| =item B<--regex-id> | ||
|
|
||
| With this option, interface IDs will be filtered using the --interface parameter as a regular expression instead of a list of IDs. | ||
|
|
||
| =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 interfaces of 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-bit counters (even with SNMP versions 2c and 3). To use when 64 bits counters are buggy. | ||
|
|
||
| =item B<--reload-cache-time> | ||
|
|
||
| Time in minutes before reloading cache file (default: 180). | ||
|
|
||
| =item B<--oid-filter> | ||
|
|
||
| Define the OID to be used to filter interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). | ||
|
|
||
| =item B<--oid-display> | ||
|
|
||
| Define the OID that will be used to name the interfaces (default: ifName) (values: ifDesc, ifAlias, ifName, IpAddr). | ||
|
|
||
| =item B<--oid-extra-display> | ||
|
|
||
| Add an OID to display. | ||
|
|
||
| =item B<--display-transform-src> B<--display-transform-dst> | ||
|
|
||
| Modify the interface name displayed by using a regular expression. | ||
|
|
||
| Example: adding --display-transform-src='eth' --display-transform-dst='ens' will replace all occurrences of 'eth' with 'ens' | ||
|
|
||
| =item B<--show-cache> | ||
|
|
||
| Display cache interface data. | ||
|
|
||
| =back | ||
|
|
||
| =cut |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.