SCHEMA +-----------+-------------+------+-----+------------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+------------+-------+ | ip | varchar(20) | | PRI | | | | interface | varchar(25) | | PRI | | | | ndate | date | | PRI | 0000-00-00 | | | ntime | time | | PRI | 00:00:00 | | | bin | int(11) | YES | | NULL | | | bout | int(11) | YES | | NULL | | +-----------+-------------+------+-----+------------+-------+ DATA ip int ndate ntime bin bout 10.151.1.254 fe0/1 2004-03-20 04:30:00 0 0 10.151.1.254 s0/1 2004-03-20 04:30:00 33 44 138.198.1.254 fe0/0 2004-03-20 04:30:00 455 455 #! /usr/bin/perl use strict; use warnings; use DBIx::Chart; my $db = "DBI:mysql:ndb"; my $dbh = DBIx::Chart->connect($db,'esm','esm') or die "Can't connect to database: $DBIx::Chart->errstr!"; my $ip= $dbh->quote('xxx.xxx.xxx.xxx'); my $int = $dbh->quote('s0/0'); my $dt = $dbh->quote('2004-03-21'); my $sth = $dbh->selectrow_arrayref("SELECT ntime,bin,bout from bw_daily where ndate=".$dt." and ip=".$ip." and interface=".$int." RETURNING LINEGRAPH(ntime,bin,bout) WHERE width=500 and height=250 and title='weekly bandwidth utilization graph' and colors in ('red','blue') and background = 'lgray' and x-axis='time' and y-axis='bandwidth' and signature='ESM\@ST' "); #$sth->bind_param(1,$dt); #$sth->execute; open(FI, ">gp1.png"); binmode FI; print FI $$sth[0]; close FI; $dbh->disconnect; exit 0;