Skip to content

Commit

Permalink
Merge branch 'develop' into CTOR-1039-netapp-ontap-rest-api-volumes-a…
Browse files Browse the repository at this point in the history
…dd-logical-space-metrics
  • Loading branch information
omercier authored Jan 10, 2025
2 parents bb8232e + 7149c95 commit e0105de
Show file tree
Hide file tree
Showing 48 changed files with 3,679 additions and 77 deletions.
12 changes: 9 additions & 3 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ runs:
shell: bash

- name: Promote DEB package to stable
if: ${{ contains(fromJSON('["bullseye", "bookworm"]'), inputs.distrib) }}
if: ${{ contains(fromJSON('["bullseye", "bookworm", "jammy"]'), inputs.distrib) }}
run: |
set -eux
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - Distrib: ${{ inputs.module }}"
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
repo="ubuntu-plugins"
else
repo="apt-plugins"
fi
echo "[DEBUG] - Get path of testing DEB packages to promote to stable."
SRC_PATHS=$(jf rt search --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path')
SRC_PATHS=$(jf rt search --include-dirs $repo-testing/pool/${{ inputs.module }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path')
if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
Expand All @@ -86,7 +92,7 @@ runs:
fi
echo "[DEBUG] - Build target path."
TARGET_PATH="apt-plugins-${{ inputs.stability }}/pool/${{ inputs.module }}/"
TARGET_PATH="$repo-${{ inputs.stability }}/pool/${{ inputs.module }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
echo "[DEBUG] - Promoting DEB testing artifacts to stable."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"centreon/plugins/snmp.pm",
"snmp_standard/mode/interfaces.pm",
"snmp_standard/mode/listinterfaces.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/listspanningtrees.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/spanningtree.pm",
"snmp_standard/mode/uptime.pm",
"network/hp/procurve/"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": [
"libsnmp-perl",
"libdatetime-perl"
"libdatetime-perl",
"libnet-ntp-perl"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"snmp_standard/mode/loadaverage.pm",
"snmp_standard/mode/listdiskspath.pm",
"snmp_standard/mode/listinterfaces.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/listprocesses.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/listprocesses.pm",
"snmp_standard/mode/liststorages.pm",
"snmp_standard/mode/processcount.pm",
"snmp_standard/mode/storage.pm",
"snmp_standard/mode/swap.pm",
"snmp_standard/mode/tcpcon.pm",
"snmp_standard/mode/uptime.pm",
"snmp_standard/mode/ntp.pm",
"os/freebsd/snmp/"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": [
"perl(SNMP)",
"perl(DateTime)"
"perl(DateTime)",
"perl(Net::NTP)"
]
}
2 changes: 1 addition & 1 deletion src/apps/protocols/smtp/lib/smtp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sub connect {
$self->{output}->exit();
}
if ($smtp_handle == -1) {
chomp $stdout;
chomp $stdout if (defined($stdout));
$self->{output}->output_add(
severity => $connection_exit,
short_msg => 'Unable to connect to SMTP: ' . (defined($stdout) ? $stdout : $error_msg)
Expand Down
12 changes: 6 additions & 6 deletions src/apps/salesforce/restapi/custom/api.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub request_api {
$self->{output}->option_exit();
}
if ($self->{http}->get_code() != 200) {
$self->{output}->add_option_msg(short_msg => "Connection issue: " . $decoded->{message});
$self->{output}->add_option_msg(short_msg => "Connection issue: " . defined($decoded->{message}) ? $decoded->{message} : '');
$self->{output}->option_exit();
}

Expand All @@ -125,27 +125,27 @@ __END__
=head1 NAME
SFDC API boilerplate
Monitor SFDC API boilerplate
=head1 SYNOPSIS
Get informations from SFDC API
Get information from SFDC API
=head1 REST API OPTIONS
=over 8
=item B<--hostname>
Set hostname to query (default: 'api.status.salesforce.com')
Define the hostname to query (default: C<api.status.salesforce.com>)
=item B<--timeout>
Set HTTP timeout in seconds (default: '10').
Define the HTTP timeout in seconds (default: '10').
=item B<--api-version>
API version (default: 'v1').
Define the API version (default: 'v1').
=back
Expand Down
17 changes: 15 additions & 2 deletions src/database/informix/snmp/mode/logfileusage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ sub new {

my $mapping = {
onLogicalLogDbspace => { oid => '.1.3.6.1.4.1.893.1.1.1.8.1.3' },
onLogicalLogStatus => { oid => '.1.3.6.1.4.1.893.1.1.1.8.1.4' },
onLogicalLogPagesAllocated => { oid => '.1.3.6.1.4.1.893.1.1.1.8.1.7' },
onLogicalLogPagesUsed => { oid => '.1.3.6.1.4.1.893.1.1.1.8.1.8' },
};
Expand All @@ -76,6 +77,7 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(oids => [
{ oid => $oid_applName },
{ oid => $mapping->{onLogicalLogDbspace}->{oid} },
{ oid => $mapping->{onLogicalLogStatus}->{oid} },
{ oid => $mapping->{onLogicalLogPagesAllocated}->{oid} },
{ oid => $mapping->{onLogicalLogPagesUsed}->{oid} },
], return_type => 1, nothing_quit => 1
Expand Down Expand Up @@ -103,7 +105,17 @@ sub manage_selection {
}

$self->{global}->{$name}->{allocated} += $result->{onLogicalLogPagesAllocated};
$self->{global}->{$name}->{used} += $result->{onLogicalLogPagesUsed};

# Status of the logical-log file:
# newlyAdded (1)
# free (2)
# current (3)
# used (4)
# backedUpButNeeded (5)
# consider log files with state backedUpButNeeded as free space
if ($result->{onLogicalLogStatus} != 5) {
$self->{global}->{$name}->{used} += $result->{onLogicalLogPagesUsed};
}
}

foreach (keys %{$self->{global}}) {
Expand All @@ -128,7 +140,8 @@ Check log files usage.
=item B<--filter-name>
Filter dbspace name (can be a regexp).
Define which C<dbspace> should be monitored based on their names.
This option will be treated as a regular expression.
=item B<--warning-usage>
Expand Down
48 changes: 48 additions & 0 deletions src/hardware/server/lenovo/xcc/snmp/mode/components/cpu.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package hardware::server::lenovo::xcc::snmp::mode::components::cpu;
use strict;
use warnings FATAL => 'all';

use strict;
use warnings;
use centreon::plugins::misc;

my $mapping = {
cpuStatus => { oid => '.1.3.6.1.4.1.19046.11.1.1.5.20.1.11' },
cpuString => { oid => '.1.3.6.1.4.1.19046.11.1.1.5.20.1.2' },
};

my $oid_cpuEntry = '.1.3.6.1.4.1.19046.11.1.1.5.20.1';

sub load {
my ($self) = @_;

push @{$self->{request}}, { oid => $oid_cpuEntry };
}
sub check {
my ($self) = @_;

$self->{output}->output_add(long_msg => "Checking cpu");
$self->{components}->{cpu} = { name => 'cpu', total => 0, skip => 0 };
return if ($self->check_filter(section => 'cpu'));

foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpuEntry}})) {

next if ($oid !~ /^$mapping->{cpuString}->{oid}\.(.*)$/);

my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpuEntry}, instance => $instance);
next if ($self->check_filter(section => 'cpu', instance => $instance));
$result->{cpuStatus} = centreon::plugins::misc::trim($result->{cpuStatus});
$self->{components}->{cpu}->{total}++;

$self->{output}->output_add(long_msg => sprintf("'%s' status is %s [instance: %s].",
$result->{cpuString}, $result->{cpuStatus}, $instance));

my $exit = $self->get_severity(label => 'default', section => 'default', value => $result->{cpuStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("'%s' cpu status for '%s'", $result->{cpuStatus}, $result->{cpuString}));
}
}
}
1;
68 changes: 68 additions & 0 deletions src/hardware/server/lenovo/xcc/snmp/mode/components/health.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# 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 hardware::server::lenovo::xcc::snmp::mode::components::health;
use Data::Dumper;

use strict;
use warnings;
use centreon::plugins::misc;

my $mapping = {
healthStatus => { oid => '.1.3.6.1.4.1.19046.11.1.1.4.2.1.2' },
healthString => { oid => '.1.3.6.1.4.1.19046.11.1.1.4.2.1.3' },
};

my $oid_healthEntry = '.1.3.6.1.4.1.19046.11.1.1.4.2.1';

sub load {
my ($self) = @_;

push @{$self->{request}}, { oid => $oid_healthEntry };
}
sub check {
my ($self) = @_;

$self->{output}->output_add(long_msg => "Checking health");
$self->{components}->{health} = { name => 'health', total => 0, skip => 0 };
return if ($self->check_filter(section => 'health'));

foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_healthEntry}})) {

next if ($oid !~ /^$mapping->{healthString}->{oid}\.(.*)$/);

my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_healthEntry}, instance => $instance);
next if ($self->check_filter(section => 'health', instance => $instance));
$result->{healthStatus} = centreon::plugins::misc::trim($result->{healthStatus});
$self->{components}->{health}->{total}++;

$self->{output}->output_add(long_msg => sprintf("health '%s' status is %s [instance: %s].",
$result->{healthString}, $result->{healthStatus}, $instance));

my $exit = $self->get_severity(label => 'default', section => 'default', value => $result->{healthStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("'%s' health status for '%s'", $result->{healthStatus}, $result->{healthString}));
}
}
}

