1CREATE TABLE users ( 2 userid bigint NOT NULL, 3 alias varchar(100) DEFAULT '' NOT NULL, 4 name varchar(100) DEFAULT '' NOT NULL, 5 surname varchar(100) DEFAULT '' NOT NULL, 6 passwd varchar(60) DEFAULT '' NOT NULL, 7 url varchar(255) DEFAULT '' NOT NULL, 8 autologin integer DEFAULT '0' NOT NULL, 9 autologout varchar(32) DEFAULT '15m' NOT NULL, 10 lang varchar(5) DEFAULT 'en_GB' NOT NULL, 11 refresh varchar(32) DEFAULT '30s' NOT NULL, 12 type integer DEFAULT '1' NOT NULL, 13 theme varchar(128) DEFAULT 'default' NOT NULL, 14 attempt_failed integer DEFAULT 0 NOT NULL, 15 attempt_ip varchar(39) DEFAULT '' NOT NULL, 16 attempt_clock integer DEFAULT 0 NOT NULL, 17 rows_per_page integer DEFAULT 50 NOT NULL, 18 PRIMARY KEY (userid) 19); 20CREATE UNIQUE INDEX users_1 ON users (alias); 21CREATE TABLE maintenances ( 22 maintenanceid bigint NOT NULL, 23 name varchar(128) DEFAULT '' NOT NULL, 24 maintenance_type integer DEFAULT '0' NOT NULL, 25 description text DEFAULT '' NOT NULL, 26 active_since integer DEFAULT '0' NOT NULL, 27 active_till integer DEFAULT '0' NOT NULL, 28 tags_evaltype integer DEFAULT '0' NOT NULL, 29 PRIMARY KEY (maintenanceid) 30); 31CREATE INDEX maintenances_1 ON maintenances (active_since,active_till); 32CREATE UNIQUE INDEX maintenances_2 ON maintenances (name); 33CREATE TABLE hosts ( 34 hostid bigint NOT NULL, 35 proxy_hostid bigint NULL REFERENCES hosts (hostid), 36 host varchar(128) DEFAULT '' NOT NULL, 37 status integer DEFAULT '0' NOT NULL, 38 disable_until integer DEFAULT '0' NOT NULL, 39 error varchar(2048) DEFAULT '' NOT NULL, 40 available integer DEFAULT '0' NOT NULL, 41 errors_from integer DEFAULT '0' NOT NULL, 42 lastaccess integer DEFAULT '0' NOT NULL, 43 ipmi_authtype integer DEFAULT '-1' NOT NULL, 44 ipmi_privilege integer DEFAULT '2' NOT NULL, 45 ipmi_username varchar(16) DEFAULT '' NOT NULL, 46 ipmi_password varchar(20) DEFAULT '' NOT NULL, 47 ipmi_disable_until integer DEFAULT '0' NOT NULL, 48 ipmi_available integer DEFAULT '0' NOT NULL, 49 snmp_disable_until integer DEFAULT '0' NOT NULL, 50 snmp_available integer DEFAULT '0' NOT NULL, 51 maintenanceid bigint NULL REFERENCES maintenances (maintenanceid), 52 maintenance_status integer DEFAULT '0' NOT NULL, 53 maintenance_type integer DEFAULT '0' NOT NULL, 54 maintenance_from integer DEFAULT '0' NOT NULL, 55 ipmi_errors_from integer DEFAULT '0' NOT NULL, 56 snmp_errors_from integer DEFAULT '0' NOT NULL, 57 ipmi_error varchar(2048) DEFAULT '' NOT NULL, 58 snmp_error varchar(2048) DEFAULT '' NOT NULL, 59 jmx_disable_until integer DEFAULT '0' NOT NULL, 60 jmx_available integer DEFAULT '0' NOT NULL, 61 jmx_errors_from integer DEFAULT '0' NOT NULL, 62 jmx_error varchar(2048) DEFAULT '' NOT NULL, 63 name varchar(128) DEFAULT '' NOT NULL, 64 flags integer DEFAULT '0' NOT NULL, 65 templateid bigint NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 66 description text DEFAULT '' NOT NULL, 67 tls_connect integer DEFAULT '1' NOT NULL, 68 tls_accept integer DEFAULT '1' NOT NULL, 69 tls_issuer varchar(1024) DEFAULT '' NOT NULL, 70 tls_subject varchar(1024) DEFAULT '' NOT NULL, 71 tls_psk_identity varchar(128) DEFAULT '' NOT NULL, 72 tls_psk varchar(512) DEFAULT '' NOT NULL, 73 proxy_address varchar(255) DEFAULT '' NOT NULL, 74 auto_compress integer DEFAULT '1' NOT NULL, 75 discover integer DEFAULT '0' NOT NULL, 76 PRIMARY KEY (hostid) 77); 78CREATE INDEX hosts_1 ON hosts (host); 79CREATE INDEX hosts_2 ON hosts (status); 80CREATE INDEX hosts_3 ON hosts (proxy_hostid); 81CREATE INDEX hosts_4 ON hosts (name); 82CREATE INDEX hosts_5 ON hosts (maintenanceid); 83CREATE TABLE hstgrp ( 84 groupid bigint NOT NULL, 85 name varchar(255) DEFAULT '' NOT NULL, 86 internal integer DEFAULT '0' NOT NULL, 87 flags integer DEFAULT '0' NOT NULL, 88 PRIMARY KEY (groupid) 89); 90CREATE INDEX hstgrp_1 ON hstgrp (name); 91CREATE TABLE group_prototype ( 92 group_prototypeid bigint NOT NULL, 93 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 94 name varchar(255) DEFAULT '' NOT NULL, 95 groupid bigint NULL REFERENCES hstgrp (groupid), 96 templateid bigint NULL REFERENCES group_prototype (group_prototypeid) ON DELETE CASCADE, 97 PRIMARY KEY (group_prototypeid) 98); 99CREATE INDEX group_prototype_1 ON group_prototype (hostid); 100CREATE TABLE group_discovery ( 101 groupid bigint NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 102 parent_group_prototypeid bigint NOT NULL REFERENCES group_prototype (group_prototypeid), 103 name varchar(64) DEFAULT '' NOT NULL, 104 lastcheck integer DEFAULT '0' NOT NULL, 105 ts_delete integer DEFAULT '0' NOT NULL, 106 PRIMARY KEY (groupid) 107); 108CREATE TABLE screens ( 109 screenid bigint NOT NULL, 110 name varchar(255) NOT NULL, 111 hsize integer DEFAULT '1' NOT NULL, 112 vsize integer DEFAULT '1' NOT NULL, 113 templateid bigint NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 114 userid bigint NULL REFERENCES users (userid), 115 private integer DEFAULT '1' NOT NULL, 116 PRIMARY KEY (screenid) 117); 118CREATE INDEX screens_1 ON screens (templateid); 119CREATE TABLE screens_items ( 120 screenitemid bigint NOT NULL, 121 screenid bigint NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE, 122 resourcetype integer DEFAULT '0' NOT NULL, 123 resourceid bigint DEFAULT '0' NOT NULL, 124 width integer DEFAULT '320' NOT NULL, 125 height integer DEFAULT '200' NOT NULL, 126 x integer DEFAULT '0' NOT NULL, 127 y integer DEFAULT '0' NOT NULL, 128 colspan integer DEFAULT '1' NOT NULL, 129 rowspan integer DEFAULT '1' NOT NULL, 130 elements integer DEFAULT '25' NOT NULL, 131 valign integer DEFAULT '0' NOT NULL, 132 halign integer DEFAULT '0' NOT NULL, 133 style integer DEFAULT '0' NOT NULL, 134 url varchar(255) DEFAULT '' NOT NULL, 135 dynamic integer DEFAULT '0' NOT NULL, 136 sort_triggers integer DEFAULT '0' NOT NULL, 137 application varchar(255) DEFAULT '' NOT NULL, 138 max_columns integer DEFAULT '3' NOT NULL, 139 PRIMARY KEY (screenitemid) 140); 141CREATE INDEX screens_items_1 ON screens_items (screenid); 142CREATE TABLE screen_user ( 143 screenuserid bigint NOT NULL, 144 screenid bigint NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE, 145 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 146 permission integer DEFAULT '2' NOT NULL, 147 PRIMARY KEY (screenuserid) 148); 149CREATE UNIQUE INDEX screen_user_1 ON screen_user (screenid,userid); 150CREATE TABLE screen_usrgrp ( 151 screenusrgrpid bigint NOT NULL, 152 screenid bigint NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE, 153 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 154 permission integer DEFAULT '2' NOT NULL, 155 PRIMARY KEY (screenusrgrpid) 156); 157CREATE UNIQUE INDEX screen_usrgrp_1 ON screen_usrgrp (screenid,usrgrpid); 158CREATE TABLE slideshows ( 159 slideshowid bigint NOT NULL, 160 name varchar(255) DEFAULT '' NOT NULL, 161 delay varchar(32) DEFAULT '30s' NOT NULL, 162 userid bigint NOT NULL REFERENCES users (userid), 163 private integer DEFAULT '1' NOT NULL, 164 PRIMARY KEY (slideshowid) 165); 166CREATE UNIQUE INDEX slideshows_1 ON slideshows (name); 167CREATE TABLE slideshow_user ( 168 slideshowuserid bigint NOT NULL, 169 slideshowid bigint NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE, 170 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 171 permission integer DEFAULT '2' NOT NULL, 172 PRIMARY KEY (slideshowuserid) 173); 174CREATE UNIQUE INDEX slideshow_user_1 ON slideshow_user (slideshowid,userid); 175CREATE TABLE slideshow_usrgrp ( 176 slideshowusrgrpid bigint NOT NULL, 177 slideshowid bigint NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE, 178 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 179 permission integer DEFAULT '2' NOT NULL, 180 PRIMARY KEY (slideshowusrgrpid) 181); 182CREATE UNIQUE INDEX slideshow_usrgrp_1 ON slideshow_usrgrp (slideshowid,usrgrpid); 183CREATE TABLE slides ( 184 slideid bigint NOT NULL, 185 slideshowid bigint NOT NULL REFERENCES slideshows (slideshowid) ON DELETE CASCADE, 186 screenid bigint NOT NULL REFERENCES screens (screenid) ON DELETE CASCADE, 187 step integer DEFAULT '0' NOT NULL, 188 delay varchar(32) DEFAULT '0' NOT NULL, 189 PRIMARY KEY (slideid) 190); 191CREATE INDEX slides_1 ON slides (slideshowid); 192CREATE INDEX slides_2 ON slides (screenid); 193CREATE TABLE drules ( 194 druleid bigint NOT NULL, 195 proxy_hostid bigint NULL REFERENCES hosts (hostid), 196 name varchar(255) DEFAULT '' NOT NULL, 197 iprange varchar(2048) DEFAULT '' NOT NULL, 198 delay varchar(255) DEFAULT '1h' NOT NULL, 199 nextcheck integer DEFAULT '0' NOT NULL, 200 status integer DEFAULT '0' NOT NULL, 201 PRIMARY KEY (druleid) 202); 203CREATE INDEX drules_1 ON drules (proxy_hostid); 204CREATE UNIQUE INDEX drules_2 ON drules (name); 205CREATE TABLE dchecks ( 206 dcheckid bigint NOT NULL, 207 druleid bigint NOT NULL REFERENCES drules (druleid) ON DELETE CASCADE, 208 type integer DEFAULT '0' NOT NULL, 209 key_ varchar(2048) DEFAULT '' NOT NULL, 210 snmp_community varchar(255) DEFAULT '' NOT NULL, 211 ports varchar(255) DEFAULT '0' NOT NULL, 212 snmpv3_securityname varchar(64) DEFAULT '' NOT NULL, 213 snmpv3_securitylevel integer DEFAULT '0' NOT NULL, 214 snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL, 215 snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL, 216 uniq integer DEFAULT '0' NOT NULL, 217 snmpv3_authprotocol integer DEFAULT '0' NOT NULL, 218 snmpv3_privprotocol integer DEFAULT '0' NOT NULL, 219 snmpv3_contextname varchar(255) DEFAULT '' NOT NULL, 220 host_source integer DEFAULT '1' NOT NULL, 221 name_source integer DEFAULT '0' NOT NULL, 222 PRIMARY KEY (dcheckid) 223); 224CREATE INDEX dchecks_1 ON dchecks (druleid,host_source,name_source); 225CREATE TABLE applications ( 226 applicationid bigint NOT NULL, 227 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 228 name varchar(255) DEFAULT '' NOT NULL, 229 flags integer DEFAULT '0' NOT NULL, 230 PRIMARY KEY (applicationid) 231); 232CREATE UNIQUE INDEX applications_2 ON applications (hostid,name); 233CREATE TABLE httptest ( 234 httptestid bigint NOT NULL, 235 name varchar(64) DEFAULT '' NOT NULL, 236 applicationid bigint NULL REFERENCES applications (applicationid), 237 nextcheck integer DEFAULT '0' NOT NULL, 238 delay varchar(255) DEFAULT '1m' NOT NULL, 239 status integer DEFAULT '0' NOT NULL, 240 agent varchar(255) DEFAULT 'Zabbix' NOT NULL, 241 authentication integer DEFAULT '0' NOT NULL, 242 http_user varchar(64) DEFAULT '' NOT NULL, 243 http_password varchar(64) DEFAULT '' NOT NULL, 244 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 245 templateid bigint NULL REFERENCES httptest (httptestid) ON DELETE CASCADE, 246 http_proxy varchar(255) DEFAULT '' NOT NULL, 247 retries integer DEFAULT '1' NOT NULL, 248 ssl_cert_file varchar(255) DEFAULT '' NOT NULL, 249 ssl_key_file varchar(255) DEFAULT '' NOT NULL, 250 ssl_key_password varchar(64) DEFAULT '' NOT NULL, 251 verify_peer integer DEFAULT '0' NOT NULL, 252 verify_host integer DEFAULT '0' NOT NULL, 253 PRIMARY KEY (httptestid) 254); 255CREATE INDEX httptest_1 ON httptest (applicationid); 256CREATE UNIQUE INDEX httptest_2 ON httptest (hostid,name); 257CREATE INDEX httptest_3 ON httptest (status); 258CREATE INDEX httptest_4 ON httptest (templateid); 259CREATE TABLE httpstep ( 260 httpstepid bigint NOT NULL, 261 httptestid bigint NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE, 262 name varchar(64) DEFAULT '' NOT NULL, 263 no integer DEFAULT '0' NOT NULL, 264 url varchar(2048) DEFAULT '' NOT NULL, 265 timeout varchar(255) DEFAULT '15s' NOT NULL, 266 posts text DEFAULT '' NOT NULL, 267 required varchar(255) DEFAULT '' NOT NULL, 268 status_codes varchar(255) DEFAULT '' NOT NULL, 269 follow_redirects integer DEFAULT '1' NOT NULL, 270 retrieve_mode integer DEFAULT '0' NOT NULL, 271 post_type integer DEFAULT '0' NOT NULL, 272 PRIMARY KEY (httpstepid) 273); 274CREATE INDEX httpstep_1 ON httpstep (httptestid); 275CREATE TABLE interface ( 276 interfaceid bigint NOT NULL, 277 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 278 main integer DEFAULT '0' NOT NULL, 279 type integer DEFAULT '1' NOT NULL, 280 useip integer DEFAULT '1' NOT NULL, 281 ip varchar(64) DEFAULT '127.0.0.1' NOT NULL, 282 dns varchar(255) DEFAULT '' NOT NULL, 283 port varchar(64) DEFAULT '10050' NOT NULL, 284 PRIMARY KEY (interfaceid) 285); 286CREATE INDEX interface_1 ON interface (hostid,type); 287CREATE INDEX interface_2 ON interface (ip,dns); 288CREATE TABLE valuemaps ( 289 valuemapid bigint NOT NULL, 290 name varchar(64) DEFAULT '' NOT NULL, 291 PRIMARY KEY (valuemapid) 292); 293CREATE UNIQUE INDEX valuemaps_1 ON valuemaps (name); 294CREATE TABLE items ( 295 itemid bigint NOT NULL, 296 type integer DEFAULT '0' NOT NULL, 297 snmp_oid varchar(512) DEFAULT '' NOT NULL, 298 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 299 name varchar(255) DEFAULT '' NOT NULL, 300 key_ varchar(2048) DEFAULT '' NOT NULL, 301 delay varchar(1024) DEFAULT '0' NOT NULL, 302 history varchar(255) DEFAULT '90d' NOT NULL, 303 trends varchar(255) DEFAULT '365d' NOT NULL, 304 status integer DEFAULT '0' NOT NULL, 305 value_type integer DEFAULT '0' NOT NULL, 306 trapper_hosts varchar(255) DEFAULT '' NOT NULL, 307 units varchar(255) DEFAULT '' NOT NULL, 308 formula varchar(255) DEFAULT '' NOT NULL, 309 logtimefmt varchar(64) DEFAULT '' NOT NULL, 310 templateid bigint NULL REFERENCES items (itemid) ON DELETE CASCADE, 311 valuemapid bigint NULL REFERENCES valuemaps (valuemapid), 312 params text DEFAULT '' NOT NULL, 313 ipmi_sensor varchar(128) DEFAULT '' NOT NULL, 314 authtype integer DEFAULT '0' NOT NULL, 315 username varchar(64) DEFAULT '' NOT NULL, 316 password varchar(64) DEFAULT '' NOT NULL, 317 publickey varchar(64) DEFAULT '' NOT NULL, 318 privatekey varchar(64) DEFAULT '' NOT NULL, 319 flags integer DEFAULT '0' NOT NULL, 320 interfaceid bigint NULL REFERENCES interface (interfaceid), 321 description text DEFAULT '' NOT NULL, 322 inventory_link integer DEFAULT '0' NOT NULL, 323 lifetime varchar(255) DEFAULT '30d' NOT NULL, 324 evaltype integer DEFAULT '0' NOT NULL, 325 jmx_endpoint varchar(255) DEFAULT '' NOT NULL, 326 master_itemid bigint NULL REFERENCES items (itemid) ON DELETE CASCADE, 327 timeout varchar(255) DEFAULT '3s' NOT NULL, 328 url varchar(2048) DEFAULT '' NOT NULL, 329 query_fields varchar(2048) DEFAULT '' NOT NULL, 330 posts text DEFAULT '' NOT NULL, 331 status_codes varchar(255) DEFAULT '200' NOT NULL, 332 follow_redirects integer DEFAULT '1' NOT NULL, 333 post_type integer DEFAULT '0' NOT NULL, 334 http_proxy varchar(255) DEFAULT '' NOT NULL, 335 headers text DEFAULT '' NOT NULL, 336 retrieve_mode integer DEFAULT '0' NOT NULL, 337 request_method integer DEFAULT '0' NOT NULL, 338 output_format integer DEFAULT '0' NOT NULL, 339 ssl_cert_file varchar(255) DEFAULT '' NOT NULL, 340 ssl_key_file varchar(255) DEFAULT '' NOT NULL, 341 ssl_key_password varchar(64) DEFAULT '' NOT NULL, 342 verify_peer integer DEFAULT '0' NOT NULL, 343 verify_host integer DEFAULT '0' NOT NULL, 344 allow_traps integer DEFAULT '0' NOT NULL, 345 discover integer DEFAULT '0' NOT NULL, 346 PRIMARY KEY (itemid) 347); 348CREATE INDEX items_1 ON items (hostid,key_); 349CREATE INDEX items_3 ON items (status); 350CREATE INDEX items_4 ON items (templateid); 351CREATE INDEX items_5 ON items (valuemapid); 352CREATE INDEX items_6 ON items (interfaceid); 353CREATE INDEX items_7 ON items (master_itemid); 354CREATE TABLE httpstepitem ( 355 httpstepitemid bigint NOT NULL, 356 httpstepid bigint NOT NULL REFERENCES httpstep (httpstepid) ON DELETE CASCADE, 357 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 358 type integer DEFAULT '0' NOT NULL, 359 PRIMARY KEY (httpstepitemid) 360); 361CREATE UNIQUE INDEX httpstepitem_1 ON httpstepitem (httpstepid,itemid); 362CREATE INDEX httpstepitem_2 ON httpstepitem (itemid); 363CREATE TABLE httptestitem ( 364 httptestitemid bigint NOT NULL, 365 httptestid bigint NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE, 366 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 367 type integer DEFAULT '0' NOT NULL, 368 PRIMARY KEY (httptestitemid) 369); 370CREATE UNIQUE INDEX httptestitem_1 ON httptestitem (httptestid,itemid); 371CREATE INDEX httptestitem_2 ON httptestitem (itemid); 372CREATE TABLE media_type ( 373 mediatypeid bigint NOT NULL, 374 type integer DEFAULT '0' NOT NULL, 375 name varchar(100) DEFAULT '' NOT NULL, 376 smtp_server varchar(255) DEFAULT '' NOT NULL, 377 smtp_helo varchar(255) DEFAULT '' NOT NULL, 378 smtp_email varchar(255) DEFAULT '' NOT NULL, 379 exec_path varchar(255) DEFAULT '' NOT NULL, 380 gsm_modem varchar(255) DEFAULT '' NOT NULL, 381 username varchar(255) DEFAULT '' NOT NULL, 382 passwd varchar(255) DEFAULT '' NOT NULL, 383 status integer DEFAULT '0' NOT NULL, 384 smtp_port integer DEFAULT '25' NOT NULL, 385 smtp_security integer DEFAULT '0' NOT NULL, 386 smtp_verify_peer integer DEFAULT '0' NOT NULL, 387 smtp_verify_host integer DEFAULT '0' NOT NULL, 388 smtp_authentication integer DEFAULT '0' NOT NULL, 389 exec_params varchar(255) DEFAULT '' NOT NULL, 390 maxsessions integer DEFAULT '1' NOT NULL, 391 maxattempts integer DEFAULT '3' NOT NULL, 392 attempt_interval varchar(32) DEFAULT '10s' NOT NULL, 393 content_type integer DEFAULT '1' NOT NULL, 394 script text DEFAULT '' NOT NULL, 395 timeout varchar(32) DEFAULT '30s' NOT NULL, 396 process_tags integer DEFAULT '0' NOT NULL, 397 show_event_menu integer DEFAULT '0' NOT NULL, 398 event_menu_url varchar(2048) DEFAULT '' NOT NULL, 399 event_menu_name varchar(255) DEFAULT '' NOT NULL, 400 description text DEFAULT '' NOT NULL, 401 PRIMARY KEY (mediatypeid) 402); 403CREATE UNIQUE INDEX media_type_1 ON media_type (name); 404CREATE TABLE media_type_param ( 405 mediatype_paramid bigint NOT NULL, 406 mediatypeid bigint NOT NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE, 407 name varchar(255) DEFAULT '' NOT NULL, 408 value varchar(2048) DEFAULT '' NOT NULL, 409 PRIMARY KEY (mediatype_paramid) 410); 411CREATE INDEX media_type_param_1 ON media_type_param (mediatypeid); 412CREATE TABLE media_type_message ( 413 mediatype_messageid bigint NOT NULL, 414 mediatypeid bigint NOT NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE, 415 eventsource integer NOT NULL, 416 recovery integer NOT NULL, 417 subject varchar(255) DEFAULT '' NOT NULL, 418 message text DEFAULT '' NOT NULL, 419 PRIMARY KEY (mediatype_messageid) 420); 421CREATE UNIQUE INDEX media_type_message_1 ON media_type_message (mediatypeid,eventsource,recovery); 422CREATE TABLE usrgrp ( 423 usrgrpid bigint NOT NULL, 424 name varchar(64) DEFAULT '' NOT NULL, 425 gui_access integer DEFAULT '0' NOT NULL, 426 users_status integer DEFAULT '0' NOT NULL, 427 debug_mode integer DEFAULT '0' NOT NULL, 428 PRIMARY KEY (usrgrpid) 429); 430CREATE UNIQUE INDEX usrgrp_1 ON usrgrp (name); 431CREATE TABLE users_groups ( 432 id bigint NOT NULL, 433 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 434 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 435 PRIMARY KEY (id) 436); 437CREATE UNIQUE INDEX users_groups_1 ON users_groups (usrgrpid,userid); 438CREATE INDEX users_groups_2 ON users_groups (userid); 439CREATE TABLE scripts ( 440 scriptid bigint NOT NULL, 441 name varchar(255) DEFAULT '' NOT NULL, 442 command varchar(255) DEFAULT '' NOT NULL, 443 host_access integer DEFAULT '2' NOT NULL, 444 usrgrpid bigint NULL REFERENCES usrgrp (usrgrpid), 445 groupid bigint NULL REFERENCES hstgrp (groupid), 446 description text DEFAULT '' NOT NULL, 447 confirmation varchar(255) DEFAULT '' NOT NULL, 448 type integer DEFAULT '0' NOT NULL, 449 execute_on integer DEFAULT '2' NOT NULL, 450 PRIMARY KEY (scriptid) 451); 452CREATE INDEX scripts_1 ON scripts (usrgrpid); 453CREATE INDEX scripts_2 ON scripts (groupid); 454CREATE UNIQUE INDEX scripts_3 ON scripts (name); 455CREATE TABLE actions ( 456 actionid bigint NOT NULL, 457 name varchar(255) DEFAULT '' NOT NULL, 458 eventsource integer DEFAULT '0' NOT NULL, 459 evaltype integer DEFAULT '0' NOT NULL, 460 status integer DEFAULT '0' NOT NULL, 461 esc_period varchar(255) DEFAULT '1h' NOT NULL, 462 formula varchar(255) DEFAULT '' NOT NULL, 463 pause_suppressed integer DEFAULT '1' NOT NULL, 464 PRIMARY KEY (actionid) 465); 466CREATE INDEX actions_1 ON actions (eventsource,status); 467CREATE UNIQUE INDEX actions_2 ON actions (name); 468CREATE TABLE operations ( 469 operationid bigint NOT NULL, 470 actionid bigint NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE, 471 operationtype integer DEFAULT '0' NOT NULL, 472 esc_period varchar(255) DEFAULT '0' NOT NULL, 473 esc_step_from integer DEFAULT '1' NOT NULL, 474 esc_step_to integer DEFAULT '1' NOT NULL, 475 evaltype integer DEFAULT '0' NOT NULL, 476 recovery integer DEFAULT '0' NOT NULL, 477 PRIMARY KEY (operationid) 478); 479CREATE INDEX operations_1 ON operations (actionid); 480CREATE TABLE opmessage ( 481 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 482 default_msg integer DEFAULT '1' NOT NULL, 483 subject varchar(255) DEFAULT '' NOT NULL, 484 message text DEFAULT '' NOT NULL, 485 mediatypeid bigint NULL REFERENCES media_type (mediatypeid), 486 PRIMARY KEY (operationid) 487); 488CREATE INDEX opmessage_1 ON opmessage (mediatypeid); 489CREATE TABLE opmessage_grp ( 490 opmessage_grpid bigint NOT NULL, 491 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 492 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid), 493 PRIMARY KEY (opmessage_grpid) 494); 495CREATE UNIQUE INDEX opmessage_grp_1 ON opmessage_grp (operationid,usrgrpid); 496CREATE INDEX opmessage_grp_2 ON opmessage_grp (usrgrpid); 497CREATE TABLE opmessage_usr ( 498 opmessage_usrid bigint NOT NULL, 499 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 500 userid bigint NOT NULL REFERENCES users (userid), 501 PRIMARY KEY (opmessage_usrid) 502); 503CREATE UNIQUE INDEX opmessage_usr_1 ON opmessage_usr (operationid,userid); 504CREATE INDEX opmessage_usr_2 ON opmessage_usr (userid); 505CREATE TABLE opcommand ( 506 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 507 type integer DEFAULT '0' NOT NULL, 508 scriptid bigint NULL REFERENCES scripts (scriptid), 509 execute_on integer DEFAULT '0' NOT NULL, 510 port varchar(64) DEFAULT '' NOT NULL, 511 authtype integer DEFAULT '0' NOT NULL, 512 username varchar(64) DEFAULT '' NOT NULL, 513 password varchar(64) DEFAULT '' NOT NULL, 514 publickey varchar(64) DEFAULT '' NOT NULL, 515 privatekey varchar(64) DEFAULT '' NOT NULL, 516 command text DEFAULT '' NOT NULL, 517 PRIMARY KEY (operationid) 518); 519CREATE INDEX opcommand_1 ON opcommand (scriptid); 520CREATE TABLE opcommand_hst ( 521 opcommand_hstid bigint NOT NULL, 522 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 523 hostid bigint NULL REFERENCES hosts (hostid), 524 PRIMARY KEY (opcommand_hstid) 525); 526CREATE INDEX opcommand_hst_1 ON opcommand_hst (operationid); 527CREATE INDEX opcommand_hst_2 ON opcommand_hst (hostid); 528CREATE TABLE opcommand_grp ( 529 opcommand_grpid bigint NOT NULL, 530 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 531 groupid bigint NOT NULL REFERENCES hstgrp (groupid), 532 PRIMARY KEY (opcommand_grpid) 533); 534CREATE INDEX opcommand_grp_1 ON opcommand_grp (operationid); 535CREATE INDEX opcommand_grp_2 ON opcommand_grp (groupid); 536CREATE TABLE opgroup ( 537 opgroupid bigint NOT NULL, 538 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 539 groupid bigint NOT NULL REFERENCES hstgrp (groupid), 540 PRIMARY KEY (opgroupid) 541); 542CREATE UNIQUE INDEX opgroup_1 ON opgroup (operationid,groupid); 543CREATE INDEX opgroup_2 ON opgroup (groupid); 544CREATE TABLE optemplate ( 545 optemplateid bigint NOT NULL, 546 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 547 templateid bigint NOT NULL REFERENCES hosts (hostid), 548 PRIMARY KEY (optemplateid) 549); 550CREATE UNIQUE INDEX optemplate_1 ON optemplate (operationid,templateid); 551CREATE INDEX optemplate_2 ON optemplate (templateid); 552CREATE TABLE opconditions ( 553 opconditionid bigint NOT NULL, 554 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 555 conditiontype integer DEFAULT '0' NOT NULL, 556 operator integer DEFAULT '0' NOT NULL, 557 value varchar(255) DEFAULT '' NOT NULL, 558 PRIMARY KEY (opconditionid) 559); 560CREATE INDEX opconditions_1 ON opconditions (operationid); 561CREATE TABLE conditions ( 562 conditionid bigint NOT NULL, 563 actionid bigint NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE, 564 conditiontype integer DEFAULT '0' NOT NULL, 565 operator integer DEFAULT '0' NOT NULL, 566 value varchar(255) DEFAULT '' NOT NULL, 567 value2 varchar(255) DEFAULT '' NOT NULL, 568 PRIMARY KEY (conditionid) 569); 570CREATE INDEX conditions_1 ON conditions (actionid); 571CREATE TABLE config ( 572 configid bigint NOT NULL, 573 refresh_unsupported varchar(32) DEFAULT '10m' NOT NULL, 574 work_period varchar(255) DEFAULT '1-5,09:00-18:00' NOT NULL, 575 alert_usrgrpid bigint NULL REFERENCES usrgrp (usrgrpid), 576 default_theme varchar(128) DEFAULT 'blue-theme' NOT NULL, 577 authentication_type integer DEFAULT '0' NOT NULL, 578 ldap_host varchar(255) DEFAULT '' NOT NULL, 579 ldap_port integer DEFAULT 389 NOT NULL, 580 ldap_base_dn varchar(255) DEFAULT '' NOT NULL, 581 ldap_bind_dn varchar(255) DEFAULT '' NOT NULL, 582 ldap_bind_password varchar(128) DEFAULT '' NOT NULL, 583 ldap_search_attribute varchar(128) DEFAULT '' NOT NULL, 584 discovery_groupid bigint NOT NULL REFERENCES hstgrp (groupid), 585 max_in_table integer DEFAULT '50' NOT NULL, 586 search_limit integer DEFAULT '1000' NOT NULL, 587 severity_color_0 varchar(6) DEFAULT '97AAB3' NOT NULL, 588 severity_color_1 varchar(6) DEFAULT '7499FF' NOT NULL, 589 severity_color_2 varchar(6) DEFAULT 'FFC859' NOT NULL, 590 severity_color_3 varchar(6) DEFAULT 'FFA059' NOT NULL, 591 severity_color_4 varchar(6) DEFAULT 'E97659' NOT NULL, 592 severity_color_5 varchar(6) DEFAULT 'E45959' NOT NULL, 593 severity_name_0 varchar(32) DEFAULT 'Not classified' NOT NULL, 594 severity_name_1 varchar(32) DEFAULT 'Information' NOT NULL, 595 severity_name_2 varchar(32) DEFAULT 'Warning' NOT NULL, 596 severity_name_3 varchar(32) DEFAULT 'Average' NOT NULL, 597 severity_name_4 varchar(32) DEFAULT 'High' NOT NULL, 598 severity_name_5 varchar(32) DEFAULT 'Disaster' NOT NULL, 599 ok_period varchar(32) DEFAULT '5m' NOT NULL, 600 blink_period varchar(32) DEFAULT '2m' NOT NULL, 601 problem_unack_color varchar(6) DEFAULT 'CC0000' NOT NULL, 602 problem_ack_color varchar(6) DEFAULT 'CC0000' NOT NULL, 603 ok_unack_color varchar(6) DEFAULT '009900' NOT NULL, 604 ok_ack_color varchar(6) DEFAULT '009900' NOT NULL, 605 problem_unack_style integer DEFAULT '1' NOT NULL, 606 problem_ack_style integer DEFAULT '1' NOT NULL, 607 ok_unack_style integer DEFAULT '1' NOT NULL, 608 ok_ack_style integer DEFAULT '1' NOT NULL, 609 snmptrap_logging integer DEFAULT '1' NOT NULL, 610 server_check_interval integer DEFAULT '10' NOT NULL, 611 hk_events_mode integer DEFAULT '1' NOT NULL, 612 hk_events_trigger varchar(32) DEFAULT '365d' NOT NULL, 613 hk_events_internal varchar(32) DEFAULT '1d' NOT NULL, 614 hk_events_discovery varchar(32) DEFAULT '1d' NOT NULL, 615 hk_events_autoreg varchar(32) DEFAULT '1d' NOT NULL, 616 hk_services_mode integer DEFAULT '1' NOT NULL, 617 hk_services varchar(32) DEFAULT '365d' NOT NULL, 618 hk_audit_mode integer DEFAULT '1' NOT NULL, 619 hk_audit varchar(32) DEFAULT '365d' NOT NULL, 620 hk_sessions_mode integer DEFAULT '1' NOT NULL, 621 hk_sessions varchar(32) DEFAULT '365d' NOT NULL, 622 hk_history_mode integer DEFAULT '1' NOT NULL, 623 hk_history_global integer DEFAULT '0' NOT NULL, 624 hk_history varchar(32) DEFAULT '90d' NOT NULL, 625 hk_trends_mode integer DEFAULT '1' NOT NULL, 626 hk_trends_global integer DEFAULT '0' NOT NULL, 627 hk_trends varchar(32) DEFAULT '365d' NOT NULL, 628 default_inventory_mode integer DEFAULT '-1' NOT NULL, 629 custom_color integer DEFAULT '0' NOT NULL, 630 http_auth_enabled integer DEFAULT '0' NOT NULL, 631 http_login_form integer DEFAULT '0' NOT NULL, 632 http_strip_domains varchar(2048) DEFAULT '' NOT NULL, 633 http_case_sensitive integer DEFAULT '1' NOT NULL, 634 ldap_configured integer DEFAULT '0' NOT NULL, 635 ldap_case_sensitive integer DEFAULT '1' NOT NULL, 636 db_extension varchar(32) DEFAULT '' NOT NULL, 637 autoreg_tls_accept integer DEFAULT '1' NOT NULL, 638 compression_status integer DEFAULT '0' NOT NULL, 639 compression_availability integer DEFAULT '0' NOT NULL, 640 compress_older varchar(32) DEFAULT '7d' NOT NULL, 641 instanceid varchar(32) DEFAULT '' NOT NULL, 642 saml_auth_enabled integer DEFAULT '0' NOT NULL, 643 saml_idp_entityid varchar(1024) DEFAULT '' NOT NULL, 644 saml_sso_url varchar(2048) DEFAULT '' NOT NULL, 645 saml_slo_url varchar(2048) DEFAULT '' NOT NULL, 646 saml_username_attribute varchar(128) DEFAULT '' NOT NULL, 647 saml_sp_entityid varchar(1024) DEFAULT '' NOT NULL, 648 saml_nameid_format varchar(2048) DEFAULT '' NOT NULL, 649 saml_sign_messages integer DEFAULT '0' NOT NULL, 650 saml_sign_assertions integer DEFAULT '0' NOT NULL, 651 saml_sign_authn_requests integer DEFAULT '0' NOT NULL, 652 saml_sign_logout_requests integer DEFAULT '0' NOT NULL, 653 saml_sign_logout_responses integer DEFAULT '0' NOT NULL, 654 saml_encrypt_nameid integer DEFAULT '0' NOT NULL, 655 saml_encrypt_assertions integer DEFAULT '0' NOT NULL, 656 saml_case_sensitive integer DEFAULT '0' NOT NULL, 657 PRIMARY KEY (configid) 658); 659CREATE INDEX config_1 ON config (alert_usrgrpid); 660CREATE INDEX config_2 ON config (discovery_groupid); 661CREATE TABLE triggers ( 662 triggerid bigint NOT NULL, 663 expression varchar(2048) DEFAULT '' NOT NULL, 664 description varchar(255) DEFAULT '' NOT NULL, 665 url varchar(255) DEFAULT '' NOT NULL, 666 status integer DEFAULT '0' NOT NULL, 667 value integer DEFAULT '0' NOT NULL, 668 priority integer DEFAULT '0' NOT NULL, 669 lastchange integer DEFAULT '0' NOT NULL, 670 comments text DEFAULT '' NOT NULL, 671 error varchar(2048) DEFAULT '' NOT NULL, 672 templateid bigint NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 673 type integer DEFAULT '0' NOT NULL, 674 state integer DEFAULT '0' NOT NULL, 675 flags integer DEFAULT '0' NOT NULL, 676 recovery_mode integer DEFAULT '0' NOT NULL, 677 recovery_expression varchar(2048) DEFAULT '' NOT NULL, 678 correlation_mode integer DEFAULT '0' NOT NULL, 679 correlation_tag varchar(255) DEFAULT '' NOT NULL, 680 manual_close integer DEFAULT '0' NOT NULL, 681 opdata varchar(255) DEFAULT '' NOT NULL, 682 discover integer DEFAULT '0' NOT NULL, 683 PRIMARY KEY (triggerid) 684); 685CREATE INDEX triggers_1 ON triggers (status); 686CREATE INDEX triggers_2 ON triggers (value,lastchange); 687CREATE INDEX triggers_3 ON triggers (templateid); 688CREATE TABLE trigger_depends ( 689 triggerdepid bigint NOT NULL, 690 triggerid_down bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 691 triggerid_up bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 692 PRIMARY KEY (triggerdepid) 693); 694CREATE UNIQUE INDEX trigger_depends_1 ON trigger_depends (triggerid_down,triggerid_up); 695CREATE INDEX trigger_depends_2 ON trigger_depends (triggerid_up); 696CREATE TABLE functions ( 697 functionid bigint NOT NULL, 698 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 699 triggerid bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 700 name varchar(12) DEFAULT '' NOT NULL, 701 parameter varchar(255) DEFAULT '0' NOT NULL, 702 PRIMARY KEY (functionid) 703); 704CREATE INDEX functions_1 ON functions (triggerid); 705CREATE INDEX functions_2 ON functions (itemid,name,parameter); 706CREATE TABLE graphs ( 707 graphid bigint NOT NULL, 708 name varchar(128) DEFAULT '' NOT NULL, 709 width integer DEFAULT '900' NOT NULL, 710 height integer DEFAULT '200' NOT NULL, 711 yaxismin DOUBLE PRECISION DEFAULT '0' NOT NULL, 712 yaxismax DOUBLE PRECISION DEFAULT '100' NOT NULL, 713 templateid bigint NULL REFERENCES graphs (graphid) ON DELETE CASCADE, 714 show_work_period integer DEFAULT '1' NOT NULL, 715 show_triggers integer DEFAULT '1' NOT NULL, 716 graphtype integer DEFAULT '0' NOT NULL, 717 show_legend integer DEFAULT '1' NOT NULL, 718 show_3d integer DEFAULT '0' NOT NULL, 719 percent_left DOUBLE PRECISION DEFAULT '0' NOT NULL, 720 percent_right DOUBLE PRECISION DEFAULT '0' NOT NULL, 721 ymin_type integer DEFAULT '0' NOT NULL, 722 ymax_type integer DEFAULT '0' NOT NULL, 723 ymin_itemid bigint NULL REFERENCES items (itemid), 724 ymax_itemid bigint NULL REFERENCES items (itemid), 725 flags integer DEFAULT '0' NOT NULL, 726 discover integer DEFAULT '0' NOT NULL, 727 PRIMARY KEY (graphid) 728); 729CREATE INDEX graphs_1 ON graphs (name); 730CREATE INDEX graphs_2 ON graphs (templateid); 731CREATE INDEX graphs_3 ON graphs (ymin_itemid); 732CREATE INDEX graphs_4 ON graphs (ymax_itemid); 733CREATE TABLE graphs_items ( 734 gitemid bigint NOT NULL, 735 graphid bigint NOT NULL REFERENCES graphs (graphid) ON DELETE CASCADE, 736 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 737 drawtype integer DEFAULT '0' NOT NULL, 738 sortorder integer DEFAULT '0' NOT NULL, 739 color varchar(6) DEFAULT '009600' NOT NULL, 740 yaxisside integer DEFAULT '0' NOT NULL, 741 calc_fnc integer DEFAULT '2' NOT NULL, 742 type integer DEFAULT '0' NOT NULL, 743 PRIMARY KEY (gitemid) 744); 745CREATE INDEX graphs_items_1 ON graphs_items (itemid); 746CREATE INDEX graphs_items_2 ON graphs_items (graphid); 747CREATE TABLE graph_theme ( 748 graphthemeid bigint NOT NULL, 749 theme varchar(64) DEFAULT '' NOT NULL, 750 backgroundcolor varchar(6) DEFAULT '' NOT NULL, 751 graphcolor varchar(6) DEFAULT '' NOT NULL, 752 gridcolor varchar(6) DEFAULT '' NOT NULL, 753 maingridcolor varchar(6) DEFAULT '' NOT NULL, 754 gridbordercolor varchar(6) DEFAULT '' NOT NULL, 755 textcolor varchar(6) DEFAULT '' NOT NULL, 756 highlightcolor varchar(6) DEFAULT '' NOT NULL, 757 leftpercentilecolor varchar(6) DEFAULT '' NOT NULL, 758 rightpercentilecolor varchar(6) DEFAULT '' NOT NULL, 759 nonworktimecolor varchar(6) DEFAULT '' NOT NULL, 760 colorpalette varchar(255) DEFAULT '' NOT NULL, 761 PRIMARY KEY (graphthemeid) 762); 763CREATE UNIQUE INDEX graph_theme_1 ON graph_theme (theme); 764CREATE TABLE globalmacro ( 765 globalmacroid bigint NOT NULL, 766 macro varchar(255) DEFAULT '' NOT NULL, 767 value varchar(255) DEFAULT '' NOT NULL, 768 description text DEFAULT '' NOT NULL, 769 type integer DEFAULT '0' NOT NULL, 770 PRIMARY KEY (globalmacroid) 771); 772CREATE UNIQUE INDEX globalmacro_1 ON globalmacro (macro); 773CREATE TABLE hostmacro ( 774 hostmacroid bigint NOT NULL, 775 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 776 macro varchar(255) DEFAULT '' NOT NULL, 777 value varchar(255) DEFAULT '' NOT NULL, 778 description text DEFAULT '' NOT NULL, 779 type integer DEFAULT '0' NOT NULL, 780 PRIMARY KEY (hostmacroid) 781); 782CREATE UNIQUE INDEX hostmacro_1 ON hostmacro (hostid,macro); 783CREATE TABLE hosts_groups ( 784 hostgroupid bigint NOT NULL, 785 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 786 groupid bigint NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 787 PRIMARY KEY (hostgroupid) 788); 789CREATE UNIQUE INDEX hosts_groups_1 ON hosts_groups (hostid,groupid); 790CREATE INDEX hosts_groups_2 ON hosts_groups (groupid); 791CREATE TABLE hosts_templates ( 792 hosttemplateid bigint NOT NULL, 793 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 794 templateid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 795 PRIMARY KEY (hosttemplateid) 796); 797CREATE UNIQUE INDEX hosts_templates_1 ON hosts_templates (hostid,templateid); 798CREATE INDEX hosts_templates_2 ON hosts_templates (templateid); 799CREATE TABLE items_applications ( 800 itemappid bigint NOT NULL, 801 applicationid bigint NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE, 802 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 803 PRIMARY KEY (itemappid) 804); 805CREATE UNIQUE INDEX items_applications_1 ON items_applications (applicationid,itemid); 806CREATE INDEX items_applications_2 ON items_applications (itemid); 807CREATE TABLE mappings ( 808 mappingid bigint NOT NULL, 809 valuemapid bigint NOT NULL REFERENCES valuemaps (valuemapid) ON DELETE CASCADE, 810 value varchar(64) DEFAULT '' NOT NULL, 811 newvalue varchar(64) DEFAULT '' NOT NULL, 812 PRIMARY KEY (mappingid) 813); 814CREATE INDEX mappings_1 ON mappings (valuemapid); 815CREATE TABLE media ( 816 mediaid bigint NOT NULL, 817 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 818 mediatypeid bigint NOT NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE, 819 sendto varchar(1024) DEFAULT '' NOT NULL, 820 active integer DEFAULT '0' NOT NULL, 821 severity integer DEFAULT '63' NOT NULL, 822 period varchar(1024) DEFAULT '1-7,00:00-24:00' NOT NULL, 823 PRIMARY KEY (mediaid) 824); 825CREATE INDEX media_1 ON media (userid); 826CREATE INDEX media_2 ON media (mediatypeid); 827CREATE TABLE rights ( 828 rightid bigint NOT NULL, 829 groupid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 830 permission integer DEFAULT '0' NOT NULL, 831 id bigint NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 832 PRIMARY KEY (rightid) 833); 834CREATE INDEX rights_1 ON rights (groupid); 835CREATE INDEX rights_2 ON rights (id); 836CREATE TABLE services ( 837 serviceid bigint NOT NULL, 838 name varchar(128) DEFAULT '' NOT NULL, 839 status integer DEFAULT '0' NOT NULL, 840 algorithm integer DEFAULT '0' NOT NULL, 841 triggerid bigint NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 842 showsla integer DEFAULT '0' NOT NULL, 843 goodsla DOUBLE PRECISION DEFAULT '99.9' NOT NULL, 844 sortorder integer DEFAULT '0' NOT NULL, 845 PRIMARY KEY (serviceid) 846); 847CREATE INDEX services_1 ON services (triggerid); 848CREATE TABLE services_links ( 849 linkid bigint NOT NULL, 850 serviceupid bigint NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE, 851 servicedownid bigint NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE, 852 soft integer DEFAULT '0' NOT NULL, 853 PRIMARY KEY (linkid) 854); 855CREATE INDEX services_links_1 ON services_links (servicedownid); 856CREATE UNIQUE INDEX services_links_2 ON services_links (serviceupid,servicedownid); 857CREATE TABLE services_times ( 858 timeid bigint NOT NULL, 859 serviceid bigint NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE, 860 type integer DEFAULT '0' NOT NULL, 861 ts_from integer DEFAULT '0' NOT NULL, 862 ts_to integer DEFAULT '0' NOT NULL, 863 note varchar(255) DEFAULT '' NOT NULL, 864 PRIMARY KEY (timeid) 865); 866CREATE INDEX services_times_1 ON services_times (serviceid,type,ts_from,ts_to); 867CREATE TABLE icon_map ( 868 iconmapid bigint NOT NULL, 869 name varchar(64) DEFAULT '' NOT NULL, 870 default_iconid bigint NOT NULL REFERENCES images (imageid), 871 PRIMARY KEY (iconmapid) 872); 873CREATE UNIQUE INDEX icon_map_1 ON icon_map (name); 874CREATE INDEX icon_map_2 ON icon_map (default_iconid); 875CREATE TABLE icon_mapping ( 876 iconmappingid bigint NOT NULL, 877 iconmapid bigint NOT NULL REFERENCES icon_map (iconmapid) ON DELETE CASCADE, 878 iconid bigint NOT NULL REFERENCES images (imageid), 879 inventory_link integer DEFAULT '0' NOT NULL, 880 expression varchar(64) DEFAULT '' NOT NULL, 881 sortorder integer DEFAULT '0' NOT NULL, 882 PRIMARY KEY (iconmappingid) 883); 884CREATE INDEX icon_mapping_1 ON icon_mapping (iconmapid); 885CREATE INDEX icon_mapping_2 ON icon_mapping (iconid); 886CREATE TABLE sysmaps ( 887 sysmapid bigint NOT NULL, 888 name varchar(128) DEFAULT '' NOT NULL, 889 width integer DEFAULT '600' NOT NULL, 890 height integer DEFAULT '400' NOT NULL, 891 backgroundid bigint NULL REFERENCES images (imageid), 892 label_type integer DEFAULT '2' NOT NULL, 893 label_location integer DEFAULT '0' NOT NULL, 894 highlight integer DEFAULT '1' NOT NULL, 895 expandproblem integer DEFAULT '1' NOT NULL, 896 markelements integer DEFAULT '0' NOT NULL, 897 show_unack integer DEFAULT '0' NOT NULL, 898 grid_size integer DEFAULT '50' NOT NULL, 899 grid_show integer DEFAULT '1' NOT NULL, 900 grid_align integer DEFAULT '1' NOT NULL, 901 label_format integer DEFAULT '0' NOT NULL, 902 label_type_host integer DEFAULT '2' NOT NULL, 903 label_type_hostgroup integer DEFAULT '2' NOT NULL, 904 label_type_trigger integer DEFAULT '2' NOT NULL, 905 label_type_map integer DEFAULT '2' NOT NULL, 906 label_type_image integer DEFAULT '2' NOT NULL, 907 label_string_host varchar(255) DEFAULT '' NOT NULL, 908 label_string_hostgroup varchar(255) DEFAULT '' NOT NULL, 909 label_string_trigger varchar(255) DEFAULT '' NOT NULL, 910 label_string_map varchar(255) DEFAULT '' NOT NULL, 911 label_string_image varchar(255) DEFAULT '' NOT NULL, 912 iconmapid bigint NULL REFERENCES icon_map (iconmapid), 913 expand_macros integer DEFAULT '0' NOT NULL, 914 severity_min integer DEFAULT '0' NOT NULL, 915 userid bigint NOT NULL REFERENCES users (userid), 916 private integer DEFAULT '1' NOT NULL, 917 show_suppressed integer DEFAULT '0' NOT NULL, 918 PRIMARY KEY (sysmapid) 919); 920CREATE UNIQUE INDEX sysmaps_1 ON sysmaps (name); 921CREATE INDEX sysmaps_2 ON sysmaps (backgroundid); 922CREATE INDEX sysmaps_3 ON sysmaps (iconmapid); 923CREATE TABLE sysmaps_elements ( 924 selementid bigint NOT NULL, 925 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 926 elementid bigint DEFAULT '0' NOT NULL, 927 elementtype integer DEFAULT '0' NOT NULL, 928 iconid_off bigint NULL REFERENCES images (imageid), 929 iconid_on bigint NULL REFERENCES images (imageid), 930 label varchar(2048) DEFAULT '' NOT NULL, 931 label_location integer DEFAULT '-1' NOT NULL, 932 x integer DEFAULT '0' NOT NULL, 933 y integer DEFAULT '0' NOT NULL, 934 iconid_disabled bigint NULL REFERENCES images (imageid), 935 iconid_maintenance bigint NULL REFERENCES images (imageid), 936 elementsubtype integer DEFAULT '0' NOT NULL, 937 areatype integer DEFAULT '0' NOT NULL, 938 width integer DEFAULT '200' NOT NULL, 939 height integer DEFAULT '200' NOT NULL, 940 viewtype integer DEFAULT '0' NOT NULL, 941 use_iconmap integer DEFAULT '1' NOT NULL, 942 application varchar(255) DEFAULT '' NOT NULL, 943 PRIMARY KEY (selementid) 944); 945CREATE INDEX sysmaps_elements_1 ON sysmaps_elements (sysmapid); 946CREATE INDEX sysmaps_elements_2 ON sysmaps_elements (iconid_off); 947CREATE INDEX sysmaps_elements_3 ON sysmaps_elements (iconid_on); 948CREATE INDEX sysmaps_elements_4 ON sysmaps_elements (iconid_disabled); 949CREATE INDEX sysmaps_elements_5 ON sysmaps_elements (iconid_maintenance); 950CREATE TABLE sysmaps_links ( 951 linkid bigint NOT NULL, 952 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 953 selementid1 bigint NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE, 954 selementid2 bigint NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE, 955 drawtype integer DEFAULT '0' NOT NULL, 956 color varchar(6) DEFAULT '000000' NOT NULL, 957 label varchar(2048) DEFAULT '' NOT NULL, 958 PRIMARY KEY (linkid) 959); 960CREATE INDEX sysmaps_links_1 ON sysmaps_links (sysmapid); 961CREATE INDEX sysmaps_links_2 ON sysmaps_links (selementid1); 962CREATE INDEX sysmaps_links_3 ON sysmaps_links (selementid2); 963CREATE TABLE sysmaps_link_triggers ( 964 linktriggerid bigint NOT NULL, 965 linkid bigint NOT NULL REFERENCES sysmaps_links (linkid) ON DELETE CASCADE, 966 triggerid bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 967 drawtype integer DEFAULT '0' NOT NULL, 968 color varchar(6) DEFAULT '000000' NOT NULL, 969 PRIMARY KEY (linktriggerid) 970); 971CREATE UNIQUE INDEX sysmaps_link_triggers_1 ON sysmaps_link_triggers (linkid,triggerid); 972CREATE INDEX sysmaps_link_triggers_2 ON sysmaps_link_triggers (triggerid); 973CREATE TABLE sysmap_element_url ( 974 sysmapelementurlid bigint NOT NULL, 975 selementid bigint NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE, 976 name varchar(255) NOT NULL, 977 url varchar(255) DEFAULT '' NOT NULL, 978 PRIMARY KEY (sysmapelementurlid) 979); 980CREATE UNIQUE INDEX sysmap_element_url_1 ON sysmap_element_url (selementid,name); 981CREATE TABLE sysmap_url ( 982 sysmapurlid bigint NOT NULL, 983 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 984 name varchar(255) NOT NULL, 985 url varchar(255) DEFAULT '' NOT NULL, 986 elementtype integer DEFAULT '0' NOT NULL, 987 PRIMARY KEY (sysmapurlid) 988); 989CREATE UNIQUE INDEX sysmap_url_1 ON sysmap_url (sysmapid,name); 990CREATE TABLE sysmap_user ( 991 sysmapuserid bigint NOT NULL, 992 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 993 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 994 permission integer DEFAULT '2' NOT NULL, 995 PRIMARY KEY (sysmapuserid) 996); 997CREATE UNIQUE INDEX sysmap_user_1 ON sysmap_user (sysmapid,userid); 998CREATE TABLE sysmap_usrgrp ( 999 sysmapusrgrpid bigint NOT NULL, 1000 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 1001 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 1002 permission integer DEFAULT '2' NOT NULL, 1003 PRIMARY KEY (sysmapusrgrpid) 1004); 1005CREATE UNIQUE INDEX sysmap_usrgrp_1 ON sysmap_usrgrp (sysmapid,usrgrpid); 1006CREATE TABLE maintenances_hosts ( 1007 maintenance_hostid bigint NOT NULL, 1008 maintenanceid bigint NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE, 1009 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1010 PRIMARY KEY (maintenance_hostid) 1011); 1012CREATE UNIQUE INDEX maintenances_hosts_1 ON maintenances_hosts (maintenanceid,hostid); 1013CREATE INDEX maintenances_hosts_2 ON maintenances_hosts (hostid); 1014CREATE TABLE maintenances_groups ( 1015 maintenance_groupid bigint NOT NULL, 1016 maintenanceid bigint NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE, 1017 groupid bigint NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 1018 PRIMARY KEY (maintenance_groupid) 1019); 1020CREATE UNIQUE INDEX maintenances_groups_1 ON maintenances_groups (maintenanceid,groupid); 1021CREATE INDEX maintenances_groups_2 ON maintenances_groups (groupid); 1022CREATE TABLE timeperiods ( 1023 timeperiodid bigint NOT NULL, 1024 timeperiod_type integer DEFAULT '0' NOT NULL, 1025 every integer DEFAULT '1' NOT NULL, 1026 month integer DEFAULT '0' NOT NULL, 1027 dayofweek integer DEFAULT '0' NOT NULL, 1028 day integer DEFAULT '0' NOT NULL, 1029 start_time integer DEFAULT '0' NOT NULL, 1030 period integer DEFAULT '0' NOT NULL, 1031 start_date integer DEFAULT '0' NOT NULL, 1032 PRIMARY KEY (timeperiodid) 1033); 1034CREATE TABLE maintenances_windows ( 1035 maintenance_timeperiodid bigint NOT NULL, 1036 maintenanceid bigint NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE, 1037 timeperiodid bigint NOT NULL REFERENCES timeperiods (timeperiodid) ON DELETE CASCADE, 1038 PRIMARY KEY (maintenance_timeperiodid) 1039); 1040CREATE UNIQUE INDEX maintenances_windows_1 ON maintenances_windows (maintenanceid,timeperiodid); 1041CREATE INDEX maintenances_windows_2 ON maintenances_windows (timeperiodid); 1042CREATE TABLE regexps ( 1043 regexpid bigint NOT NULL, 1044 name varchar(128) DEFAULT '' NOT NULL, 1045 test_string text DEFAULT '' NOT NULL, 1046 PRIMARY KEY (regexpid) 1047); 1048CREATE UNIQUE INDEX regexps_1 ON regexps (name); 1049CREATE TABLE expressions ( 1050 expressionid bigint NOT NULL, 1051 regexpid bigint NOT NULL REFERENCES regexps (regexpid) ON DELETE CASCADE, 1052 expression varchar(255) DEFAULT '' NOT NULL, 1053 expression_type integer DEFAULT '0' NOT NULL, 1054 exp_delimiter varchar(1) DEFAULT '' NOT NULL, 1055 case_sensitive integer DEFAULT '0' NOT NULL, 1056 PRIMARY KEY (expressionid) 1057); 1058CREATE INDEX expressions_1 ON expressions (regexpid); 1059CREATE TABLE ids ( 1060 table_name varchar(64) DEFAULT '' NOT NULL, 1061 field_name varchar(64) DEFAULT '' NOT NULL, 1062 nextid bigint NOT NULL, 1063 PRIMARY KEY (table_name,field_name) 1064); 1065CREATE TABLE alerts ( 1066 alertid bigint NOT NULL, 1067 actionid bigint NOT NULL REFERENCES actions (actionid) ON DELETE CASCADE, 1068 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1069 userid bigint NULL REFERENCES users (userid) ON DELETE CASCADE, 1070 clock integer DEFAULT '0' NOT NULL, 1071 mediatypeid bigint NULL REFERENCES media_type (mediatypeid) ON DELETE CASCADE, 1072 sendto varchar(1024) DEFAULT '' NOT NULL, 1073 subject varchar(255) DEFAULT '' NOT NULL, 1074 message text DEFAULT '' NOT NULL, 1075 status integer DEFAULT '0' NOT NULL, 1076 retries integer DEFAULT '0' NOT NULL, 1077 error varchar(2048) DEFAULT '' NOT NULL, 1078 esc_step integer DEFAULT '0' NOT NULL, 1079 alerttype integer DEFAULT '0' NOT NULL, 1080 p_eventid bigint NULL REFERENCES events (eventid) ON DELETE CASCADE, 1081 acknowledgeid bigint NULL REFERENCES acknowledges (acknowledgeid) ON DELETE CASCADE, 1082 parameters text DEFAULT '{}' NOT NULL, 1083 PRIMARY KEY (alertid) 1084); 1085CREATE INDEX alerts_1 ON alerts (actionid); 1086CREATE INDEX alerts_2 ON alerts (clock); 1087CREATE INDEX alerts_3 ON alerts (eventid); 1088CREATE INDEX alerts_4 ON alerts (status); 1089CREATE INDEX alerts_5 ON alerts (mediatypeid); 1090CREATE INDEX alerts_6 ON alerts (userid); 1091CREATE INDEX alerts_7 ON alerts (p_eventid); 1092CREATE INDEX alerts_8 ON alerts (acknowledgeid); 1093CREATE TABLE history ( 1094 itemid bigint NOT NULL, 1095 clock integer DEFAULT '0' NOT NULL, 1096 value DOUBLE PRECISION DEFAULT '0.0000' NOT NULL, 1097 ns integer DEFAULT '0' NOT NULL 1098); 1099CREATE INDEX history_1 ON history (itemid,clock); 1100CREATE TABLE history_uint ( 1101 itemid bigint NOT NULL, 1102 clock integer DEFAULT '0' NOT NULL, 1103 value bigint DEFAULT '0' NOT NULL, 1104 ns integer DEFAULT '0' NOT NULL 1105); 1106CREATE INDEX history_uint_1 ON history_uint (itemid,clock); 1107CREATE TABLE history_str ( 1108 itemid bigint NOT NULL, 1109 clock integer DEFAULT '0' NOT NULL, 1110 value varchar(255) DEFAULT '' NOT NULL, 1111 ns integer DEFAULT '0' NOT NULL 1112); 1113CREATE INDEX history_str_1 ON history_str (itemid,clock); 1114CREATE TABLE history_log ( 1115 itemid bigint NOT NULL, 1116 clock integer DEFAULT '0' NOT NULL, 1117 timestamp integer DEFAULT '0' NOT NULL, 1118 source varchar(64) DEFAULT '' NOT NULL, 1119 severity integer DEFAULT '0' NOT NULL, 1120 value text DEFAULT '' NOT NULL, 1121 logeventid integer DEFAULT '0' NOT NULL, 1122 ns integer DEFAULT '0' NOT NULL 1123); 1124CREATE INDEX history_log_1 ON history_log (itemid,clock); 1125CREATE TABLE history_text ( 1126 itemid bigint NOT NULL, 1127 clock integer DEFAULT '0' NOT NULL, 1128 value text DEFAULT '' NOT NULL, 1129 ns integer DEFAULT '0' NOT NULL 1130); 1131CREATE INDEX history_text_1 ON history_text (itemid,clock); 1132CREATE TABLE proxy_history ( 1133 id integer NOT NULL PRIMARY KEY AUTOINCREMENT, 1134 itemid bigint NOT NULL, 1135 clock integer DEFAULT '0' NOT NULL, 1136 timestamp integer DEFAULT '0' NOT NULL, 1137 source varchar(64) DEFAULT '' NOT NULL, 1138 severity integer DEFAULT '0' NOT NULL, 1139 value text DEFAULT '' NOT NULL, 1140 logeventid integer DEFAULT '0' NOT NULL, 1141 ns integer DEFAULT '0' NOT NULL, 1142 state integer DEFAULT '0' NOT NULL, 1143 lastlogsize bigint DEFAULT '0' NOT NULL, 1144 mtime integer DEFAULT '0' NOT NULL, 1145 flags integer DEFAULT '0' NOT NULL, 1146 write_clock integer DEFAULT '0' NOT NULL 1147); 1148CREATE INDEX proxy_history_1 ON proxy_history (clock); 1149CREATE TABLE proxy_dhistory ( 1150 id integer NOT NULL PRIMARY KEY AUTOINCREMENT, 1151 clock integer DEFAULT '0' NOT NULL, 1152 druleid bigint NOT NULL, 1153 ip varchar(39) DEFAULT '' NOT NULL, 1154 port integer DEFAULT '0' NOT NULL, 1155 value varchar(255) DEFAULT '' NOT NULL, 1156 status integer DEFAULT '0' NOT NULL, 1157 dcheckid bigint NULL, 1158 dns varchar(255) DEFAULT '' NOT NULL 1159); 1160CREATE INDEX proxy_dhistory_1 ON proxy_dhistory (clock); 1161CREATE INDEX proxy_dhistory_2 ON proxy_dhistory (druleid); 1162CREATE TABLE events ( 1163 eventid bigint NOT NULL, 1164 source integer DEFAULT '0' NOT NULL, 1165 object integer DEFAULT '0' NOT NULL, 1166 objectid bigint DEFAULT '0' NOT NULL, 1167 clock integer DEFAULT '0' NOT NULL, 1168 value integer DEFAULT '0' NOT NULL, 1169 acknowledged integer DEFAULT '0' NOT NULL, 1170 ns integer DEFAULT '0' NOT NULL, 1171 name varchar(2048) DEFAULT '' NOT NULL, 1172 severity integer DEFAULT '0' NOT NULL, 1173 PRIMARY KEY (eventid) 1174); 1175CREATE INDEX events_1 ON events (source,object,objectid,clock); 1176CREATE INDEX events_2 ON events (source,object,clock); 1177CREATE TABLE trends ( 1178 itemid bigint NOT NULL, 1179 clock integer DEFAULT '0' NOT NULL, 1180 num integer DEFAULT '0' NOT NULL, 1181 value_min DOUBLE PRECISION DEFAULT '0.0000' NOT NULL, 1182 value_avg DOUBLE PRECISION DEFAULT '0.0000' NOT NULL, 1183 value_max DOUBLE PRECISION DEFAULT '0.0000' NOT NULL, 1184 PRIMARY KEY (itemid,clock) 1185); 1186CREATE TABLE trends_uint ( 1187 itemid bigint NOT NULL, 1188 clock integer DEFAULT '0' NOT NULL, 1189 num integer DEFAULT '0' NOT NULL, 1190 value_min bigint DEFAULT '0' NOT NULL, 1191 value_avg bigint DEFAULT '0' NOT NULL, 1192 value_max bigint DEFAULT '0' NOT NULL, 1193 PRIMARY KEY (itemid,clock) 1194); 1195CREATE TABLE acknowledges ( 1196 acknowledgeid bigint NOT NULL, 1197 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 1198 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1199 clock integer DEFAULT '0' NOT NULL, 1200 message varchar(2048) DEFAULT '' NOT NULL, 1201 action integer DEFAULT '0' NOT NULL, 1202 old_severity integer DEFAULT '0' NOT NULL, 1203 new_severity integer DEFAULT '0' NOT NULL, 1204 PRIMARY KEY (acknowledgeid) 1205); 1206CREATE INDEX acknowledges_1 ON acknowledges (userid); 1207CREATE INDEX acknowledges_2 ON acknowledges (eventid); 1208CREATE INDEX acknowledges_3 ON acknowledges (clock); 1209CREATE TABLE auditlog ( 1210 auditid bigint NOT NULL, 1211 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 1212 clock integer DEFAULT '0' NOT NULL, 1213 action integer DEFAULT '0' NOT NULL, 1214 resourcetype integer DEFAULT '0' NOT NULL, 1215 note varchar(128) DEFAULT '' NOT NULL, 1216 ip varchar(39) DEFAULT '' NOT NULL, 1217 resourceid bigint NULL, 1218 resourcename varchar(255) DEFAULT '' NOT NULL, 1219 PRIMARY KEY (auditid) 1220); 1221CREATE INDEX auditlog_1 ON auditlog (userid,clock); 1222CREATE INDEX auditlog_2 ON auditlog (clock); 1223CREATE INDEX auditlog_3 ON auditlog (resourcetype,resourceid); 1224CREATE TABLE auditlog_details ( 1225 auditdetailid bigint NOT NULL, 1226 auditid bigint NOT NULL REFERENCES auditlog (auditid) ON DELETE CASCADE, 1227 table_name varchar(64) DEFAULT '' NOT NULL, 1228 field_name varchar(64) DEFAULT '' NOT NULL, 1229 oldvalue text DEFAULT '' NOT NULL, 1230 newvalue text DEFAULT '' NOT NULL, 1231 PRIMARY KEY (auditdetailid) 1232); 1233CREATE INDEX auditlog_details_1 ON auditlog_details (auditid); 1234CREATE TABLE service_alarms ( 1235 servicealarmid bigint NOT NULL, 1236 serviceid bigint NOT NULL REFERENCES services (serviceid) ON DELETE CASCADE, 1237 clock integer DEFAULT '0' NOT NULL, 1238 value integer DEFAULT '0' NOT NULL, 1239 PRIMARY KEY (servicealarmid) 1240); 1241CREATE INDEX service_alarms_1 ON service_alarms (serviceid,clock); 1242CREATE INDEX service_alarms_2 ON service_alarms (clock); 1243CREATE TABLE autoreg_host ( 1244 autoreg_hostid bigint NOT NULL, 1245 proxy_hostid bigint NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1246 host varchar(128) DEFAULT '' NOT NULL, 1247 listen_ip varchar(39) DEFAULT '' NOT NULL, 1248 listen_port integer DEFAULT '0' NOT NULL, 1249 listen_dns varchar(255) DEFAULT '' NOT NULL, 1250 host_metadata varchar(255) DEFAULT '' NOT NULL, 1251 flags integer DEFAULT '0' NOT NULL, 1252 tls_accepted integer DEFAULT '1' NOT NULL, 1253 PRIMARY KEY (autoreg_hostid) 1254); 1255CREATE INDEX autoreg_host_1 ON autoreg_host (host); 1256CREATE INDEX autoreg_host_2 ON autoreg_host (proxy_hostid); 1257CREATE TABLE proxy_autoreg_host ( 1258 id integer NOT NULL PRIMARY KEY AUTOINCREMENT, 1259 clock integer DEFAULT '0' NOT NULL, 1260 host varchar(128) DEFAULT '' NOT NULL, 1261 listen_ip varchar(39) DEFAULT '' NOT NULL, 1262 listen_port integer DEFAULT '0' NOT NULL, 1263 listen_dns varchar(255) DEFAULT '' NOT NULL, 1264 host_metadata varchar(255) DEFAULT '' NOT NULL, 1265 flags integer DEFAULT '0' NOT NULL, 1266 tls_accepted integer DEFAULT '1' NOT NULL 1267); 1268CREATE INDEX proxy_autoreg_host_1 ON proxy_autoreg_host (clock); 1269CREATE TABLE dhosts ( 1270 dhostid bigint NOT NULL, 1271 druleid bigint NOT NULL REFERENCES drules (druleid) ON DELETE CASCADE, 1272 status integer DEFAULT '0' NOT NULL, 1273 lastup integer DEFAULT '0' NOT NULL, 1274 lastdown integer DEFAULT '0' NOT NULL, 1275 PRIMARY KEY (dhostid) 1276); 1277CREATE INDEX dhosts_1 ON dhosts (druleid); 1278CREATE TABLE dservices ( 1279 dserviceid bigint NOT NULL, 1280 dhostid bigint NOT NULL REFERENCES dhosts (dhostid) ON DELETE CASCADE, 1281 value varchar(255) DEFAULT '' NOT NULL, 1282 port integer DEFAULT '0' NOT NULL, 1283 status integer DEFAULT '0' NOT NULL, 1284 lastup integer DEFAULT '0' NOT NULL, 1285 lastdown integer DEFAULT '0' NOT NULL, 1286 dcheckid bigint NOT NULL REFERENCES dchecks (dcheckid) ON DELETE CASCADE, 1287 ip varchar(39) DEFAULT '' NOT NULL, 1288 dns varchar(255) DEFAULT '' NOT NULL, 1289 PRIMARY KEY (dserviceid) 1290); 1291CREATE UNIQUE INDEX dservices_1 ON dservices (dcheckid,ip,port); 1292CREATE INDEX dservices_2 ON dservices (dhostid); 1293CREATE TABLE escalations ( 1294 escalationid bigint NOT NULL, 1295 actionid bigint NOT NULL, 1296 triggerid bigint NULL, 1297 eventid bigint NULL, 1298 r_eventid bigint NULL, 1299 nextcheck integer DEFAULT '0' NOT NULL, 1300 esc_step integer DEFAULT '0' NOT NULL, 1301 status integer DEFAULT '0' NOT NULL, 1302 itemid bigint NULL, 1303 acknowledgeid bigint NULL, 1304 PRIMARY KEY (escalationid) 1305); 1306CREATE UNIQUE INDEX escalations_1 ON escalations (triggerid,itemid,escalationid); 1307CREATE INDEX escalations_2 ON escalations (eventid); 1308CREATE INDEX escalations_3 ON escalations (nextcheck); 1309CREATE TABLE globalvars ( 1310 globalvarid bigint NOT NULL, 1311 snmp_lastsize bigint DEFAULT '0' NOT NULL, 1312 PRIMARY KEY (globalvarid) 1313); 1314CREATE TABLE graph_discovery ( 1315 graphid bigint NOT NULL REFERENCES graphs (graphid) ON DELETE CASCADE, 1316 parent_graphid bigint NOT NULL REFERENCES graphs (graphid), 1317 lastcheck integer DEFAULT '0' NOT NULL, 1318 ts_delete integer DEFAULT '0' NOT NULL, 1319 PRIMARY KEY (graphid) 1320); 1321CREATE INDEX graph_discovery_1 ON graph_discovery (parent_graphid); 1322CREATE TABLE host_inventory ( 1323 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1324 inventory_mode integer DEFAULT '0' NOT NULL, 1325 type varchar(64) DEFAULT '' NOT NULL, 1326 type_full varchar(64) DEFAULT '' NOT NULL, 1327 name varchar(128) DEFAULT '' NOT NULL, 1328 alias varchar(128) DEFAULT '' NOT NULL, 1329 os varchar(128) DEFAULT '' NOT NULL, 1330 os_full varchar(255) DEFAULT '' NOT NULL, 1331 os_short varchar(128) DEFAULT '' NOT NULL, 1332 serialno_a varchar(64) DEFAULT '' NOT NULL, 1333 serialno_b varchar(64) DEFAULT '' NOT NULL, 1334 tag varchar(64) DEFAULT '' NOT NULL, 1335 asset_tag varchar(64) DEFAULT '' NOT NULL, 1336 macaddress_a varchar(64) DEFAULT '' NOT NULL, 1337 macaddress_b varchar(64) DEFAULT '' NOT NULL, 1338 hardware varchar(255) DEFAULT '' NOT NULL, 1339 hardware_full text DEFAULT '' NOT NULL, 1340 software varchar(255) DEFAULT '' NOT NULL, 1341 software_full text DEFAULT '' NOT NULL, 1342 software_app_a varchar(64) DEFAULT '' NOT NULL, 1343 software_app_b varchar(64) DEFAULT '' NOT NULL, 1344 software_app_c varchar(64) DEFAULT '' NOT NULL, 1345 software_app_d varchar(64) DEFAULT '' NOT NULL, 1346 software_app_e varchar(64) DEFAULT '' NOT NULL, 1347 contact text DEFAULT '' NOT NULL, 1348 location text DEFAULT '' NOT NULL, 1349 location_lat varchar(16) DEFAULT '' NOT NULL, 1350 location_lon varchar(16) DEFAULT '' NOT NULL, 1351 notes text DEFAULT '' NOT NULL, 1352 chassis varchar(64) DEFAULT '' NOT NULL, 1353 model varchar(64) DEFAULT '' NOT NULL, 1354 hw_arch varchar(32) DEFAULT '' NOT NULL, 1355 vendor varchar(64) DEFAULT '' NOT NULL, 1356 contract_number varchar(64) DEFAULT '' NOT NULL, 1357 installer_name varchar(64) DEFAULT '' NOT NULL, 1358 deployment_status varchar(64) DEFAULT '' NOT NULL, 1359 url_a varchar(255) DEFAULT '' NOT NULL, 1360 url_b varchar(255) DEFAULT '' NOT NULL, 1361 url_c varchar(255) DEFAULT '' NOT NULL, 1362 host_networks text DEFAULT '' NOT NULL, 1363 host_netmask varchar(39) DEFAULT '' NOT NULL, 1364 host_router varchar(39) DEFAULT '' NOT NULL, 1365 oob_ip varchar(39) DEFAULT '' NOT NULL, 1366 oob_netmask varchar(39) DEFAULT '' NOT NULL, 1367 oob_router varchar(39) DEFAULT '' NOT NULL, 1368 date_hw_purchase varchar(64) DEFAULT '' NOT NULL, 1369 date_hw_install varchar(64) DEFAULT '' NOT NULL, 1370 date_hw_expiry varchar(64) DEFAULT '' NOT NULL, 1371 date_hw_decomm varchar(64) DEFAULT '' NOT NULL, 1372 site_address_a varchar(128) DEFAULT '' NOT NULL, 1373 site_address_b varchar(128) DEFAULT '' NOT NULL, 1374 site_address_c varchar(128) DEFAULT '' NOT NULL, 1375 site_city varchar(128) DEFAULT '' NOT NULL, 1376 site_state varchar(64) DEFAULT '' NOT NULL, 1377 site_country varchar(64) DEFAULT '' NOT NULL, 1378 site_zip varchar(64) DEFAULT '' NOT NULL, 1379 site_rack varchar(128) DEFAULT '' NOT NULL, 1380 site_notes text DEFAULT '' NOT NULL, 1381 poc_1_name varchar(128) DEFAULT '' NOT NULL, 1382 poc_1_email varchar(128) DEFAULT '' NOT NULL, 1383 poc_1_phone_a varchar(64) DEFAULT '' NOT NULL, 1384 poc_1_phone_b varchar(64) DEFAULT '' NOT NULL, 1385 poc_1_cell varchar(64) DEFAULT '' NOT NULL, 1386 poc_1_screen varchar(64) DEFAULT '' NOT NULL, 1387 poc_1_notes text DEFAULT '' NOT NULL, 1388 poc_2_name varchar(128) DEFAULT '' NOT NULL, 1389 poc_2_email varchar(128) DEFAULT '' NOT NULL, 1390 poc_2_phone_a varchar(64) DEFAULT '' NOT NULL, 1391 poc_2_phone_b varchar(64) DEFAULT '' NOT NULL, 1392 poc_2_cell varchar(64) DEFAULT '' NOT NULL, 1393 poc_2_screen varchar(64) DEFAULT '' NOT NULL, 1394 poc_2_notes text DEFAULT '' NOT NULL, 1395 PRIMARY KEY (hostid) 1396); 1397CREATE TABLE housekeeper ( 1398 housekeeperid bigint NOT NULL, 1399 tablename varchar(64) DEFAULT '' NOT NULL, 1400 field varchar(64) DEFAULT '' NOT NULL, 1401 value bigint NOT NULL, 1402 PRIMARY KEY (housekeeperid) 1403); 1404CREATE TABLE images ( 1405 imageid bigint NOT NULL, 1406 imagetype integer DEFAULT '0' NOT NULL, 1407 name varchar(64) DEFAULT '0' NOT NULL, 1408 image longblob DEFAULT '' NOT NULL, 1409 PRIMARY KEY (imageid) 1410); 1411CREATE UNIQUE INDEX images_1 ON images (name); 1412CREATE TABLE item_discovery ( 1413 itemdiscoveryid bigint NOT NULL, 1414 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1415 parent_itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1416 key_ varchar(2048) DEFAULT '' NOT NULL, 1417 lastcheck integer DEFAULT '0' NOT NULL, 1418 ts_delete integer DEFAULT '0' NOT NULL, 1419 PRIMARY KEY (itemdiscoveryid) 1420); 1421CREATE UNIQUE INDEX item_discovery_1 ON item_discovery (itemid,parent_itemid); 1422CREATE INDEX item_discovery_2 ON item_discovery (parent_itemid); 1423CREATE TABLE host_discovery ( 1424 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1425 parent_hostid bigint NULL REFERENCES hosts (hostid), 1426 parent_itemid bigint NULL REFERENCES items (itemid), 1427 host varchar(128) DEFAULT '' NOT NULL, 1428 lastcheck integer DEFAULT '0' NOT NULL, 1429 ts_delete integer DEFAULT '0' NOT NULL, 1430 PRIMARY KEY (hostid) 1431); 1432CREATE TABLE interface_discovery ( 1433 interfaceid bigint NOT NULL REFERENCES interface (interfaceid) ON DELETE CASCADE, 1434 parent_interfaceid bigint NOT NULL REFERENCES interface (interfaceid) ON DELETE CASCADE, 1435 PRIMARY KEY (interfaceid) 1436); 1437CREATE TABLE profiles ( 1438 profileid bigint NOT NULL, 1439 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 1440 idx varchar(96) DEFAULT '' NOT NULL, 1441 idx2 bigint DEFAULT '0' NOT NULL, 1442 value_id bigint DEFAULT '0' NOT NULL, 1443 value_int integer DEFAULT '0' NOT NULL, 1444 value_str varchar(255) DEFAULT '' NOT NULL, 1445 source varchar(96) DEFAULT '' NOT NULL, 1446 type integer DEFAULT '0' NOT NULL, 1447 PRIMARY KEY (profileid) 1448); 1449CREATE INDEX profiles_1 ON profiles (userid,idx,idx2); 1450CREATE INDEX profiles_2 ON profiles (userid,profileid); 1451CREATE TABLE sessions ( 1452 sessionid varchar(32) DEFAULT '' NOT NULL, 1453 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 1454 lastaccess integer DEFAULT '0' NOT NULL, 1455 status integer DEFAULT '0' NOT NULL, 1456 PRIMARY KEY (sessionid) 1457); 1458CREATE INDEX sessions_1 ON sessions (userid,status,lastaccess); 1459CREATE TABLE trigger_discovery ( 1460 triggerid bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 1461 parent_triggerid bigint NOT NULL REFERENCES triggers (triggerid), 1462 lastcheck integer DEFAULT '0' NOT NULL, 1463 ts_delete integer DEFAULT '0' NOT NULL, 1464 PRIMARY KEY (triggerid) 1465); 1466CREATE INDEX trigger_discovery_1 ON trigger_discovery (parent_triggerid); 1467CREATE TABLE application_template ( 1468 application_templateid bigint NOT NULL, 1469 applicationid bigint NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE, 1470 templateid bigint NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE, 1471 PRIMARY KEY (application_templateid) 1472); 1473CREATE UNIQUE INDEX application_template_1 ON application_template (applicationid,templateid); 1474CREATE INDEX application_template_2 ON application_template (templateid); 1475CREATE TABLE item_condition ( 1476 item_conditionid bigint NOT NULL, 1477 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1478 operator integer DEFAULT '8' NOT NULL, 1479 macro varchar(64) DEFAULT '' NOT NULL, 1480 value varchar(255) DEFAULT '' NOT NULL, 1481 PRIMARY KEY (item_conditionid) 1482); 1483CREATE INDEX item_condition_1 ON item_condition (itemid); 1484CREATE TABLE item_rtdata ( 1485 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1486 lastlogsize bigint DEFAULT '0' NOT NULL, 1487 state integer DEFAULT '0' NOT NULL, 1488 mtime integer DEFAULT '0' NOT NULL, 1489 error varchar(2048) DEFAULT '' NOT NULL, 1490 PRIMARY KEY (itemid) 1491); 1492CREATE TABLE application_prototype ( 1493 application_prototypeid bigint NOT NULL, 1494 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1495 templateid bigint NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE, 1496 name varchar(255) DEFAULT '' NOT NULL, 1497 PRIMARY KEY (application_prototypeid) 1498); 1499CREATE INDEX application_prototype_1 ON application_prototype (itemid); 1500CREATE INDEX application_prototype_2 ON application_prototype (templateid); 1501CREATE TABLE item_application_prototype ( 1502 item_application_prototypeid bigint NOT NULL, 1503 application_prototypeid bigint NOT NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE, 1504 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1505 PRIMARY KEY (item_application_prototypeid) 1506); 1507CREATE UNIQUE INDEX item_application_prototype_1 ON item_application_prototype (application_prototypeid,itemid); 1508CREATE INDEX item_application_prototype_2 ON item_application_prototype (itemid); 1509CREATE TABLE application_discovery ( 1510 application_discoveryid bigint NOT NULL, 1511 applicationid bigint NOT NULL REFERENCES applications (applicationid) ON DELETE CASCADE, 1512 application_prototypeid bigint NOT NULL REFERENCES application_prototype (application_prototypeid) ON DELETE CASCADE, 1513 name varchar(255) DEFAULT '' NOT NULL, 1514 lastcheck integer DEFAULT '0' NOT NULL, 1515 ts_delete integer DEFAULT '0' NOT NULL, 1516 PRIMARY KEY (application_discoveryid) 1517); 1518CREATE INDEX application_discovery_1 ON application_discovery (applicationid); 1519CREATE INDEX application_discovery_2 ON application_discovery (application_prototypeid); 1520CREATE TABLE opinventory ( 1521 operationid bigint NOT NULL REFERENCES operations (operationid) ON DELETE CASCADE, 1522 inventory_mode integer DEFAULT '0' NOT NULL, 1523 PRIMARY KEY (operationid) 1524); 1525CREATE TABLE trigger_tag ( 1526 triggertagid bigint NOT NULL, 1527 triggerid bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 1528 tag varchar(255) DEFAULT '' NOT NULL, 1529 value varchar(255) DEFAULT '' NOT NULL, 1530 PRIMARY KEY (triggertagid) 1531); 1532CREATE INDEX trigger_tag_1 ON trigger_tag (triggerid); 1533CREATE TABLE event_tag ( 1534 eventtagid bigint NOT NULL, 1535 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1536 tag varchar(255) DEFAULT '' NOT NULL, 1537 value varchar(255) DEFAULT '' NOT NULL, 1538 PRIMARY KEY (eventtagid) 1539); 1540CREATE INDEX event_tag_1 ON event_tag (eventid); 1541CREATE TABLE problem ( 1542 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1543 source integer DEFAULT '0' NOT NULL, 1544 object integer DEFAULT '0' NOT NULL, 1545 objectid bigint DEFAULT '0' NOT NULL, 1546 clock integer DEFAULT '0' NOT NULL, 1547 ns integer DEFAULT '0' NOT NULL, 1548 r_eventid bigint NULL REFERENCES events (eventid) ON DELETE CASCADE, 1549 r_clock integer DEFAULT '0' NOT NULL, 1550 r_ns integer DEFAULT '0' NOT NULL, 1551 correlationid bigint NULL, 1552 userid bigint NULL, 1553 name varchar(2048) DEFAULT '' NOT NULL, 1554 acknowledged integer DEFAULT '0' NOT NULL, 1555 severity integer DEFAULT '0' NOT NULL, 1556 PRIMARY KEY (eventid) 1557); 1558CREATE INDEX problem_1 ON problem (source,object,objectid); 1559CREATE INDEX problem_2 ON problem (r_clock); 1560CREATE INDEX problem_3 ON problem (r_eventid); 1561CREATE TABLE problem_tag ( 1562 problemtagid bigint NOT NULL, 1563 eventid bigint NOT NULL REFERENCES problem (eventid) ON DELETE CASCADE, 1564 tag varchar(255) DEFAULT '' NOT NULL, 1565 value varchar(255) DEFAULT '' NOT NULL, 1566 PRIMARY KEY (problemtagid) 1567); 1568CREATE INDEX problem_tag_1 ON problem_tag (eventid,tag,value); 1569CREATE TABLE tag_filter ( 1570 tag_filterid bigint NOT NULL, 1571 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 1572 groupid bigint NOT NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 1573 tag varchar(255) DEFAULT '' NOT NULL, 1574 value varchar(255) DEFAULT '' NOT NULL, 1575 PRIMARY KEY (tag_filterid) 1576); 1577CREATE TABLE event_recovery ( 1578 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1579 r_eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1580 c_eventid bigint NULL REFERENCES events (eventid) ON DELETE CASCADE, 1581 correlationid bigint NULL, 1582 userid bigint NULL, 1583 PRIMARY KEY (eventid) 1584); 1585CREATE INDEX event_recovery_1 ON event_recovery (r_eventid); 1586CREATE INDEX event_recovery_2 ON event_recovery (c_eventid); 1587CREATE TABLE correlation ( 1588 correlationid bigint NOT NULL, 1589 name varchar(255) DEFAULT '' NOT NULL, 1590 description text DEFAULT '' NOT NULL, 1591 evaltype integer DEFAULT '0' NOT NULL, 1592 status integer DEFAULT '0' NOT NULL, 1593 formula varchar(255) DEFAULT '' NOT NULL, 1594 PRIMARY KEY (correlationid) 1595); 1596CREATE INDEX correlation_1 ON correlation (status); 1597CREATE UNIQUE INDEX correlation_2 ON correlation (name); 1598CREATE TABLE corr_condition ( 1599 corr_conditionid bigint NOT NULL, 1600 correlationid bigint NOT NULL REFERENCES correlation (correlationid) ON DELETE CASCADE, 1601 type integer DEFAULT '0' NOT NULL, 1602 PRIMARY KEY (corr_conditionid) 1603); 1604CREATE INDEX corr_condition_1 ON corr_condition (correlationid); 1605CREATE TABLE corr_condition_tag ( 1606 corr_conditionid bigint NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE, 1607 tag varchar(255) DEFAULT '' NOT NULL, 1608 PRIMARY KEY (corr_conditionid) 1609); 1610CREATE TABLE corr_condition_group ( 1611 corr_conditionid bigint NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE, 1612 operator integer DEFAULT '0' NOT NULL, 1613 groupid bigint NOT NULL REFERENCES hstgrp (groupid), 1614 PRIMARY KEY (corr_conditionid) 1615); 1616CREATE INDEX corr_condition_group_1 ON corr_condition_group (groupid); 1617CREATE TABLE corr_condition_tagpair ( 1618 corr_conditionid bigint NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE, 1619 oldtag varchar(255) DEFAULT '' NOT NULL, 1620 newtag varchar(255) DEFAULT '' NOT NULL, 1621 PRIMARY KEY (corr_conditionid) 1622); 1623CREATE TABLE corr_condition_tagvalue ( 1624 corr_conditionid bigint NOT NULL REFERENCES corr_condition (corr_conditionid) ON DELETE CASCADE, 1625 tag varchar(255) DEFAULT '' NOT NULL, 1626 operator integer DEFAULT '0' NOT NULL, 1627 value varchar(255) DEFAULT '' NOT NULL, 1628 PRIMARY KEY (corr_conditionid) 1629); 1630CREATE TABLE corr_operation ( 1631 corr_operationid bigint NOT NULL, 1632 correlationid bigint NOT NULL REFERENCES correlation (correlationid) ON DELETE CASCADE, 1633 type integer DEFAULT '0' NOT NULL, 1634 PRIMARY KEY (corr_operationid) 1635); 1636CREATE INDEX corr_operation_1 ON corr_operation (correlationid); 1637CREATE TABLE task ( 1638 taskid bigint NOT NULL, 1639 type integer NOT NULL, 1640 status integer DEFAULT '0' NOT NULL, 1641 clock integer DEFAULT '0' NOT NULL, 1642 ttl integer DEFAULT '0' NOT NULL, 1643 proxy_hostid bigint NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1644 PRIMARY KEY (taskid) 1645); 1646CREATE INDEX task_1 ON task (status,proxy_hostid); 1647CREATE TABLE task_close_problem ( 1648 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1649 acknowledgeid bigint NOT NULL, 1650 PRIMARY KEY (taskid) 1651); 1652CREATE TABLE item_preproc ( 1653 item_preprocid bigint NOT NULL, 1654 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1655 step integer DEFAULT '0' NOT NULL, 1656 type integer DEFAULT '0' NOT NULL, 1657 params text DEFAULT '' NOT NULL, 1658 error_handler integer DEFAULT '0' NOT NULL, 1659 error_handler_params varchar(255) DEFAULT '' NOT NULL, 1660 PRIMARY KEY (item_preprocid) 1661); 1662CREATE INDEX item_preproc_1 ON item_preproc (itemid,step); 1663CREATE TABLE task_remote_command ( 1664 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1665 command_type integer DEFAULT '0' NOT NULL, 1666 execute_on integer DEFAULT '0' NOT NULL, 1667 port integer DEFAULT '0' NOT NULL, 1668 authtype integer DEFAULT '0' NOT NULL, 1669 username varchar(64) DEFAULT '' NOT NULL, 1670 password varchar(64) DEFAULT '' NOT NULL, 1671 publickey varchar(64) DEFAULT '' NOT NULL, 1672 privatekey varchar(64) DEFAULT '' NOT NULL, 1673 command text DEFAULT '' NOT NULL, 1674 alertid bigint NULL, 1675 parent_taskid bigint NOT NULL, 1676 hostid bigint NOT NULL, 1677 PRIMARY KEY (taskid) 1678); 1679CREATE TABLE task_remote_command_result ( 1680 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1681 status integer DEFAULT '0' NOT NULL, 1682 parent_taskid bigint NOT NULL, 1683 info text DEFAULT '' NOT NULL, 1684 PRIMARY KEY (taskid) 1685); 1686CREATE TABLE task_data ( 1687 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1688 type integer DEFAULT '0' NOT NULL, 1689 data text DEFAULT '' NOT NULL, 1690 parent_taskid bigint NOT NULL, 1691 PRIMARY KEY (taskid) 1692); 1693CREATE TABLE task_result ( 1694 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1695 status integer DEFAULT '0' NOT NULL, 1696 parent_taskid bigint NOT NULL, 1697 info text DEFAULT '' NOT NULL, 1698 PRIMARY KEY (taskid) 1699); 1700CREATE INDEX task_result_1 ON task_result (parent_taskid); 1701CREATE TABLE task_acknowledge ( 1702 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1703 acknowledgeid bigint NOT NULL, 1704 PRIMARY KEY (taskid) 1705); 1706CREATE TABLE sysmap_shape ( 1707 sysmap_shapeid bigint NOT NULL, 1708 sysmapid bigint NOT NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 1709 type integer DEFAULT '0' NOT NULL, 1710 x integer DEFAULT '0' NOT NULL, 1711 y integer DEFAULT '0' NOT NULL, 1712 width integer DEFAULT '200' NOT NULL, 1713 height integer DEFAULT '200' NOT NULL, 1714 text text DEFAULT '' NOT NULL, 1715 font integer DEFAULT '9' NOT NULL, 1716 font_size integer DEFAULT '11' NOT NULL, 1717 font_color varchar(6) DEFAULT '000000' NOT NULL, 1718 text_halign integer DEFAULT '0' NOT NULL, 1719 text_valign integer DEFAULT '0' NOT NULL, 1720 border_type integer DEFAULT '0' NOT NULL, 1721 border_width integer DEFAULT '1' NOT NULL, 1722 border_color varchar(6) DEFAULT '000000' NOT NULL, 1723 background_color varchar(6) DEFAULT '' NOT NULL, 1724 zindex integer DEFAULT '0' NOT NULL, 1725 PRIMARY KEY (sysmap_shapeid) 1726); 1727CREATE INDEX sysmap_shape_1 ON sysmap_shape (sysmapid); 1728CREATE TABLE sysmap_element_trigger ( 1729 selement_triggerid bigint NOT NULL, 1730 selementid bigint NOT NULL REFERENCES sysmaps_elements (selementid) ON DELETE CASCADE, 1731 triggerid bigint NOT NULL REFERENCES triggers (triggerid) ON DELETE CASCADE, 1732 PRIMARY KEY (selement_triggerid) 1733); 1734CREATE UNIQUE INDEX sysmap_element_trigger_1 ON sysmap_element_trigger (selementid,triggerid); 1735CREATE TABLE httptest_field ( 1736 httptest_fieldid bigint NOT NULL, 1737 httptestid bigint NOT NULL REFERENCES httptest (httptestid) ON DELETE CASCADE, 1738 type integer DEFAULT '0' NOT NULL, 1739 name varchar(255) DEFAULT '' NOT NULL, 1740 value text DEFAULT '' NOT NULL, 1741 PRIMARY KEY (httptest_fieldid) 1742); 1743CREATE INDEX httptest_field_1 ON httptest_field (httptestid); 1744CREATE TABLE httpstep_field ( 1745 httpstep_fieldid bigint NOT NULL, 1746 httpstepid bigint NOT NULL REFERENCES httpstep (httpstepid) ON DELETE CASCADE, 1747 type integer DEFAULT '0' NOT NULL, 1748 name varchar(255) DEFAULT '' NOT NULL, 1749 value text DEFAULT '' NOT NULL, 1750 PRIMARY KEY (httpstep_fieldid) 1751); 1752CREATE INDEX httpstep_field_1 ON httpstep_field (httpstepid); 1753CREATE TABLE dashboard ( 1754 dashboardid bigint NOT NULL, 1755 name varchar(255) NOT NULL, 1756 userid bigint NOT NULL REFERENCES users (userid), 1757 private integer DEFAULT '1' NOT NULL, 1758 PRIMARY KEY (dashboardid) 1759); 1760CREATE TABLE dashboard_user ( 1761 dashboard_userid bigint NOT NULL, 1762 dashboardid bigint NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE, 1763 userid bigint NOT NULL REFERENCES users (userid) ON DELETE CASCADE, 1764 permission integer DEFAULT '2' NOT NULL, 1765 PRIMARY KEY (dashboard_userid) 1766); 1767CREATE UNIQUE INDEX dashboard_user_1 ON dashboard_user (dashboardid,userid); 1768CREATE TABLE dashboard_usrgrp ( 1769 dashboard_usrgrpid bigint NOT NULL, 1770 dashboardid bigint NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE, 1771 usrgrpid bigint NOT NULL REFERENCES usrgrp (usrgrpid) ON DELETE CASCADE, 1772 permission integer DEFAULT '2' NOT NULL, 1773 PRIMARY KEY (dashboard_usrgrpid) 1774); 1775CREATE UNIQUE INDEX dashboard_usrgrp_1 ON dashboard_usrgrp (dashboardid,usrgrpid); 1776CREATE TABLE widget ( 1777 widgetid bigint NOT NULL, 1778 dashboardid bigint NOT NULL REFERENCES dashboard (dashboardid) ON DELETE CASCADE, 1779 type varchar(255) DEFAULT '' NOT NULL, 1780 name varchar(255) DEFAULT '' NOT NULL, 1781 x integer DEFAULT '0' NOT NULL, 1782 y integer DEFAULT '0' NOT NULL, 1783 width integer DEFAULT '1' NOT NULL, 1784 height integer DEFAULT '2' NOT NULL, 1785 view_mode integer DEFAULT '0' NOT NULL, 1786 PRIMARY KEY (widgetid) 1787); 1788CREATE INDEX widget_1 ON widget (dashboardid); 1789CREATE TABLE widget_field ( 1790 widget_fieldid bigint NOT NULL, 1791 widgetid bigint NOT NULL REFERENCES widget (widgetid) ON DELETE CASCADE, 1792 type integer DEFAULT '0' NOT NULL, 1793 name varchar(255) DEFAULT '' NOT NULL, 1794 value_int integer DEFAULT '0' NOT NULL, 1795 value_str varchar(255) DEFAULT '' NOT NULL, 1796 value_groupid bigint NULL REFERENCES hstgrp (groupid) ON DELETE CASCADE, 1797 value_hostid bigint NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1798 value_itemid bigint NULL REFERENCES items (itemid) ON DELETE CASCADE, 1799 value_graphid bigint NULL REFERENCES graphs (graphid) ON DELETE CASCADE, 1800 value_sysmapid bigint NULL REFERENCES sysmaps (sysmapid) ON DELETE CASCADE, 1801 PRIMARY KEY (widget_fieldid) 1802); 1803CREATE INDEX widget_field_1 ON widget_field (widgetid); 1804CREATE INDEX widget_field_2 ON widget_field (value_groupid); 1805CREATE INDEX widget_field_3 ON widget_field (value_hostid); 1806CREATE INDEX widget_field_4 ON widget_field (value_itemid); 1807CREATE INDEX widget_field_5 ON widget_field (value_graphid); 1808CREATE INDEX widget_field_6 ON widget_field (value_sysmapid); 1809CREATE TABLE task_check_now ( 1810 taskid bigint NOT NULL REFERENCES task (taskid) ON DELETE CASCADE, 1811 itemid bigint NOT NULL, 1812 PRIMARY KEY (taskid) 1813); 1814CREATE TABLE event_suppress ( 1815 event_suppressid bigint NOT NULL, 1816 eventid bigint NOT NULL REFERENCES events (eventid) ON DELETE CASCADE, 1817 maintenanceid bigint NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE, 1818 suppress_until integer DEFAULT '0' NOT NULL, 1819 PRIMARY KEY (event_suppressid) 1820); 1821CREATE UNIQUE INDEX event_suppress_1 ON event_suppress (eventid,maintenanceid); 1822CREATE INDEX event_suppress_2 ON event_suppress (suppress_until); 1823CREATE INDEX event_suppress_3 ON event_suppress (maintenanceid); 1824CREATE TABLE maintenance_tag ( 1825 maintenancetagid bigint NOT NULL, 1826 maintenanceid bigint NOT NULL REFERENCES maintenances (maintenanceid) ON DELETE CASCADE, 1827 tag varchar(255) DEFAULT '' NOT NULL, 1828 operator integer DEFAULT '2' NOT NULL, 1829 value varchar(255) DEFAULT '' NOT NULL, 1830 PRIMARY KEY (maintenancetagid) 1831); 1832CREATE INDEX maintenance_tag_1 ON maintenance_tag (maintenanceid); 1833CREATE TABLE lld_macro_path ( 1834 lld_macro_pathid bigint NOT NULL, 1835 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1836 lld_macro varchar(255) DEFAULT '' NOT NULL, 1837 path varchar(255) DEFAULT '' NOT NULL, 1838 PRIMARY KEY (lld_macro_pathid) 1839); 1840CREATE UNIQUE INDEX lld_macro_path_1 ON lld_macro_path (itemid,lld_macro); 1841CREATE TABLE host_tag ( 1842 hosttagid bigint NOT NULL, 1843 hostid bigint NOT NULL REFERENCES hosts (hostid) ON DELETE CASCADE, 1844 tag varchar(255) DEFAULT '' NOT NULL, 1845 value varchar(255) DEFAULT '' NOT NULL, 1846 PRIMARY KEY (hosttagid) 1847); 1848CREATE INDEX host_tag_1 ON host_tag (hostid); 1849CREATE TABLE config_autoreg_tls ( 1850 autoreg_tlsid bigint NOT NULL, 1851 tls_psk_identity varchar(128) DEFAULT '' NOT NULL, 1852 tls_psk varchar(512) DEFAULT '' NOT NULL, 1853 PRIMARY KEY (autoreg_tlsid) 1854); 1855CREATE UNIQUE INDEX config_autoreg_tls_1 ON config_autoreg_tls (tls_psk_identity); 1856CREATE TABLE module ( 1857 moduleid bigint NOT NULL, 1858 id varchar(255) DEFAULT '' NOT NULL, 1859 relative_path varchar(255) DEFAULT '' NOT NULL, 1860 status integer DEFAULT '0' NOT NULL, 1861 config text DEFAULT '' NOT NULL, 1862 PRIMARY KEY (moduleid) 1863); 1864CREATE TABLE interface_snmp ( 1865 interfaceid bigint NOT NULL REFERENCES interface (interfaceid) ON DELETE CASCADE, 1866 version integer DEFAULT '2' NOT NULL, 1867 bulk integer DEFAULT '1' NOT NULL, 1868 community varchar(64) DEFAULT '' NOT NULL, 1869 securityname varchar(64) DEFAULT '' NOT NULL, 1870 securitylevel integer DEFAULT '0' NOT NULL, 1871 authpassphrase varchar(64) DEFAULT '' NOT NULL, 1872 privpassphrase varchar(64) DEFAULT '' NOT NULL, 1873 authprotocol integer DEFAULT '0' NOT NULL, 1874 privprotocol integer DEFAULT '0' NOT NULL, 1875 contextname varchar(255) DEFAULT '' NOT NULL, 1876 PRIMARY KEY (interfaceid) 1877); 1878CREATE TABLE lld_override ( 1879 lld_overrideid bigint NOT NULL, 1880 itemid bigint NOT NULL REFERENCES items (itemid) ON DELETE CASCADE, 1881 name varchar(255) DEFAULT '' NOT NULL, 1882 step integer DEFAULT '0' NOT NULL, 1883 evaltype integer DEFAULT '0' NOT NULL, 1884 formula varchar(255) DEFAULT '' NOT NULL, 1885 stop integer DEFAULT '0' NOT NULL, 1886 PRIMARY KEY (lld_overrideid) 1887); 1888CREATE UNIQUE INDEX lld_override_1 ON lld_override (itemid,name); 1889CREATE TABLE lld_override_condition ( 1890 lld_override_conditionid bigint NOT NULL, 1891 lld_overrideid bigint NOT NULL REFERENCES lld_override (lld_overrideid) ON DELETE CASCADE, 1892 operator integer DEFAULT '8' NOT NULL, 1893 macro varchar(64) DEFAULT '' NOT NULL, 1894 value varchar(255) DEFAULT '' NOT NULL, 1895 PRIMARY KEY (lld_override_conditionid) 1896); 1897CREATE INDEX lld_override_condition_1 ON lld_override_condition (lld_overrideid); 1898CREATE TABLE lld_override_operation ( 1899 lld_override_operationid bigint NOT NULL, 1900 lld_overrideid bigint NOT NULL REFERENCES lld_override (lld_overrideid) ON DELETE CASCADE, 1901 operationobject integer DEFAULT '0' NOT NULL, 1902 operator integer DEFAULT '0' NOT NULL, 1903 value varchar(255) DEFAULT '' NOT NULL, 1904 PRIMARY KEY (lld_override_operationid) 1905); 1906CREATE INDEX lld_override_operation_1 ON lld_override_operation (lld_overrideid); 1907CREATE TABLE lld_override_opstatus ( 1908 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1909 status integer DEFAULT '0' NOT NULL, 1910 PRIMARY KEY (lld_override_operationid) 1911); 1912CREATE TABLE lld_override_opdiscover ( 1913 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1914 discover integer DEFAULT '0' NOT NULL, 1915 PRIMARY KEY (lld_override_operationid) 1916); 1917CREATE TABLE lld_override_opperiod ( 1918 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1919 delay varchar(1024) DEFAULT '0' NOT NULL, 1920 PRIMARY KEY (lld_override_operationid) 1921); 1922CREATE TABLE lld_override_ophistory ( 1923 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1924 history varchar(255) DEFAULT '90d' NOT NULL, 1925 PRIMARY KEY (lld_override_operationid) 1926); 1927CREATE TABLE lld_override_optrends ( 1928 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1929 trends varchar(255) DEFAULT '365d' NOT NULL, 1930 PRIMARY KEY (lld_override_operationid) 1931); 1932CREATE TABLE lld_override_opseverity ( 1933 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1934 severity integer DEFAULT '0' NOT NULL, 1935 PRIMARY KEY (lld_override_operationid) 1936); 1937CREATE TABLE lld_override_optag ( 1938 lld_override_optagid bigint NOT NULL, 1939 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1940 tag varchar(255) DEFAULT '' NOT NULL, 1941 value varchar(255) DEFAULT '' NOT NULL, 1942 PRIMARY KEY (lld_override_optagid) 1943); 1944CREATE INDEX lld_override_optag_1 ON lld_override_optag (lld_override_operationid); 1945CREATE TABLE lld_override_optemplate ( 1946 lld_override_optemplateid bigint NOT NULL, 1947 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1948 templateid bigint NOT NULL REFERENCES hosts (hostid), 1949 PRIMARY KEY (lld_override_optemplateid) 1950); 1951CREATE UNIQUE INDEX lld_override_optemplate_1 ON lld_override_optemplate (lld_override_operationid,templateid); 1952CREATE INDEX lld_override_optemplate_2 ON lld_override_optemplate (templateid); 1953CREATE TABLE lld_override_opinventory ( 1954 lld_override_operationid bigint NOT NULL REFERENCES lld_override_operation (lld_override_operationid) ON DELETE CASCADE, 1955 inventory_mode integer DEFAULT '0' NOT NULL, 1956 PRIMARY KEY (lld_override_operationid) 1957); 1958CREATE TABLE dbversion ( 1959 mandatory integer DEFAULT '0' NOT NULL, 1960 optional integer DEFAULT '0' NOT NULL 1961); 1962INSERT INTO dbversion VALUES ('5000000','5000005'); 1963