Date: Sun, 16 Sep 2001 17:05:34 +0200 (CEST) From: Alexander Leidinger <Alexander@Leidinger.net> To: gh@raditex.se Cc: freebsd-isdn@FreeBSD.ORG Subject: Re: Plotting util Message-ID: <200109161505.f8GF5Zn47686@Magelan.Leidinger.net> In-Reply-To: <Pine.BSF.4.21.0108222215090.64367-100000@gandalf.sickla.raditex.se>
next in thread | previous in thread | raw e-mail | index | archive | help
--0-1804289383-1000652737=:47683 Content-Type: TEXT/plain; charset=iso-8859-1 On 22 Aug, G Hasse wrote: > I also hacked a small script that makes a graph from > the logfile, and I run this daily from cron. The > script needs gnuplot ( /usr/ports/math/gnuplot ). I modified it a little bit. - "-d dd.mm.YYYY" to plot the specified date - "-p <prefix>" to add <prefix> to the filename of the PRINTFILE - use YYYYMMDD in PRINTFILE to make it sortable in a directory listing (if you need the output of some days in a specific directory, very useful with -d, -p and a for loop around the script) - use mktemp for TEMPFILE - rm TEMPFILE after the use - comment out "lpr" (the script which calls it should do the lpr) Bye, Alexander. -- The computer revolution is over. The computers won. http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7 --0-1804289383-1000652737=:47683 Content-Type: TEXT/plain; name="isdn-graph.sh" Content-Disposition: attachment; filename="isdn-graph.sh" #!/bin/sh #------------------------------------------------------ # # Prints a postscript graph of the connectiontimes # for your ISDN line # # gh@raditex.se # #------------------------------------------------------ # # Change to suite your needs # # Use the standard format on the accouning file LOGFILE=/var/log/isdnd.acct TEMPFILE=$(mktemp -t isdnlog) # One day back GRAPHDATE=$(date -j -v -1d "+%d.%m.%Y") # processing options args=$(getopt d:p: $@) if [ $? != 0 ]; then echo "Wrong parameters." exit 2 fi set -- ${args} for i ; do case "${i}" in -d) # override date GRAPHDATE=$2 shift shift ;; -p) PRINTFILE_PREFIX=$2 shift shift ;; --) shift break ;; esac done DAY=$(echo ${GRAPHDATE} | awk -F . '{ print $1 }') MONTH=$(echo ${GRAPHDATE} | awk -F . '{ print $2 }') YEAR=$(echo ${GRAPHDATE} | awk -F . '{ print $3 }') PRINTFILE=${PRINTFILE_PREFIX}isdn-trafficpattern-${YEAR}${MONTH}${DAY}.ps grep "${GRAPHDATE}" /var/log/isdnd.acct | \ awk '{ print $2 "\t0\n" $2"\t1\n" $5 "\t1\n" $5"\t0" }' > ${TEMPFILE} if [ -s ${TEMPFILE} ]; then /usr/local/bin/gnuplot <<EOF set output "${PRINTFILE}" set terminal postscript set title "ISDN ${GRAPHDATE}" set data style lines set xlabel "Time" set timefmt "%H:%M:%S" set ytics 2 set xdata time set ylabel "traficpattern" set format x "%H:%M" set grid set key left plot '${TEMPFILE}' using 1:2 t 'isdn up / down" EOF fi rm "${TEMPFILE}" #lpr "${PRINTFILE}" --0-1804289383-1000652737=:47683-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isdn" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109161505.f8GF5Zn47686>