|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d/ |
Upload File : |
#!/bin/sh
#
# Plugin to monitor the number of open files in the system.
#
# $Log$
# Revision 1.7.2.1 2005/01/29 20:13:59 jimmyo
# Made generic/samba more portable (fixes by Nicolas Stransky).
#
# Revision 1.7 2005/01/05 15:18:13 jimmyo
# Made generic/samba more portable (fixes by Nicolas Stransky).
#
# Revision 1.6 2005/01/04 18:25:33 jimmyo
# Made generic/samba more portable.
#
# Revision 1.5 2005/01/03 22:22:58 jimmyo
# Plugins: Made generic/samba more portable.
#
# Revision 1.4 2004/12/22 21:21:18 jimmyo
# Cleaned up generic/samba a bit (SF#1087961).
#
# Revision 1.3 2004/05/20 19:02:36 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.2 2004/01/29 19:39:00 jimmyo
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
#
# Revision 1.1 2004/01/02 18:50:00 jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.1 2003/11/24 10:01:53 jimmyo
# New plugin by Finn-Arne Johansen
#
#
# client-conf.d/-options:
#
# smbstatus -- path to smbstatus executable
# ignoreipcshare -- ignore IPC$ whan counting shares
# any string will do
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers (Used by munin-config and some installation scripts.
# Optional):
#
#%# family=contrib
#%# capabilities=autoconf
SMBSTATUS=${smbstatus:-`which smbstatus`}
SMBSTATUS=${SMBSTATUS:-/usr/bin/smbstatus}
if [ "$1" = "autoconf" ]; then
if [ -x $SMBSTATUS ]; then
echo yes
exit 0
else
echo no '(smbstatus not found)'
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Samba status'
echo 'graph_args -l 0'
echo 'graph_vlabel number'
echo 'graph_category samba'
echo 'proc.label processes'
echo 'lock.label locked files'
echo 'share.label Open shares'
echo 'max.warning 900'
echo 'max.critical 960'
exit 0
fi
$SMBSTATUS -p 2>/dev/null | awk 'BEGIN {lines=0} $1 ~ /^[0-9]+/ {lines++} END {print "proc.value " lines}'
$SMBSTATUS -L 2>/dev/null | awk 'BEGIN {lines=0} $1 ~ /^[0-9]+/ {lines++} END {print "lock.value " lines}'
if [ -n "$ignoreipcshare" ]; then
IGNORE='$1=="IPC$" {next}'
fi
$SMBSTATUS -S 2>/dev/null | awk '
BEGIN {lines=0;state=0}
$1=="Service"&&state==0 {state=1;next}
/^--*$/&&state==1 {state=2;next}
state<2 {next}
/^$/ {next}
'"$IGNORE"'
{lines++}
END {print "share.value " lines}'