Calculating swap usage is Solaris without top or prstat isn't easy since the output of 'swap -s' doesn't exactly paint an easily decipherable picture.
So what do we do?
We do some piping, some translation with tr & finally awk!
Take this example of the 'swap -s' output from a Solaris 10 server.
root@localhost:/# swap -s
total: 11454880k bytes allocated + 0k reserved = 11454880k used, 55653984k available
root@localhost:/#
So what do we do?
We do some piping, some translation with tr & finally awk!
Take this example of the 'swap -s' output from a Solaris 10 server.
root@localhost:/# swap -s
total: 11454880k bytes allocated + 0k reserved = 11454880k used, 55653984k available
root@localhost:/#
To make it really easy to interpret, I did this:
root@localhost:/# swap -s | tr -d "k$" | awk '{total= $9 + $11;} {print 100 * $9 / total, "% swap is used"}'
17.0699 % swap is used
root@localhost:/#
That's it!
No comments:
Post a Comment