pmacct / pmacct

pmacct is a small set of multi-purpose passive network monitoring tools [NetFlow IPFIX sFlow libpcap BGP BMP RPKI IGP Streaming Telemetry].

Home Page:http://www.pmacct.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trouble writing data to database

udostanic opened this issue · comments

Hello, I'm using sfacctd and I have problem with writing data to database. I have tried to write data to a txt file and it is working. I'm using PostgreSQL. In /var/log/syslog I have this error.
image

This is from /var/log/postgresql/
image

I have created database and granted all privileges to user, also in config file I have set sql_host, sql_user, sql_passwd, sql_db. What am I doing wrong?

Hi @udostanic ,

If you try to connect by hand with psql, does it work? I mean not only using the DB, username and password but also forcing the connection to go via TCP, ie. psql [ .. ] -h localhost.

Paolo

Hello @paololucente,
I have tried to connect to psql through terminal like you mentioned and it works fine.

Whav version of pmacct are you using? A copy/paste of sfacctd -V would do.

Unfortunately that output omits the most important info on the first line where version and commit version is present

Sorry for bad screenshot, here is a full version
image

Thanks @udostanic ,

While i try to reproduce, can you just try removing the sql_host from the config and connect with the local database without using TCP? Or do you have some specific reason to prefer TCP over UNIX socket?

Also, the library being used by pmacct is 140010: can you confirm that your server is running PostgreSQL 14?

Paolo

I tried to remove sql_host from config and it still won't write data to database. Database and application are on the same server so there isn't specific reason to use TCP. I confirm that I have PostgreSQL 14 running on the server.

I don't have any errors in PostgreSQL log, so I have used syslog where I see same error from the first post in this thread:
image

Hi @udostanic ,

I was able to reproduce the issue and the last commit should address it. Could you please download latest master code and confirm it working for you?

Paolo

I've tested with new version and everything works fine. Thanks @paololucente

Thanks for confirming @udostanic