Help needed to find a suitable plugin to monitor memory usage via SNMPv3

Hi,

I wish to monitor memory usage on Radware Alteon load balancer appliances. This device provides an SNMP agent with two OIDs:

  • one for total memory: .1.3.6.1.4.1.1872.2.5.1.2.8.1
  • one for free memory: .1.3.6.1.4.1.1872.2.5.1.2.8.3

Some other devices proceed similarly.

Would anyone know a plugin I could use to monitor the ratio (100 * free / total), in percentage, ideally one where I could specify the OID for “free” and OID for “total” as parameters?

This plugin would need to support SNMPv3 with SHA-256 and AES-256.

Thank you in advance,

Jean

1 Like

Have you tried check_nwc_health?
Otherwise i would try either check_snmp or the now deprecated thola

Honestly, i think you could also develop a checkplugin by yourself for this. I guess if you are already having a device giving you suitable data (like your two OIDs) you just need to create an plugin that queries the appliances via SNMPv3 and calculates ratio.

Hi bberg,

Thank you for your reply!

Yes I have, but the device is not supported.

I have also tried with check_snmp, but that plugin does not allow expressions to be evaluated - in this case: 100*(Total-Free)/Total. Furthermore, I need the warning and critial thresholds to apply to the evaluated expression, not to the individual OID values.

I am busy writing my own plugin :slight_smile:

If someone has the bash code to handle threshold ranges described here: Development Guidelines · Nagios Plugins, I would be interested!

Thank you,

Jean

If you need to calculate then I can recommend the plugin from the Linuxfabrik.
You provide a CSV file per OID and can use python manipulate value and thresholds.

1 Like

Great tip, thanks a lot, Dominik! I just took the time to test it and it works. The output is not to my taste, but it sure does the job.

Nevertheless, in the meantime, I did write my own plugin, in bash, and it also works. The main concepts are a couple of arguments:

  • an OID list, whose values can be referred to as OID00, OID01, etc.
  • a Linux bc expression, containing these OID00, OID01 references and evaluated to produce a numeric result compared to warning and critical thresholds

My proficiency in bash is not very high, so I would love to have some guru refactor the code to acceptable standards, after which it could be shared on Github or any other place.

A correction to my post from above: Multiple OIDs per CSV file are possible - one OID per line.

If the output isn’t to your liking, you could post a feature request at GitHub · Where software is built.

Try to ask an AI how your code could be improved according to Monitoring Plugins Development Guidelines and bash best practices :wink:

Here the content of the CSV file used to monitor the memory usage:

OID,Name,Re-Calc,Unit Label,WARN,CRIT,Show in 1st Line,Report Change as
SNMPv2-SMI::enterprises.1872.2.5.1.2.8.1.0,TotalMem,int(value),,,,,
SNMPv2-SMI::enterprises.1872.2.5.1.2.8.3.0,FreeMem,int(value),,,,,
,warnPercent,70,%,,,,
,critPercent,90,%,,,,
,UsedMem,"values['TotalMem'] - values['FreeMem']",,,,,
,Memory Usage,"round( 100.0 * values['UsedMem'] / values['TotalMem'],2)",%,value > values['warnPercent'],value > values['critPercent'],True,

And the snmp plugin output:

lb-alteon-any.csv: Memory Usage: 40.06%

Key          ! Value    ! State
-------------+----------+-------
TotalMem     ! 65835992 ! [OK]
FreeMem      ! 39465220 ! [OK]
warnPercent  ! 70%      ! [OK]
critPercent  ! 90%      ! [OK]
UsedMem      ! 26370772 ! [OK]
Memory Usage ! 40.06%   ! [OK]|'TotalMem'=65835992;;;0; 'FreeMem'=39465220;;;0; 'warnPercent'=70%;;;0;100 'critPercent'=90%;;;0;100 'UsedMem'=26370772;;;0; 'Memory Usage'=40.06%;;;0;100
1 Like

What don’t you like about this output?

My plugin’s command and output - same check:

$ ./check_snmp_bcexpression.bash -H 10.9.8.7 -t 10 -L authPriv -P 3 -U 'username' -x AES -X 'obfuscated' -a SHA -A 'obfuscated' -b 'scale=2;100*(OID1-OID0)/OID1' -l 'Memory utilisation' -o '.1.3.6.1.4.1.1872.2.5.1.2.8.3.0,.1.3.6.1.4.1.1872.2.5.1.2.8.1.0' -u '%' -w 70 -c 90
OK - Memory utilisation: 40.57% | 'Memory utilisation'=40.57%
$

I prefer this output format :slight_smile:

@jeanm just ask for a change on the plugin, as I did in snmp: Improve Performance Data Handling · Issue #481 · Linuxfabrik/monitoring-plugins · GitHub or send in a pull request.

@linuxfabrik what do you think about suppressing the table via command line augment and also add a column to suppress lines in the table (like intermediate calculations and threshold definitions). Also the CSV file name in the fist line looks strange and isn’t of interest for non Icinga admins.

That sounds good and wouldn’t be that difficult to implement.

1 Like

Done.

2 Likes

The diffs look fantastic - what a great community service!
Can’t wait to update the plugins and clean up the output :smile:

Thanks a lot for the changes!

When would these be available in the compiled zip files on Index of /monitoring-plugins?

I don’t usually comment on release dates, but I can confirm that we are currently in the process of releasing it.