Bladeren bron

add check another copy of runned script
update mysql structure

Dmitriev Roman 5 jaren geleden
bovenliggende
commit
f2d157d803

+ 5 - 0
docs/mysql/stat_database.sql

@@ -0,0 +1,5 @@
+--
+-- Database: `stat`
+--
+CREATE DATABASE IF NOT EXISTS `stat` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+USE `stat`;

+ 13 - 35
docs/mysql/stat_extra.sql

@@ -7,7 +7,9 @@
 -- Indexes for table `auth_rules`
 --
 ALTER TABLE `auth_rules`
-  ADD PRIMARY KEY (`id`);
+  ADD PRIMARY KEY (`id`),
+  ADD UNIQUE KEY `rule` (`rule`),
+  ADD KEY `user_id` (`user_id`);
 
 --
 -- Indexes for table `building`
@@ -49,6 +51,7 @@ ALTER TABLE `devices`
   ADD PRIMARY KEY (`id`),
   ADD UNIQUE KEY `id` (`id`),
   ADD KEY `ip` (`ip`),
+  ADD KEY `ip_2` (`ip`),
   ADD KEY `device_type` (`device_type`);
 
 --
@@ -84,9 +87,7 @@ ALTER TABLE `device_types`
 --
 ALTER TABLE `dhcp_log`
   ADD PRIMARY KEY (`id`),
-  ADD KEY `timestamp` (`timestamp`),
-  ADD KEY `ip1` (`ip`),
-  ADD KEY `timestamp_2` (`timestamp`,`action`);
+  ADD KEY `timestamp` (`timestamp`,`action`) USING BTREE;
 
 --
 -- Indexes for table `dns_cache`
@@ -121,8 +122,6 @@ ALTER TABLE `Group_list`
 --
 ALTER TABLE `mac_history`
   ADD PRIMARY KEY (`id`),
-  ADD KEY `mac` (`mac`,`timestamp`) USING BTREE,
-  ADD KEY `ip` (`ip`,`timestamp`) USING BTREE,
   ADD KEY `timestamp` (`timestamp`,`mac`),
   ADD KEY `timestamp_2` (`timestamp`,`ip`);
 
@@ -151,11 +150,9 @@ ALTER TABLE `Queue_list`
 --
 ALTER TABLE `remote_syslog`
   ADD PRIMARY KEY (`id`),
-  ADD UNIQUE KEY `id` (`id`),
-  ADD KEY `device_id` (`device_id`),
+  ADD KEY `date_2` (`date`),
   ADD KEY `date` (`date`,`device_id`,`ip`);
 ALTER TABLE `remote_syslog` ADD FULLTEXT KEY `message` (`message`);
-ALTER TABLE `remote_syslog` ADD FULLTEXT KEY `message_2` (`message`);
 
 --
 -- Indexes for table `subnets`
@@ -170,12 +167,7 @@ ALTER TABLE `subnets`
 --
 ALTER TABLE `syslog`
   ADD PRIMARY KEY (`id`),
-  ADD KEY `auth_idx` (`auth_id`),
-  ADD KEY `timestamp` (`timestamp`,`auth_id`,`customer`,`level`),
-  ADD KEY `timestamp_2` (`timestamp`,`level`,`customer`);
-ALTER TABLE `syslog` ADD FULLTEXT KEY `message` (`message`);
-ALTER TABLE `syslog` ADD FULLTEXT KEY `message_2` (`message`);
-ALTER TABLE `syslog` ADD FULLTEXT KEY `customer` (`customer`);
+  ADD KEY `timestamp` (`timestamp`,`level`,`customer`);
 
 --
 -- Indexes for table `Traffic_detail`
@@ -190,7 +182,6 @@ ALTER TABLE `Traffic_detail`
 --
 ALTER TABLE `Unknown_mac`
   ADD PRIMARY KEY (`id`),
-  ADD KEY `mac` (`mac`,`timestamp`),
   ADD KEY `timestamp` (`timestamp`,`device_id`,`port_id`,`mac`);
 
 --
@@ -198,16 +189,9 @@ ALTER TABLE `Unknown_mac`
 --
 ALTER TABLE `User_auth`
   ADD PRIMARY KEY (`id`),
