Memory usage - service for checking avialable, not free in %

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Memory usage - service for checking avialable, not free in %

Post by Shwele »

Hello guys,

I'm using check over SNMP for memory usage, using check_xi_service_snmp_linux_storage .

I keep getting critical used memory due that Ubuntu 16.04 is using unused memory for buff/cache. It is a good thing, but the check itself is checking free memory, not the available one, thus resulting in service going warning/critical very often. Is there something that I can change in order to look at available memory ( + free too if its possible) or something else to advise?

Here is free -m in output bellow:

Code: Select all

              total        used        free      shared  buff/cache   available
Mem:           3947        1294         208         103        2444        2247
Swap:          1023          84         939
Thanks in advance.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Memory usage - service for checking avialable, not free

Post by lmiltchev »

You can use a regex with the "-m" flag, and search for the type of memory you would like to monitor, provided it is available via SNMP.

For example, when I run snmwalk against my CentOS box, I see the following entries in the output:

Code: Select all

HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory
so, I can modify my check accordingly.

Examples:

Code: Select all

[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H x.x.x.x  -C <community> --v2c -m Physical -w 95 -c 98 -f
Physical memory: 95%used(7595MB/8001MB) (<95%) : OK | 'Physical_memory'=7595MB;7601;7841;0;8001
[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H x.x.x.x  -C <community> --v2c -m Virtual -w 95 -c 98 -f
Virtual memory: 75%used(7578MB/10049MB) (<95%) : OK | 'Virtual_memory'=7578MB;9547;9848;0;10049
[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H x.x.x.x  -C <community> --v2c -m buffers -w 95 -c 98 -f
Memory buffers: 2%used(193MB/8001MB) (<95%) : OK | 'Memory_buffers'=193MB;7601;7841;0;8001
[root@main-nagios-xi libexec]# /usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H x.x.x.x  -C <community> --v2c -m Cached -w 95 -c 98 -f
Cached memory: 100%used(490MB/490MB) (>98%) : CRITICAL | 'Cached_memory'=490MB;466;480;0;490
This may be different on Ubuntu 16.04, but you could save the output of the snmpwalk command, open the file in a text editor, and try to find out what you can monitor as far as memory type.

Code: Select all

snmpwalk -v 2c -c community ip address > /tmp/snmpoutput.txt
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Re: Memory usage - service for checking avialable, not free

Post by Shwele »

Heya, thanks for your answer

Looks like Virtual check did the trick, as in now its reporting calculated memory left not only free one, which as at the moment about 10%

Now it shows 30% of free memory which is great. Simple modification helped out.

Thanks!!
We can lock this topic
...
for now xD
kyang

Re: Memory usage - service for checking avialable, not free

Post by kyang »

Sounds good! I'll be closing this thread!

If you have any more questions, feel free to create another thread.

Thanks for using the Nagios Support Forum!
Locked