| 1 |
Here's something that Paul Blackman sent me that may be useful: |
| 2 |
|
| 3 |
------------------- |
| 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. |
| 7 |
|
| 8 |
******* |
| 9 |
#!/bin/csh |
| 10 |
if ($1 == "-p") then |
| 11 |
smbstatus -p |sort -u |
| 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 |
| 20 |
else |
| 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)" |
| 30 |
endif |
| 31 |
****** |
| 32 |
|
| 33 |
Run this script from cron eg. |
| 34 |
|
| 35 |
0,5,10,15,20,25,30,35,40,50,55 * * * * /usr/local/samba/bin/smbstat -l /usr/local/samba/var/smbdcount.log |
| 36 |
|
| 37 |
and you get a good idea of usage over time. |
| 38 |
|
| 39 |
Cheers, |
| 40 |
~^ MIME OK ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~ |
| 41 |
o | Paul Blackman [email protected] |
| 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/ ~~~~~~~~~~~~~~ |
| 50 |
|