Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
RRDTOOL problems
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
kaksi
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2004
Posts: 125

PostPosted: Sun Jun 19, 2005 10:48 am    Post subject: RRDTOOL problems Reply with quote

Hi!

I have tried to write a script that generates graphs from of my netwrok traffic. I use iptables and l7-filter to mark my packages. The iptables script work but my rrdtool database does not! I always get 0 B/s even though that I actually have traffic.

Here are my scripts:

create the database:
Code:

#!/usr/bin/perl -w
#

use RRDs;

# define location of rrdtool databases
my $rrd = '/var/rrd';

if (! -e "$rrd/network.rrd")
{
        print "creating rrd database for network...\n";
        RRDs::create "$rrd/network.rrd",
                "-s 300",
                "DS:br0_in_total:COUNTER:600:0:12500000",
                "DS:br0_out_total:COUNTER:600:0:12500000",
                "DS:br0_in_dc:DERIVE:600:0:12500000",
                "DS:br0_out_dc:DERIVE:600:0:12500000",
                "DS:br0_in_bittorrent:DERIVE:600:0:12500000",
                "DS:br0_out_bittorrent:DERIVE:600:0:12500000",
                "DS:br0_in_smtp:DERIVE:600:0:12500000",
                "DS:br0_out_smtp:DERIVE:600:0:12500000",
                "DS:br0_in_pop3:DERIVE:600:0:12500000",
                "DS:br0_out_pop3:DERIVE:600:0:12500000",
      "DS:br0_in_imap:DERIVE:600:0:12500000",
                "DS:br0_out_imap:DERIVE:600:0:12500000",
                "DS:br0_in_ftp:DERIVE:600:0:12500000",
                "DS:br0_out_ftp:DERIVE:600:0:12500000",
                "DS:br0_in_http:DERIVE:600:0:12500000",
                "DS:br0_out_http:DERIVE:600:0:12500000",
                "DS:br0_in_smb:DERIVE:600:0:12500000",
                "DS:br0_out_smb:DERIVE:600:0:12500000",
                "DS:br0_in_ssh:DERIVE:600:0:12500000",
                "DS:br0_out_ssh:DERIVE:600:0:12500000",
                "DS:br0_in_ssl:DERIVE:600:0:12500000",
                "DS:br0_out_ssl:DERIVE:600:0:12500000",
                "DS:br0_in_hlds:DERIVE:600:0:12500000",
                "DS:br0_out_hlds:DERIVE:600:0:12500000",
                "DS:br0_in_ccxstream:DERIVE:600:0:12500000",
                "DS:br0_out_ccxstream:DERIVE:600:0:12500000",
                "DS:br0_in_icmp:DERIVE:600:0:12500000",
                "DS:br0_out_icmp:DERIVE:600:0:12500000",
                "RRA:AVERAGE:0.5:1:576",
                "RRA:AVERAGE:0.9:6:672",
                "RRA:AVERAGE:0.9:24:744",
                "RRA:AVERAGE:0.9:288:730",
                "RRA:AVERAGE:0.9:2016:522";
        if ($ERROR = RRDs::error) { print "unable to generate database: $ERROR\n"; }
}


update the script:
Code:

#!/usr/bin/perl -w

use RRDs;

sleep 2;

# define location of rrdtool databases
my $rrd = '/var/rrd';


my $br0_in_total =  `ifconfig br0 |grep bytes|cut -d":" -f2|cut -d" " -f1`  *1;
my $br0_out_total =  `ifconfig br0 |grep bytes|cut -d":" -f3|cut -d" " -f1`  *1;

my $br0_in_dc =  `iptables -t mangle -L -n -v -x|grep 0x102|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_dc =  `iptables -t mangle -L -n -v -x|grep 0x202|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_bittorrent =  `iptables -t mangle -L -n -v -x|grep 0x104|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_bittorrent =  `iptables -t mangle -L -n -v -x|grep 0x204|grep LAYER7|gawk '{print \$2}' ` *1;

my $br0_in_smtp =  `iptables -t mangle -L -n -v -x|grep 0x107|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_smtp =  `iptables -t mangle -L -n -v -x|grep 0x207|grep LAYER7|gawk '{print \$2}'` *1;

