Valentin Chopov
valentin@valcho.net
Tue Mar 25 14:46:05 UTC 2003
Hi,
It seems that the latest libexec/dcc-stats-collect and libexec/stats-get
are not working. I think I fixed them, look at the attchmnts.
Val
==
Valentin S. Chopov, CCNP
Sys/Net Admin
SEI Data Inc.
E-Mail: valentin@valcho.net
==
-------------- next part --------------
#! /bin/sh
# get statistics from a DCC server
# [-x] debugging
# [-q] quiet
# [-i client-ID] that DCC server will accept
# [-p password] that DCC server will accept
# host server to ask for numbers
# A single line of 5 decimal numbers separated by colons is sent to stdout:
# For example,
# 115492:71318:44694:2462909:155924
# means the DCC server has
# 115492 received reports of checksums from DCC clients
# 71318 received reports where the target count was >= 10
# 44694 received reports where the target count was "many"
# 2462909 entries in its hash table
# 155924 received reports by flooding
# Copyright (c) 2003 by Rhyolite Software
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE
# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# Rhyolite Software DCC 1.1.33-1.2 $Revision$
DEBUG=
QUIET=
RRDTOOL=/usr/local/bin/rrdtool
CLNT_ID="1"
PASSWD=
USAGE="`basename $0`: [-xq] [-i client-ID] [-p password] host"
while getopts "xqi:p:" c; do
case $c in
x) set -x; DEBUG=-x;;
q) QUIET="-q";;
i) CLNT_ID="$OPTARG";;
p) PASSWD="password $OPTARG;";;
*) echo "$USAGE" 1>&2; exit 1;;
esac
done
shift `expr $OPTIND - 1 || true`
if test "$#" -eq 0; then
echo "$USAGE" 1>&2
exit 1
fi
HOST=$1
# pick ",portnum" from the hostname
PORT=`expr "$HOST" : '.*,\(.*\)'`
if test "$PORT" != ""; then
HOST=`expr $HOST : '\(.*\),$PORT"`
PORT="port $PORT;"
fi
(
if test ! -z "$QUIET"; then
exec 2>/dev/null
fi
cdcc "id $CLNT_ID; $PASSWD $PORT host $HOST; stats"
) | awk '/hash entries/{ hashes = $4; }
/^ *[0-9][0-9 ]*reports/{
reports = $1;
}
/answers.*>10/{
split($2,bulk,">");
spam=$5;
}
/accepted/{
flooded=$1;
printf "%s:%s:%s:%s:%s\n",
reports, bulk[1], spam, hashes, flooded;
}'
-------------- next part --------------
#! /bin/sh
# collect spam statistics in .rrd files
# [-x] debugging
# [-q] quiet
# [-h dcc_homedir]
# [-T /usr/local/bin/rrdtool]
# see http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/
# or the FreeBSD package.
# [-i client-ID] that DCC servers will accept
# [-p password] that DCC servers will accept
# host1, host2, ... servers to ask for data
# Copyright (c) 2003 by Rhyolite Software
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE
# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# Rhyolite Software DCC 1.1.33-1.6 $Revision$
# Generated automatically from dcc-stats-collect.in by configure.
exec 1>&2 </dev/null
DCC_HOMEDIR=/var/dcc
DEBUG=
# check the args once to get the home directory
while getopts "xqh:T:i:p:" c; do
case $c in
x) set -x; DEBUG=-x;;
h) DCC_HOMEDIR="$OPTARG";;
*) ;;
esac
done
. $DCC_HOMEDIR/dcc_conf
QUIET=
RRDTOOL=/usr/local/bin/rrdtool
CLNT_ID="1"
PASSWD=
USAGE="`basename $0`: [-xq] [-h homedir] [-T rrdtool] [-i client-ID] [-p password] host1 host2 ..."
OPTIND=1
while getopts "xqh:T:i:p:" c; do
case $c in
x) ;;
q) QUIET="-q";;
h) ;;
T) RRDTOOL="$OPTARG";;
i) CLNT_ID="$OPTARG";;
p) PASSWD="$OPTARG;";;
*) echo "$USAGE"; exit 1;;
esac
done
shift `expr $OPTIND - 1 || true`
if test "$#" -eq 0; then
echo "$USAGE"
exit 1
fi
cd $DCC_HOMEDIR/stats
for HOST in $*; do
HOST="`basename $HOST .rrd`"
FILE=$HOST.rrd
if test ! -s $FILE; then
$DCC_LIBEXEC/dcc-stats-init $QUIET $DEBUG -h \
"$DCC_HOMEDIR" -T "$RRDTOOL" $FILE
fi
LINE="`$DCC_LIBEXEC/stats-get $DEBUG $QUIET -i $CLNT_ID -p $PASSWD $HOST`"
if test ! -z "$LINE"; then
$RRDTOOL update $FILE "N:$LINE"
fi
done
More information about the DCC
mailing list