<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";
color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman";
color:black;}
pre
{margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.EmailStyle19
{mso-style-type:personal;
font-family:Arial;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> I am trying to use this option but
the issue I have now is with the following:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The output from the /proc/meminfo is
as follows:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> MemFree:
206788 kB<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> 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…<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> I
have even tried this with free and the same result….<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> What
should I use as delimiter to the cut command?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Any
other suggestions on how to only get the numeric value?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Commands
used with output:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>cat /proc/meminfo | grep MemTotal | cut -f
2 -d ":"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>output :<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> 2067884 kB<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> As you can see the spaces are all
out of place…..<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> 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.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> nagios-users-bounces@lists.sourceforge.net
[mailto:nagios-users-bounces@lists.sourceforge.net] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Dale J. Chatham<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, March 11, 2008 1:15
PM<br>
<b><span style='font-weight:bold'>To:</span></b> Machiel Richards<br>
<b><span style='font-weight:bold'>Cc:</span></b>
nagios-users@lists.sourceforge.net<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Nagios-users] Nagios
memory percentages</span></font><font color=black><span style='color:windowtext'><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Looc at the /proc/meminfo file and the vmstat command.<br>
<br>
Divide memory parameter (free, used, whatever) by total memory, multiply by 100
and you have percent.<br>
<br>
Machiel Richards wrote: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Hi Everyone<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'> Maybe someone can assist me, but this may be a
more linux specific question than Nagios even though related to Nagios.<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'> I need to monitor the memory usage in
percentage on Nagios and would like to rather write my own scripts for this.<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'> 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.<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>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.<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>
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.<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>
My question is this… I can use the command free to get the amount of
memory , used, free etc… <u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>
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?<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'><u1:p> </u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial'>tx<u1:p></u1:p></span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>*** Disclaimer *** </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>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. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>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. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>The Company is not
liable to ensure that outgoing e-mails are virus-free. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>The Company is not
liable, should information or data, for whatever reason, be corrupted or fail
to reach its intended addressee. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>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. </span></font><o:p></o:p></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=1 color=black
face=Arial><span style='font-size:8.0pt;font-family:Arial'>The sender of this
e-mail is subject to and bound by the terms and conditions of Company’s
Electronic Communications Usage Policy. </span></font><o:p></o:p></p>
<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>
<hr size=4 width="90%" align=center>
</span></font></pre><pre style='text-align:center'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>-------------------------------------------------------------------------<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>This SF.net email is sponsored by: Microsoft<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Defy all challenges. Microsoft(R) Visual Studio 2008.<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><o:p></o:p></span></font></pre><pre
wrap=""><font size=2 color=black face="Courier New"><span style='font-size:
10.0pt'><o:p> </o:p></span></font></pre><pre style='text-align:center'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>
<hr size=4 width="90%" align=center>
</span></font></pre><pre style='text-align:center'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><o:p> </o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Nagios-users mailing list<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. <o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>::: Messages without supporting info will risk being sent to /dev/null<o:p></o:p></span></font></pre>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
</div>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">*** Disclaimer *** </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">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. </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">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. </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">The Company is not liable to ensure that outgoing e-mails are virus-free. </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">The Company is not liable, should information or data, for whatever reason, be corrupted or fail to reach its intended addressee. </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">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. </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;"> </SPAN>
</P>
<P STYLE="margin-top: 0pt;margin-bottom: 0pt;"><SPAN STYLE="FONT-FAMILY:'Arial';FONT-SIZE:8pt;">The sender of this e-mail is subject to and bound by the terms and conditions of Company’s Electronic Communications Usage Policy. </SPAN> </P></body>
</html>