2012-02-13 19:53:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Munin plugin for monitoring Nginx working set
|
|
|
|
#
|
2012-02-15 01:48:07 +01:00
|
|
|
# by Mike Koss, Feb 12, 2012 - MIT License
|
|
|
|
#
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
2012-02-13 19:53:16 +01:00
|
|
|
|
2012-02-15 01:48:07 +01:00
|
|
|
case $1 in
|
|
|
|
config)
|
2012-02-13 19:53:16 +01:00
|
|
|
cat <<'EOF'
|
|
|
|
graph_title NGINX Working Set
|
|
|
|
graph_vlabel WS Bytes
|
2017-02-21 17:11:23 +01:00
|
|
|
graph_category webserver
|
2012-02-13 19:53:16 +01:00
|
|
|
graph_args --base 1024
|
|
|
|
ws.label Working Set
|
|
|
|
EOF
|
|
|
|
exit 0
|
2012-02-15 01:48:07 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
autoconf)
|
|
|
|
if [ "$(pidof nginx)" == "" ]; then
|
|
|
|
echo no
|
|
|
|
else
|
|
|
|
echo yes
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
2012-02-13 19:53:16 +01:00
|
|
|
|
|
|
|
KBS=$(ps -o rss --no-heading -p $(pidof nginx))
|
|
|
|
total=0
|
|
|
|
for size in $KBS
|
|
|
|
do
|
|
|
|
total=$(($total + $size * 1024))
|
|
|
|
done
|
|
|
|
echo ws.value $total
|