check_snmp memTotalFree thresholds

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
fsbeaunix
Posts: 31
Joined: Mon Apr 20, 2015 2:58 pm
Location: Michigan, USA

check_snmp memTotalFree thresholds

Post by fsbeaunix »

Hello,

I've searched other posts and I'm not able to locate anything on my particular issue. This is my first go round setting up snmp monitoring.
From my nagios server I'm able to snmpwalk all OID's that I'm interested in. But, I'm having trouble setting thresholds.

$ snmpwalk -O n -v2c -c mystring server1.domain.com:161 Memory
.1.3.6.1.4.1.2021.4.3.0 = INTEGER: 2097148 kB
.1.3.6.1.4.1.2021.4.4.0 = INTEGER: 2097148 kB
.1.3.6.1.4.1.2021.4.5.0 = INTEGER: 16262416 kB
.1.3.6.1.4.1.2021.4.6.0 = INTEGER: 14288168 kB
.1.3.6.1.4.1.2021.4.11.0 = INTEGER: 16385316 kB
.1.3.6.1.4.1.2021.4.13.0 = INTEGER: 68984 kB
.1.3.6.1.4.1.2021.4.14.0 = INTEGER: 2108 kB
.1.3.6.1.4.1.2021.4.15.0 = INTEGER: 651484 kB

Just focusing on OID ( .1.3.6.1.4.1.2021.4.11.0 ) for this post. Which is memTotalFree.0 ( Total RAM Free ) according or oidref.com
Checking with snmp_check it seems to report critical no matter what I put in for warning and critical. Just for testing I'd like to get warning when memTotalFree is 8gb and critical when its 4gb. So, I thought something like this would do it.

$ /usr/local/nagios/libexec/check_snmp -H server1.domain.com -p 161 -o 'memTotalFree.0' -C 'mystring' -P 2c -u 'kB' -m UCD-SNMP-MIB -w 8192658 -c 4096329
SNMP CRITICAL - *16385176* kB | UCD-SNMP-MIB::memTotalFree.0=16385176kB;8192658;4096329

I cannot get anything other than CRITICAL for return status.

Not sure what I'm doing wrong or if I'm misunderstand the values.

Update: This seems to report incorreclty. If I make the -w and -c higher than the actual amount of memory it will report ok.
So, server has 16gb of Total Memory free and I make warn just 1 kb higher and it will report ok.

No values ='s OK

$ /usr/local/nagios/libexec/check_snmp -H server1.domain.com -p 161 -o 'memTotalFree.0' -C 'mystring' -P 2c -m UCD-SNMP-MIB
SNMP OK - 16374568 kB | UCD-SNMP-MIB::memTotalFree.0=16374568

Make warn and critical 1byte beyond what the server has.

$ /usr/local/nagios/libexec/check_snmp -H server1.domain.com -p 161 -o 'memTotalFree.0' -C "mystring' -P 2c -m UCD-SNMP-MIB -w 16374617 -c 16374618
SNMP OK - 16374584 | UCD-SNMP-MIB::memTotalFree.0=16374584;16374617;16374618

Same applies to swap space, etc. Found another post in the community w/ same issue. Its unanswered. Hoping someone has some insight.
https://support.nagios.com/forum/viewto ... 81#p308596

Thanks,




Thanks,
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_snmp memTotalFree thresholds

Post by tgriep »

When specifying threshold levels for a plugin, for the most part, when you put in a value, the plugin will generate a Warning or Critical is the value returned by the plugin is over the threshold settings and that is why, when you set the threshold levels to be greater that the free memory returned, it goes to an OK state.

Since you are measuring free memory, you would like to get an alert if the free memory falls below a certain value.
To do that, you would put a colon on the end of the value.
In your first example, if you change the thresholds to the following

Code: Select all

-w 8192658: -c 4096329:
It will generate a warning in the free memory falls below 8192658 and a critical if it falls below 4096329.
Try it out and see if that works like you want.

More details in Threshold settings can be found here.
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
fsbeaunix
Posts: 31
Joined: Mon Apr 20, 2015 2:58 pm
Location: Michigan, USA

Re: check_snmp memTotalFree thresholds

Post by fsbeaunix »

Hello,

Thank you very much for the information and example. Its working well. Thanks again.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_snmp memTotalFree thresholds

Post by tgriep »

Your very welcome. Glad to help. I'll lock the post as solved for you but feel free to open a new one for any new questions or issues.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked