Skip to content

Instantly share code, notes, and snippets.

@gwynp
Created June 19, 2012 18:02
Show Gist options
  • Save gwynp/2955601 to your computer and use it in GitHub Desktop.
Save gwynp/2955601 to your computer and use it in GitHub Desktop.
vmstat check for swapping
#!/bin/bash
vmstat 5 1|tail -1|awk '{print $7,$8}' | while read vmstatResults;
do
SI=$(echo $vmstatResults | awk '{Print $1}')
SO=$(echo $vmstatResults | awk '{Print $1}')
if [[ $SI -gt 0 || $SO -gt 0 ]]
then
echo "swapping is showing as greater than zero in vmstat"
return 1
else
echo "vmstat is showing no swapping"
return 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment