Page 1 of 1
Memory usage - service for checking avialable, not free in %
Posted: Tue Nov 28, 2017 9:37 am
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.
Re: Memory usage - service for checking avialable, not free
Posted: Tue Nov 28, 2017 2:07 pm
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
Re: Memory usage - service for checking avialable, not free
Posted: Thu Nov 30, 2017 10:29 am
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
Re: Memory usage - service for checking avialable, not free
Posted: Thu Nov 30, 2017 12:06 pm
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!