PluginOutdatedCatalog: files_user_

File files_user_, 1.1 KB (added by frankg, at 2006-03-13T21:00:30+01:00)

modified files_ to show open files per user

Line 
1#!/bin/sh
2#
3# Plugin to monitor the number of open files in the system by user.
4#  copyied for the files_ plugin
5#
6# Parameters:
7#       
8#       config   (required)
9#       autoconf (optional - used by munin-config)
10#
11# Magic markers (Used by munin-config and some installation scripts.
12# Optional):
13#
14#%# family=contrib
15#%# capabilities=autoconf
16
17
18U=`basename $0 | sed 's/^files_user_//g'`
19TMPFILE="/home/munin/var/opt/munin/plugin-state/munin-files_user_$U.state"
20
21if [ "$1" = "autoconf" ]; then
22        if [ -x /usr/sbin/lsof ]; then
23                echo yes
24                exit 0
25        else
26                echo no
27                exit 1
28        fi
29fi
30
31if [ "$1" = "config" ]; then
32
33        echo 'graph_title user '$U' open files usage'
34        echo 'graph_args --base 1024 -l 0'
35        echo 'graph_vlabel number of files'
36        echo 'graph_category system'
37        echo 'cnt.label '$U' file count'
38        echo 'avg.label avg all '$U' file'
39        echo 'max.label max $U files'
40        echo hei | awk  '{printf "max.warning %d\nmax.critical %d\n",900,960}'
41        exit 0
42fi
43
44for ALL in $(pgrep   $U) ; do 
45  /usr/sbin/lsof -u $U | wc -l
46done | sort -n | \
47    awk '{ C=C+1 ;  S=S + $1-1 ; M=$1-1 } END { printf "cnt.value %d\navg.value %d\nmax.value %d\n", C, S/C, M} '