root / plugins / processes / multipsu @ e70093d3
Historique | Voir | Annoter | Télécharger (948 octets)
| 1 | 8b76e0da | Michael Rutledge | #!/bin/bash |
|---|---|---|---|
| 2 | # |
||
| 3 | # Script to monitor number of processes by user. Programs are configured |
||
| 4 | # in /etc/munin/plugin-conf.d/munin-node |
||
| 5 | # |
||
| 6 | # Parameters: |
||
| 7 | # |
||
| 8 | # config (required) |
||
| 9 | # autoconf (optional - used by lrrd-config) |
||
| 10 | # |
||
| 11 | # Configuration example |
||
| 12 | # |
||
| 13 | # [multipsu] |
||
| 14 | # env.multipsunames root exim ftp |
||
| 15 | # |
||
| 16 | # |
||
| 17 | # Magic markers (optional): |
||
| 18 | #%# family=manual |
||
| 19 | #%# capabilities=autoconf |
||
| 20 | |||
| 21 | if [ "$1" = "autoconf" ]; then |
||
| 22 | if [ -z "$multipsunames" ]; then |
||
| 23 | echo "Configuration required $multipsunames" |
||
| 24 | else |
||
| 25 | echo yes |
||
| 26 | fi |
||
| 27 | exit 0 |
||
| 28 | fi |
||
| 29 | |||
| 30 | if [ "$1" = "config" ]; then |
||
| 31 | |||
| 32 | echo graph_title Number of selected processes |
||
| 33 | echo 'graph_category processes' |
||
| 34 | echo 'graph_args --base 1000 --vertical-label processes -l 0' |
||
| 35 | for name in $multipsunames; do |
||
| 36 | echo "$name.label $name" |
||
| 37 | echo "$name.draw LINE2" |
||
| 38 | done |
||
| 39 | exit 0 |
||
| 40 | fi |
||
| 41 | |||
| 42 | for name in $multipsunames; do |
||
| 43 | printf "$name.value " |
||
| 44 | (pgrep -u "$name"; pgrep -U "$name") | sort -u | wc -l |
||
| 45 | done |
