mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-01 02:23:21 +00:00
739027a27d
These scripts will be necessary for parsing pihole.log before it is flushed and then saving the information into a DB. This information can then be displayed in the Web GUI. mysql-server and php5-mysql will need to be installed. you can then setup the database with this command: mysql -u root -p"raspberry" < /usr/local/bin/setupPiholeStats.sql Once that is done, run sudo php /usr/local/bin/lrs.php
22 lines
1.1 KiB
SQL
22 lines
1.1 KiB
SQL
|
|
-- instal with this command: mysql -u root -p"raspberry" < /usr/local/bin/setupPiholeStats.sql
|
|
CREATE DATABASE charts;
|
|
USE charts;
|
|
DROP TABLE IF EXISTS `pie_chart_stats`;
|
|
CREATE TABLE `pie_chart_stats` (
|
|
`insert_date` DATE NOT NULL COMMENT 'date when values were captured',
|
|
`query_cnt` INT(10) UNSIGNED NOT NULL COMMENT 'query count appreaprence',
|
|
`adver_cnt` INT(10) UNSIGNED NOT NULL COMMENT 'advertiser count apperance',
|
|
PRIMARY KEY (`insert_date`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'table to store stats for pie (queries vs advertisers) chart';
|
|
-- this row would be updated to store SUM values
|
|
-- needs to be added within a table creation
|
|
INSERT INTO `pie_chart_stats` VALUES ('0000-00-00', 0, 0);
|
|
|
|
DROP TABLE IF EXISTS `top_chart_stats`;
|
|
CREATE TABLE `top_chart_stats` (
|
|
`insert_date` DATE NOT NULL COMMENT 'date when values were captured',
|
|
`adver_name` VARCHAR (60) NOT NULL COMMENT 'advertiser domain name',
|
|
`cnt` MEDIUMINT(7) NOT NULL COMMENT 'advertiser count apperance',
|
|
PRIMARY KEY (`insert_date`, `adver_name`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|