-
Notifications
You must be signed in to change notification settings - Fork 656
03 MySQL FAQ
pash! edited this page Sep 3, 2018
·
9 revisions
You can instruct ntopng to save flow information to a MySQL Database. This enables you to:
- Visualize historical information using ntopng
- Create your own reports using data stored in MySQL
Example: $ ntopng -F "mysql;localhost;ntopng;flows;root;1234" Format: $ ntopng -F "mysql;{host|socket};{dbname};{table name};{user};{pw}"
Before executing, you should create a database (and optionally user /w rights):
CREATE DATABASE IF NOT EXISTS ntopng;
Example: http://localhost:3000/lua/host_details.lua?ifname=0&host=192.168.1.92&page=historical
flowsv4 flowsv6
A: You are not need any manual creation (exept CREATE DATABASE
). All tables will be created at ntopng startup. They are two tables (one for IPv4 and one for IPv6) partitioned in sub-tables.
| idx | VLAN_ID | L7_PROTO | IP_SRC_ADDR | L4_SRC_PORT | IP_DST_ADDR | L4_DST_PORT | PROTOCOL | BYTES | PACKETS | FIRST_SWITCHED | LAST_SWITCHED | INFO | JSON
A sample INSERT follows for illustration. Note data in the JSON column is compressed:
INSERT INTO `flowsv4_0` (VLAN_ID,L7_PROTO,IP_SRC_ADDR,L4_SRC_PORT,IP_DST_ADDR,L4_DST_PORT,PROTOCOL,BYTES,PACKETS,FIRST_SWITCHED,LAST_SWITCHED,INFO,JSON) VALUES ('0','5','3232235777','53','3232235799','13562','17','198','1','1443380163','1443380163','[email protected]',COMPRESS('{ "8": "192.168.1.1", "7": 53, "12": "192.168.1.23", "11": 13562, "4": 17, "57590": 5, "57591": "DNS", "2": 1, "1": 198, "24": 0, "23": 0, "22": 1443380163, "21": 1443380163, "DNS_QUERY": "[email protected]" }'))
Debian: apt-get install libmysqlclient-dev CentOS: yum install mysql-devel