1
Here's something that Paul Blackman sent me that may be useful:
4
I created this script to do a few things that smbstatus doesn't at the
5
moment. Perhaps you might want to include these. Sorry I haven't
6
added things at source level, script was quick&easy.
12
else if ($1 == "-c") then
13
echo There are `smbstatus -p |sort -u |grep -n -v z |grep -c :` unique smbd processes running.
14
else if ($1 == "-l") then
15
echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus -p |sort -u |grep -n -v z |grep -c :` >>$2
16
else if ($1 == "-cs") then
17
echo There are `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` concurrent connections to share: $2
18
else if ($1 == "-csl") then
19
echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` >>$3
21
echo "'smbstat -c' ==> Count unique smbd processes."
22
echo "'smbstat -p' ==> List unique smbd processes."
23
echo "'smbstat -l logfile' ==> Append a log entry for the number of"
24
echo " concurrent and unique processes to logfile."
25
echo "'smbstat -cs sharename'"
26
echo " ==> Count processes connected to sharename (assumed unique)"
27
echo "'smbstat -csl sharename logfile'"
28
echo " ==> Append a log entry for the number of concurrent"
29
echo " processes connected to sharename (assumed unique)"
33
Run this script from cron eg.
35
0,5,10,15,20,25,30,35,40,50,55 * * * * /usr/local/samba/bin/smbstat -l /usr/local/samba/var/smbdcount.log
37
and you get a good idea of usage over time.
40
~^ MIME OK ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
41
o | Paul Blackman ictinus@lake.canberra.edu.au
42
o | Co-operative Research ------------------------
43
o _ | Centre For Freshwater Ecology. Ph. (Aus) 06 2012518
44
-- (") o | University of Canberra, Australia. Fax. " 06 2015038
45
\_|_-- |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
| | "Spend a little love and get high"
47
_/ \_ | - Lenny Kravitz
48
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
~~~~~~~~~~~~~~ SAMBA Web Pages: http://samba.org/samba/ ~~~~~~~~~~~~~~