Script Munin pour Samba

Script Munin pour Samba

Voila deux petit plugins pour surveiller Samba sous munin. Le premier indique le nombre de personne en train d’utiliser des fichier avec samba (source):

#!/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.
#
# 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.'
    echo 'graph_category Samba'
    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 ^$

Le deuxième script (tiré d’ici), samba_locked, qui indique le nombre de fichiers qui sont verrouillés afin d’éviter que le fichier soit corrompu pendant que plusieurs personnes travaillent dessus

#!/bin/sh
#
# Plugin to monitor the number of Samba locked files 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.
#
# 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 Locked Files'
    echo 'graph_args --base 1000 -l 0 '
    echo 'graph_vlabel number of locked files'
    echo 'graph_category Samba'
    echo 'graph_info This graph shows the number locked Samba Files.'
    echo 'samba_locked.label Locked Files'
    echo 'samba_locked.draw LINE2'
    echo 'samba_locked.info The current number of locked files.'
    exit 0
fi

echo -n "samba_locked.value "
smbstatus -L 2> /dev/null | grep -c DENY_