Skip to content

feat(os/aix/snmp): add memory monitoring mode via hrStorageTable#6008

Open
senbonzak wants to merge 1 commit intocentreon:developfrom
senbonzak:feat/os-aix-snmp-memory-mode
Open

feat(os/aix/snmp): add memory monitoring mode via hrStorageTable#6008
senbonzak wants to merge 1 commit intocentreon:developfrom
senbonzak:feat/os-aix-snmp-memory-mode

Conversation

@senbonzak
Copy link
Copy Markdown

@senbonzak senbonzak commented Feb 27, 2026

Description

Add a new memory mode to the os::aix::snmp plugin to monitor physical RAM
usage on AIX servers via SNMP HOST-RESOURCES-MIB.

The existing modes cannot monitor RAM on AIX because AIX SNMP agents expose RAM
under hrStorageType = hrStorageRam (.1.3.6.1.2.1.25.2.1.2) with a dynamic
index
that must be discovered by scanning the full hrStorageTable. This mode
handles that discovery automatically.

Type of change

  • New functionality (non-breaking change)

How this pull request can be tested ?

Requirements:

  • AIX server with SNMP agent configured (v1, v2c or v3)
  • centreon-plugins installed

Command:
/usr/lib/nagios/plugins/centreon_plugins.pl --plugin=os::aix::snmp::plugin --mode=memory --hostname=<AIX_IP> --snmp-version=2c --snmp-community= --warning-usage=80 --critical-usage=90

Expected output:
CRITICAL: Ram Total: 90.00 GB Used: 82.81 GB (92.02%) Free: 7.19 GB (7.98%)
| 'memory_used'=88920719360B;... 'memory_free'=7715979264B;... 'memory_usage'=92.02%;80;90;0;100

SNMP data (hrStorageTable extract):
HOST-RESOURCES-MIB::hrStorageType.21 = OID: HOST-RESOURCES-TYPES::hrStorageRam
HOST-RESOURCES-MIB::hrStorageAllocationUnits.21 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageSize.21 = INTEGER: 16777216
HOST-RESOURCES-MIB::hrStorageUsed.21 = INTEGER: 16576949

Note: the RAM index (here .21) is dynamic and varies across AIX systems.

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR
  • I have rebased my development branch on the base branch (develop)
  • I have provide data or shown output displaying the result of this code in the plugin area concerned

Summary by Aikido

Security Issues: 0 Quality Issues: 0 Resolved Issues: 0

🚀 New Features

  • Added memory monitoring mode for AIX via hrStorageTable discovery

More info

@senbonzak senbonzak requested a review from a team as a code owner February 27, 2026 03:36
@senbonzak senbonzak requested a review from scresto31 February 27, 2026 03:36
@senbonzak senbonzak force-pushed the feat/os-aix-snmp-memory-mode branch from 7edda46 to 5a8a42b Compare March 12, 2026 21:50
@Evan-Adam
Copy link
Copy Markdown
Contributor

Hello @senbonzak
Could you try to use the storage mode of the AIX plugin with the option --filter-storage-type='hrStorageRam$' ?

The $ should make the plugin ignore the hrStorageRamDisk disk type, which I don't know the use.

It seem the ram is considered as a disk, and this mode should allow you to monitor most value in this table.

If the percentage is wrong, please try to play with --space-reservation parameter that might screw the calculation if active.

Thanks,

@senbonzak
Copy link
Copy Markdown
Author

Hi, thanks for the suggestion!

I tested both approaches on the same AIX host (60 GB RAM, SNMP v1) and here are the results:

Storage mode (your suggestion):

/usr/lib/centreon/plugins/centreon_aix_snmp.pl \
  --plugin=os::aix::snmp::plugin \
  --mode=storage \
  --hostname=10.147.130.152 \
  --snmp-version='x' \
  --snmp-community='xxxxxxx' \
  --filter-storage-type='hrStorageRam$' \
  --warning-usage='90' --critical-usage='95' 

CRITICAL: Storage 'System RAM' Usage Total: 60.00 GB Used: 58.22 GB (97.03%) Free: 1.78 GB (2.97%) | 'count'=1;;;0; 'used'=62510997504B;0:57982058496;0:61203283968;0;64424509440

Memory mode (this PR):

/usr/lib/nagios/plugins/centreon_plugins.pl \
  --plugin=os::aix::snmp::plugin \
  --mode=memory \
  --hostname=10.147.130.152 \
  --snmp-version='x' \
  --snmp-community='xxxxxx' \
  --warning-usage='90' --critical-usage='95' --verbose

CRITICAL: Ram Total: 60.00 GB Used: 58.22 GB (97.03%) Free: 1.78 GB (2.97%) | 'memory_used'=62511030272B;0:57982058496;0:61203283968;0;64424509440 'memory_free'=1913479168B;0:90;0:95;0;64424509440 'memory_usage'=97.03%;0:90;0:95;0;100

Both modes return identical values. They both read the same hrStorageRam entry from hrStorageTable.

However, I believe the dedicated memory mode still brings real value for the following reasons:

1. There is currently no memory monitoring for AIX in the official connector

Looking at the official Centreon documentation for the AIX SNMP connector (https://docs.centreon.com/pp/integrations/plugin-packs/procedures/operatingsystems-aix-snmp/), there is no memory mode and no service template dedicated to physical RAM monitoring. The available modes are: cpu, storage, swap, interfaces, processcount, time, and uptime , but nothing for RAM or Memory.

This means that today, a Centreon user who wants to monitor physical RAM on an AIX server has no native, explicit solution. The only workaround is using --mode=storage with --filter-storage-type='hrStorageRam$', which is not documented anywhere in the connector's documentation and is far from intuitive.

2. Usability and consistency

Using --mode=memory is self-explanatory and consistent with how other OS plugins already work in centreon-plugins (Linux, Windows, etc.). Users should not need to understand the internals of hrStorageTable and storage type filtering just to monitor RAM on an AIX server.

I think adding a dedicated memory mode is ultimately simpler for end users than documenting a storage mode workaround. It just works out of the box without any extra filtering knowledge required.

Thanks again for your feedback!

- Extends centreon::plugins::templates::counter following swap.pm conventions
- Walks hrStorageTable dynamically to identify RAM entry by hrStorageType OID
- AIX exposes RAM as hrStorageRam (.1.3.6.1.2.1.25.2.1.2) with dynamic index
- No fixed index assumption -- works across all AIX versions and configurations
- Tested on AIX 7.x production infrastructure
@senbonzak senbonzak force-pushed the feat/os-aix-snmp-memory-mode branch from 5a8a42b to 4f14bd0 Compare March 29, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants