Skip to content
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

Release 20241010 #5231

Merged
merged 27 commits into from
Oct 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4d26ef5
Sync release 20240909 (#5179)
pkippes Sep 10, 2024
9b5b90c
fix(packaging): add perl(Env) dependency to FFI::CheckLib rpm package…
kduret Sep 11, 2024
c31dfa5
enh(pr-template): add checklist items to secure new plugins delivery …
omercier Sep 16, 2024
95bff5f
fix(counter): replaced the unit of the latency for vmware vsan-cluste…
omercier Sep 17, 2024
f28f345
feat(dependencies) CTOR-596 - Add missing dependencies for Paws in De…
sdepassio Sep 18, 2024
a8a0d03
Ctor 323 refactor robot tests (#5164)
sfarouq-ext Sep 20, 2024
53afb6e
enh(ci): add pipeline for as400 using nfpm (#5167)
tuntoja Sep 23, 2024
8af60e8
Quick fix on HPE-Primera-RestAPI (#5186)
lucie-dubrunfaut Sep 24, 2024
c1f030a
feat(dependencies) CTOR-596 - Add paws dependency to AWS plugins (#5040)
sdepassio Sep 24, 2024
c4fe1a7
Fix 3com snmp fan/psu check (#5201)
octvcdrc Sep 24, 2024
9540a08
enh(dockerfiles): added new dependencies (#5209)
omercier Sep 27, 2024
03db47c
new(lib): package new dependency coming from CPAN for AES (#5208)
omercier Sep 27, 2024
a47a440
chore(packaging): update deb packages naming convention (#5203)
kduret Sep 30, 2024
e0033d0
enh(plugin): add Centreon header for Meraki api calls (#5207)
sdepassio Sep 30, 2024
11482e4
Plugin(network::stormshield::snmp) - Mode(Hardware) : Issue on temper…
lucie-dubrunfaut Sep 30, 2024
bc6c0ae
Fix power unit and add Voltage metric (#5187)
lucie-dubrunfaut Sep 30, 2024
1b9f0fd
[Plugin(storage::wd::nas::snmp) - Modes(volumes, listvolumes, hardwar…
lucie-dubrunfaut Sep 30, 2024
3b4ef12
enh(plugin): added 64 bits counters in snmp_standard::memory (#5210)
omercier Oct 1, 2024
b9d19ed
enh(ci): update legacy packaging (#5206)
tuntoja Oct 3, 2024
df03cc5
enh(vmware-connector): add the ability to load configuration from a j…
omercier Oct 3, 2024
ab7218d
fix(plugin) Linux local - mode systemd-journal : --output-fields adde…
s-duret Oct 4, 2024
06b1fe2
enh(vmware-daemon): prepare release of version 3.3.0 with 24.10 conne…
omercier Oct 7, 2024
591981b
enh(plugin): add ansible host IP to Ansible Tower discovery (#5221)
sdepassio Oct 7, 2024
88be153
enh(rubrik): add --check-retention option to track disappeared jobs a…
itoussies Oct 8, 2024
b118801
enh(ansible-tower): add filter-time option (#5225)
sdepassio Oct 8, 2024
53ff39f
enh(cisco-standard): add option --add-fc-fe-errors (#5199)
lucie-dubrunfaut Oct 10, 2024
cda1705
bump(as400): increased as400 connector version for new build (#5232)
omercier Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enh(plugin): added 64 bits counters in snmp_standard::memory (#5210)
- fix(tests): fixed spellchecks and Safe missing dependency on Alma9
- fix(stopwords): added net-snmp
- Apply suggestions from code review
- Update src/snmp_standard/mode/memory.pm
- enh(workflow): consider building plugins when the default dependencies are changed
- enh(code): use is_snmpv1() method as suggested by @garnier-quentin ;)

Co-authored-by: sdepassio <114986849+sdepassio@users.noreply.github.com>
Co-authored-by: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com>

REFS: CTOR-542
omercier authored Oct 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3b4ef128e4b7d99300bcd89e65e78cef696c4e76
1 change: 1 addition & 0 deletions .github/packaging/centreon-plugin.yaml.template
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ overrides:
perl(JSON::XS),
perl-JSON-Path,
perl-KeePass-Reader,
perl(Safe),
perl(Storable),
perl(POSIX),
perl(Encode),
4 changes: 4 additions & 0 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ on:
paths:
- '.github/workflows/plugins.yml'
- '.github/scripts/plugins-source.container.pl'
- '.github/packaging/centreon-plugin.yaml.template'
- 'src/**'
- 'packaging/**'
push:
@@ -18,6 +19,8 @@ on:
- master
paths:
- '.github/workflows/plugins.yml'
- '.github/scripts/plugins-source.container.pl'
- '.github/packaging/centreon-plugin.yaml.template'
- 'src/**'
- 'packaging/**'

@@ -46,6 +49,7 @@ jobs:
filters: |
common:
- added|deleted|modified: src/centreon/**
- modified: .github/packaging/centreon-plugin.yaml.template
packages:
- added|modified: packaging/**
plugins:
76 changes: 53 additions & 23 deletions src/snmp_standard/mode/memory.pm
Original file line number Diff line number Diff line change
@@ -146,13 +146,14 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;

$options{options}->add_options(arguments => {
'units:s' => { name => 'units', default => '%' },
'free' => { name => 'free' },
'swap' => { name => 'check_swap' },
'patch-redhat' => { name => 'patch_redhat' },
'redhat' => { name => 'redhat' }, # for legacy (do nothing)
'autodetect-redhat' => { name => 'autodetect_redhat' } # for legacy (do nothing)
$options{options}->add_options(arguments => {
'units:s' => { name => 'units', default => '%' },
'force-64bits-counters' => { name => 'force_64bits_counters' },
'free' => { name => 'free' },
'swap' => { name => 'check_swap' },
'patch-redhat' => { name => 'patch_redhat' },
'redhat' => { name => 'redhat' }, # for legacy (do nothing)
'autodetect-redhat' => { name => 'autodetect_redhat' } # for legacy (do nothing)
});

return $self;
@@ -177,7 +178,8 @@ sub check_options {
$self->SUPER::check_options(%options);
}

my $mapping = {
# legacy counters
my $mapping_32 = {
memTotalSwap => { oid => '.1.3.6.1.4.1.2021.4.3' },
memAvailSwap => { oid => '.1.3.6.1.4.1.2021.4.4' },
memTotalReal => { oid => '.1.3.6.1.4.1.2021.4.5' },
@@ -188,29 +190,41 @@ my $mapping = {
memCached => { oid => '.1.3.6.1.4.1.2021.4.15' }
};

my $mapping_64 = {
memTotalSwap => { oid => '.1.3.6.1.4.1.2021.4.18' },
memAvailSwap => { oid => '.1.3.6.1.4.1.2021.4.19' },
memTotalReal => { oid => '.1.3.6.1.4.1.2021.4.20' },
memAvailReal => { oid => '.1.3.6.1.4.1.2021.4.21' },
memTotalFree => { oid => '.1.3.6.1.4.1.2021.4.23' },
memShared => { oid => '.1.3.6.1.4.1.2021.4.24' },
memBuffer => { oid => '.1.3.6.1.4.1.2021.4.25' },
memCached => { oid => '.1.3.6.1.4.1.2021.4.26' }
};

sub memory_calc {
my ($self, %options) = @_;

my $available = ($options{result}->{memAvailReal}) ? $options{result}->{memAvailReal} * 1024 : 0;
my $total = ($options{result}->{memTotalReal}) ? $options{result}->{memTotalReal} * 1024 : 0;
my $buffer = ($options{result}->{memBuffer}) ? $options{result}->{memBuffer} * 1024 : 0;
my $cached = ($options{result}->{memCached}) ? $options{result}->{memCached} * 1024 : 0;
my $total = ($options{result}->{memTotalReal}) ? $options{result}->{memTotalReal} * 1024 : 0;
my $buffer = ($options{result}->{memBuffer}) ? $options{result}->{memBuffer} * 1024 : 0;
my $cached = ($options{result}->{memCached}) ? $options{result}->{memCached} * 1024 : 0;

my ($used, $free, $prct_used, $prct_free) = (0, 0, 0, 0);

# rhel patch introduced: net-snmp-5.7.2-43.el7 (https://bugzilla.redhat.com/show_bug.cgi?id=1250060)
# rhel patch reverted: net-snmp-5.7.2-47.el7 (https://bugzilla.redhat.com/show_bug.cgi?id=1779609)

if ($total != 0) {
$used = (defined($self->{option_results}->{patch_redhat})) ? $total - $available : $total - $available - $buffer - $cached;
$free = (defined($self->{option_results}->{patch_redhat})) ? $available : $total - $used;
$used = (defined($self->{option_results}->{patch_redhat})) ? $total - $available : $total - $available - $buffer - $cached;
$free = (defined($self->{option_results}->{patch_redhat})) ? $available : $total - $used;
$prct_used = $used * 100 / $total;
$prct_free = 100 - $prct_used;
}

$self->{ram} = {
total => $total,
used => $used,
free => $free,
total => $total,
used => $used,
free => $free,
prct_used => $prct_used,
prct_free => $prct_free,
memShared => ($options{result}->{memShared}) ? $options{result}->{memShared} * 1024 : 0,
@@ -222,20 +236,21 @@ sub memory_calc {
sub swap_calc {
my ($self, %options) = @_;

my $free = ($options{result}->{memAvailSwap}) ? $options{result}->{memAvailSwap} * 1024 : 0;
my $free = ($options{result}->{memAvailSwap}) ? $options{result}->{memAvailSwap} * 1024 : 0;
my $total = ($options{result}->{memTotalSwap}) ? $options{result}->{memTotalSwap} * 1024 : 0;

my ($used, $prct_used, $prct_free) = (0, 0, 0, 0);

if ($total != 0) {
$used = $total - $free;
$used = $total - $free;
$prct_used = $used * 100 / $total;
$prct_free = 100 - $prct_used;
}

$self->{swap} = {
total => $total,
used => $used,
free => $free,
total => $total,
used => $used,
free => $free,
prct_used => $prct_used,
prct_free => $prct_free
};
@@ -244,8 +259,17 @@ sub swap_calc {
sub manage_selection {
my ($self, %options) = @_;

my $mapping = $mapping_32;
# If asked to use 64bits counters AND if using v2c or v3 (v1 does not support 64bits counters)
if (defined($self->{option_results}->{force_64bits_counters})
&& defined($self->{option_results}->{snmp_version})
&& !$options{snmp}->is_snmpv1()) {
$mapping = $mapping_64;
}
my @oids = sort map($_->{oid} . '.0', values(%$mapping));

my $results = $options{snmp}->get_leef(
oids => [ map($_->{oid} . '.0', values(%$mapping)) ],
oids => \@oids,
nothing_quit => 1
);
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $results, instance => 0);
@@ -287,12 +311,18 @@ Can be: 'usage' (B), 'usage-free' (B), 'usage-prct' (%),

=item B<--patch-redhat>

If using RedHat distribution with net-snmp >= 5.7.2-43 and net-snmp < 5.7.2-47. But you should update net-snmp!!!!
If using Red Hat distribution with net-snmp >= 5.7.2-43 and net-snmp < 5.7.2-47. But you should update net-snmp!!!!

This version: used = memTotalReal - memAvailReal // free = memAvailReal

Others versions: used = memTotalReal - memAvailReal - memBuffer - memCached // free = total - used

=item B<--force-64bits-counters>

Use this option to monitor a server/device that has more than 2 TB of RAM, the maximum size of a signed 32 bits integer.
If you omit it you'll get the remainder of the Euclidean division of the actual value by 2 TB.
NB: it cannot work with version 1 of SNMP protocol. 64 bits counters are supported starting version 2c.

=back

=cut
16 changes: 8 additions & 8 deletions tests/os/linux/snmp/linux.snmpwalk
Original file line number Diff line number Diff line change
@@ -11041,15 +11041,15 @@
.1.3.6.1.4.1.2021.4.13.0 = INTEGER: 29600
.1.3.6.1.4.1.2021.4.14.0 = INTEGER: 36720
.1.3.6.1.4.1.2021.4.15.0 = INTEGER: 510772
.1.3.6.1.4.1.2021.4.18.0 = Counter64: 0
.1.3.6.1.4.1.2021.4.19.0 = Counter64: 0
.1.3.6.1.4.1.2021.4.20.0 = Counter64: 2014256
.1.3.6.1.4.1.2021.4.21.0 = Counter64: 747712
.1.3.6.1.4.1.2021.4.22.0 = Counter64: 747712
.1.3.6.1.4.1.2021.4.18.0 = Counter64: 17825788
.1.3.6.1.4.1.2021.4.19.0 = Counter64: 13283452
.1.3.6.1.4.1.2021.4.20.0 = Counter64: 6341032700
.1.3.6.1.4.1.2021.4.21.0 = Counter64: 20050780
.1.3.6.1.4.1.2021.4.22.0 = Counter64: 33334232
.1.3.6.1.4.1.2021.4.23.0 = Counter64: 16000
.1.3.6.1.4.1.2021.4.24.0 = Counter64: 29600
.1.3.6.1.4.1.2021.4.25.0 = Counter64: 36720
.1.3.6.1.4.1.2021.4.26.0 = Counter64: 510772
.1.3.6.1.4.1.2021.4.24.0 = Counter64: 9763096
.1.3.6.1.4.1.2021.4.25.0 = Counter64: 711208
.1.3.6.1.4.1.2021.4.26.0 = Counter64: 230069704
.1.3.6.1.4.1.2021.4.27.0 = Counter64: 1117168
.1.3.6.1.4.1.2021.4.100.0 = INTEGER: 1
.1.3.6.1.4.1.2021.4.101.0 = STRING: "Running out of swap space (0)"
67 changes: 45 additions & 22 deletions tests/os/linux/snmp/memory.robot

Large diffs are not rendered by default.

118 changes: 62 additions & 56 deletions tests/resources/spellcheck/stopwords.txt
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
--filter-imei
--filter-vdom
--filter-vm
--force-64bits-counters
--force-counters32
--force-counters64
--force-oid
@@ -49,6 +50,7 @@
--oid-display
--oid-extra-display
--oid-filter
--patch-redhat
--scope-datacenter
--sql-errors-exit
--urlpath
@@ -63,106 +65,85 @@
2c
3CX
ADSL
ASAM
Alcatel
allCapacity
Ansible
api.meraki.com
ASAM
Avigilon
Backbox
Centreon
DC4
Datacore
FCCapacity
Fortigate
Fortinet
HPE
HashiCorp
IMEI
ISAM
IpAddr
Iwsva
JOBQ
Kubernetes
Loggly
MBean
MIB
MQTT
Meraki
Mosquitto
NLCapacity
NTLMv2
NagVis
Nagios
Netscaler
OID
PKCS1
Primera
QoS
RestAPI
RFC1628
RRDCached
RestAPI
SNMP
SSDCapacity
SSH
Sansymphony
SureBackup
SysVol
TCP
Teldat
TrendMicro
UCD
VDSL2
VM
VMware
VPN
Veeam
VeloCloud
WSMAN
XPath
allCapacity
api.meraki.com
cardtemperature
Centreon
connections-dhcp
connections-dns
cpu-utilization-1m
cpu-utilization-5m
cpu-utilization-5s
Datacore
datasource
DC4
dcdiag
deduplication
deltaps
df
dfsrevent
eth
fanspeed
FCCapacity
Fortigate
Fortinet
frsevent
HashiCorp
hashicorpvault
HPE
ifAlias
ifDesc
ifName
IMEI
in-bcast
in-mcast
in-ucast
interface-dsl-name
IpAddr
ipv4
ipv6
ISAM
Iwsva
JOBQ
jobqueue
jobqueues
kccevent
keepass
Kubernetes
Kubernetes
ldap
license-instances-usage-prct
Loggly
machineaccount
MBean
memAvailReal
memBuffer
memTotalReal
Meraki
MIB
module-cellradio-csq
module-cellradio-rscp
module-cellradio-rsrp
module-cellradio-rsrq
module-cellradio-snr
modules-cellradio-detected
Mosquitto
MQTT
multiple
NTP
Nagios
nagios
NagVis
net-snmp
Netscaler
NLCapacity
NTLMv2
NTP
OID
okta
oneaccess-sys-mib
out-bcast
@@ -171,31 +152,56 @@ out-ucast
overprovisioning
perfdata
physicaldrive
PKCS1
powershell
powershell.exe
prct
Primera
proto
psu
QoS
queue-messages-inflighted
RestAPI
RestAPI
RFC1628
RRDCached
Sansymphony
sfp.temperature
SNMP
space-usage-prct
SSDCapacity
SSH
SureBackup
SysVol
TCP
teampass
Teldat
timeframe
topic-messages-inflighted
total-offline-prct
total-online-prct
total-oper-down
total-oper-up
tower-cli
TrendMicro
UCD
UDP
uptime
usage-prct
userpass
v1
v2
VDSL2
VDSL2
Veeam
Veeam
VeloCloud
VeloCloud
VM
VMware
VMware
VPN
vSAN
WSMAN
WSMAN
WSMAN
XPath