1#!@@GOODSH@@ 2# -*- sh -*- 3# 4# Plugin to monitor the number of open files in the system. 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=auto 15#%# capabilities=autoconf 16 17 18 19if [ "$1" = "autoconf" ]; then 20 if [ -x /sbin/sysctl ]; then 21 /sbin/sysctl kern.openfiles > /dev/null 22 if [ $? = "0" ]; then 23 echo yes 24 exit 0 25 else 26 echo no 27 exit 0 28 fi 29 else 30 echo no 31 exit 0 32 fi 33fi 34 35if [ "$1" = "config" ]; then 36 37 echo 'graph_title File table usage' 38 echo 'graph_args --base 1000 -l 0' 39 echo 'graph_vlabel number of open files' 40 echo 'graph_category system' 41 echo 'graph_info This graph monitors the number of open files.' 42 echo 'used.label open files' 43 echo 'used.info The number of currently open files.' 44 echo 'max.label max open files' 45 echo 'max.info The maximum supported number of open files.' 46 /sbin/sysctl -n kern.maxfiles | awk '{printf "used.warning %d\nused.critical %d\n",$1*0.92,$1*0.98}' 47 exit 0 48fi 49 50#awk '{print "used.value " $1-$2 "\nmax.value " $3}' < /proc/sys/fs/file-nr 51echo -n 'max.value ' 52/sbin/sysctl -n kern.maxfiles 53echo -n 'used.value ' 54/sbin/sysctl -n kern.openfiles 55