my $br0_in_pop3 =  `iptables -t mangle -L -n -v -x|grep 0x108|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_pop3 =  `iptables -t mangle -L -n -v -x|grep 0x208|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_imap =  `iptables -t mangle -L -n -v -x|grep 0x109|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_imap =  `iptables -t mangle -L -n -v -x|grep 0x209|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_ftp =  `iptables -t mangle -L -n -v -x|grep 0x110|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_ftp =  `iptables -t mangle -L -n -v -x|grep 0x210|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_http =  `iptables -t mangle -L -n -v -x|grep 0x111|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_http =  `iptables -t mangle -L -n -v -x|grep 0x211|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_smb =  `iptables -t mangle -L -n -v -x|grep 0x113|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_smb =  `iptables -t mangle -L -n -v -x|grep 0x213|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_ssh =  `iptables -t mangle -L -n -v -x|grep 0x114|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_ssh =  `iptables -t mangle -L -n -v -x|grep 0x214|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_ssl =  `iptables -t mangle -L -n -v -x|grep 0x115|grep LAYER7|gawk '{print \$2}'`  *1;
my $br0_out_ssl =  `iptables -t mangle -L -n -v -x|grep 0x215|grep LAYER7|gawk '{print \$2}'`  *1;

my $br0_in_hlds =  `iptables -t mangle -L -n -v -x|grep 'MARK match 0x116'|gawk '{print \$2}'`  *1;
my $br0_out_hlds =  `iptables -t mangle -L -n -v -x|grep 'MARK match 0x216'|gawk '{print \$2}'`  *1;

my $br0_in_ccxstream =`iptables -t mangle -L -n -v -x|grep 'MARK match 0x117'|gawk '{print \$2}'`  *1;
my $br0_out_ccxstream = `iptables -t mangle -L -n -v -x|grep 'MARK match 0x217'|gawk '{print \$2}'`  *1;
                     
my $br0_in_icmp = `iptables -t mangle -L -n -v -x|grep 0x118|grep 'MARK match 0x118'|gawk '{print \$2}'`  *1;
my $br0_out_icmp = `iptables -t mangle -L -n -v -x|grep 0x218|grep 'MARK match 0x218'|gawk '{print \$2}'` *1;



print "$br0_in_total\n";
print "$br0_out_total\n";

print "$br0_in_dc\n";
print "$br0_out_dc\n";

print "$br0_in_bittorrent\n";
print "$br0_out_bittorrent\n";

print "$br0_in_smtp\n";
print "$br0_out_smtp\n";

print "$br0_in_pop3\n";
print "$br0_out_pop3\n";

print "$br0_in_imap\n";
print "$br0_out_imap\n";

print "$br0_in_ftp\n";
print "$br0_out_ftp\n";

print "$br0_in_http\n";
print "$br0_out_http\n";

print "$br0_in_smb\n";
print "$br0_out_smb\n";

print "$br0_in_ssh\n";
print "$br0_out_ssh\n";

print "$br0_in_ssl\n";
print "$br0_out_ssl\n";


print "$br0_in_hlds\n";
print "$br0_out_hlds\n";

print "$br0_in_ccxstream\n";
print "$br0_out_ccxstream\n";
print "$br0_in_icmp\n";
print "$br0_out_icmp\n";



my $uptime = `cut -d" " -f1 /proc/uptime` *1;
if ($uptime > 600) {
# insert values into rrd
RRDs::update "$rrd/network.rrd",
        "-t",
"br0_in_total:br0_out_total:br0_in_dc:br0_out_dc:br0_in_bittorrent:br0_out_bittorrent:br0_in_smtp:br0_out_smtp:br0_in_pop3:br0_out_pop3:br0_in_imap:br0_out_imap:br0_in_ftp:br0_out_ftp:br0_in_http:br0_out_http:br0_in_smb:br0_out_smb:br0_in_ssh:br0_out_ssh:br0_in_ssl:br0_out_ssl:br0_in_hlds:br0_out_hlds:br0_in_ccxstream:br0_out_ccxstream:br0_in_icmp:br0_out_icmp",
"N:$br0_in_total:$br0_out_total:$br0_in_dc:$br0_out_dc:$br0_in_bittorrent:$br0_out_bittorrent:$br0_in_smtp:$br0_out_smtp:$br0_in_pop3:$br0_out_pop3:$br0_in_imap:$br0_out_imap:$br0_in_ftp:$br0_out_ftp:$br0_in_http:$br0_out_http:$br0_in_smb:$br0_out_smb:$br0_in_ssh:$br0_out_ssh:$br0_in_ssl:$br0_out_ssl:$br0_in_hlds:$br0_out_hlds:$br0_in_ccxstream:$br0_out_ccxstream:$br0_in_icmp:$br0_out_icmp";
             


if ($ERROR = RRDs::error) { print "unable to update: $ERROR\n"; }
}


