Hi guys!

I have built the pmacct 0.14.0rc1 and I would like the following result:
* I store the accounting data on monthly tables: acct_in_%Y_%m (Done!)
* I store the accounting data each 20 minutes, 1 record by day/ip address
* I would like each 1st of month, pmacctd creates a new monthly table
with format acct_in_%Y_%m

It seems to work fine but when month change from June to July (i.e.),
the new monthly table acct_in_2011_07 is not created automatically.
Instead it tries to create again the June table acct_in_2011_06
It is only created if I restart the pmacctd daemon.

I try to simulate the month change setting the system data to 2011-07-01
with command  "date --set 2011-07-01" and it seems the pmacct detect the
changing date but it still thinks it is in june because it tries to
create the june monthly table and the start timestamp is still in the
real datetime (june).

Can someone help me to solve this?
What am I doing wrong?



My configuration file:

promisc: true
debug: false
daemonize: true
interface: eth1
networks_file: /etc/pmacct/networks.def
logfile: /var/log/pmacct.log

plugins: mysql[sqlin], mysql[sqlout], memory[in], memory[out]
aggregate: dst_host, src_host
aggregate[in]: dst_host
aggregate[out]: src_host
aggregate[sqlin]: dst_host
aggregate[sqlout]: src_host
!
!FILTROS TCPDUMP
!
pcap_filter: xxxxxxx
!
!MEMORY CONFIG
imt_path[in]: /tmp/in.pipe
imt_path[out]: /tmp/out.pipe
plugin_buffer_size: 4096
plugin_pipe_size: 4096000

!SQL CONFIG
sql_host: 127.0.0.1
sql_db: pmacct
sql_user: dbuserp
sql_passwd: dbpassp
sql_refresh_time: 1200
sql_table_version: 1

!1 fila cada dia
sql_history: 1d
sql_history_roundoff: d
sql_dont_try_update: false
!
sql_table_schema[sqlin]: /etc/pmacct/v1_db_schema_in_monthly.mysql
sql_table_schema[sqlout]: /etc/pmacct/v1_db_schema_out_monthly.mysql
!
sql_table[sqlin]: acct_in_%Y_%m
sql_table[sqlout]: acct_out_%Y_%m
!
sql_recovery_logfile[sqlin]: /var/log/sqlin_logfile
sql_recovery_logfile[sqlout]: /var/log/sqlout_logfile
!
sql_multi_values[sqlin]: 1000000
sql_multi_values[sqlout]: 1000000


Logs pmacct:

LERT ( sqlin/mysql ): Invalid magic number: '/root/sqlin_logfile'.
ERROR ( sqlout/mysql ): PRIMARY 'mysql' backend trouble.
ERROR ( sqlout/mysql ): The SQL server says: Table
'pmacct.acct_out_2011_07' doesn't exist

ALERT ( sqlin/mysql ): recovery for MySQL daemon failed.
ALERT ( sqlout/mysql ): Invalid magic number: '/root/sqlout_logfile'.
ALERT ( sqlout/mysql ): recovery for MySQL daemon failed.
ERROR ( sqlin/mysql ): PRIMARY 'mysql' backend trouble.
ERROR ( sqlin/mysql ): The SQL server says: Table
'pmacct.acct_in_2011_07' doesn't exist

ALERT ( sqlin/mysql ): Invalid magic number: '/root/sqlin_logfile'.
ALERT ( sqlin/mysql ): recovery for MySQL daemon failed.
ERROR ( sqlout/mysql ): PRIMARY 'mysql' backend trouble.
ERROR ( sqlout/mysql ): The SQL server says: Table
'pmacct.acct_out_2011_07' doesn't exist

ALERT ( sqlout/mysql ): Invalid magic number: '/root/sqlout_logfile'.
ALERT ( sqlout/mysql ): recovery for MySQL daemon failed.


Logs Mysql:

110701  0:00:00    11604 Connect    root@localhost on pmacct
        11603 Connect    root@localhost on pmacct
        11604 Query    create table acct_out_2011_06 (
    mac_src CHAR(17) NOT NULL,
    mac_dst CHAR(17) NOT NULL,
    ip_src CHAR(15) NOT NULL,
    ip_dst CHAR(15) NOT NULL,
    src_port INT(2) UNSIGNED NOT NULL,
    dst_port INT(2) UNSIGNED NOT NULL,
    ip_proto CHAR(6) NOT NULL,
        packets INT UNSIGNED NOT NULL,
    bytes BIGINT UNSIGNED NOT NULL,
    stamp_inserted DATETIME NOT NULL,
    stamp_updated DATETIME,
    PRIMARY KEY (mac_src, mac_dst, ip_src, ip_dst, src_port, dst_port,
ip_proto, stamp_inserted)
)
        11603 Query    create table acct_in_2011_06 (
    mac_src CHAR(17) NOT NULL,
    mac_dst CHAR(17) NOT NULL,
    ip_src CHAR(15) NOT NULL,
    ip_dst CHAR(15) NOT NULL,
    src_port INT(2) UNSIGNED NOT NULL,
    dst_port INT(2) UNSIGNED NOT NULL,
    ip_proto CHAR(6) NOT NULL,
        packets INT UNSIGNED NOT NULL,
    bytes BIGINT UNSIGNED NOT NULL,
    stamp_inserted DATETIME NOT NULL,
    stamp_updated DATETIME,
    PRIMARY KEY (mac_src, mac_dst, ip_src, ip_dst, src_port, dst_port,
ip_proto, stamp_inserted)
)
        11604 Query    LOCK TABLES `acct_out_2011_06` WRITE
        11603 Query    LOCK TABLES `acct_in_2011_06` WRITE
        11604 Query    UPDATE `acct_out_2011_06` SET
packets=packets+10466, bytes=bytes+12844139, stamp_updated=NOW() WHERE
FROM_UNIXTIME(1306965600) = stamp_inserted A
ND ip_src='1.2.3.4' AND src_port=0 AND dst_port=0 AND ip_proto='ip' AND
mac_src='0:0:0:0:0:0' AND mac_dst='0:0:0:0:0:0' AND ip_dst='0.0.0.0'









Thanks in advance


-- 
*Luis Galán Gragera*
SYSTEMS INFRASTRUCTURE MANAGER

[email protected] <mailto:[email protected]>
Información General: 902 884 633
Centro Soporte Soluciones: 902 884 622
Provisión: 902 884 802
Fax: +34 934 451 920

Claranet
Hosting / Redes / Aplicaciones
c/Juan Gris, 10-18, Torres Cerdà
08014 Barcelona
www.claranet.es <http://www.claranet.es>
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to