From: Antonios Chalkiopoulos Date: Mon, 25 Oct 2004 08:26:09 +0000 Subject: [LARTC] Questions about qdisc statistics Message-Id: <200410251126.09364.alg0@iit.demokritos.gr> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_hiLfBiibG9R6rAq" List-Id: References: <20041025020538.18699.qmail@web51606.mail.yahoo.com> In-Reply-To: <20041025020538.18699.qmail@web51606.mail.yahoo.com> To: lartc@vger.kernel.org --Boundary-00=_hiLfBiibG9R6rAq Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline >Can I use round robin database and mrtg tool to generate html files at linux >routers and call them from windows PC ? >If it is impossible , can I use snmp to retrieve data from linux router at >windows PC (snmp server at linux and snmp client at windows , if i don't >misunderstand ) and use round robin database and mrtg tool to generate html >pages at windows ? You can do both although i haven't managed to compile succesfully the QoS snmp extensions with net-snmp although lots of people have been succesfull at that. As far as round robin databases and mrtg (rrdtool is even better than mrtg) here is a script to help you. Just run: php tc.phps <-- In your linux QoS router, and cp graph.php /srv/www/htdocs/ <-- In the apache htdocs of your linux QoS router --Boundary-00=_hiLfBiibG9R6rAq Content-Type: application/x-php; name="graph.php" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="graph.php" 23 Sept 2004 # # v0.03 --> 30 Sept 2004 # ################################################### ################# FUNCTION createHtmlList(); ######################### function createHtmlList($probe) { global $qdisc; for($i=0;$i"; echo "
  • "; echo "$qdisc
    "; echo ""; } if ( strstr($line[1],"DP:") ) { $qdisc=$line[1]; $qdisc=ereg_replace(":", "_", $qdisc); echo "
      "; echo "
    • "; echo "$qdisc
      "; echo "
    "; } } } ########### end. if($_GET['disc']=="") { $DEV=eth0; $TC="/usr/sbin/tc"; exec("$TC qdisc ls dev $DEV", $tc_qdiscs); exec("$TC -s class show dev $DEV", $tc_classes); createHtmlList($tc_qdiscs); createHtmlList($tc_classes); } else { ?> Back



    --Boundary-00=_hiLfBiibG9R6rAq Content-Type: text/x-c++src; charset="us-ascii"; name="tc.phps" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tc.phps" # # Version 0.01 - 20 Sept 2004 # Version 0.02 - 20 Sept 2004 - 17:21 # Version 0.03 - 22 Sept 2004 - 18:03 --> classes & qdiscs work perfectly # Version 0.04 - 23 Sept 2004 - 16:00 --> Added checks for tc , rrdtool # Version 0.05 - 30 Sept 2004 - 12:12 --> GRED virtual channels are properly parsed. $tc_lines exec($tc_command,$tc_lines); # 2. Go through every line of the tc output for($i=0;$i $tc_lines $tc_lines=null; exec($tc_command,$tc_lines); # 2. Go through every line of the tc output for($i=0;$i $token[1] 2--> $token[2] 3--> $token[3] 4--> $token[4] 5--> $token[5] \n"; #1--> Packet 2--> totals: 3--> 0 4--> (bytes 5--> 0) $pkts=$token[3]; # remove unwanted ')' at the end of the string $temp=strrchr($token[5], ")"); $sent=substr($token[5],0, -strlen($temp)); # RED - GRED packets!! $red_line=$tc_lines[$i-1]; $red_token=preg_split("/[\s,]+/",$red_line); echo "For filename = $filename we have packets dropped: $red_token[3] . $red_token[5] where dropped and $red_token[7] were early dropped\n"; $drops=1; #to-do: to count drops look at line @ i-1 token 3 passthru("rrdtool update $filename N:$sent:$pkts:$drops"); echo("rrdtool update $filename N:$sent:$pkts:$drops\n"); } else { $sent=$token[2]; $pkts=$token[4]; $drops=$token[7]; if ( $dp_counter != 0 ) { $filename=$qdisc[$counter-$dp_counter].".rrd"; $dp_counter=0; } else { $filename=$qdisc[$counter].".rrd"; } passthru("rrdtool update $filename N:$sent:$pkts:$drops"); echo "passthru rrdtool update $filename N:$sent:$pkts:$drops\n"; $counter++; } } } } } ## end function ?> # qdisc gred 805f: # DP:1 (prio 8) Average Queue 0b Measured Queue 0b # Packet drops: 0 (forced 0 early 0) # Packet totals: 0 (bytes 0) ewma 3 Plog 25 Scell_log 12 # DP:2 (prio 8) Average Queue 0b Measured Queue 0b # Packet drops: 0 (forced 0 early 0) # Packet totals: 0 (bytes 0) ewma 3 Plog 22 Scell_log 12 # DP:3 (prio 8) Average Queue 36110b Measured Queue 35428b # Packet drops: 517 (forced 0 early 517) # Packet totals: 14128 (bytes 14721376) ewma 3 Plog 20 Scell_log 12 # Sent 14182662 bytes 13611 pkts (dropped 517, overlimits 517 requeues 0) # backlog 35428b 34p #qdisc red 4: limit 600000b min 30000b max 60000b # Sent 5285024 bytes 5072 pkts (dropped 42031, overlimits 42031 requeues 0) # backlog 63562b 61p # marked 0 early 42031 pdrop 0 other 0 #qdisc htb 3: r2q 10 default 12 direct_packets_stat 68 # Sent 44076642 bytes 42301 pkts (dropped 42548, overlimits 89997 requeues 0) # backlog 1043p #qdisc dsmark 1: indices 0x0040 set_tc_index # Sent 44083936 bytes 42308 pkts (dropped 42548, overlimits 0 requeues 0) # backlog 1043p --Boundary-00=_hiLfBiibG9R6rAq-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/