generate the graph:
Code:

#!/bin/bash


# Full path to your rrdtool binary
RRDTOOL=/usr/bin/rrdtool

# Full path to your rrd datase
RRD=/var/rrd/network.rrd

# The title of your graph
TITLE='Statistics for grand1982.com network traffic'

# Output path where your graphs will end up
OPATH=/wwwroot/qos.grand1982.com/network/

# Date command, add date formating if you would like so (man date)
DATECMD='/bin/date'

#
# End of configuration
#

for i in 1 2 3 4 5;
  do
    if [ "$i" == "1" ]; then
      START="12h"
      FILENAME="network-12h.png"
    fi
    if [ "$i" == "2" ]; then
      START="24h"
      FILENAME="network-day.png"
    fi
    if [ "$i" == "3" ]; then
      START=604800
      FILENAME="network-week.png"
    fi
    if [ "$i" == "4" ]; then
      START=2419200
      FILENAME="network-month.png"
    fi
    if [ "$i" == "5" ]; then
      START=31536000
      FILENAME="network-year.png"
    fi
DATE=`$DATECMD`

$RRDTOOL graph $OPATH/$FILENAME \
--start -$START \
--title "$TITLE" \
--vertical-label 'Bytes per second' \
-w 800 \
-h 200 \
-l 0 \
-Y \
-M \
-E \
-i \
DEF:br0_in_total=$RRD:br0_in_total:AVERAGE \
DEF:br0_in_dc=$RRD:br0_in_dc:AVERAGE \
DEF:br0_in_bittorrent=$RRD:br0_in_bittorrent:AVERAGE \
DEF:br0_in_smtp=$RRD:br0_in_smtp:AVERAGE \
DEF:br0_in_pop3=$RRD:br0_in_pop3:AVERAGE \
DEF:br0_in_imap=$RRD:br0_in_imap:AVERAGE \
DEF:br0_in_ftp=$RRD:br0_in_ftp:AVERAGE \
DEF:br0_in_http=$RRD:br0_in_http:AVERAGE \
DEF:br0_in_smb=$RRD:br0_in_smb:AVERAGE \
DEF:br0_in_ssh=$RRD:br0_in_ssh:AVERAGE \
DEF:br0_in_ssl=$RRD:br0_in_ssl:AVERAGE \
DEF:br0_in_hlds=$RRD:br0_in_hlds:AVERAGE \
DEF:br0_in_ccxstream=$RRD:br0_in_ccxstream:AVERAGE \
DEF:br0_in_icmp=$RRD:br0_in_icmp:AVERAGE \
DEF:br0_out_total=$RRD:br0_out_total:AVERAGE \
DEF:br0_out_dc=$RRD:br0_out_dc:AVERAGE \
DEF:br0_out_bittorrent=$RRD:br0_out_bittorrent:AVERAGE \
DEF:br0_out_smtp=$RRD:br0_out_smtp:AVERAGE \
DEF:br0_out_pop3=$RRD:br0_out_pop3:AVERAGE \
DEF:br0_out_imap=$RRD:br0_out_imap:AVERAGE \
DEF:br0_out_ftp=$RRD:br0_out_ftp:AVERAGE \
DEF:br0_out_http=$RRD:br0_out_http:AVERAGE \
DEF:br0_out_smb=$RRD:br0_out_smb:AVERAGE \
DEF:br0_out_ssh=$RRD:br0_out_ssh:AVERAGE \
DEF:br0_out_ssl=$RRD:br0_out_ssl:AVERAGE \
DEF:br0_out_hlds=$RRD:br0_out_hlds:AVERAGE \
DEF:br0_out_ccxstream=$RRD:br0_out_ccxstream:AVERAGE \
DEF:br0_out_icmp=$RRD:br0_out_icmp:AVERAGE \
 "CDEF:neg_br0_out_total=br0_out_total,-1,*"    \
 "CDEF:neg_br0_out_dc=br0_out_dc,-1,*"    \
 "CDEF:neg_br0_out_bittorrent=br0_out_bittorrent,-1,*"    \
 "CDEF:neg_br0_out_smtp=br0_out_smtp,-1,*"    \
 "CDEF:neg_br0_out_pop3=br0_out_pop3,-1,*"    \
 "CDEF:neg_br0_out_imap=br0_out_imap,-1,*"    \
 "CDEF:neg_br0_out_ftp=br0_out_ftp,-1,*"    \
 "CDEF:neg_br0_out_http=br0_out_http,-1,*"    \
 "CDEF:neg_br0_out_smb=br0_out_smb,-1,*"    \
 "CDEF:neg_br0_out_ssh=br0_out_ssh,-1,*"    \
 "CDEF:neg_br0_out_ssl=br0_out_ssl,-1,*"    \
 "CDEF:neg_br0_out_hlds=br0_out_hlds,-1,*"    \
 "CDEF:neg_br0_out_ccxstream=br0_out_ccxstream,-1,*"    \
 "CDEF:neg_br0_out_icmp=br0_out_icmp,-1,*"    \
 LINE1:br0_in_total#FF0000:'TOTAL ' \
