Re: seemingly incorrect memory and swapsapce
Posted: Thu Jun 18, 2020 3:17 pm
There are some differences between how top and Nagios check memory and swap usage. I probably won't be able to explain how they work in great detail, but I may be able to illuminate some differences.
I assume that you are using the plugin from NCPA to check memory?
It looks like that plugin is just a bash script using the Linux utility free to check memory usage.
The other difference is that Nagios will do a series of checks before determining a state, and top is measuring those values in real time. This means that those reports could both be correct, but from slightly different time frames.
HARD AND SOFT STATES
You could try running a top and a free check simultaneously to view the differences.
Another option would be to find or script a plugin that uses top to check memory if you find that it is more accurate.
I assume that you are using the plugin from NCPA to check memory?
Code: Select all
/usr/local/nagios/libexec/custom_check_memCode: Select all
memoutput=`free -m | head -2 | tail -1`HARD AND SOFT STATES
You could try running a top and a free check simultaneously to view the differences.
Another option would be to find or script a plugin that uses top to check memory if you find that it is more accurate.