1;
48 changes: 48 additions & 0 deletions src/hardware/server/lenovo/xcc/snmp/mode/components/memory.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package hardware::server::lenovo::xcc::snmp::mode::components::memory;
use strict;
use warnings;

use strict;
use warnings;
use centreon::plugins::misc;

my $mapping = {
memoryStatus => { oid => '.1.3.6.1.4.1.19046.11.1.1.5.21.1.8' },
memoryString => { oid => '.1.3.6.1.4.1.19046.11.1.1.5.21.1.2' },
};

my $oid_memoryEntry = '.1.3.6.1.4.1.19046.11.1.1.5.21.1';

sub load {
my ($self) = @_;

push @{$self->{request}}, { oid => $oid_memoryEntry };
}
sub check {
my ($self) = @_;

$self->{output}->output_add(long_msg => "Checking memory");
$self->{components}->{memory} = { name => 'memory', total => 0, skip => 0 };
return if ($self->check_filter(section => 'memory'));

foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_memoryEntry}})) {

next if ($oid !~ /^$mapping->{memoryString}->{oid}\.(.*)$/);

my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_memoryEntry}, instance => $instance);
next if ($self->check_filter(section => 'memory', instance => $instance));
$result->{memoryStatus} = centreon::plugins::misc::trim($result->{memoryStatus});
$self->{components}->{memory}->{total}++;

$self->{output}->output_add(long_msg => sprintf("'%s' status is %s [instance: %s].",
$result->{memoryString}, $result->{memoryStatus}, $instance));

my $exit = $self->get_severity(label => 'default', section => 'default', value => $result->{memoryStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("'%s' memory status for '%s'", $result->{memoryStatus}, $result->{memoryString}));
}
}
}
1;
9 changes: 5 additions & 4 deletions src/hardware/server/lenovo/xcc/snmp/mode/hardware.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ sub set_system {
$self->{cb_hook2} = 'snmp_execute';

$self->{thresholds} = {
default => [
default => [
['Normal', 'OK'],
['.*', 'CRITICAL']
],
raidvolume => [
['Optimal', 'OK'],
['.*', 'CRITICAL']
]
],

};

$self->{components_path} = 'hardware::server::lenovo::xcc::snmp::mode::components';
$self->{components_module} = ['temperature', 'voltage', 'fan', 'psu', 'disk', 'raidvolume'];
$self->{components_module} = ['temperature', 'voltage', 'fan', 'psu', 'disk', 'raidvolume', 'health', 'cpu', 'memory'];
}

sub snmp_execute {
Expand Down Expand Up @@ -77,7 +78,7 @@ Check hardware.
=item B<--component>
Which component to check (default: '.*').
Can be: 'temperature', 'voltage', 'fan', 'psu', 'disk', 'raidvolume'.
Can be: 'temperature', 'voltage', 'fan', 'psu', 'disk', 'raidvolume', 'health', 'cpu', 'memory'.
=item B<--filter>
Expand Down
Loading

0 comments on commit e0105de

Please sign in to comment.