root / plugins / samba / samba_users @ 3e900944
Historique | Voir | Annoter | Télécharger (1,15 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# Plugin to monitor the number of Samba users on the machine. |
| 4 |
# |
| 5 |
# Parameters: |
| 6 |
# |
| 7 |
# config (required) |
| 8 |
# autoconf (optional - used by munin-config) |
| 9 |
# |
| 10 |
# $Log$ |
| 11 |
# Revision 1.0 2007/04/16 Jon Higgs |
| 12 |
# Initial Release - Adapated from jimmyo's processses plugin. |
| 13 |
# |
| 14 |
# Revision 1.1 2014/07/24 MangaII |
| 15 |
# Add exit 0 |
| 16 |
# WARNING : Samba 3.6 and newer block access to smbstatus for no root user |
| 17 |
# On Debian make a "chmod a+w /run/samba/sessionid.tdb" |
| 18 |
# smbstatus must open this file with RW option |
| 19 |
# |
| 20 |
# Magick markers (optional - used by munin-config and som installation |
| 21 |
# scripts): |
| 22 |
#%# family=auto |
| 23 |
#%# capabilities=autoconf |
| 24 |
|
| 25 |
if [ "$1" = "autoconf" ]; then |
| 26 |
echo yes |
| 27 |
exit 0 |
| 28 |
fi |
| 29 |
|
| 30 |
if [ "$1" = "config" ]; then |
| 31 |
|
| 32 |
echo 'graph_title Samba Users' |
| 33 |
echo 'graph_args --base 1000 -l 0 ' |
| 34 |
echo 'graph_vlabel number of Samba users.' |
| 35 |
echo 'graph_category Samba' |
| 36 |
echo 'graph_info This graph shows the number Samba users.' |
| 37 |
echo 'samba_users.label Samba Users' |
| 38 |
echo 'samba_users.draw LINE2' |
| 39 |
echo 'samba_users.info The current number of Samba users.' |
| 40 |
exit 0 |
| 41 |
fi |
| 42 |
|
| 43 |
echo -n "samba_users.value " |
| 44 |
smbstatus -b 2> /dev/null | grep -c -v -e "^Samba" -e "^---" -e "^PID" -e ^$ |
| 45 |
|
| 46 |
exit 0 |
