jaapar
1
Hi Folks,
I am looking for a way to write a script to calculate swap usage in Solaris so that the current usage will be shown in Percentage value. Thanks!!
Based on 'swap -s' command
# swap -s
total: 1378936k bytes allocated + 1236880k reserved = 2615816k used, 2725104k available
swap -l ok?
swap -l | tail -1 | awk '{ printf("%.2f\n", 100 * ($5/$4))}'
jaapar
3
Hi Jim,
Thanks for the effort, but the output looks wrong when I executed in my Solaris box.
swap -l | tail -1 | awk '{ printf("%.2f\n", 100 * ($5/$4))}'
100.00
This is output for swap -s
swap -s
total: 140936k bytes allocated + 9448k reserved = 150384k used, 43186440k available
Cheers!