2007-04-17 12:40:04 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Plugin to monitor the number of Samba users on the machine.
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
#
|
|
|
|
# config (required)
|
|
|
|
# autoconf (optional - used by munin-config)
|
|
|
|
#
|
|
|
|
# $Log$
|
|
|
|
# Revision 1.0 2007/04/16 Jon Higgs
|
|
|
|
# Initial Release - Adapated from jimmyo's processses plugin.
|
|
|
|
#
|
2014-07-24 14:02:36 +02:00
|
|
|
# Revision 1.1 2014/07/24 MangaII
|
|
|
|
# Add exit 0
|
|
|
|
# WARNING : Samba 3.6 and newer block access to smbstatus for no root user
|
|
|
|
# On Debian make a "chmod a+w /run/samba/sessionid.tdb"
|
|
|
|
# smbstatus must open this file with RW option
|
|
|
|
#
|
2007-04-17 12:40:04 +02:00
|
|
|
# Magick markers (optional - used by munin-config and som installation
|
|
|
|
# scripts):
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title Samba Users'
|
|
|
|
echo 'graph_args --base 1000 -l 0 '
|
|
|
|
echo 'graph_vlabel number of Samba users.'
|
2017-02-21 22:15:07 +01:00
|
|
|
echo 'graph_category fs'
|
2007-04-17 12:40:04 +02:00
|
|
|
echo 'graph_info This graph shows the number Samba users.'
|
|
|
|
echo 'samba_users.label Samba Users'
|
|
|
|
echo 'samba_users.draw LINE2'
|
|
|
|
echo 'samba_users.info The current number of Samba users.'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n "samba_users.value "
|
|
|
|
smbstatus -b 2> /dev/null | grep -c -v -e "^Samba" -e "^---" -e "^PID" -e ^$
|
2014-07-24 14:02:36 +02:00
|
|
|
|
|
|
|
exit 0
|