Skip to content

Instantly share code, notes, and snippets.

@alder
Last active August 29, 2015 14:14
Show Gist options
  • Save alder/5b70fa57501c2a3abea4 to your computer and use it in GitHub Desktop.
Save alder/5b70fa57501c2a3abea4 to your computer and use it in GitHub Desktop.
PerfMon EXEC examples
#Example1: Monitoring Linux cached memory size, used free utility output:
/bin/sh:-c:free | grep Mem | awk '{print $7}'
#Example2: Monitoring MySQL select query count:
/bin/sh:-c:echo "show global status like 'Com_select'" | mysql -u root | awk '$1 =="Com_select" {print $2}'
#Example3: Monitoring PostgreSQL CPU usage in percents:
/bin/sh:-c:ps aux | grep "postgres" | grep -v "grep" | grep "puser" | awk 'BEGIN {c = 0} {a = $3; c += a} END {print c}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment