Nagios memory percentages

Machiel Richards MachielR at agilitytech.co.za
Tue Mar 11 13:41:07 CET 2008


Hi

 

  I am trying to use this option but the issue I have now is with the
following:

 

The output from the /proc/meminfo is  as follows:

 

            MemFree:      206788 kB

 

   However, when I try to use cut in order to only get the numeric
value, the output I get back does not work that well as it still
includes the <spaces> infront of the numeric value as well as the kb at
the end...

 

            I have even tried this with free and the same result....

 

            What should I use as delimiter to the cut command?

 

            Any other suggestions on how to only get the numeric value?

 

            Commands used with output:

 

cat /proc/meminfo | grep MemTotal | cut -f 2 -d ":"

 

output :

 

      2067884 kB

 

 

  As you can see the spaces are all out of place.....

 

      I have also noticed that when using a space as delimiter and
counting the spaces to the value, then you get the result, however if
the numeric value increase by one digit (i.e. from 6 digits to 7 digits
for instance) then the amount of spaces change and the program does not
work.

 

 

 

 

________________________________

From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of Dale J.
Chatham
Sent: Tuesday, March 11, 2008 1:15 PM
To: Machiel Richards
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Nagios memory percentages

 

Looc at the /proc/meminfo file and the vmstat command.

Divide memory parameter (free, used, whatever) by total memory, multiply
by 100 and you have percent.

Machiel Richards wrote: 

Hi Everyone

 

  Maybe someone can assist me, but this may be a more linux specific
question than Nagios even though related to Nagios.

 

   I need to monitor the memory usage in percentage on Nagios and would
like to rather write my own scripts for this.

 

 

   I know there are snmp versions of this to do the job for me, however
I do not want to complicate the systems with too many clients running on
them.

 

Currently we are using the normal nrpe to connect to the systems and run
scripts remotely, however we do not have one to monitor the memory.

 

            On the web there are a lot of references to the snmp
commands but as all the systems are production and we might be having a
couple of upgrades soon, I would like to rather keep it simple and only
run one client on it for all Nagios connections.

 

 

            My question is this... I can use the command free to get the
amount of memory , used, free etc... 

 

            How can I write this into a script to display as
percentages... is there another command I can use or maybe an option
that I do not know about?

 

tx

*** Disclaimer *** 

The information contained in this e-mail is confidential and legally
privileged and is intended solely for the addressee and to others who
have the authority to receive it. Access to this e-mail by anyone else
is unauthorized and as such, any disclosure, copying, distribution or
any action taken or omitted in reliance on it is unlawful. If you have
received this e-mail in error, please notify the sender immediately. 

The views expressed in this e-mail are the views of the individual
sender and should in no way be construed as the views of the Company. 

The Company is not liable to ensure that outgoing e-mails are
virus-free. 

The Company is not liable, should information or data, for whatever
reason, be corrupted or fail to reach its intended addressee. 

The Company is not liable for any loss or damage of whatsoever nature
and howsoever arising resulting from the opening or the use of the
information in this e-mail, including its attachments and links. 

The sender of this e-mail is subject to and bound by the terms and
conditions of Company's Electronic Communications Usage Policy. 

 
 
 



________________________________



 
 
 
------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
 
 
 



________________________________



 
 
 
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null

 



*** Disclaimer ***

The information contained in this e-mail is confidential and legally privileged and is intended solely for the addressee and to others who have the authority to receive it. Access to this e-mail by anyone else is unauthorized and as such, any disclosure, copying, distribution or any action taken or omitted in reliance on it is unlawful. If you have received this e-mail in error, please notify the sender immediately.

The views expressed in this e-mail are the views of the individual sender and should in no way be construed as the views of the Company.

The Company is not liable to ensure that outgoing e-mails are virus-free.

The Company is not liable, should information or data, for whatever reason, be corrupted or fail to reach its intended addressee.

The Company is not liable for any loss or damage of whatsoever nature and howsoever arising resulting from the opening or the use of the information in this e-mail, including its attachments and links.

The sender of this e-mail is subject to and bound by the terms and conditions of Company’s Electronic Communications Usage Policy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080311/56464d9f/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list