Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- supervisorctl status | \
- awk '
- match($0, /^([^:]+):[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).*$/, line) {
- SUBSEP=","
- # Sadly, we can not initialize all the worker,status couples in the BEGIN section.
- # We have to run these almost useless lines during the input parsing
- if ( status[line[1],"STOPPED"] == 0 ) { status[line[1],"STOPPED"] = 0 }
- if ( status[line[1],"STARTING"] == 0 ) { status[line[1],"STARTING"] = 0 }
- if ( status[line[1],"RUNNING"] == 0 ) { status[line[1],"RUNNING"] = 0 }
- if ( status[line[1],"BACKOFF"] == 0 ) { status[line[1],"BACKOFF"] = 0 }
- if ( status[line[1],"STOPPING"] == 0 ) { status[line[1],"STOPPING"] = 0 }
- if ( status[line[1],"EXITED"] == 0 ) { status[line[1],"EXITED"] = 0 }
- if ( status[line[1],"FATAL"] == 0 ) { status[line[1],"FATAL"] = 0 }
- if ( status[line[1],"UNKNOWN"] == 0 ) { status[line[1],"UNKNOWN"] = 0 }
- status[line[1],line[2]]++
- }
- END {
- for(i in status) {
- print "- supervisord.workerState[" i "] " status[i]
- }
- }'
Add Comment
Please, Sign In to add comment