On Fri, Jun 30, 2006 at 12:12:10PM +0200, Adam Borowski wrote:
> Oh, so you mean checking the _free_ RAM instead of the _physical_ RAM?
> This would be reasonable -- I didn't use this in the debian/rules
> snippet I proposed as the physical memory is a trivially discernable
> number while free RAM can be sometimes hard to tell, especially on Xen:
[...]
> Of course, when I say that something is tricky, it doesn't mean that
> someone with more clue than me can't do it.
[...]

Just grep it out of /proc/meminfo? Something like this ugly bit of
bourne shell:

   echo $(
      grep ^MemTotal: /proc/meminfo | awk '{ print $2 }'
   ) - $(
      grep ^MemFree: /proc/meminfo | awk '{ print $2 }'
   ) - $(
      grep ^Buffers: /proc/meminfo | awk '{ print $2 }'
   ) - $(
      grep ^Cached: /proc/meminfo | awk '{ print $2 }'
   ) | bc

Which would give you a count of the total kb minus what's free and
in use for buffers/cache, similar to what free(1) spits out, but
probably not identical. That might not be an option on older kernels
(I seem to remember dealing with some /proc/meminfo change a while
back that broke check_swap in nagios-plugins), or at least might
differ at particular points in the kernel's release history.
-- 
{ IRL(Jeremy_Stanley); PGP(9E8DFF2E4F5995F8FEADDC5829ABF7441FB84657);
SMTP([EMAIL PROTECTED]); IRC([EMAIL PROTECTED]); ICQ(114362511);
AIM(dreadazathoth); YAHOO(crawlingchaoslabs); FINGER([EMAIL PROTECTED]);
MUD([EMAIL PROTECTED]:6669); WWW(http://fungi.yuggoth.org/); }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to