-  ADD KEY `auth_index` (`id`,`user_id`,`ip_int`,`mac`,`ip`,`deleted`),
+  ADD KEY `auth_index` (`id`,`user_id`,`ip_int`,`mac`,`ip`,`deleted`) USING BTREE,
   ADD KEY `deleted` (`deleted`);
 
---
--- Indexes for table `User_auth_alias`
---
-ALTER TABLE `User_auth_alias`
-  ADD PRIMARY KEY (`id`),
-  ADD KEY `auth_id` (`auth_id`);
-
 --
 -- Indexes for table `User_list`
 --
@@ -257,7 +241,7 @@ ALTER TABLE `auth_rules`
 -- AUTO_INCREMENT for table `building`
 --
 ALTER TABLE `building`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
 --
 -- AUTO_INCREMENT for table `config`
@@ -329,13 +313,13 @@ ALTER TABLE `dns_cache`
 -- AUTO_INCREMENT for table `Filter_list`
 --
 ALTER TABLE `Filter_list`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=107;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
 --
 -- AUTO_INCREMENT for table `Group_filters`
 --
 ALTER TABLE `Group_filters`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=235;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
 --
 -- AUTO_INCREMENT for table `Group_list`
@@ -353,7 +337,7 @@ ALTER TABLE `mac_history`
 -- AUTO_INCREMENT for table `mac_vendors`
 --
 ALTER TABLE `mac_vendors`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38949;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
 --
 -- AUTO_INCREMENT for table `OU`
@@ -365,7 +349,7 @@ ALTER TABLE `OU`
 -- AUTO_INCREMENT for table `Queue_list`
 --
 ALTER TABLE `Queue_list`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
 --
 -- AUTO_INCREMENT for table `remote_syslog`
@@ -403,12 +387,6 @@ ALTER TABLE `Unknown_mac`
 ALTER TABLE `User_auth`
   MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
 
---
--- AUTO_INCREMENT for table `User_auth_alias`
---
-ALTER TABLE `User_auth_alias`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-
 --
 -- AUTO_INCREMENT for table `User_list`
 --

+ 9 - 3
docs/mysql/stat_table_OU.sql

@@ -14,6 +14,11 @@ CREATE TABLE `OU` (
   `nagios_default_service` varchar(100) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Truncate table before insert `OU`
+--
+
+TRUNCATE TABLE `OU`;
 --
 -- Dumping data for table `OU`
 --
@@ -22,12 +27,13 @@ INSERT INTO `OU` (`id`, `ou_name`, `nagios_dir`, `nagios_host_use`, `nagios_ping
 (0, '!Всё', 'any', 'generic-host', 1, NULL),
 (1, 'Сервера', NULL, NULL, 1, NULL),
 (2, 'Администраторы', NULL, NULL, 1, NULL),
+(3, 'Пользователи', NULL, NULL, 1, NULL),
 (4, 'VOIP', 'voip', 'voip', 1, NULL),
 (5, 'IPCAM', 'videocam', 'ip-cam', 0, NULL),
-(6, 'Принтеры', 'printers', 'printers', 1, 'printer-service'),
+(6, 'Printers', 'printers', 'printers', 1, 'printer-service'),
+(7, 'Свичи', 'switches', 'switches', 1, NULL),
 (8, 'UPS', 'ups', 'ups', 1, NULL),
 (9, 'Охрана', 'security', 'security', 1, NULL),
 (10, 'Роутеры', 'routers', 'routers', 1, NULL),
 (12, 'WiFi AP', 'ap', 'ap', 1, NULL),
-(16, 'Пользователи', NULL, NULL, 1, NULL),
-(17, 'Свичи', NULL, NULL, 1, NULL);
+(14, 'POS-терминалы', NULL, NULL, 1, NULL);

+ 1 - 1
docs/mysql/stat_table_Traffic_detail.sql

@@ -2,7 +2,7 @@
 -- --------------------------------------------------------
 
 --
--- Структура таблицы `Traffic_detail`
+-- Table structure for table `Traffic_detail`
 --
 
 CREATE TABLE `Traffic_detail` (

+ 1 - 1
docs/mysql/stat_table_Unknown_mac.sql

@@ -2,7 +2,7 @@
 -- --------------------------------------------------------
 
 --
--- Структура таблицы `Unknown_mac`
+-- Table structure for table `Unknown_mac`
 --
 
 CREATE TABLE `Unknown_mac` (

+ 14 - 14
docs/mysql/stat_table_User_auth.sql

@@ -9,33 +9,33 @@ CREATE TABLE `User_auth` (
   `id` int(11) NOT NULL,
   `user_id` int(11) NOT NULL DEFAULT 0,
   `ip` varchar(18) NOT NULL DEFAULT '',
-  `ip_int` int(10) UNSIGNED NOT NULL,
+  `ip_int` int(10) UNSIGNED NOT NULL DEFAULT 0,
+  `save_traf` tinyint(1) NOT NULL DEFAULT 0,
   `enabled` tinyint(1) NOT NULL DEFAULT 0,
   `dhcp` tinyint(1) NOT NULL DEFAULT 1,
+  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
+  `clientid` varchar(50) NOT NULL DEFAULT '',
+  `nagios` tinyint(1) NOT NULL DEFAULT 0,
+  `nagios_status` varchar(10) NOT NULL DEFAULT 'UP',
   `filter_group_id` tinyint(1) NOT NULL DEFAULT 0,
   `deleted` tinyint(4) NOT NULL DEFAULT 0,
   `comments` text DEFAULT NULL,
-  `dns_name` varchar(60) DEFAULT NULL,
+  `dns_name` varchar(60) NOT NULL DEFAULT '',
   `WikiName` varchar(250) DEFAULT NULL,
   `dhcp_acl` text DEFAULT NULL,
-  `queue_id` int(11) NOT NULL DEFAULT 1,
-  `mac` varchar(20) DEFAULT NULL,
-  `dhcp_action` varchar(10) DEFAULT NULL,
-  `dhcp_time` datetime DEFAULT NULL,
+  `queue_id` int(11) NOT NULL DEFAULT 0,
+  `mac` varchar(20) NOT NULL DEFAULT '',
+  `dhcp_action` varchar(10) DEFAULT '',
+  `dhcp_time` datetime NOT NULL DEFAULT current_timestamp(),
   `dhcp_hostname` varchar(60) DEFAULT NULL,
-  `last_found` datetime DEFAULT NULL,
+  `last_found` datetime DEFAULT current_timestamp(),
   `blocked` tinyint(1) NOT NULL DEFAULT 0,
   `day_quota` int(11) NOT NULL DEFAULT 0,
   `month_quota` int(11) NOT NULL DEFAULT 0,
   `device_model_id` int(11) DEFAULT 87,
   `firmware` varchar(100) DEFAULT NULL,
-  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
-  `clientid` varchar(50) DEFAULT NULL,
-  `nagios` tinyint(1) NOT NULL DEFAULT 0,
-  `nagios_status` varchar(10) DEFAULT NULL,
-  `nagios_handler` varchar(50) DEFAULT NULL,
+  `nagios_handler` varchar(50) DEFAULT '',
   `link_check` tinyint(1) NOT NULL DEFAULT 0,
   `changed` tinyint(1) NOT NULL DEFAULT 0,
-  `changed_time` datetime NOT NULL DEFAULT current_timestamp(),
-  `save_traf` tinyint(1) NOT NULL DEFAULT 0
+  `changed_time` datetime NOT NULL DEFAULT current_timestamp()
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 6 - 1
docs/mysql/stat_table_User_list.sql

@@ -20,9 +20,14 @@ CREATE TABLE `User_list` (
   `month_quota` int(11) NOT NULL DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Truncate table before insert `User_list`
+--
+
+TRUNCATE TABLE `User_list`;
 --
 -- Dumping data for table `User_list`
 --
 
 INSERT INTO `User_list` (`id`, `timestamp`, `login`, `fio`, `enabled`, `blocked`, `deleted`, `ou_id`, `filter_group_id`, `queue_id`, `day_quota`, `month_quota`) VALUES
-(1, '2017-11-02 10:54:36', 'default', '', 0, 0, 0, 32, 0, 0, 0, 0);
+(1, '2017-11-02 06:37:50', 'default', 'unknown user', 0, 0, 0, 3, 0, 0, 0, 0);

+ 1 - 1
docs/mysql/stat_table_User_stats.sql

@@ -9,7 +9,7 @@ CREATE TABLE `User_stats` (
   `id` int(11) NOT NULL,
   `router_id` int(11) DEFAULT 0,
   `auth_id` int(11) NOT NULL DEFAULT 0,
-  `timestamp` datetime NOT NULL,
+  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
   `byte_in` bigint(20) NOT NULL DEFAULT 0,
   `byte_out` bigint(20) NOT NULL DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 2 - 2
docs/mysql/stat_table_config_options.sql

@@ -7,10 +7,10 @@
 
 CREATE TABLE `config_options` (
   `id` int(11) NOT NULL,
-  `option_name` varchar(50) DEFAULT NULL,
+  `option_name` varchar(50) NOT NULL,
   `description` text DEFAULT NULL,
   `uniq` tinyint(1) NOT NULL DEFAULT 1,
-  `type` varchar(10) DEFAULT NULL,
+  `type` varchar(10) NOT NULL,
   `default_value` text DEFAULT NULL,
   `min_value` int(11) NOT NULL DEFAULT 0,
   `max_value` int(11) NOT NULL DEFAULT 0

+ 3 - 3
docs/mysql/stat_table_connections.sql

@@ -7,7 +7,7 @@
 
 CREATE TABLE `connections` (
   `id` int(11) NOT NULL,
-  `device_id` int(11) DEFAULT NULL,
-  `port_id` int(11) DEFAULT NULL,
-  `auth_id` int(11) DEFAULT NULL
+  `device_id` int(11) NOT NULL,
+  `port_id` int(11) NOT NULL,
+  `auth_id` int(11) NOT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 30 - 35
docs/mysql/stat_table_device_models.sql

@@ -12,6 +12,11 @@ CREATE TABLE `device_models` (
   `nagios_template` varchar(200) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Truncate table before insert `device_models`
+--
+
+TRUNCATE TABLE `device_models`;
 --
 -- Dumping data for table `device_models`
 --
@@ -88,43 +93,33 @@ INSERT INTO `device_models` (`id`, `model_name`, `vendor_id`, `nagios_template`)
 (71, 'OKI MC562', 22, 'oki.cfg'),
 (72, 'OKI MC573', 22, 'oki.cfg'),
 (73, 'OKI MC861', 22, 'oki.cfg'),
-(74, 'Panasonic KX-MB2000RU', 21, 'panasonic.cfg'),
-(75, 'PT-MZ10KE', 21, NULL),
-(76, 'PT-VX41', 21, NULL),
+(74, 'KX-MB2000RU', 21, 'panasonic.cfg'),
+(75, 'PT-MZ10KE', 21, ''),
+(76, 'PT-VX41', 21, 'proj.cfg'),
 (77, 'Rave 522AA', 33, NULL),
-(78, 'DZ570E', 21, NULL),
-(79, 'DZ6700', 21, NULL),
-(80, 'Rcq80', 21, NULL),
-(81, 'RZ12K', 21, NULL),
-(82, 'RZ660', 21, NULL),
-(83, 'RZ770', 21, NULL),
-(84, 'RZ970', 21, NULL),
+(78, 'DZ570E', 21, 'proj.cfg'),
+(79, 'DZ6700', 21, 'proj.cfg'),
+(80, 'Rcq80', 21, 'proj.cfg'),
+(81, 'RZ12K', 21, 'proj.cfg'),
+(82, 'RZ660', 21, 'proj.cfg'),
+(83, 'RZ770', 21, 'proj.cfg'),
+(84, 'RZ970', 21, 'proj.cfg'),
 (85, 'XVR-5216', 32, NULL),
-(86, 'HWg-STE', 30, NULL),
+(86, 'HWg-STE', 30, ''),
 (87, 'Computer', 1, NULL),
 (88, 'Mobile Phone', 1, NULL),
 (89, 'Switch', 1, NULL),
-(90, 'Projectiondesign F22', 34, NULL),
-(91, 'MES2124P', 2, NULL),
-(92, 'MES2124P rev.C', 2, NULL),
-(93, 'MES2324B', 2, NULL),
-(94, 'MES2324P', 2, NULL),
-(95, 'MES-3528', 2, NULL),
-(96, 'ME-C6524GS-8S', 16, NULL),
-(97, 'SM3100-28TC', 17, NULL),
-(98, 'SM3200-50T', 17, NULL),
-(99, 'SM3200-52T', 17, NULL),
-(100, 'APC6000XL', 20, NULL),
-(101, 'MP RT 10K', 35, NULL),
-(102, 'LaserJet P2035n', 15, NULL),
-(103, 'MES3116F', 2, NULL),
-(104, 'MES2124M', 2, NULL),
-(105, 'RB750r2', 9, NULL),
-(106, 'DES-1210-52', 7, NULL),
-(107, 'DES-1210-52/ME', 7, NULL),
-(108, 'GS-4012F', 4, NULL),
-(109, 'MES2308', 2, NULL),
-(110, 'NanoBeam M5 16', 11, NULL),
-(111, 'MES2428B', 2, NULL),
-(112, 'CRS109-8G-1S-2HnD', 9, NULL),
-(113, 'MES2324', 2, NULL);
+(90, 'F22 1080p', 34, ''),
+(91, 'ipad', 25, 'ipad.cfg'),
+(92, 'AP4050DN-E', 3, NULL),
+(93, 'AP4050DN', 3, NULL),
+(94, 'DS-2CD2332-I', 29, 'ipcam.cfg'),
+(95, 'DS-2CD2347G1-L', 29, 'ipcam.cfg'),
+(96, 'DS-2CD2347G1-LU', 29, 'ipcam.cfg'),
+(97, 'DS-2CD2422FWD-IW', 29, 'ipcam.cfg'),
+(98, 'DS-2CD2432F-I', 29, 'ipcam.cfg'),
+(99, 'DS-2CD2432F-IW', 29, 'ipcam.cfg'),
+(100, 'DS-2CD2643G0-IZS', 29, 'ipcam.cfg'),
+(101, 'DS-2CD2942F', 29, 'ipcam.cfg'),
+(102, 'mPort', 11, NULL),
+(103, 'Galaxy-S8', 23, NULL);

+ 7 - 7
docs/mysql/stat_table_device_ports.sql

@@ -7,13 +7,13 @@
 
 CREATE TABLE `device_ports` (
   `id` int(11) NOT NULL,
-  `device_id` int(11) DEFAULT NULL,
-  `snmp_index` int(11) DEFAULT NULL,
-  `port` int(11) DEFAULT NULL,
-  `comment` varchar(50) DEFAULT NULL,
-  `target_port_id` int(11) DEFAULT NULL,
-  `auth_id` int(11) DEFAULT NULL,
-  `last_mac_count` int(11) DEFAULT NULL,
+  `device_id` int(11) NOT NULL DEFAULT 0,
+  `snmp_index` int(11) NOT NULL DEFAULT 0,
+  `port` int(11) NOT NULL DEFAULT 0,
+  `comment` varchar(50) DEFAULT '',
+  `target_port_id` int(11) NOT NULL DEFAULT 0,
+  `auth_id` int(11) NOT NULL DEFAULT 0,
+  `last_mac_count` int(11) NOT NULL DEFAULT 0,
   `uplink` tinyint(1) NOT NULL DEFAULT 0,
   `nagios` tinyint(1) NOT NULL DEFAULT 0,
   `skip` tinyint(1) NOT NULL DEFAULT 0,

+ 8 - 8
docs/mysql/stat_table_devices.sql

@@ -11,11 +11,12 @@ CREATE TABLE `devices` (
   `device_model_id` int(11) DEFAULT 89,
   `firmware` varchar(100) DEFAULT NULL,
   `vendor_id` int(11) NOT NULL DEFAULT 1,
-  `device_name` varchar(50) DEFAULT NULL,
+  `device_name` varchar(50) DEFAULT '',
   `building_id` int(11) NOT NULL DEFAULT 1,
-  `ip` varchar(15) DEFAULT NULL,
+  `ip` varchar(15) DEFAULT '',
   `port_count` int(11) NOT NULL DEFAULT 0,
   `SN` varchar(80) DEFAULT NULL,
+  `dhcp` tinyint(1) NOT NULL DEFAULT 0,
   `comment` text DEFAULT NULL,
   `snmp_version` tinyint(4) NOT NULL DEFAULT 0,
   `snmp3_user_rw` varchar(20) DEFAULT NULL,
@@ -27,12 +28,11 @@ CREATE TABLE `devices` (
   `fdb_snmp_index` tinyint(1) NOT NULL DEFAULT 0,
   `discovery` tinyint(1) NOT NULL DEFAULT 1,
   `user_acl` tinyint(1) NOT NULL DEFAULT 0,
-  `dhcp` tinyint(1) NOT NULL DEFAULT 0,
   `nagios` tinyint(1) NOT NULL DEFAULT 0,
+  `deleted` tinyint(1) NOT NULL DEFAULT 0,
   `active` tinyint(1) NOT NULL DEFAULT 1,
-  `nagios_status` varchar(12) NOT NULL DEFAULT 'UP',
-  `queue_enabled` tinyint(1) NOT NULL DEFAULT 1,
-  `connected_user_only` tinyint(1) NOT NULL DEFAULT 1,
-  `user_id` int(11) DEFAULT NULL,
-  `deleted` tinyint(1) NOT NULL DEFAULT 0
+  `nagios_status` varchar(10) NOT NULL DEFAULT 'UP',
+  `queue_enabled` tinyint(1) NOT NULL DEFAULT 0,
+  `connected_user_only` tinyint(1) NOT NULL DEFAULT 0,
+  `user_id` int(11) DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 5 - 0
docs/mysql/stat_table_subnets.sql

@@ -25,6 +25,11 @@ CREATE TABLE `subnets` (
   `comment` text DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Truncate table before insert `subnets`
+--
+
+TRUNCATE TABLE `subnets`;
 --
 -- Dumping data for table `subnets`
 --

+ 1 - 1
docs/mysql/stat_table_syslog.sql

@@ -10,6 +10,6 @@ CREATE TABLE `syslog` (
   `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
   `auth_id` int(11) NOT NULL DEFAULT 0,
   `customer` varchar(50) NOT NULL DEFAULT 'system',
-  `message` text NOT NULL,
+  `message` text DEFAULT NULL,
   `level` int(11) NOT NULL DEFAULT 1
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 1 - 2
docs/mysql/stat_table_vendors.sql

@@ -52,5 +52,4 @@ INSERT INTO `vendors` (`id`, `name`) VALUES
 (33, 'QSC'),
 (34, 'Projectiondesign'),
 (35, 'Lenovo'),
-(36, 'SIPOWER'),
-(37, 'TP-Link');
+(36, 'SIPOWER');

+ 4 - 0
scripts/fetch_new_arp.pl

@@ -19,6 +19,10 @@ use Rstat::net_utils;
 use Rstat::snmp;
 use Rstat::mysql;
 use NetAddr::IP;
+use Fcntl qw(:flock);
+
+open(SELF,"<",$0) or die "Cannot open $0 - $!";
+flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
 setpriority(0,0,19);
 

+ 3 - 0
scripts/garbage.pl

@@ -13,6 +13,9 @@ use Rstat::config;
 use Rstat::mysql;
 use Rstat::net_utils;
 use DateTime;
+use Fcntl qw(:flock);
+open(SELF,"<",$0) or die "Cannot open $0 - $!";
+flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
 db_log_info($dbh,'Garbage started.');
 

+ 3 - 0
scripts/print-dnsmasq.pl

@@ -18,6 +18,9 @@ use Rstat::mysql;
 use Rstat::net_utils;
 use File::Basename;
 use File::Path;
+use Fcntl qw(:flock);
+open(SELF,"<",$0) or die "Cannot open $0 - $!";
+flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
 setpriority(0,0,19);
 

+ 3 - 0
scripts/sync_mikrotik.pl

@@ -21,6 +21,9 @@ use Rstat::mysql;
 use DBI;
 use utf8;
 use open ":encoding(utf8)";
+use Fcntl qw(:flock);
+open(SELF,"<",$0) or die "Cannot open $0 - $!";
+flock(SELF, LOCK_EX|LOCK_NB) or exit 1;
 
 $|=1;