[Xymon] hpux-meminfo.c patch

Williams, Doug (Consultant-RIC) Doug.Williams at DexOne.com
Thu Mar 3 16:19:57 CET 2011


yes, sorry:

# /usr/sbin/swapinfo | awk '/^memory/ {tot=$2/1024;free=$4/1024} END {printf "Total: %d\nFree: %d\n",tot,free}'
Total: 49122
Free: 42732


# swapinfo -tam
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev        1024       0    1014    0%       0       -    1  /dev/vg00/lvol2
dev       81888       0   81887    0%       0       -    0  /dev/vgev08_swap_r0_1/lvswap
reserve       -    3714   -3714
memory    49122    6390   42732   13%
total    132034   10104  121919    8%       -       0    -

# uname -r
B.11.23



-----Original Message-----
From: Buchan Milne [mailto:bgmilne at staff.telkomsa.net] 
Sent: Thursday, March 03, 2011 10:14 AM
To: Williams, Doug (Consultant-RIC)
Cc: xymon at xymon.com; henrik at hswn.dk
Subject: Re: [Xymon] hpux-meminfo.c patch

Do the numbers look correct (~ 50GB memory, 42GB free, and 24GB memory, 10GB free)?

The following shorter form should also work:

/usr/sbin/swapinfo | awk '/^memory/ {printf "Total: %d\nFree: %d\n",$2/1024,$4/1024}'

Regards,
Buchan

----- "Doug Williams (Consultant-RIC)" <Doug.Williams at DexOne.com> wrote:

> # uname -r
> B.11.23
> # /usr/sbin/swapinfo | awk '/^memory/ {tot=$2/1024;free=$4/1024} END
> {printf "Total: %d\nFree: %d\n",tot,free}'
> Total: 49122
> Free: 42732
> 
> # uname -r
> B.11.31
> # /usr/sbin/swapinfo | awk '/^memory/ {tot=$2/1024;free=$4/1024} END
> {printf "Total: %d\nFree: %d\n",tot,free}'
> Total: 23354
> Free: 9986
> 
> 
> -----Original Message-----
> From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On
> Behalf
> Of Buchan Milne
> Sent: Thursday, March 03, 2011 9:51 AM
> To: henrik at hswn.dk
> Cc: xymon at xymon.com
> Subject: Re: [Xymon] hpux-meminfo.c patch
> 
> 
> ----- henrik at hswn.dk wrote:
> 
> > Hi Jason,
> > 
> > On Tue, 22 Feb 2011 08:15:14 -0600, Jason Fredricksen
> > <jasonajfredricksen at gmail.com> wrote:
> > > This patch for hpux-meminfo.c may help due to  11iv3 page sizes
> > 4096
> > ,8192
> > > ,16384 ,65536. 
> > 
> > I was sent another solution back in December which replaces the
> > hpux-meminfo 
> > utility with a bit of shell scripting:
> > 
> > FREE=`/usr/sbin/swapinfo |grep ^memory |awk {'print $4'}`
> > FREEREPORT=`echo $FREE / 1024 |/usr/bin/bc`
> > TOTAL=`/usr/sbin/swapinfo |grep ^memory |awk {'print $2'}`
> > TOTALREPORT=`echo $TOTAL / 1024 |/usr/bin/bc`
> > echo Total:$TOTALREPORT
> > echo Free:$FREEREPORT
> 
> I am not sure of the features of awk on HP-UX, but on Linux, you can
> do
> all the processing with a single invocation of awk and swapinfo:
> 
> /usr/sbin/swapinfo | awk '/^memory/ {tot=$2/1024;free=$4/1024} END
> {printf "Total: %d\nFree: %d\n",tot,free}'
> 
> It would be useful to know if this version works on HP-UX.
> 
> Regards,
> Buchan
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon


More information about the Xymon mailing list