Xymon Mailing List Archive search

Linux client with local-config (or bb-memory.sh for linux)

3 messages in this thread

list John Thurston · Thu, 11 Oct 2018 14:45:56 -0800 ·
We run xymon servers the old-school way*: local config of clients with client-side evaluation of thresholds. I run a mashup of ancient BB, newer BBPE, and even newer xymon clients.

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 :(

For linux, the script captures the output of 'free -m' and then populates variables:
   FREE_PHYS
   FREE_ACT
   FREE_SWAP
by grepping lines from the result:
   Mem
   • Swap
and 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.

Before I go dive in and engineer my own parser, I thought I'd ask here:
   Does anyone have a bb-memory.sh they'd share with me?

Alternatively, I could remove the old client and install something newer. But the last time I tried compiling the client with the 'local-config' option, it didn't work out well. So my second question is:
   Is there a linux client package that correctly support local-config?


* Yeah, I know there are plenty who think this is a terrible idea and can't stand the concept. But I don't own most of the hosts. So I don't want to have them dragging my central code down to them. Nor do I know the business rules which define success or failure. It's up to the owner of the host to set those things.


-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska
list Jeremy Laidman · Fri, 12 Oct 2018 11:24:43 +1100 ·
Have you considered creating a very simple client data message containing
just the [free] section, and let Xymon parse the output?

On Fri, 12 Oct 2018 at 09:46, John Thurston <user-ce4d79d99bab@xymon.invalid>
quoted from John Thurston
wrote:
We run xymon servers the old-school way*: local config of clients with
client-side evaluation of thresholds. I run a mashup of ancient BB,
newer BBPE, and even newer xymon clients.

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 :(

For linux, the script captures the output of 'free -m' and then
populates variables:
   FREE_PHYS
   FREE_ACT
   FREE_SWAP
by grepping lines from the result:
   Mem
   • Swap
and 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.

Before I go dive in and engineer my own parser, I thought I'd ask here:
   Does anyone have a bb-memory.sh they'd share with me?

Alternatively, I could remove the old client and install something
newer. But the last time I tried compiling the client with the
'local-config' option, it didn't work out well. So my second question is:
   Is there a linux client package that correctly support local-config?


* Yeah, I know there are plenty who think this is a terrible idea and
can't stand the concept. But I don't own most of the hosts. So I don't
want to have them dragging my central code down to them. Nor do I know
the business rules which define success or failure. It's up to the owner
of the host to set those things.


--
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska

list John Thurston · Fri, 12 Oct 2018 10:58:37 -0800 ·
quoted from John Thurston
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.
quoted from Jeremy Laidman

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska