Hello continuing on from my determination to get opsview up and running i have now encounted yet another issue with the setup. Seriously it has been non stop issues. ive managed to fix many of them or find workarounds but i need some guidance on the SQL statements in one of the perl scripts.
Im at the stage where i am capturing netflow data (using flavio) but are now trying to run the "netflow_aggregate.pl" file to import the captured data into MYSQL. When i run the file ive enounted issues regarding missing columns in the tables created earlier following the documentation. now i get an error:
Table: 2008_12_23
Week: 1
WeekTable: W2008_1
MonthTable: M2008_12
YearTable: Y2008
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and 'endtime' <=' at line 1 at /usr/local/flavio/netflow_aggregate.pl line 114.
Unable to execute query:DBI::db=HASH(0x82e17f[IMG]https://us.v-cdn.net/6030959/uploads/images/smilies/icon_cool.gif[/IMG]->err, DBI::db=HASH(0x82e17f[IMG]https://us.v-cdn.net/6030959/uploads/images/smilies/icon_cool.gif[/IMG]->errstr
From the error it seems the problem is with the "and 'endtime'" part of the following SQL statement:
$statement = "DELETE from $weekTable where starttime >= $since and endtime <= $to";
$sth = $dbh->prepare($statement);
$sth->execute or die "Unable to execute query:$dbh->err, $dbh->errstr\n";
$sth->finish;
$statement = "DELETE from $monthTable where starttime >= $since and endtime <= $to";
$sth = $dbh->prepare($statement);
$sth->execute or die "Unable to execute query:$dbh->err, $dbh->errstr\n";
$sth->finish;
$statement = "DELETE from $yearTable where starttime >= $since and endtime <= $to";
$sth = $dbh->prepare($statement);
$sth->execute or die "Unable to execute query:$dbh->err, $dbh->errstr\n";
$sth->finish;
Ive had a look and the statement looks OK to me but to be honest i dont have any SQL experiance. Anyone got any ideas on this statement?
Thanks