All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Stemplinger <Simon.Stemplinger@gmx.de>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] tc statistics
Date: Wed, 02 Jul 2003 13:08:50 +0000	[thread overview]
Message-ID: <marc-lartc-105715175002758@msgid-missing> (raw)
In-Reply-To: <marc-lartc-99115393524655@msgid-missing>

Joerg Hartmann wrote:
> Hello,
> 
> i have to write a script to visualize the output of tc -s class show dev 
> eth0 with rrdtool.
> Or does anybody know of such a script , which is available for download ?
> 
> I assume the bps in "rate 5728bps 34pps" is Byte per Second.
> Is that right ?
> How can i set all the counters back to zero ?
> I did not found anything in the manpage of tc.
> 
> regards
> 			Joerg

Hi Joerg,

i use this script.  It is not yet complete and as I am not very good in 
shell programming, you can probably do better, but it works ;-)

regards,
	Simon


---- snip -----
#!/bin/bash

TC=/root/bin/tc
CLASS=$2

usage ()
{
   echo
   echo "Usage: $0 option class"
   echo
   echo "  Options:  -r   show rate"
#  echo "            -s   show avg packet size"
   echo
   exit
}

# print uptime and hostname
printuptime ()
{
   test -z "$(uptime|grep day)" && echo 0 days
   test -z "$(uptime|grep day)" || echo $(uptime | awk {'print $3'}) days
   hostname
}

# an error has happened... return 0 traffic
error ()
{
   echo 0
   echo 0
   printuptime
   exit
}


rate()
{
   RATE=`echo $STATS|cut -f2 -d' '`
   echo $RATE
   echo 0
   printuptime
   exit
}

# read info about class
test -z $CLASS && usage
STATS=`$TC -s class ls dev ppp0|grep -A1 $CLASS|grep Sent`

# parse arguments
test $1 = "-r" && rate
#test $1 = "-s" && size

# else
usage


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  parent reply	other threads:[~2003-07-02 13:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-29 16:41 [LARTC] tc statistics Serguei I. Ivantsov
2001-07-03 16:56 ` [LARTC] TC statistics Nayak, Ramakrishna
2001-07-03 18:31 ` xplorer
2001-07-03 20:11 ` Nayak, Ramakrishna
2003-07-02 12:44 ` [LARTC] tc statistics Joerg Hartmann
2003-07-02 13:08 ` Simon Stemplinger [this message]
2007-02-12 15:49 ` Bob Puff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-105715175002758@msgid-missing \
    --to=simon.stemplinger@gmx.de \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.