db: update init scripts due to removed stats tables in MySQL
While at it, improve name to distinguish from influxdb. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
30de5a052e
commit
fcccf3b9db
|
@ -2,6 +2,5 @@
|
|||
|
||||
import routers
|
||||
import hoods
|
||||
import stats
|
||||
import gws
|
||||
import users
|
|
@ -32,24 +32,6 @@ mysql.execute("""
|
|||
ADD PRIMARY KEY (`mac`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `netifs` (
|
||||
`id` smallint(6) UNSIGNED NOT NULL,
|
||||
`name` varchar(15) COLLATE utf8_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `netifs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `name` (`name`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `netifs`
|
||||
MODIFY `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router` (
|
||||
`id` mediumint(8) UNSIGNED NOT NULL,
|
||||
|
@ -209,152 +191,6 @@ mysql.execute("""
|
|||
ADD KEY `mac` (`mac`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`sys_proctot` smallint(6) NOT NULL,
|
||||
`sys_procrun` smallint(6) NOT NULL,
|
||||
`sys_memcache` int(11) NOT NULL,
|
||||
`sys_membuff` int(11) NOT NULL,
|
||||
`sys_memfree` int(11) NOT NULL,
|
||||
`loadavg` float NOT NULL,
|
||||
`clients` smallint(6) NOT NULL,
|
||||
`clients_eth` smallint(6) DEFAULT NULL,
|
||||
`clients_w2` smallint(6) DEFAULT NULL,
|
||||
`clients_w5` smallint(6) DEFAULT NULL,
|
||||
`airtime_w2` float DEFAULT NULL,
|
||||
`airtime_w5` float DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats`
|
||||
ADD PRIMARY KEY (`time`,`router`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_gw` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` bigint(20) UNSIGNED NOT NULL,
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_gw`
|
||||
ADD PRIMARY KEY (`time`,`router`,`mac`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_neighbor` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` bigint(20) UNSIGNED NOT NULL,
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_neighbor`
|
||||
ADD PRIMARY KEY (`time`,`router`,`mac`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_netif` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`netif` smallint(6) UNSIGNED NOT NULL,
|
||||
`rx` int(10) UNSIGNED NOT NULL,
|
||||
`tx` int(10) UNSIGNED NOT NULL,
|
||||
`deletebit` tinyint(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_netif`
|
||||
ADD PRIMARY KEY (`time`,`router`,`netif`),
|
||||
ADD KEY `router` (`router`),
|
||||
ADD KEY `deletebit` (`deletebit`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_old` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`sys_proctot` smallint(6) NOT NULL,
|
||||
`sys_procrun` smallint(6) NOT NULL,
|
||||
`sys_memcache` int(11) NOT NULL,
|
||||
`sys_membuff` int(11) NOT NULL,
|
||||
`sys_memfree` int(11) NOT NULL,
|
||||
`loadavg` float NOT NULL,
|
||||
`clients` smallint(6) NOT NULL,
|
||||
`clients_eth` smallint(6) DEFAULT NULL,
|
||||
`clients_w2` smallint(6) DEFAULT NULL,
|
||||
`clients_w5` smallint(6) DEFAULT NULL,
|
||||
`airtime_w2` float DEFAULT NULL,
|
||||
`airtime_w5` float DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_old`
|
||||
ADD PRIMARY KEY (`time`,`router`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_old_gw` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` bigint(20) UNSIGNED NOT NULL,
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_old_gw`
|
||||
ADD PRIMARY KEY (`time`,`router`,`mac`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_old_neighbor` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` bigint(20) UNSIGNED NOT NULL,
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_old_neighbor`
|
||||
ADD PRIMARY KEY (`time`,`router`,`mac`),
|
||||
ADD KEY `router` (`router`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `router_stats_old_netif` (
|
||||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`netif` smallint(6) UNSIGNED NOT NULL,
|
||||
`rx` int(10) UNSIGNED NOT NULL,
|
||||
`tx` int(10) UNSIGNED NOT NULL,
|
||||
`deletebit` tinyint(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `router_stats_old_netif`
|
||||
ADD PRIMARY KEY (`time`,`router`,`netif`),
|
||||
ADD KEY `router` (`router`),
|
||||
ADD KEY `deletebit` (`deletebit`)
|
||||
""")
|
||||
|
||||
mysql.commit()
|
||||
|
||||
mysql.close()
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/' + '../..'))
|
||||
|
||||
from ffmap.mysqltools import FreifunkMySQL
|
||||
|
||||
mysql = FreifunkMySQL()
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `stats_global` (
|
||||
`time` int(11) NOT NULL,
|
||||
`clients` mediumint(9) NOT NULL,
|
||||
`online` smallint(6) NOT NULL,
|
||||
`offline` smallint(6) NOT NULL,
|
||||
`unknown` smallint(6) NOT NULL,
|
||||
`orphaned` smallint(6) NOT NULL,
|
||||
`rx` int(10) UNSIGNED DEFAULT NULL,
|
||||
`tx` int(10) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `stats_global`
|
||||
ADD PRIMARY KEY (`time`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `stats_gw` (
|
||||
`time` int(11) NOT NULL,
|
||||
`mac` bigint(20) UNSIGNED NOT NULL,
|
||||
`clients` mediumint(9) NOT NULL,
|
||||
`online` smallint(6) NOT NULL,
|
||||
`offline` smallint(6) NOT NULL,
|
||||
`unknown` smallint(6) NOT NULL,
|
||||
`orphaned` smallint(6) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `stats_gw`
|
||||
ADD PRIMARY KEY (`time`,`mac`),
|
||||
ADD KEY `mac` (`mac`)
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
CREATE TABLE `stats_hood` (
|
||||
`time` int(11) NOT NULL,
|
||||
`hood` smallint(5) UNSIGNED NOT NULL,
|
||||
`clients` mediumint(9) NOT NULL,
|
||||
`online` smallint(6) NOT NULL,
|
||||
`offline` smallint(6) NOT NULL,
|
||||
`unknown` smallint(6) NOT NULL,
|
||||
`orphaned` smallint(6) NOT NULL,
|
||||
`rx` int(10) UNSIGNED DEFAULT NULL,
|
||||
`tx` int(10) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
mysql.execute("""
|
||||
ALTER TABLE `stats_hood`
|
||||
ADD PRIMARY KEY (`time`,`hood`),
|
||||
ADD KEY `hood` (`hood`)
|
||||
""")
|
||||
|
||||
mysql.commit()
|
||||
|
||||
mysql.close()
|
Loading…
Reference in New Issue