root / plugins / nginx / nginx_working_set @ a7139bca
Historique | Voir | Annoter | Télécharger (593 octets)
| 1 | f77cbb87 | Mike Koss | #!/bin/bash |
|---|---|---|---|
| 2 | # |
||
| 3 | # Munin plugin for monitoring Nginx working set |
||
| 4 | # |
||
| 5 | 240cf1fd | Mike Koss | # by Mike Koss, Feb 12, 2012 - MIT License |
| 6 | # |
||
| 7 | #%# family=auto |
||
| 8 | #%# capabilities=autoconf |
||
| 9 | f77cbb87 | Mike Koss | |
| 10 | 240cf1fd | Mike Koss | case $1 in |
| 11 | config) |
||
| 12 | f77cbb87 | Mike Koss | cat <<'EOF' |
| 13 | graph_title NGINX Working Set |
||
| 14 | graph_vlabel WS Bytes |
||
| 15 | 3c98d069 | dipohl | graph_category webserver |
| 16 | f77cbb87 | Mike Koss | graph_args --base 1024 |
| 17 | ws.label Working Set |
||
| 18 | EOF |
||
| 19 | exit 0 |
||
| 20 | 240cf1fd | Mike Koss | ;; |
| 21 | |||
| 22 | autoconf) |
||
| 23 | if [ "$(pidof nginx)" == "" ]; then |
||
| 24 | echo no |
||
| 25 | else |
||
| 26 | echo yes |
||
| 27 | fi |
||
| 28 | exit 0 |
||
| 29 | ;; |
||
| 30 | esac |
||
| 31 | f77cbb87 | Mike Koss | |
| 32 | KBS=$(ps -o rss --no-heading -p $(pidof nginx)) |
||
| 33 | total=0 |
||
| 34 | for size in $KBS |
||
| 35 | do |
||
| 36 | total=$(($total + $size * 1024)) |
||
| 37 | done |
||
| 38 | echo ws.value $total |
