ntopng and mysql dependency

796 views Asked by At

I'm trying to setup ntopng (on raspbian) with persistent storage in MySQL. I've added the following line in ntopng.conf

--dump-flows=mysql;localhost;ntopng;flows;root;root

Upon boot, I find that ntopng has exited because it wasn't able to connect with the database

---snippet from /var/log/ntopng/ntopng.log------------

28/Dec/2016 09:50:03 [MySQLDB.cpp:573] Attempting to connect to MySQL for interface eth0...
28/Dec/2016 09:50:03 [MySQLDB.cpp:602] ERROR: Failed to connect to MySQL: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)[localhost:root]
28/Dec/2016 09:50:03 [MySQLDB.cpp:79] ERROR: Unable to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
28/Dec/2016 09:50:03 [main.cpp:279] ERROR: Unable to create database schema, quitting

----end of snippet--------------

But after booting, if I run 'sudo service ntopng restart' I find that ntopng connects with MySQL and starts the service.

I'm guessing that during upstart, ntopng is being run before MySQL and fails to find an active daemon. Any way I can make sure that ntopng starts after MySQL?

1

There are 1 answers

0
d3noob On

It's possible that there has been a version change since your question was asked, but I have been successful with placing the following line in /etc/ntopng/ntopng.conf (and I have used your settings for <server>, <database>, <table>, <user> and <password>)

-F "mysql;localhost;ntopng;flows;root;root"

From the docs it should be in the form;

-F "mysql;<server>;<database>;<table>;<user>;<password>"

This is obviously slightly different to what you have above (although --dump-flows should be replaceable for -F). It might be possible that the equals sign that you have mentioned should be a space and the latter part of the argument enclosed in speech-marks?