"GPRINT:br0_in_total:MAX: %5.1lf %sB/s", \
"GPRINT:br0_in_total:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_total:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_total:MAX: %5.1lf %sB/s", \
"GPRINT:br0_out_total:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_total:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_dc#ff00ea:'DC ' \
"GPRINT:br0_in_dc:MAX: %5.1lf %sB/s", \
"GPRINT:br0_in_dc:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_dc:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_dc:MAX: %5.1lf %sB/s", \
"GPRINT:br0_out_dc:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_dc:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_bittorrent#a200ff:'BITTORRENT ' \
"GPRINT:br0_in_bittorrent:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_bittorrent:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_bittorrent:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_bittorrent:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_bittorrent:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_bittorrent:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_smtp#3c00ff:'SMTP ' \
"GPRINT:br0_in_smtp:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_smtp:AVERAGE:%5.1lf %sB/s", \
"GPRINT:br0_in_smtp:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_smtp:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_smtp:AVERAGE:%5.1lf %sB/s", \
"GPRINT:br0_out_smtp:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_pop3#0072ff:'POP3 ' \
"GPRINT:br0_in_pop3:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_pop3:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_pop3:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_pop3:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_pop3:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_pop3:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_imap#00fffc:'IMAP ' \
"GPRINT:br0_in_imap:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_imap:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_imap:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_imap:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_imap:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_imap:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_ftp#00ff84:'FTP ' \
"GPRINT:br0_in_ftp:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_ftp:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_ftp:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_ftp:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_ftp:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_ftp:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_http#00ff18:'HTTP ' \
"GPRINT:br0_in_http:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_http:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_http:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_http:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_http:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_http:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_smb#a8ff00:'SAMBA ' \
"GPRINT:br0_in_smb:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_smb:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_smb:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_smb:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_smb:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_smb:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_ssh#fcff00:'SSH ' \
"GPRINT:br0_in_ssh:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_ssh:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_ssh:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_ssh:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_ssh:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_ssh:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_ssl#ffc600:'SSL ' \
"GPRINT:br0_in_ssl:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_ssl:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_ssl:LAST:%5.1lf %sB/s", \
"GPRINT:br0_out_ssl:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_ssl:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_ssl:LAST:%5.1lf %sB/s\n" \
LINE1:br0_in_hlds#ff7200:'HLDS ' \
"GPRINT:br0_in_hlds:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_hlds:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_hlds:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_hlds:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_hlds:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_hlds:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_ccxstream#ff008a:'CCXSTREAN ' \
"GPRINT:br0_in_ccxstream:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_in_ccxstream:AVERAGE:%5.1lf %sB/s", \
"GPRINT:br0_in_ccxstream:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_ccxstream:MAX:  %5.1lf %sB/s", \
"GPRINT:br0_out_ccxstream:AVERAGE:%5.1lf %sB/s", \
"GPRINT:br0_out_ccxstream:LAST: %5.1lf %sB/s\n" \
LINE1:br0_in_icmp#000000:'ICMP ' \
"GPRINT:br0_in_icmp:MAX: %5.1lf %sB/s", \
"GPRINT:br0_in_icmp:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_in_icmp:LAST: %5.1lf %sB/s", \
"GPRINT:br0_out_icmp:MAX: %5.1lf %sB/s", \
"GPRINT:br0_out_icmp:AVERAGE: %5.1lf %sB/s", \
"GPRINT:br0_out_icmp:LAST: %5.1lf %sB/s\n" \
LINE1:neg_br0_out_dc#ff00ea \
LINE1:neg_br0_out_bittorrent#a200ff \
LINE1:neg_br0_out_smtp#3c00ff \
LINE1:neg_br0_out_pop3#0072ff \
LINE1:neg_br0_out_imap#00fffc \
LINE1:neg_br0_out_ftp#00ff84 \
LINE1:neg_br0_out_http#00ff18 \
LINE1:neg_br0_out_smb#a8ff00 \
LINE1:neg_br0_out_ssh#fcff00 \
LINE1:neg_br0_out_ssl#ffc600 \
LINE1:neg_br0_out_hlds#ff7200 \
LINE1:neg_br0_out_ccxstream#ff008a \
LINE1:neg_br0_out_icmp#000000 \
COMMENT:"!\r" #date

