root / plugins / samba / samba_users @ 8589c6df
Historique | Voir | Annoter | Télécharger (1,14 ko)
| 1 | deefb86c | Jon Higgs | #!/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 | 8589c6df | klemens | # Initial Release - Adapted from jimmyo's processses plugin. |
| 13 | deefb86c | Jon Higgs | # |
| 14 | 3e900944 | OOP Master | # 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 | deefb86c | Jon Higgs | # 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 | 65652aa0 | dipohl | echo 'graph_category fs' |
| 36 | deefb86c | Jon Higgs | 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 | 3e900944 | OOP Master | |
| 46 | exit 0 |
