> I am trying to adapt a script I have found to run MRTG
> to cut a long story short I need to figure out how awk
> figures out deciphers which is the right field to choose?
> 
> ie which would be the print for Free MEM & Swap

If it helps, this is the MRTG script I wrote for reporting on memory and swap 
usage:

#!/bin/bash

# Get memory usage
sar -r 1 1 | grep Average | awk '
{
  TotalMem = $2 + $3
  MemUsed = $3 - $6 - $7

  # print memory usage %
  printf("%3.2f\n", MemUsed * 100 / TotalMem)

  # print swap usage %
  print $10
}
'

# print uptime
uptime | sed 's/.* up \([^,]*\), .*$/\1/'

# print machine name
uname -a | cut -d " " -f 2


and the MRTG config:
Target[mem]: `/root/scripts/mrtg/mem`
MaxBytes[mem]: 100
Title[mem]: MEM Usage %
PageTop[mem]: <H1>MEM Statistics</H1>
Options[mem]: growright, gauge, nopercent, noarrow, nobanner
Suppress[mem]: y
YLegend[mem]: MEM Usage %
ShortLegend[mem]: %
Legend1[mem]: Real %
Legend2[mem]: Swap %
LegendI[mem]: &nbsp;Real:&nbsp;
LegendO[mem]: &nbsp;Swap:&nbsp;

-- 
Regards,
+-----------------------+---------------------------------+
| Peter Kiem            | E-Mail    : <[EMAIL PROTECTED]> |
| Zordah IT             | Mobile    : +61 0414 724 766    |
|   IT Consultancy &    | WWW       : www.zordah.net      |
|   Internet Hosting    | ICQ       : "Zordah" 866661     |
+-----------------------+---------------------------------+






_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to