Hi

Ah.
I upgraded to the latest version, and now it works.
(I had to remove the "TRIGGER" also.)

Edward


On 11/08/2010 12:59, Edward van Kuik wrote:
Hi

I've been fiddling for a while now.

I can't get pmacct to create my mysql table even though I have:
    sql_table: pmacctlan_%Y%m
    sql_table_schema: /home/bwb/iptl/schema_lan

If I create the file manually, then the data is inserted correctly.
Also, I have mysql logging on and I can see no such "CREATE" in the mysql log file.

pmacct logs only show:

Aug 11 12:58:03 barnfw pmacctd[29324]: ERROR ( default/mysql ): Table 'pmacct.pmacctlan_20100857' doesn't exist#012


I have the following pmacct.conf:

daemonize: true
pidfile: /var/run/pmacctd-iptl-lan.pid
syslog: daemon
aggregate: src_host,dst_host,src_port,dst_port
interface: eth2
plugins: mysql
sql_host: goose.barn.nitric.co.za
sql_passwd: ******
sql_table_schema: /home/bwb/iptl/schema_lan
sql_table: pmacctlan_%Y%m
sql_user: pmacct
sql_db: pmacct
sql_refresh_time: 60
sql_optimize_clauses: true
sql_history: 1m
sql_history_roundoff: m
sql_recovery_logfile: /var/lib/pmacct/recovery_log_lan
!sql_dont_try_update: true
sql_multi_values: 1000
sql_locking_style: row


My /home/bwb/iptl/schema_lan looks like this:

CREATE TABLE `pmacctlan_%Y%m` (
  `ip_src` char(15) character set latin1 NOT NULL,
  `ip_dst` char(15) character set latin1 NOT NULL,
  `src_port` int(2) unsigned NOT NULL,
  `dst_port` int(2) unsigned NOT NULL,
  `packets` int(10) unsigned NOT NULL,
  `bytes` bigint(20) unsigned NOT NULL,
  `stamp_inserted` datetime NOT NULL,
  `stamp_updated` datetime default NULL,
  `ip_src_int` int(11) unsigned default NULL,
  `ip_dst_int` int(11) unsigned default NULL,
  `port_uid` int(11) default NULL,
PRIMARY KEY (`ip_src`,`ip_dst`,`src_port`,`dst_port`,`stamp_inserted`),
  KEY `ip_src_int` (`ip_src_int`),
  KEY `ip_dst_int` (`ip_dst_int`),
  KEY `stamp_inserted` (`stamp_inserted`),
  KEY `port_uid` (`port_uid`)
) ENGINE=MyISAM DEFAULT CHARSET=ascii;

--
-- Triggers `acct_barnlan`
--
DROP TRIGGER IF EXISTS `pmacctlan`;
DELIMITER //
CREATE TRIGGER `pmacctlan` BEFORE INSERT ON `pmacctlan_%Y%m`
 FOR EACH ROW BEGIN
 SET NEW.ip_dst_int = INET_ATON(NEW.ip_dst);
 SET NEW.ip_src_int = INET_ATON(NEW.ip_src);
END
//
DELIMITER ;


r...@barnfw:~/iptl# uname -a
Linux barnfw 2.6.32-22-generic-pae #33-Ubuntu SMP Wed Apr 28 14:57:29 UTC 2010 i686 GNU/Linux
r...@barnfw:~/iptl# apt-cache policy pmacct
pmacct:
  Installed: 0.11.6-2build1
  Candidate: 0.11.6-2build1
  Version table:
 *** 0.11.6-2build1 0
        500 http://za.archive.ubuntu.com/ubuntu/ lucid/universe Packages
        100 /var/lib/dpkg/status




_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists


--
Edward van Kuik
Nitric Industries CC
5th Floor Buitengracht Centre
125 Buitengracht Street, Cape Town
Box 7207, Roggebaai, 8012
South Africa
Tel: +27 21 409 7977
Fax: +27 21 409 7050
Cell: +27 83 645 6443
http://nitric.co.za
To send me big files, use http://edward.filegooi.co.za/


_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to