[Samba] Looking for samba user statistics
Thomas Bork
tombork at web.de
Sun Aug 22 12:31:00 GMT 2004
Stephen Kühn wrote:
>> This system is running for a while, using Redhat 7.2 and Samba
>> 2.2.3. Question: Before I completely reinstall this system, I
>> would like to get some samba statistics from this system. Can
>> anybody point me in the right direction on how to do this.
[...]
> After blowing out 16mb of logfiles, yeah, that would be a nice thing
> to have, wouldn't it? I just googled my brains out and didn't come up
> with anything - then again, it could be because I'm rather
> tired...would like to know what your findings are on this, though...
take a look in the samba tarball under
/examples/misc/extra_smbstatus
I modified the script a little bit:
#! /bin/sh
# set -x
int_samba_version=`smbd -V | cut -d" " -f2`
share="$2"
do_c_status ()
{
status=`smbstatus -p \
| grep -vi "Samba version $int_samba_version" \
| grep -vi "Service uid gid pid machine" \
| grep -vi "-" \
| sort -u \
| grep -n -v : \
| grep -v "1:" \
| grep -c :`
}
do_cs_status ()
{
status=`smbstatus -S \
| grep -vi "Samba version $int_samba_version" \
| grep -vi "Service uid gid pid machine" \
| grep -vi "-" \
| grep -n $share \
| grep -c :`
}
if [ "$1" = "-c" ]
then
do_c_status
echo "There are $status unique smbd processes running."
elif [ "$1" = "-p" ]
then
status=`smbstatus -b \
| grep -vi "Samba version $int_samba_version"`
echo "$status"
elif [ "$1" = "-l" ]
then
do_c_status
timestamp=`date '+%d.%m.%Y %H:%M:%S'`
echo "$timestamp $status" >>$2
elif [ "$1" = "-cs" ]
then
do_cs_status
echo "There are $status concurrent connections to share $share."
elif [ "$1" = "-csl" ]
then
do_cs_status
timestamp=`date '+%d.%m.%Y %H:%M:%S'`
echo "$timestamp $status" >>$2
else
echo "'smbstat -c' ==> Count unique smbd processes."
echo "'smbstat -p' ==> List unique smbd processes."
echo "'smbstat -l logfile' ==> Append a log entry for the"
echo " number of concurrent and"
echo " unique processes to logfile."
echo "'smbstat -cs sharename' ==> Count processes connected to"
echo " sharename (assumed unique)."
echo "'smbstat -csl sharename logfile' ==> Append a log entry for the"
echo " number of concurrent"
echo " processes connected to"
echo " sharename (assumed unique)."
fi
Run this script from cron.
--
der tom
[fli4l-/eis-team]
More information about the samba
mailing list