· 9 years ago · Nov 07, 2016, 01:18 PM
1-- MySQL dump 10.13 Distrib 5.5.46, for Linux (x86_64)
2--
3-- Host: localhost Database: monitoring
4-- ------------------------------------------------------
5-- Server version 5.5.46
6
7/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10/*!40101 SET NAMES utf8 */;
11/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12/*!40103 SET TIME_ZONE='+00:00' */;
13/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17
18--
19-- Table structure for table `devices`
20--
21
22DROP TABLE IF EXISTS `devices`;
23/*!40101 SET @saved_cs_client = @@character_set_client */;
24/*!40101 SET character_set_client = utf8 */;
25CREATE TABLE `devices` (
26 `id` int(11) NOT NULL AUTO_INCREMENT,
27 `name` varchar(50) NOT NULL,
28 PRIMARY KEY (`id`)
29) ENGINE=InnoDB DEFAULT CHARSET=latin1;
30/*!40101 SET character_set_client = @saved_cs_client */;
31
32--
33-- Dumping data for table `devices`
34--
35
36LOCK TABLES `devices` WRITE;
37/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
38/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
39UNLOCK TABLES;
40
41--
42-- Table structure for table `history`
43--
44
45DROP TABLE IF EXISTS `history`;
46/*!40101 SET @saved_cs_client = @@character_set_client */;
47/*!40101 SET character_set_client = utf8 */;
48CREATE TABLE `history` (
49 `id` bigint(20) NOT NULL AUTO_INCREMENT,
50 `template_node_id` int(11) NOT NULL,
51 `monitor_date` datetime NOT NULL,
52 `amount` int(11) NOT NULL,
53 PRIMARY KEY (`id`),
54 KEY `template_node_id` (`template_node_id`),
55 CONSTRAINT `history_ibfk_1` FOREIGN KEY (`template_node_id`) REFERENCES `template_nodes` (`id`)
56) ENGINE=InnoDB DEFAULT CHARSET=latin1;
57/*!40101 SET character_set_client = @saved_cs_client */;
58
59--
60-- Dumping data for table `history`
61--
62
63LOCK TABLES `history` WRITE;
64/*!40000 ALTER TABLE `history` DISABLE KEYS */;
65/*!40000 ALTER TABLE `history` ENABLE KEYS */;
66UNLOCK TABLES;
67
68--
69-- Table structure for table `nodes`
70--
71
72DROP TABLE IF EXISTS `nodes`;
73/*!40101 SET @saved_cs_client = @@character_set_client */;
74/*!40101 SET character_set_client = utf8 */;
75CREATE TABLE `nodes` (
76 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
77 `node_name` varchar(50) NOT NULL,
78 `description` varchar(200) DEFAULT NULL,
79 `device_type` int(11) NOT NULL,
80 `ip_address` varchar(15) DEFAULT NULL,
81 `enabled` int(11) NOT NULL DEFAULT '1',
82 `owner_user_id` int(10) unsigned NOT NULL,
83 `create_time` datetime NOT NULL,
84 PRIMARY KEY (`id`),
85 UNIQUE KEY `ip_address` (`ip_address`),
86 KEY `node_name` (`node_name`),
87 KEY `owner_user_id` (`owner_user_id`),
88 KEY `device_type` (`device_type`),
89 CONSTRAINT `nodes_ibfk_2` FOREIGN KEY (`device_type`) REFERENCES `devices` (`id`) ON UPDATE CASCADE,
90 CONSTRAINT `nodes_ibfk_1` FOREIGN KEY (`owner_user_id`) REFERENCES `users` (`id`)
91) ENGINE=InnoDB DEFAULT CHARSET=latin1;
92/*!40101 SET character_set_client = @saved_cs_client */;
93
94--
95-- Dumping data for table `nodes`
96--
97
98LOCK TABLES `nodes` WRITE;
99/*!40000 ALTER TABLE `nodes` DISABLE KEYS */;
100/*!40000 ALTER TABLE `nodes` ENABLE KEYS */;
101UNLOCK TABLES;
102
103--
104-- Table structure for table `protocols`
105--
106
107DROP TABLE IF EXISTS `protocols`;
108/*!40101 SET @saved_cs_client = @@character_set_client */;
109/*!40101 SET character_set_client = utf8 */;
110CREATE TABLE `protocols` (
111 `id` int(11) NOT NULL AUTO_INCREMENT,
112 `protocol_name` varchar(50) DEFAULT NULL,
113 PRIMARY KEY (`id`)
114) ENGINE=InnoDB DEFAULT CHARSET=latin1;
115/*!40101 SET character_set_client = @saved_cs_client */;
116
117--
118-- Dumping data for table `protocols`
119--
120
121LOCK TABLES `protocols` WRITE;
122/*!40000 ALTER TABLE `protocols` DISABLE KEYS */;
123/*!40000 ALTER TABLE `protocols` ENABLE KEYS */;
124UNLOCK TABLES;
125
126--
127-- Table structure for table `template_nodes`
128--
129
130DROP TABLE IF EXISTS `template_nodes`;
131/*!40101 SET @saved_cs_client = @@character_set_client */;
132/*!40101 SET character_set_client = utf8 */;
133CREATE TABLE `template_nodes` (
134 `id` int(11) NOT NULL AUTO_INCREMENT,
135 `template_id` int(11) NOT NULL,
136 `node_id` bigint(20) unsigned NOT NULL,
137 `interval_s` int(11) NOT NULL,
138 PRIMARY KEY (`id`),
139 KEY `template_id` (`template_id`),
140 KEY `node_id` (`node_id`),
141 CONSTRAINT `template_nodes_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
142 CONSTRAINT `template_nodes_ibfk_2` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
143) ENGINE=InnoDB DEFAULT CHARSET=latin1;
144/*!40101 SET character_set_client = @saved_cs_client */;
145
146--
147-- Dumping data for table `template_nodes`
148--
149
150LOCK TABLES `template_nodes` WRITE;
151/*!40000 ALTER TABLE `template_nodes` DISABLE KEYS */;
152/*!40000 ALTER TABLE `template_nodes` ENABLE KEYS */;
153UNLOCK TABLES;
154
155--
156-- Table structure for table `templates`
157--
158
159DROP TABLE IF EXISTS `templates`;
160/*!40101 SET @saved_cs_client = @@character_set_client */;
161/*!40101 SET character_set_client = utf8 */;
162CREATE TABLE `templates` (
163 `id` int(11) NOT NULL AUTO_INCREMENT,
164 `template_name` varchar(50) NOT NULL,
165 `protocol_id` int(11) NOT NULL,
166 `target` varchar(100) NOT NULL,
167 `is_guage` int(11) DEFAULT '0',
168 PRIMARY KEY (`id`),
169 UNIQUE KEY `template_name` (`template_name`),
170 KEY `protocol_id` (`protocol_id`),
171 CONSTRAINT `templates_ibfk_1` FOREIGN KEY (`protocol_id`) REFERENCES `protocols` (`id`) ON UPDATE CASCADE
172) ENGINE=InnoDB DEFAULT CHARSET=latin1;
173/*!40101 SET character_set_client = @saved_cs_client */;
174
175--
176-- Dumping data for table `templates`
177--
178
179LOCK TABLES `templates` WRITE;
180/*!40000 ALTER TABLE `templates` DISABLE KEYS */;
181/*!40000 ALTER TABLE `templates` ENABLE KEYS */;
182UNLOCK TABLES;
183
184--
185-- Table structure for table `users`
186--
187
188DROP TABLE IF EXISTS `users`;
189/*!40101 SET @saved_cs_client = @@character_set_client */;
190/*!40101 SET character_set_client = utf8 */;
191CREATE TABLE `users` (
192 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
193 `username` varchar(20) NOT NULL,
194 `password` varchar(50) NOT NULL,
195 `enabled` int(11) NOT NULL DEFAULT '1',
196 `creation_date` datetime NOT NULL,
197 PRIMARY KEY (`id`),
198 UNIQUE KEY `username` (`username`)
199) ENGINE=InnoDB DEFAULT CHARSET=latin1;
200/*!40101 SET character_set_client = @saved_cs_client */;
201
202--
203-- Dumping data for table `users`
204--
205
206LOCK TABLES `users` WRITE;
207/*!40000 ALTER TABLE `users` DISABLE KEYS */;
208/*!40000 ALTER TABLE `users` ENABLE KEYS */;
209UNLOCK TABLES;
210/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
211
212/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
213/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
214/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
215/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
216/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
217/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
218/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
219
220-- Dump completed on 2016-10-23 1:47:43