falsecz
1/28/2014 - 3:49 PM

supervisor-metrics.sh

#!/bin/bash

SCHEME=supervisor.`hostname -s`

APPS=`supervisorctl status | awk '{print $1 "|" $4}' | tr -d ','`

for APP in $APPS; do
    PID=`echo $APP | cut -f2 -d '|'`
    NAME=`echo $APP | cut -f1 -d '|'`
    RSS=`cat /proc/$PID/status | grep VmRSS: | awk '{print $2}'`

    echo $SCHEME.$NAME.rss $RSS
done