/usr/bin/add_txrx is in flowscan 1.006-13.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #! /bin/ksh
# add_txrx - add two new Data Sources called 'tx' and 'rx' to an RRD file
# $Id: add_txrx.in,v 1.2 2001/02/11 20:43:25 dplonka Exp $
# Dave Plonka <plonka@doit.wisc.edu>
# This utility is used when upgrading from FlowScan-1.005 (or less) to
# FlowScan-1.006 (or greater). It is used to add two new Data Sources
# to FlowScan ".rrd" files. e.g.:
#
# $ make install # install FlowScan-1.006 in your existing FlowScan dir
# $ cd $prefix/graphs
# $ add_txrx total.rrd *.*.*.*_*.rrd
#
# tx - a count of the unique source IP addresses that have transmitted flows
# rx - a count of the unique destination IP addresses that have received flows
#
# These Data Sources will allows FlowScan users to calculate the average
# number of bytes, packets, and flows per host and to determine the overall
# level of activity (in terms of numbers of individual hosts) for each subnet
# and for the entire campus.
#
# The values will be recorded only if you use the TopN directive with the
# CampusIO and/or SubNetIO reports. TopN was introduced in FlowScan-1.006.
#
# For instance, if you set CampusIO's TopN to a value greater than zero,
# the tx value in FlowScan's "total.rrd" is the number of unique source
# IP addresses (hosts) from which FlowScan has seen outbound flows.
# { CONFIGURATION SECTION START ################################################
# { external commands used by this script:
typeset head="/usr/bin/head"
typeset grep="/bin/grep"
typeset cp="/bin/cp"
typeset mv="/bin/mv"
typeset rm="/bin/rm"
typeset perl="/usr/bin/perl"
typeset rrdtool="/usr/bin/rrdtool"
typeset add_ds="/usr/bin/add_ds.pl"
# }
# } CONFIGURATION SECTION END ##################################################
typeset script=${0##*/}
if (( $# < 1 ))
then
print -u2 "usage"
exit 2
fi
for file in "$@"
do
if ${rrdtool?} fetch ${file?} AVERAGE -s 0 -e 0 \
| ${head?} -1 | ${grep?} 'tx.*rx' >/dev/null
then
print -u2 "${script}: \"${file?}\" appears to have tx and rx already"
continue
fi
if ${rrdtool?} dump ${file?} \
| ${add_ds?} 2 NaN GAUGE 400 NaN NaN \
| ${perl?} -pe 's/>\s*ds1\s*</>tx</; s/>\s*ds2\s*</>rx</' \
> .${file%.rrd}.xml \
&& ${rrdtool?} restore .${file%.rrd}.xml .${file?} \
&& ${cp?} .${file?} ${file?} # cp(1) instead of mv(1) to save permissions
then
print -u2 "${script}: \"${file?}\" done"
else
exit 1
fi
${rm?} -f .${file?} .${file%.rrd}.xml
done
exit 0
|