mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-11 21:42:39 -04:00
82 lines
2.0 KiB
Bash
Executable File
82 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# 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.2 2008/10/15 13:13:09 he
|
|
# Convert from using an input-less awk job (how did that ever work?)
|
|
# to using shell arithmetic, which should be more light-weight and should
|
|
# not pose a danger of hanging.
|
|
#
|
|
# 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 1
|
|
fi
|
|
else
|
|
echo no
|
|
exit 1
|
|
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.'
|
|
|
|
echo "used.warning $(($filemax * 92/100))"
|
|
echo "used.critical $(($filemax * 98/100))"
|
|
exit 0
|
|
fi
|
|
|
|
echo 'max.value ' $filemax
|
|
echo 'used.value ' $openfiles
|