done

I run the update script every 5 minutes via a cronjob. It seems like the problem is with the update script since when I look at the database all values are 0.0000000000e+00.

I have printed the values that are inserted to the database and this is an example of the output:
Code:

568440252
648253440
0
0
2680283027
15179015823
3524866
3224614
19420
19420
29113
29113
10494
43811
60492065
106620184
0
0
19875602
136221136
13730
13730
12238678615
12226893819
40400642
1027662305
1817348
1995286


So the correct data is actually inserted.

Anyone that can see the problem?
Back to top
View user's profile Send private message
kaksi
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2004
Posts: 125

PostPosted: Sun Jun 19, 2005 10:50 am    Post subject: Reply with quote

The graphs generated: http://qos.grand1982.com/network/
Back to top
View user's profile Send private message
kaksi
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2004
Posts: 125

PostPosted: Mon Jul 04, 2005 3:51 pm    Post subject: Reply with quote

There must be a problem with rrdtool. I downloaded a script from this website: http://martybugs.net/linux/rrdtool/traffic.cgi

This: http://martybugs.net/linux/rrdtool/download/rrd_traffic.txt

And that is supposed to work out of the box. But I still only gets zeros!

I havetried the versions 1.2.6-r1 and 1.2.10 and they both give me the same result. The scipt gives me no errors and the correct data is sent to rrdtool. Here is some output of the script:

Code:

molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992363814, 1699086175
eth1 traffic in, out: 3478799697, 2624035005
br0 traffic in, out: 539886162, 3921499073
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992430814, 1699237550
eth1 traffic in, out: 3478877095, 2624091663
br0 traffic in, out: 539889818, 3921552820
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992481624, 1699361907
eth1 traffic in, out: 3478940083, 2624138473
br0 traffic in, out: 539894015, 3921616838
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992532689, 1699469712
eth1 traffic in, out: 3479006279, 2624184623
br0 traffic in, out: 539897188, 3921666538
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992582831, 1699589316
eth1 traffic in, out: 3479070111, 2624233563
br0 traffic in, out: 539898920, 3921723578
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992634683, 1699716239
eth1 traffic in, out: 3479135984, 2624283498
br0 traffic in, out: 539900384, 3921768334
molgan rrd # ./rrd_traffic.pl
eth0 traffic in, out: 2992711069, 1699893229
eth1 traffic in, out: 3479239012, 2624356250
br0 traffic in, out: 539902854, 3921845979


What could be the problem?
Back to top
View user's profile Send private message
kaksi
Tux's lil' helper
Tux's lil' helper


Joined: 21 May 2004
Posts: 125

PostPosted: Tue Jul 05, 2005 4:04 pm    Post subject: Reply with quote

I found the problem. By adding this line to crontab -s (executed as root) did NOT work:

Code:

*/5 * * * *     /var/rrd/rrd_network_update.sh


But entering this to /etc/crontab DID work:
Code:

*/5 * * * * root /var/rrd/rrd_network_update.sh >/dev/null


Anyone that know what the differens is?
Back to top
View user's profile Send private message
Tuinslak
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2003
Posts: 129
Location: Belgium

PostPosted: Thu Oct 13, 2005 3:58 pm    Post subject: Reply with quote

Code:
Aragorn .rrd # iptables -t mangle -L -n -v -x|grep 0x110|grep LAYER7|gawk '{prin
t $2}'
Aragorn .rrd # iptables -t mangle -L -n -v -x|grep 0x110
Aragorn .rrd # iptables -t mangle -L -n -v -x
Chain PREROUTING (policy ACCEPT 3540271 packets, 3338034633 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 3472948 packets, 3307462674 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 66586 packets, 30366183 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 2857398 packets, 1442481407 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 2924559 packets, 1472949879 bytes)
    pkts      bytes target     prot opt in     out     source               destination       


I've modified it to use it with eth0 and eth1. works fine till now, it just doesn't show detailed traffic information (only total).
Why is that? The iptables cmd doesn't show what it should show?
_________________
Tuinslak
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum