Are the hash values MD5, for the data within MySQL?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Are the hash values MD5, for the data within MySQL?

Post by skohrs »

In a quest to automatically generate collective traffic graphs for hosts discovered with Ntop, I've reached the point of creating custom CDEFs that sum all the individual .rrd files. My question is, when creating new rows in the cdef & cdef_items tables, can I utilize the MySQL MD5 function to produce a suitable hash? What is the purpose of the hash anyway?

For anyone interested, here's what I've come up with so far. Next comes the fun part of adding graph items.

Code: Select all

#!/usr/bin/perl

use DBI;
use Time::Local;

# Set our start time to 7:55AM, today.  Might not be correct.
($day, $month, $year) = (localtime)[3,4,5];
$start_time = timelocal('00', '55', '7', $day, $month, $year);

# Get all the Ntop files that another script has already copied and renamed
# into the Cacti 'rra' directory, i.e. MIAFL_192.168.123.210_bytesRcvd.rrd & 
# MIAFL_192.168.123.210_bytesSent.rrd.
#
open(FILES,"ls -1 /var/www/html/mrtg/cacti/rra/*_bytes*.rrd |");
@output = <FILES>;
foreach $file (@output) {
    if ( $file =~ /.*bytesSent.rrd/ ) {
        push( @{$sites{substr($file, 29, 5)}{'Sent'}}, $file );
    }
    elsif ( $file =~ /.*bytesRcvd.rrd/ ) {
        push( @{$sites{substr($file, 29, 5)}{'Rcvd'}}, $file );
    }
    else {
        next;
    }
}
close(FILES);

$dsn = "DBI:mysql:database=cacti;host=localhost";
$dbh = DBI->connect($dsn, "cacti", "cacti")
    or die "Couldn't connect to database: $DBI::errstr\n";

foreach $site ( sort keys %sites ) {

    $site_id = undef;
    $sth = $dbh->prepare("SELECT id FROM host WHERE description = \"$site\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $site_id = $ref->{ id };
    }

# If the host doesn't exist, add a new host.
    unless ( $site_id ) {
        $dbh->do("INSERT INTO host (description, hostname, disabled) VALUES (\"$site\", \"localhost\", \"on\")");

        $sth = $dbh->prepare("SELECT id FROM host WHERE description = \"$site\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $site_id = $ref->{ id };
        }
    }

# Process each _bytesRcvd.rrd file.
    $def_letter = 'a';
    $cdefa = '';
    $rcvd_counter = 0;

    foreach $file ( @{$sites{$site}{'Rcvd'}} ) {
        chomp($file);

        $file = substr($file, 29);

        $local_data_id = undef;

        $sth = $dbh->prepare("SELECT id FROM data_template_data WHERE name = \"$file\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $local_data_id = $ref->{ id };
        }

# If this data source doesn't exist, create a new data source.
        unless ( $local_data_id ) {
            $dbh->do("INSERT INTO data_local (host_id) VALUES (\"$site_id\")");

            $sth = $dbh->prepare("SELECT id FROM data_local ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $local_data_id = $ref->{ id };
            }

            $dbh->do("INSERT INTO data_template_data (local_data_id, name, name_cache, data_source_path, active, rrd_step)
VALUES (\"$local_data_id\",\"$file\", \"$file\", \"<path_rra>\/$file\", \"on\", 300)");

            $sth = $dbh->prepare("SELECT id FROM data_template_data ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $data_temp_data_id = $ref->{ id };
            }

            for ($i=1; $i <= 4; $i++) {
                $dbh->do("INSERT INTO data_template_data_rra (data_template_data_id, rra_id) VALUES (\"$data_temp_data_id\",\"$i\")");
            }
            $dbh->do("INSERT INTO data_template_rrd (local_data_id, rrd_heartbeat, data_source_type_id, data_source_name) VALUES (\"$local_data_id\", 600, 2, \"counter\")");
        }

        $cdefa = $cdefa . "TIME,$start_time,GT,$def_letter,$def_letter,UN,0,$def_letter,IF,IF,";
        
        $def_letter++;
        $rcvd_counter++;

    }

# Process each _bytesSent.rrd file.
    $cdefb = '';
    $sent_counter = 0;

    foreach $file ( @{$sites{$site}{'Sent'}} ) {
        chomp($file);

        $file = substr($file, 29);

        $local_data_id = undef;

        $sth = $dbh->prepare("SELECT id FROM data_template_data WHERE name = \"$file\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $local_data_id = $ref->{ id };
        }

        unless ( $local_data_id ) {
            $dbh->do("INSERT INTO data_local (host_id) VALUES (\"$site_id\")");

            $sth = $dbh->prepare("SELECT id FROM data_local ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $local_data_id = $ref->{ id };
            }

            $dbh->do("INSERT INTO data_template_data (local_data_id, name, name_cache, data_source_path, active, rrd_step) VALUES (\"$local_data_id\",\"$file\", \"$file\", \"<path_rra>\/$file\", \"on\", 300)");

            $sth = $dbh->prepare("SELECT id FROM data_template_data ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $data_temp_data_id = $ref->{ id };
            }

            for ($i=1; $i <= 4; $i++) {
                $dbh->do("INSERT INTO data_template_data_rra (data_template_data_id, rra_id) VALUES (\"$data_temp_data_id\",\"$i\")");
            }
            $dbh->do("INSERT INTO data_template_rrd (local_data_id, rrd_heartbeat, data_source_type_id, data_source_name) VALUES (\"$local_data_id\", 600, 2, \"counter\")");
        }

        $cdefb = $cdefb . "TIME,$start_time,GT,$def_letter,$def_letter,UN,0,$def_letter,IF,IF,";
        
        $def_letter++;
        $sent_counter++;

    }

    for($count = 1; $count < $rcvd_counter; $count++) {
        $cdefa = $cdefa . '+,';
    }
    chop($cdefa);  # remove the extra ',' from the last entry.

    for($count = 1; $count < $sent_counter; $count++) {
        $cdefb = $cdefb . '+,';
    }
    chop($cdefb);  # remove the extra ',' from the last entry.

    $cdef_id = undef;

    $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $cdef_id = $ref->{ id };
    }

    unless ( $cdef_id ) {
        $dbh->do("INSERT INTO cdef (hash, name) VALUES (MD5(\"$site Inbound\"),\"$site Inbound\")");
        $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $cdef_id = $ref->{ id };
        }
        $dbh->do("INSERT INTO cdef_items (hash, cdef_id, sequence, type, value) VALUES (MD5(\"$cdefb\"), $cdef_id, 1, 6, \"$cdefb\")");
    }
    else {
        $dbh->do("UPDATE cdef_items SET hash=MD5(\"$cdefb\"), value=\"$cdefb\" WHERE cdef_id = $cdef_id");
    }

    $cdef_id = undef;

    $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Outbound\"");
    $sth->execute();


    while ( $ref = $sth->fetchrow_hashref() ) {
        $cdef_id = $ref->{ id };
    }

    unless ( $cdef_id ) {
        $dbh->do("INSERT INTO cdef (hash, name) VALUES (MD5(\"$site Inbound\"),\"$site Outbound\")");
        $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $cdef_id = $ref->{ id };
        }
        $dbh->do("INSERT INTO cdef_items (hash, cdef_id, sequence, type, value) VALUES (MD5(\"$cdefa\"), $cdef_id, 1, 6, \"$cdefa\")");
    }
    else {
        $dbh->do("UPDATE cdef_items SET hash=MD5(\"$cdefa\"), value=\"$cdefa\" WHERE cdef_id = $cdef_id");
    }
}

$dbh->disconnect();
NOTE: I did have to modify the data type of 'value' in 'cdef_items' to be a BLOB.

This is what I'm trying to automatically replicate within Cacti.

Code: Select all

/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=1142949300 \
--end=1142982000 \
--title="MIAFL Bandwidth" \
--base=1000 \
--height=120 \
--width=600 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.58.234_bytesRcvd.rrd":counter:AVERAGE \
DEF:b="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.62.218_bytesRcvd.rrd":counter:AVERAGE \
DEF:c="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.177.201_bytesRcvd.rrd":counter:AVERAGE \
DEF:d="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.116.100_bytesRcvd.rrd":counter:AVERAGE \
DEF:e="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.182.226_bytesRcvd.rrd":counter:AVERAGE \
DEF:f="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.197.63_bytesRcvd.rrd":counter:AVERAGE \
DEF:g="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.198.131_bytesRcvd.rrd":counter:AVERAGE \
DEF:h="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.166.113_bytesRcvd.rrd":counter:AVERAGE \
DEF:i="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.171.33_bytesRcvd.rrd":counter:AVERAGE \
DEF:j="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.175.193_bytesRcvd.rrd":counter:AVERAGE \
DEF:k="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.170.157_bytesRcvd.rrd":counter:AVERAGE \
DEF:l="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.182.184_bytesRcvd.rrd":counter:AVERAGE \
DEF:m="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.58.234_bytesSent.rrd":counter:AVERAGE \
DEF:n="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.62.218_bytesSent.rrd":counter:AVERAGE \
DEF:o="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.177.201_bytesSent.rrd":counter:AVERAGE \
DEF:p="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.116.100_bytesSent.rrd":counter:AVERAGE \
DEF:q="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.182.226_bytesSent.rrd":counter:AVERAGE \
DEF:r="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.197.63_bytesSent.rrd":counter:AVERAGE \
DEF:s="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.198.131_bytesSent.rrd":counter:AVERAGE \
DEF:t="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.166.113_bytesSent.rrd":counter:AVERAGE \
DEF:u="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.171.33_bytesSent.rrd":counter:AVERAGE \
DEF:v="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.175.193_bytesSent.rrd":counter:AVERAGE \
DEF:w="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.170.157_bytesSent.rrd":counter:AVERAGE \
DEF:x="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.182.184_bytesSent.rrd":counter:AVERAGE \
CDEF:cdefa=TIME,1142985480,GT,a,a,UN,0,a,IF,IF,TIME,1142985480,GT,b,b,UN,0,b,IF,IF,TIME,1142985480,GT,c,c,UN,0,c,IF,IF,TIME
,1142985480,GT,d,d,UN,0,d,IF,IF,TIME,1142985480,GT,e,e,UN,0,e,IF,IF,TIME,1142985480,GT,f,f,UN,0,f,IF,IF,TIME,1142985480,GT,
g,g,UN,0,g,IF,IF,TIME,1142985480,GT,h,h,UN,0,h,IF,IF,TIME,1142985480,GT,i,i,UN,0,i,IF,IF,TIME,1142985480,GT,j,j,UN,0,j,IF,I
F,TIME,1142985480,GT,k,k,UN,0,k,IF,IF,TIME,1142985480,GT,l,l,UN,0,l,IF,IF,+,+,+,+,+,+,+,+,+,+,+ \
CDEF:cdefb=TIME,1142985480,GT,m,m,UN,0,m,IF,IF,TIME,1142985480,GT,n,n,UN,0,n,IF,IF,TIME,1142985480,GT,o,o,UN,0,o,IF,IF,TIME
,1142985480,GT,p,p,UN,0,p,IF,IF,TIME,1142985480,GT,q,q,UN,0,q,IF,IF,TIME,1142985480,GT,r,r,UN,0,r,IF,IF,TIME,1142985480,GT,
s,s,UN,0,s,IF,IF,TIME,1142985480,GT,t,t,UN,0,t,IF,IF,TIME,1142985480,GT,u,u,UN,0,u,IF,IF,TIME,1142985480,GT,v,v,UN,0,v,IF,I
F,TIME,1142985480,GT,w,w,UN,0,w,IF,IF,TIME,1142985480,GT,x,x,UN,0,x,IF,IF,+,+,+,+,+,+,+,+,+,+,+ \
CDEF:cdefc=cdefa,8,* \
CDEF:cdefd=cdefb,8,* \
AREA:cdefd#00FF00:"Inbound"  \
GPRINT:cdefd:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefd:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefd:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefc#0000FF:"Outbound"  \
GPRINT:cdefc:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefc:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefc:MAX:"Maximum\:%8.2lf %s\n"

elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

The first problem on your graph is that the sources in RRDtool don't go past the letter "j". For the 11th source (you have it as "k"), you intstead add a "b" in front like "ba", 12th one is "bb" and so on. Once you get to "bj" it starts over again with "ca" which you have as source "u".
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Post by skohrs »

You're 10 days early for April Fool's Day. Can you point me to official documentation that supports your claims? It's funny that I don't receive any errors from running that rrdtool graph script. Is that a Cacti specific caveat?
elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

skohrs wrote:You're 10 days early for April Fool's Day. Can you point me to official documentation that supports your claims? It's funny that I don't receive any errors from running that rrdtool graph script. Is that a Cacti specific caveat?
Thats what I was told in this thread: http://forums.cacti.net/post-29895.html ... ght=#29895
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Post by skohrs »

Well, elnino, you were correct. After adding all my graph items into Cacti, the DEFs came back out just like you said.

Code: Select all

/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="MIAFL Bandwidth" \
--base=1000 \
--height=120 \
--width=600 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.1.20_bytesSent.rrd":counter:AVERAGE \
DEF:b="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.169.118_bytesSent.rrd":counter:AVERAGE \
DEF:c="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.171.118_bytesSent.rrd":counter:AVERAGE \
DEF:d="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.173.44_bytesSent.rrd":counter:AVERAGE \
DEF:e="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.253.58_bytesSent.rrd":counter:AVERAGE \
DEF:f="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.210.80_bytesSent.rrd":counter:AVERAGE \
DEF:g="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.128.51_bytesSent.rrd":counter:AVERAGE \
DEF:h="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.130.200_bytesSent.rrd":counter:AVERAGE \
DEF:i="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.137.125_bytesSent.rrd":counter:AVERAGE \
DEF:j="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.67.166_bytesSent.rrd":counter:AVERAGE \
DEF:ba="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.103.86_bytesSent.rrd":counter:AVERAGE \
DEF:bb="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.103.87_bytesSent.rrd":counter:AVERAGE \
DEF:bc="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.118.8_bytesSent.rrd":counter:AVERAGE \
DEF:bd="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.208.133_bytesSent.rrd":counter:AVERAGE \
DEF:be="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.14.181_bytesSent.rrd":counter:AVERAGE \
DEF:bf="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.86.214_bytesSent.rrd":counter:AVERAGE \
DEF:bg="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.169.55_bytesSent.rrd":counter:AVERAGE \
DEF:bh="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.13.103_bytesSent.rrd":counter:AVERAGE \
DEF:bi="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.1.20_bytesRcvd.rrd":counter:AVERAGE \
DEF:bj="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.169.118_bytesRcvd.rrd":counter:AVERAGE \
DEF:ca="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.171.118_bytesRcvd.rrd":counter:AVERAGE \
DEF:cb="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.173.44_bytesRcvd.rrd":counter:AVERAGE \
DEF:cc="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.253.58_bytesRcvd.rrd":counter:AVERAGE \
DEF:cd="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.210.80_bytesRcvd.rrd":counter:AVERAGE \
DEF:ce="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.128.51_bytesRcvd.rrd":counter:AVERAGE \
DEF:cf="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.130.200_bytesRcvd.rrd":counter:AVERAGE \
DEF:cg="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.137.125_bytesRcvd.rrd":counter:AVERAGE \
DEF:ch="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.67.166_bytesRcvd.rrd":counter:AVERAGE \
DEF:ci="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.103.86_bytesRcvd.rrd":counter:AVERAGE \
DEF:cj="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.103.87_bytesRcvd.rrd":counter:AVERAGE \
DEF:da="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.118.8_bytesRcvd.rrd":counter:AVERAGE \
DEF:db="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.208.133_bytesRcvd.rrd":counter:AVERAGE \
DEF:dc="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.14.181_bytesRcvd.rrd":counter:AVERAGE \
DEF:dd="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.86.214_bytesRcvd.rrd":counter:AVERAGE \
DEF:de="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.169.55_bytesRcvd.rrd":counter:AVERAGE \
DEF:df="/var/www/html/mrtg/cacti/rra/MIAFL_192.168.13.103_bytesRcvd.rrd":counter:AVERAGE \
CDEF:cdefdg=TIME,1143035700,GT,s,s,UN,0,s,IF,IF,TIME,1143035700,GT,t,t,UN,0,t,IF,IF,TIME,1143035700,GT,u,u,UN,0,u,IF,IF,TIME,1143035700,GT,v,v,UN,0,v,IF,IF,TIME,1143035700,GT,w,w,UN,0,w,IF,IF,TIME,1143035700,GT,x,x,UN,0,x,IF,IF,TIME,1143035700,GT,y,y,UN,0,y,IF,IF,TIME,1143035700,GT,z,z,UN,0,z,IF,IF,TIME,1143035700,GT,aa,aa,UN,0,aa,IF,IF,TIME,1143035700,GT,ab,ab,UN,0,ab,IF,IF,TIME,1143035700,GT,ac,ac,UN,0,ac,IF,IF,TIME,1143035700,GT,ad,ad,UN,0,ad,IF,IF,TIME,1143035700,GT,ae,ae,UN,0,ae,IF,IF,TIME,1143035700,GT,af,af,UN,0,af,IF,IF,TIME,1143035700,GT,ag,ag,UN,0,ag,IF,IF,TIME,1143035700,GT,ah,ah,UN,0,ah,IF,IF,TIME,1143035700,GT,ai,ai,UN,0,ai,IF,IF,TIME,1143035700,GT,aj,aj,UN,0,aj,IF,IF,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+ \
CDEF:cdefeb=TIME,1143035700,GT,a,a,UN,0,a,IF,IF,TIME,1143035700,GT,b,b,UN,0,b,IF,IF,TIME,1143035700,GT,c,c,UN,0,c,IF,IF,TIME,1143035700,GT,d,d,UN,0,d,IF,IF,TIME,1143035700,GT,e,e,UN,0,e,IF,IF,TIME,1143035700,GT,f,f,UN,0,f,IF,IF,TIME,1143035700,GT,g,g,UN,0,g,IF,IF,TIME,1143035700,GT,h,h,UN,0,h,IF,IF,TIME,1143035700,GT,i,i,UN,0,i,IF,IF,TIME,1143035700,GT,j,j,UN,0,j,IF,IF,TIME,1143035700,GT,k,k,UN,0,k,IF,IF,TIME,1143035700,GT,l,l,UN,0,l,IF,IF,TIME,1143035700,GT,m,m,UN,0,m,IF,IF,TIME,1143035700,GT,n,n,UN,0,n,IF,IF,TIME,1143035700,GT,o,o,UN,0,o,IF,IF,TIME,1143035700,GT,p,p,UN,0,p,IF,IF,TIME,1143035700,GT,q,q,UN,0,q,IF,IF,TIME,1143035700,GT,r,r,UN,0,r,IF,IF,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+,+ \
AREA:a:""  \
AREA:b:""  \
AREA:c:""  \
AREA:d:""  \
AREA:e:""  \
AREA:f:""  \
AREA:g:""  \
AREA:h:""  \
AREA:i:""  \
AREA:j:""  \
AREA:ba:""  \
AREA:bb:""  \
AREA:bc:""  \
AREA:bd:""  \
AREA:be:""  \
AREA:bf:""  \
AREA:bg:""  \
AREA:bh:""  \
LINE1:bi:""  \
LINE1:bj:""  \
LINE1:ca:""  \
LINE1:cb:""  \
LINE1:cc:""  \
LINE1:cd:""  \
LINE1:ce:""  \
LINE1:cf:""  \
LINE1:cg:""  \
LINE1:ch:""  \
LINE1:ci:""  \
LINE1:cj:""  \
LINE1:da:""  \
LINE1:db:""  \
LINE1:dc:""  \
LINE1:dd:""  \
LINE1:de:""  \
LINE1:df:""  \
AREA:cdefdg#00FF00:"Inbound\:"  \
GPRINT:cdefdg:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefdg:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefdg:MAX:"Maximum\:%8.2lf %s"  \
COMMENT:"Total In\: 0 bytes\n"  \
LINE1:cdefeb#0000FF:"Outbound\:"  \
GPRINT:cdefeb:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefeb:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefeb:MAX:"Maximum\:%8.2lf %s"  \
COMMENT:"Total Out\: 0 bytes\n" 

Sorry to have doubted you. :oops:

I don't suppose anyone can tell me a way to not have AREA and LINE1 entries for each data source?
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Post by skohrs »

Oh, and I forgot to ask..."WHY THE FSCK DOES CACTI LABEL THE DEFS IN THAT FASHION?"
elnino
Cacti User
Posts: 205
Joined: Tue Mar 08, 2005 9:51 pm

Post by elnino »

skohrs wrote:Oh, and I forgot to ask..."WHY THE FSCK DOES CACTI LABEL THE DEFS IN THAT FASHION?"
lol Don't have have an answer for that one, sorry. If you could, post a copy of the graph it generated. That CDEF is kinda hard to read, but I think it's still got some of the old line references past "j" in there
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

skohrs wrote:Oh, and I forgot to ask..."WHY THE FSCK DOES CACTI LABEL THE DEFS IN THAT FASHION?"
The RRDtool documentation (http://people.ee.ethz.ch/~oetiker/webto ... ta.en.html) states this :
DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>]

Variable names (vname) must be made up strings of the following characters A-Z, a-z, 0-9, -,_ and a maximum length of 255 characters.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Post by skohrs »

Exactly my point! 'a-z', not 'j'.
skohrs
Posts: 9
Joined: Tue Mar 07, 2006 10:40 am

Post by skohrs »

Apparently the hash is not needed. Cacti is displaying my graphs just fine.

The final script:

Code: Select all

#!/usr/bin/perl

use DBI;
use Time::Local;

$start_time = time() - 600;

# Get all the Ntop files that another script has already copied and renamed
# into the Cacti 'rra' directory, i.e. MIAFL_192.168.123.210_bytesRcvd.rrd &
# MIAFL_192.168.123.210_bytesSent.rrd.
#
open(FILES,"ls -1 /var/www/html/mrtg/cacti/rra/*_bytes*.rrd |");
@output = <FILES>;
foreach $file (@output) {
    if ( $file =~ /.*bytesSent.rrd/ ) {
        push( @{$sites{substr($file, 29, 5)}{'Sent'}}, $file );
    }
    elsif ( $file =~ /.*bytesRcvd.rrd/ ) {
        push( @{$sites{substr($file, 29, 5)}{'Rcvd'}}, $file );
    }
    else {
        next;
    }
}
close(FILES);

$dsn = "DBI:mysql:database=cacti;host=localhost";
$dbh = DBI->connect($dsn, "cacti", "cacti")
    or die "Couldn't connect to database: $DBI::errstr\n";

foreach $site ( sort keys %sites ) {

    $site_id = undef;
    $sth = $dbh->prepare("SELECT id FROM host WHERE description = \"$site\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $site_id = $ref->{ id };
    }

# If the host doesn't exist, add a new host.

    unless ( $site_id ) {
        $dbh->do("INSERT INTO host (description, hostname, disabled) VALUES (\"$site\", \"localhost\", \"on\")");

        $sth = $dbh->prepare("SELECT id FROM host WHERE description = \"$site\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $site_id = $ref->{ id };
        }
    }

# Process each _bytesRcvd.rrd file.

    $def_counter = 1;
    $def_letter = 'a';
    $def_letter_2 = 'b';
    $cdefa = '';
    $rcvd_counter = 0;

    foreach $file ( @{$sites{$site}{'Rcvd'}} ) {
        chomp($file);

        $file = substr($file, 29);

        $local_data_id = undef;

        $sth = $dbh->prepare("SELECT id FROM data_template_data WHERE name = \"$file\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $local_data_id = $ref->{ id };
        }

# If this data source doesn't exist, create a new data source.

        unless ( $local_data_id ) {
            $dbh->do("INSERT INTO data_local (host_id) VALUES (\"$site_id\")");

            $sth = $dbh->prepare("SELECT id FROM data_local ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $local_data_id = $ref->{ id };
            }

            $dbh->do("INSERT INTO data_template_data (local_data_id, name, name_cache, data_source_path, active, rrd_step)
VALUES (\"$local_data_id\",\"$file\", \"$file\", \"<path_rra>\/$file\", \"on\", 300)");

            $sth = $dbh->prepare("SELECT id FROM data_template_data ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $data_temp_data_id = $ref->{ id };
            }

            for ($i=1; $i <= 4; $i++) {
                $dbh->do("INSERT INTO data_template_data_rra (data_template_data_id, rra_id) VALUES (\"$data_temp_data_id\",\"$i\")");
            }
            $dbh->do("INSERT INTO data_template_rrd (local_data_id, rrd_heartbeat, data_source_type_id, data_source_name) VALUES (\"$local_data_id\", 600, 2, \"counter\")");
        }

        $cdefa = $cdefa . "TIME,$start_time,GT,$def_letter,$def_letter,UN,0,$def_letter,IF,IF,";
       
        if ( $def_counter % 10 ) {
            $def_letter++;
        }
        else {
            $def_letter = $def_letter_2++ . 'a';
        }
        $def_counter++;
        $rcvd_counter++;

    }

# Process each _bytesSent.rrd file.

    $cdefb = '';
    $sent_counter = 0;

    foreach $file ( @{$sites{$site}{'Sent'}} ) {
        chomp($file);

        $file = substr($file, 29);

        $local_data_id = undef;

        $sth = $dbh->prepare("SELECT id FROM data_template_data WHERE name = \"$file\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $local_data_id = $ref->{ id };
        }

        unless ( $local_data_id ) {
            $dbh->do("INSERT INTO data_local (host_id) VALUES (\"$site_id\")");

            $sth = $dbh->prepare("SELECT id FROM data_local ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $local_data_id = $ref->{ id };
            }

            $dbh->do("INSERT INTO data_template_data (local_data_id, name, name_cache, data_source_path, active, rrd_step) VALUES (\"$local_data_id\",\"$file\", \"$file\", \"<path_rra>\/$file\", \"on\", 300)");

            $sth = $dbh->prepare("SELECT id FROM data_template_data ORDER BY id DESC LIMIT 0,1");
            $sth->execute();

            while ( $ref = $sth->fetchrow_hashref() ) {
                $data_temp_data_id = $ref->{ id };
            }

            for ($i=1; $i <= 4; $i++) {
                $dbh->do("INSERT INTO data_template_data_rra (data_template_data_id, rra_id) VALUES (\"$data_temp_data_id\",\"$i\")");
            }
            $dbh->do("INSERT INTO data_template_rrd (local_data_id, rrd_heartbeat, data_source_type_id, data_source_name) VALUES (\"$local_data_id\", 600, 2, \"counter\")");
        }

        $cdefb = $cdefb . "TIME,$start_time,GT,$def_letter,$def_letter,UN,0,$def_letter,IF,IF,";
       
        if ( $def_counter % 10 ) {
            $def_letter++;
        }
        else {
            $def_letter = $def_letter_2++ . 'a';
        }
        $def_counter++;
        $sent_counter++;

    }

    for($count = 1; $count < $rcvd_counter; $count++) {
        $cdefa = $cdefa . '+,';
    }
    $cdefa = $cdefa . '8,*';

    for($count = 1; $count < $sent_counter; $count++) {
        $cdefb = $cdefb . '+,';
    }
    $cdefb = $cdefb . '8,*';

    $inbound_cdef_id = undef;

    $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $inbound_cdef_id = $ref->{ id };
    }

    unless ( $inbound_cdef_id ) {
        $dbh->do("INSERT INTO cdef (hash, name) VALUES (MD5(\"$site Inbound\"),\"$site Inbound\")");
        $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $inbound_cdef_id = $ref->{ id };
        }
        $dbh->do("INSERT INTO cdef_items (hash, cdef_id, sequence, type, value) VALUES (MD5(\"$cdefa\"), $inbound_cdef_id, 1, 6, \"$cdefa\")");
    }
    else {
        $dbh->do("UPDATE cdef_items SET hash=MD5(\"$cdefa\"), value=\"$cdefa\" WHERE cdef_id = $inbound_cdef_id");
    }

    $outbound_cdef_id = undef;

    $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Outbound\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $outbound_cdef_id = $ref->{ id };
    }

    unless ( $outbound_cdef_id ) {
        $dbh->do("INSERT INTO cdef (hash, name) VALUES (MD5(\"$site Inbound\"),\"$site Outbound\")");
        $sth = $dbh->prepare("SELECT id FROM cdef WHERE name = \"$site Inbound\"");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $outbound_cdef_id = $ref->{ id };
        }

        $dbh->do("INSERT INTO cdef_items (hash, cdef_id, sequence, type, value) VALUES (MD5(\"$cdefb\"), $outbound_cdef_id, 1, 6, \"$cdefb\")");
    }
    else {
        $dbh->do("UPDATE cdef_items SET hash=MD5(\"$cdefb\"), value=\"$cdefb\" WHERE cdef_id = $outbound_cdef_id");
    }

    $local_graph_id = undef;

    $sth = $dbh->prepare("SELECT local_graph_id FROM graph_templates_graph WHERE title LIKE \"%" . $site . "%Bandwidth%\"");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $local_graph_id = $ref->{ local_graph_id };
    }

    unless ( $local_graph_id ) {
        $dbh->do("INSERT INTO graph_local (host_id) VALUES (\"$site_id\")");

        $sth = $dbh->prepare("SELECT id FROM graph_local ORDER BY id DESC LIMIT 0,1");
        $sth->execute();

        while ( $ref = $sth->fetchrow_hashref() ) {
            $local_graph_id = $ref->{ id };
        }

        $dbh->do("INSERT INTO graph_templates_graph (local_graph_id, image_format_id, title, title_cache, height, width, upper_limit, vertical_label, auto_scale, base_value) VALUES ($local_graph_id, 1, \"$site Bandwidth\", \"$site Bandwidth\", 120, 600, 100, \"bits per second\", \"on\", 1000)");
    }

    $dbh->do("DELETE FROM graph_templates_item WHERE local_graph_id = $local_graph_id");

    $sequence_counter = 1;

    $sth = $dbh->prepare("SELECT data_template_rrd.id FROM data_template_rrd, data_template_data WHERE data_template_rrd.local_data_id = data_template_data.local_data_id AND data_template_data.name LIKE \"$site%bytesSent%\" ORDER BY id");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $task_item_id = $ref->{ id };
        $dbh->do("INSERT INTO graph_templates_item (local_graph_id, task_item_id, graph_type_id, consolidation_function_id, gprint_id, sequence) VALUES ($local_graph_id, $task_item_id, 7, 1, 2, $sequence_counter)");
	$sequence_counter++;
    }

    $sth = $dbh->prepare("SELECT data_template_rrd.id FROM data_template_rrd, data_template_data WHERE data_template_rrd.local_data_id = data_template_data.local_data_id AND data_template_data.name LIKE \"$site%bytesRcvd%\" ORDER BY id");
    $sth->execute();

    while ( $ref = $sth->fetchrow_hashref() ) {
        $task_item_id = $ref->{ id };
        $dbh->do("INSERT INTO graph_templates_item (local_graph_id, task_item_id, graph_type_id, consolidation_function_id, gprint_id, sequence) VALUES ($local_graph_id, $task_item_id, 4, 1, 2, $sequence_counter)");
	$sequence_counter++;
    }

# INSERT the "Inbound:" AREA
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, color_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 12, 7, $inbound_cdef_id, 1, \"Inbound:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Inbound Current:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 9, $inbound_cdef_id, 4, \" Current:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Inbound Average:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 9, $inbound_cdef_id, 1, \"Average:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Inbound Maximum:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, hard_return, gprint_id, sequence) VALUES ($local_graph_id, 9, $inbound_cdef_id, 3, \"Maximum:\", \"on\", 2, $sequence_counter)");
    $sequence_counter++;

# INSERT the "Outbound:" LINE1
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, color_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 21, 4, $outbound_cdef_id, 1, \"Outbound:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Outbound Current:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 9, $outbound_cdef_id, 4, \"Current:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Outbound Average:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 9, $outbound_cdef_id, 1, \"Average:\", 2, $sequence_counter)");
    $sequence_counter++;
# INSERT the "Outbound Maximum:" GPRINT
    $dbh->do("INSERT INTO graph_templates_item (local_graph_id, graph_type_id, cdef_id, consolidation_function_id, text_format, gprint_id, sequence) VALUES ($local_graph_id, 9, $outbound_cdef_id, 3, \"Maximum:\", 2, $sequence_counter)");
    $sequence_counter++;
}

$dbh->disconnect(); 
Cacti RRDTool input:

Code: Select all

/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="DESIA Bandwidth" \
--base=1000 \
--height=120 \
--width=600 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/html/mrtg/cacti/rra/DESIA_192.168.58.234_bytesSent.rrd":counter:AVERAGE \
DEF:b="/var/www/html/mrtg/cacti/rra/DESIA_192.168.177.201_bytesSent.rrd":counter:AVERAGE \
DEF:c="/var/www/html/mrtg/cacti/rra/DESIA_192.168.116.100_bytesSent.rrd":counter:AVERAGE \
DEF:d="/var/www/html/mrtg/cacti/rra/DESIA_192.168.182.226_bytesSent.rrd":counter:AVERAGE \
DEF:e="/var/www/html/mrtg/cacti/rra/DESIA_192.168.197.63_bytesSent.rrd":counter:AVERAGE \
DEF:f="/var/www/html/mrtg/cacti/rra/DESIA_192.168.198.131_bytesSent.rrd":counter:AVERAGE \
DEF:g="/var/www/html/mrtg/cacti/rra/DESIA_192.168.171.33_bytesSent.rrd":counter:AVERAGE \
DEF:h="/var/www/html/mrtg/cacti/rra/DESIA_192.168.175.193_bytesSent.rrd":counter:AVERAGE \
DEF:i="/var/www/html/mrtg/cacti/rra/DESIA_192.168.170.157_bytesSent.rrd":counter:AVERAGE \
DEF:j="/var/www/html/mrtg/cacti/rra/DESIA_192.168.62.218_bytesSent.rrd":counter:AVERAGE \
DEF:ba="/var/www/html/mrtg/cacti/rra/DESIA_192.168.166.113_bytesSent.rrd":counter:AVERAGE \
DEF:bb="/var/www/html/mrtg/cacti/rra/DESIA_192.168.182.184_bytesSent.rrd":counter:AVERAGE \
DEF:bc="/var/www/html/mrtg/cacti/rra/DESIA_192.168.58.234_bytesRcvd.rrd":counter:AVERAGE \
DEF:bd="/var/www/html/mrtg/cacti/rra/DESIA_192.168.177.201_bytesRcvd.rrd":counter:AVERAGE \
DEF:be="/var/www/html/mrtg/cacti/rra/DESIA_192.168.116.100_bytesRcvd.rrd":counter:AVERAGE \
DEF:bf="/var/www/html/mrtg/cacti/rra/DESIA_192.168.182.226_bytesRcvd.rrd":counter:AVERAGE \
DEF:bg="/var/www/html/mrtg/cacti/rra/DESIA_192.168.197.63_bytesRcvd.rrd":counter:AVERAGE \
DEF:bh="/var/www/html/mrtg/cacti/rra/DESIA_192.168.198.131_bytesRcvd.rrd":counter:AVERAGE \
DEF:bi="/var/www/html/mrtg/cacti/rra/DESIA_192.168.171.33_bytesRcvd.rrd":counter:AVERAGE \
DEF:bj="/var/www/html/mrtg/cacti/rra/DESIA_192.168.175.193_bytesRcvd.rrd":counter:AVERAGE \
DEF:ca="/var/www/html/mrtg/cacti/rra/DESIA_192.168.170.157_bytesRcvd.rrd":counter:AVERAGE \
DEF:cb="/var/www/html/mrtg/cacti/rra/DESIA_192.168.62.218_bytesRcvd.rrd":counter:AVERAGE \
DEF:cc="/var/www/html/mrtg/cacti/rra/DESIA_192.168.166.113_bytesRcvd.rrd":counter:AVERAGE \
DEF:cd="/var/www/html/mrtg/cacti/rra/DESIA_192.168.182.184_bytesRcvd.rrd":counter:AVERAGE \
CDEF:cdefce=TIME,1143144721,GT,a,a,UN,0,a,IF,IF,TIME,1143144721,GT,b,b,UN,0,b,IF,IF,TIME,1143144721,GT,c,c,UN,0,c,IF,IF,TIME,1143144721,GT,d,d,UN,0,d,IF,IF,TIME,1143144721
,GT,e,e,UN,0,e,IF,IF,TIME,1143144721,GT,f,f,UN,0,f,IF,IF,TIME,1143144721,GT,g,g,UN,0,g,IF,IF,TIME,1143144721,GT,h,h,UN,0,h,IF,IF,TIME,1143144721,GT,i,i,UN,0,i,IF,IF,TIME,1
143144721,GT,j,j,UN,0,j,IF,IF,TIME,1143144721,GT,ba,ba,UN,0,ba,IF,IF,TIME,1143144721,GT,bb,bb,UN,0,bb,IF,IF,+,+,+,+,+,+,+,+,+,+,+,8,* \
CDEF:cdefci=TIME,1143144721,GT,bc,bc,UN,0,bc,IF,IF,TIME,1143144721,GT,bd,bd,UN,0,bd,IF,IF,TIME,1143144721,GT,be,be,UN,0,be,IF,IF,TIME,1143144721,GT,bf,bf,UN,0,bf,IF,IF,TIM
E,1143144721,GT,bg,bg,UN,0,bg,IF,IF,TIME,1143144721,GT,bh,bh,UN,0,bh,IF,IF,TIME,1143144721,GT,bi,bi,UN,0,bi,IF,IF,TIME,1143144721,GT,bj,bj,UN,0,bj,IF,IF,TIME,1143144721,GT
,ca,ca,UN,0,ca,IF,IF,TIME,1143144721,GT,cb,cb,UN,0,cb,IF,IF,TIME,1143144721,GT,cc,cc,UN,0,cc,IF,IF,TIME,1143144721,GT,cd,cd,UN,0,cd,IF,IF,+,+,+,+,+,+,+,+,+,+,+,8,* \
AREA:a:""  \
AREA:b:""  \
AREA:c:""  \
AREA:d:""  \
AREA:e:""  \
AREA:f:""  \
AREA:g:""  \
AREA:h:""  \
AREA:i:""  \
AREA:j:""  \
AREA:ba:""  \
AREA:bb:""  \
LINE1:bc:""  \
LINE1:bd:""  \
LINE1:be:""  \
LINE1:bf:""  \
LINE1:bg:""  \
LINE1:bh:""  \
LINE1:bi:""  \
LINE1:bj:""  \
LINE1:ca:""  \
LINE1:cb:""  \
LINE1:cc:""  \
LINE1:cd:""  \
AREA:cdefce#00FF00:"Inbound\:"  \
GPRINT:cdefce:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefce:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefce:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefci#0000FF:"Outbound\:"  \
GPRINT:cdefci:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefci:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefci:MAX:"Maximum\:%8.2lf %s"
And the graph (nothing fancy, but constructed completely automatically):
Image
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Hash is only needed for template records in the tables.

But it's generated for all, I think.. :)
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest