[Xymon] Linux client with local-config (or bb-memory.sh for linux)
John Thurston
john.thurston at alaska.gov
Fri Oct 12 20:58:37 CEST 2018
On 10/11/2018 2:45 PM, John Thurston wrote:
...
> I'm in need of memory monitoring on a CentOS 7 host. The client I have
> there (I think it is a BBPE version) doesn't provide it. So I reached
> back and grabbed a bb-memory.sh from some other system. But it doesn't
> work cleanly :(
...> my version of 'free' (3.3.10) has moved the '+/-' information up
> into a new column in the 'Mem' line. I don't see a way to adjust the
> 'free' command to return results in the old format, so I'll need to
> accommodate the new format in the shell script.
Digging in, I think I've figured out the line missing from the 'free -m'
output is irrelevant with the new reporting done by free.
For reference:
> https://askubuntu.com/questions/770108/what-do-the-changes-in-free-output-from-14-04-to-16-04-mean
> https://serverfault.com/questions/85470/meaning-of-the-buffers-cache-line-in-the-output-of-free
What I've done (in the linux block of bb-memory.sh) is preface the line:
ACT_MEMORY_USED=`echo $FREE_ACT | $AWK '{ print $3; }'`
with a conditional
[ "$FREE_ACT" ] &&
On systems which have internalized the calculation of free memory, the
ACT_MEMORY_USED variable will be left at -1 (its initial value as set in
the script), and later code will not barf with a "unary operator" error
due to the empty string returned by grep.
And so do I perpetuate the use of ancient code.
--
Do things because you should, not just because you can.
John Thurston 907-465-8591
John.Thurston at alaska.gov
Department of Administration
State of Alaska
More information about the Xymon
mailing list