source: branches/samba-3.3.x/examples/misc/extra_smbstatus

Last change on this file was 206, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 2.3 KB
Line 
1Here's something that Paul Blackman sent me that may be useful:
2
3-------------------
4I created this script to do a few things that smbstatus doesn't at the
5moment. Perhaps you might want to include these. Sorry I haven't
6added things at source level, script was quick&easy.
7
8*******
9#!/bin/csh
10if ($1 == "-p") then
11 smbstatus -p |sort -u
12else 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
16else if ($1 == "-cs") then
17 echo There are `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` concurrent connections to share: $2
18else if ($1 == "-csl") then
19 echo `date '+ %d/%m/%y %H:%M:%S'` `smbstatus |awk '$1==share {n++;} END {print n}' share=$2` >>$3
20else
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)"
30endif
31******
32
33Run this script from cron eg.
34
350,5,10,15,20,25,30,35,40,50,55 * * * * /usr/local/samba/bin/smbstat -l /usr/local/samba/var/smbdcount.log
36
37and you get a good idea of usage over time.
38
39Cheers,
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/ ~~~~~~~~~~~~~~
50
Note: See TracBrowser for help on using the repository browser.