/usr/share/munin/plugins/files_ is in munin-plugins-extra 2.0.19-3ubuntu0.3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/bin/sh
#
# Plugin to monitor the number of open files in the system.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers (Used by munin-config and some installation scripts.
# Optional):
#
#%# family=contrib
#%# capabilities=autoconf
PROC=${0##*/files_}
TMPFILE="$MUNIN_PLUGSTATE/munin-files_${PROC}.state"
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/lsof ]; then
echo yes
exit 0
else
echo "no (no lsof)"
exit 0
fi
fi
if [ "$1" = "config" ]; then
echo graph_title slapd open files usage
echo graph_args --base 1000 -l 0
echo graph_vlabel number of files
echo graph_category system
echo cnt.label Slapd proc count
echo avg.label avg all slapd proc
echo max.label max slapd files
echo max.warning 900
echo max.critical 960
exit 0
fi
if [ "$1" = "collect" ]; then
for ALL in $(pgrep -u root $PROC) ; do
lsof -p $ALL | wc -l
done | sort -n | \
awk '{ C=C+1 ; S=S + $1 ; M=$1 } END { printf "cnt.value %d\navg.value %d\nmax.value %d\n", C, S/C, M} '
else
[ -f $TMPFILE ] && cat $TMPFILE
echo "/etc/munin/node.d/slapd_files collect > $TMPFILE" | at +4min 2>/dev/null
fi
|