#!@@GOODSH@@ # # Plugin to monitor the number of open files in the system. # # Parameters: # # config (required) # autoconf (optional - used by munin-config) # # $Log: open_files.in,v $ # Revision 1.1.1.1 2006/06/04 20:53:57 he # Import the client version of the Munin system monitoring/graphing # tool -- project homepage is at http://munin.sourceforge.net/ # # This package has added support for NetBSD, via a number of new plugin # scripts where specific steps needs to be taken to collect information. # # I also modified the ntp_ plugin script to make it possible to not # plot the NTP poll delay, leaving just jitter and offset, which IMO # produces a more telling graph. # # # # # Magic markers (Used by munin-config and some installation scripts. # Optional): # #%# family=auto #%# capabilities=autoconf if [ "$1" = "autoconf" ]; then if [ -x /usr/sbin/pstat ]; then /usr/sbin/pstat -T | grep files > /dev/null if [ $? = "0" ]; then echo yes exit 0 else echo no exit 0 fi else echo no exit 0 fi fi eval `/usr/sbin/pstat -T | awk '/files/ { split($1, a, "/"); print "filemax=" a[2]; print "openfiles=" a[1]; }'` if [ "$1" = "config" ]; then echo 'graph_title File table usage' echo 'graph_args --base 1000 -l 0' echo 'graph_vlabel number of open files' echo 'graph_category system' echo 'graph_info This graph monitors the Linux open files table.' echo 'used.label open files' echo 'used.info The number of currently open files.' echo 'max.label max open files' echo 'max.info The maximum supported number of open files.' awk -v filemax=$filemax '{ printf "used.warning %d\n", $filemax * 0.92; printf "used.critical %d\n", $filemax * 0.98; }' exit 0 fi echo 'max.value ' $filemax echo 'used.value ' $openfiles