Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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