diff options
Diffstat (limited to 'frontends/php')
-rw-r--r-- | frontends/php/create/mysql.sql | 1058 | ||||
-rw-r--r-- | frontends/php/exp_imp.php | 216 | ||||
-rw-r--r-- | frontends/php/hosts.php | 6 | ||||
-rw-r--r-- | frontends/php/include/config.inc.php | 8 | ||||
-rw-r--r-- | frontends/php/include/forms.inc.php | 24 | ||||
-rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 11 | ||||
-rw-r--r-- | frontends/php/include/page_header.php | 1 |
7 files changed, 737 insertions, 587 deletions
diff --git a/frontends/php/create/mysql.sql b/frontends/php/create/mysql.sql index 0413a05b..a537c362 100644 --- a/frontends/php/create/mysql.sql +++ b/frontends/php/create/mysql.sql @@ -1,704 +1,626 @@ --- --- ZABBIX --- Copyright (C) 2000-2005 SIA Zabbix --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. --- - --- --- Table structure for table 'nodes' --- - CREATE TABLE nodes ( - nodeid {integer} DEFAULT '0' NOT NULL, - name {varchar}(64) DEFAULT '' NOT NULL, - timezone {integer} DEFAULT '0' NOT NULL, - ip {varchar}(15) DEFAULT '' NOT NULL, - port {integer} DEFAULT '0' NOT NULL, - slave_history {integer} DEFAULT '0' NOT NULL, - slave_trends {integer} DEFAULT '0' NOT NULL, - event_lastid {bigint} DEFAULT '0' NOT NULL, - history_lastid {bigint} DEFAULT '0' NOT NULL, - nodetype {integer} DEFAULT '0' NOT NULL, - masterid {bigint} DEFAULT '0' NOT NULL, + nodeid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(64) DEFAULT '0' NOT NULL, + timezone integer DEFAULT '0' NOT NULL, + ip varchar(15) DEFAULT '' NOT NULL, + port integer DEFAULT '10051' NOT NULL, + slave_history integer DEFAULT '30' NOT NULL, + slave_trends integer DEFAULT '365' NOT NULL, + event_lastid bigint unsigned DEFAULT '0' NOT NULL, + event_maxid bigint unsigned DEFAULT '0' NOT NULL, + history_lastid bigint unsigned DEFAULT '0' NOT NULL, + history_str_lastid bigint unsigned DEFAULT '0' NOT NULL, + history_uint_lastid bigint unsigned DEFAULT '0' NOT NULL, + nodetype integer DEFAULT '0' NOT NULL, + masterid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (nodeid) -) {create_table_opt}; - +); CREATE TABLE node_cksum ( - cksumid {bigint} DEFAULT '0' NOT NULL, - nodeid {bigint} DEFAULT '0' NOT NULL, - tablename {varchar}(64) DEFAULT '' NOT NULL, - fieldname {varchar}(64) DEFAULT '' NOT NULL, - recordid {bigint} DEFAULT '0' NOT NULL, - cksumtype {integer} DEFAULT '0' NOT NULL, - cksum {char}(32) DEFAULT '' NOT NULL, + cksumid bigint unsigned DEFAULT '0' NOT NULL, + nodeid bigint unsigned DEFAULT '0' NOT NULL, + tablename varchar(64) DEFAULT '' NOT NULL, + fieldname varchar(64) DEFAULT '' NOT NULL, + recordid bigint unsigned DEFAULT '0' NOT NULL, + cksumtype integer DEFAULT '0' NOT NULL, + cksum char(32) DEFAULT '' NOT NULL, PRIMARY KEY (cksumid) -) {create_table_opt}; - -CREATE INDEX node_cksum_1 ON node_cksum (nodeid,tablename,fieldname,recordid,cksumtype); +); +CREATE INDEX node_cksum_cksum_1 on node_cksum (nodeid,tablename,fieldname,recordid,cksumtype); CREATE TABLE node_configlog ( - conflogid {bigint} DEFAULT '0' NOT NULL, - nodeid {bigint} DEFAULT '0' NOT NULL, - tablename {varchar}(64) DEFAULT '' NOT NULL, - recordid {bigint} DEFAULT '0' NOT NULL, - operation {integer} DEFAULT '0' NOT NULL, - sync_master {integer} DEFAULT '0' NOT NULL, - sync_slave {integer} DEFAULT '0' NOT NULL, + conflogid bigint unsigned DEFAULT '0' NOT NULL, + nodeid bigint unsigned DEFAULT '0' NOT NULL, + tablename varchar(64) DEFAULT '' NOT NULL, + recordid bigint unsigned DEFAULT '0' NOT NULL, + operation integer DEFAULT '0' NOT NULL, + sync_master integer DEFAULT '0' NOT NULL, + sync_slave integer DEFAULT '0' NOT NULL, PRIMARY KEY (nodeid,conflogid) -) {create_table_opt}; - -CREATE INDEX node_configlog_1 ON node_configlog (conflogid); -CREATE INDEX node_configlog_2 ON node_configlog (nodeid,tablename); +); +CREATE INDEX node_configlog_configlog_1 on node_configlog (conflogid); +CREATE INDEX node_configlog_configlog_2 on node_configlog (nodeid,tablename); CREATE TABLE services ( - serviceid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(128) DEFAULT '' NOT NULL, - status {integer} DEFAULT '0' NOT NULL, - algorithm {integer} DEFAULT '0' NOT NULL, - triggerid {bigint}, - showsla {integer} DEFAULT '0' NOT NULL, - goodsla {double}(5,2) DEFAULT '99.9' NOT NULL, - sortorder {integer} DEFAULT '0' NOT NULL, + serviceid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(128) DEFAULT '' NOT NULL, + status integer DEFAULT '0' NOT NULL, + algorithm integer DEFAULT '0' NOT NULL, + triggerid bigint unsigned , + showsla integer DEFAULT '0' NOT NULL, + goodsla double(5,2) DEFAULT '99.9' NOT NULL, + sortorder integer DEFAULT '0' NOT NULL, PRIMARY KEY (serviceid) -) {create_table_opt}; - +); CREATE TABLE services_times ( - timeid {bigint} DEFAULT '0' NOT NULL, - serviceid {bigint} DEFAULT '0' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, - ts_from {integer} DEFAULT '0' NOT NULL, - ts_to {integer} DEFAULT '0' NOT NULL, - note {varchar}(255) DEFAULT '' NOT NULL, + timeid bigint unsigned DEFAULT '0' NOT NULL, + serviceid bigint unsigned DEFAULT '0' NOT NULL, + type integer DEFAULT '0' NOT NULL, + ts_from integer DEFAULT '0' NOT NULL, + ts_to integer DEFAULT '0' NOT NULL, + note varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (timeid) -) {create_table_opt}; - -CREATE INDEX services_times_1 ON services_times (serviceid,type,ts_from,ts_to); +); +CREATE INDEX services_times_times_1 on services_times (serviceid,type,ts_from,ts_to); CREATE TABLE services_links ( - linkid {bigint} DEFAULT '0' NOT NULL, - serviceupid {bigint} DEFAULT '0' NOT NULL, - servicedownid {bigint} DEFAULT '0' NOT NULL, - soft {integer} DEFAULT '0' NOT NULL, + linkid bigint unsigned DEFAULT '0' NOT NULL, + serviceupid bigint unsigned DEFAULT '0' NOT NULL, + servicedownid bigint unsigned DEFAULT '0' NOT NULL, + soft integer DEFAULT '0' NOT NULL, PRIMARY KEY (linkid) -) {create_table_opt}; - -CREATE INDEX services_links_1 ON services_links (servicedownid); -CREATE INDEX services_links_2 ON services_links (serviceupid,servicedownid); +); +CREATE INDEX services_links_links_1 on services_links (servicedownid); +CREATE INDEX services_links_links_2 on services_links (serviceupid,servicedownid); CREATE TABLE graphs_items ( - gitemid {bigint} DEFAULT '0' NOT NULL, - graphid {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - drawtype {integer} DEFAULT '0' NOT NULL, - sortorder {integer} DEFAULT '0' NOT NULL, - color {varchar}(32) DEFAULT 'Dark Green' NOT NULL, - yaxisside {integer} DEFAULT '1' NOT NULL, - calc_fnc {integer} DEFAULT '2' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, - periods_cnt {integer} DEFAULT '5' NOT NULL, + gitemid bigint unsigned DEFAULT '0' NOT NULL, + graphid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + drawtype integer DEFAULT '0' NOT NULL, + sortorder integer DEFAULT '0' NOT NULL, + color varchar(32) DEFAULT 'Dark Green' NOT NULL, + yaxisside integer DEFAULT '1' NOT NULL, + calc_fnc integer DEFAULT '2' NOT NULL, + type integer DEFAULT '0' NOT NULL, + periods_cnt integer DEFAULT '5' NOT NULL, PRIMARY KEY (gitemid) -) {create_table_opt}; - +); CREATE TABLE graphs ( - graphid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(128) DEFAULT '' NOT NULL, - width {integer} DEFAULT '0' NOT NULL, - height {integer} DEFAULT '0' NOT NULL, - yaxistype {integer} DEFAULT '0' NOT NULL, - yaxismin {double}(16,4) DEFAULT '0' NOT NULL, - yaxismax {double}(16,4) DEFAULT '0' NOT NULL, - templateid {bigint} DEFAULT '0' NOT NULL, - show_work_period {integer} DEFAULT '1' NOT NULL, - show_triggers {integer} DEFAULT '1' NOT NULL, - graphtype {integer} DEFAULT '0' NOT NULL, + graphid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(128) DEFAULT '' NOT NULL, + width integer DEFAULT '0' NOT NULL, + height integer DEFAULT '0' NOT NULL, + yaxistype integer DEFAULT '0' NOT NULL, + yaxismin double(16,4) DEFAULT '0' NOT NULL, + yaxismax double(16,4) DEFAULT '0' NOT NULL, + templateid bigint unsigned DEFAULT '0' NOT NULL, + show_work_period integer DEFAULT '1' NOT NULL, + show_triggers integer DEFAULT '1' NOT NULL, + graphtype integer DEFAULT '0' NOT NULL, PRIMARY KEY (graphid) -) {create_table_opt}; - -CREATE INDEX graphs_1 ON graphs (name); +); +CREATE INDEX graphs_graphs_1 on graphs (name); CREATE TABLE sysmaps_links ( - linkid {bigint} DEFAULT '0' NOT NULL, - sysmapid {bigint} DEFAULT '0' NOT NULL, - selementid1 {bigint} DEFAULT '0' NOT NULL, - selementid2 {bigint} DEFAULT '0' NOT NULL, - triggerid {bigint}, - drawtype_off {integer} DEFAULT '0' NOT NULL, - color_off {varchar}(32) DEFAULT 'Black' NOT NULL, - drawtype_on {integer} DEFAULT '0' NOT NULL, - color_on {varchar}(32) DEFAULT 'Red' NOT NULL, + linkid bigint unsigned DEFAULT '0' NOT NULL, + sysmapid bigint unsigned DEFAULT '0' NOT NULL, + selementid1 bigint unsigned DEFAULT '0' NOT NULL, + selementid2 bigint unsigned DEFAULT '0' NOT NULL, + triggerid bigint unsigned , + drawtype_off integer DEFAULT '0' NOT NULL, + color_off varchar(32) DEFAULT 'Black' NOT NULL, + drawtype_on integer DEFAULT '0' NOT NULL, + color_on varchar(32) DEFAULT 'Red' NOT NULL, PRIMARY KEY (linkid) -) {create_table_opt}; - +); CREATE TABLE sysmaps_elements ( - selementid {bigint} DEFAULT '0' NOT NULL, - sysmapid {bigint} DEFAULT '0' NOT NULL, - elementid {bigint} DEFAULT '0' NOT NULL, - elementtype {integer} DEFAULT '0' NOT NULL, - iconid_off {bigint} DEFAULT '0' NOT NULL, - iconid_on {bigint} DEFAULT '0' NOT NULL, - label {varchar}(128) DEFAULT '' NOT NULL, - label_location {integer} DEFAULT NULL, - x {integer} DEFAULT '0' NOT NULL, - y {integer} DEFAULT '0' NOT NULL, - url {varchar}(255) DEFAULT '' NOT NULL, + selementid bigint unsigned DEFAULT '0' NOT NULL, + sysmapid bigint unsigned DEFAULT '0' NOT NULL, + elementid bigint unsigned DEFAULT '0' NOT NULL, + elementtype integer DEFAULT '0' NOT NULL, + iconid_off bigint unsigned DEFAULT '0' NOT NULL, + iconid_on bigint unsigned DEFAULT '0' NOT NULL, + label varchar(128) DEFAULT '' NOT NULL, + label_location integer NULL, + x integer DEFAULT '0' NOT NULL, + y integer DEFAULT '0' NOT NULL, + url varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (selementid) -) {create_table_opt}; - +); CREATE TABLE sysmaps ( - sysmapid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(128) DEFAULT '' NOT NULL, - width {integer} DEFAULT '0' NOT NULL, - height {integer} DEFAULT '0' NOT NULL, - backgroundid {bigint} DEFAULT '0' NOT NULL, - label_type {integer} DEFAULT '0' NOT NULL, - label_location {integer} DEFAULT '0' NOT NULL, + sysmapid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(128) DEFAULT '' NOT NULL, + width integer DEFAULT '0' NOT NULL, + height integer DEFAULT '0' NOT NULL, + backgroundid bigint unsigned DEFAULT '0' NOT NULL, + label_type integer DEFAULT '0' NOT NULL, + label_location integer DEFAULT '0' NOT NULL, PRIMARY KEY (sysmapid) -) {create_table_opt}; - -CREATE INDEX sysmaps_1 ON sysmaps (name); +); +CREATE INDEX sysmaps_1 on sysmaps (name); CREATE TABLE config ( - configid {bigint} DEFAULT '0' NOT NULL, - alert_history {integer} DEFAULT '0' NOT NULL, - event_history {integer} DEFAULT '0' NOT NULL, - refresh_unsupported {integer} DEFAULT '0' NOT NULL, - work_period {varchar}(100) DEFAULT '1-5,00:00-24:00' NOT NULL, + configid bigint unsigned DEFAULT '0' NOT NULL, + alert_history integer DEFAULT '0' NOT NULL, + event_history integer DEFAULT '0' NOT NULL, + refresh_unsupported integer DEFAULT '0' NOT NULL, + work_period varchar(100) DEFAULT '1-5,00:00-24:00' NOT NULL, PRIMARY KEY (configid) -) {create_table_opt}; - +); CREATE TABLE groups ( - groupid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(64) DEFAULT '' NOT NULL, + groupid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(64) DEFAULT '' NOT NULL, PRIMARY KEY (groupid) -) {create_table_opt}; - -CREATE INDEX groups_1 ON groups (name); +); +CREATE INDEX groups_1 on groups (name); CREATE TABLE hosts_groups ( - hostgroupid {bigint} DEFAULT '0' NOT NULL, - hostid {bigint} DEFAULT '0' NOT NULL, - groupid {bigint} DEFAULT '0' NOT NULL, + hostgroupid bigint unsigned DEFAULT '0' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, + groupid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (hostgroupid) -) {create_table_opt}; - -CREATE INDEX hosts_groups_1 ON hosts_groups (hostid,groupid); +); +CREATE INDEX hosts_groups_groups_1 on hosts_groups (hostid,groupid); CREATE TABLE alerts ( - alertid {bigint} DEFAULT '0' NOT NULL, - actionid {bigint} DEFAULT '0' NOT NULL, - triggerid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - mediatypeid {bigint} DEFAULT '0' NOT NULL, - sendto {varchar}(100) DEFAULT '' NOT NULL, - subject {varchar}(255) DEFAULT '' NOT NULL, - message {blob} DEFAULT '' NOT NULL, - status {integer} DEFAULT '0' NOT NULL, - retries {integer} DEFAULT '0' NOT NULL, - error {varchar}(128) DEFAULT '' NOT NULL, - repeats {integer} DEFAULT '0' NOT NULL, - maxrepeats {integer} DEFAULT '0' NOT NULL, - nextcheck {integer} DEFAULT '0' NOT NULL, - delay {integer} DEFAULT '0' NOT NULL, - + alertid bigint unsigned DEFAULT '0' NOT NULL, + actionid bigint unsigned DEFAULT '0' NOT NULL, + triggerid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + mediatypeid bigint unsigned DEFAULT '0' NOT NULL, + sendto varchar(100) DEFAULT '' NOT NULL, + subject varchar(255) DEFAULT '' NOT NULL, + message blob DEFAULT '' NOT NULL, + status integer DEFAULT '0' NOT NULL, + retries integer DEFAULT '0' NOT NULL, + error varchar(128) DEFAULT '' NOT NULL, + repeats integer DEFAULT '0' NOT NULL, + maxrepeats integer DEFAULT '0' NOT NULL, + nextcheck integer DEFAULT '0' NOT NULL, + delay integer DEFAULT '0' NOT NULL, PRIMARY KEY (alertid) -) {create_table_opt}; - -CREATE INDEX alerts_1 ON alerts (actionid); -CREATE INDEX alerts_2 ON alerts (clock); -CREATE INDEX alerts_3 ON alerts (triggerid); -CREATE INDEX alerts_4 ON alerts (status, retries); -CREATE INDEX alerts_5 ON alerts (mediatypeid); -CREATE INDEX alerts_6 ON alerts (userid); +); +CREATE INDEX alerts_1 on alerts (actionid); +CREATE INDEX alerts_2 on alerts (clock); +CREATE INDEX alerts_3 on alerts (triggerid); +CREATE INDEX alerts_4 on alerts (status,retries); +CREATE INDEX alerts_5 on alerts (mediatypeid); +CREATE INDEX alerts_6 on alerts (userid); CREATE TABLE actions ( - actionid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - subject {varchar}(255) DEFAULT '' NOT NULL, - message {blob} DEFAULT '' NOT NULL, - recipient {integer} DEFAULT '0' NOT NULL, - maxrepeats {integer} DEFAULT '0' NOT NULL, - repeatdelay {integer} DEFAULT '600' NOT NULL, - source {integer} DEFAULT '0' NOT NULL, - actiontype {integer} DEFAULT '0' NOT NULL, - status {integer} DEFAULT '0' NOT NULL, - scripts {blob} DEFAULT '' NOT NULL, + actionid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + subject varchar(255) DEFAULT '' NOT NULL, + message blob DEFAULT '' NOT NULL, + recipient integer DEFAULT '0' NOT NULL, + maxrepeats integer DEFAULT '0' NOT NULL, + repeatdelay integer DEFAULT '600' NOT NULL, + source integer DEFAULT '0' NOT NULL, + actiontype integer DEFAULT '0' NOT NULL, + status integer DEFAULT '0' NOT NULL, + scripts blob DEFAULT '' NOT NULL, PRIMARY KEY (actionid) -) {create_table_opt}; - +); CREATE TABLE conditions ( - conditionid {bigint} DEFAULT '0' NOT NULL, - actionid {bigint} DEFAULT '0' NOT NULL, - conditiontype {integer} DEFAULT '0' NOT NULL, - operator {integer} DEFAULT '0' NOT NULL, - value {varchar}(255) DEFAULT '' NOT NULL, + conditionid bigint unsigned DEFAULT '0' NOT NULL, + actionid bigint unsigned DEFAULT '0' NOT NULL, + conditiontype integer DEFAULT '0' NOT NULL, + operator integer DEFAULT '0' NOT NULL, + value varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (conditionid) -) {create_table_opt}; - -CREATE INDEX conditions_1 ON conditions (actionid); +); +CREATE INDEX conditions_1 on conditions (actionid); CREATE TABLE events ( - eventid {bigint} DEFAULT '0' NOT NULL, - triggerid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {integer} DEFAULT '0' NOT NULL, - acknowledged {integer} DEFAULT '0' NOT NULL, + eventid bigint unsigned DEFAULT '0' NOT NULL, + triggerid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value integer DEFAULT '0' NOT NULL, + acknowledged integer DEFAULT '0' NOT NULL, PRIMARY KEY (eventid) -) {create_table_opt}; - -CREATE INDEX events_1 ON events (triggerid,clock); -CREATE INDEX events_2 ON events (clock); +); +CREATE INDEX events_1 on events (triggerid,clock); +CREATE INDEX events_2 on events (clock); CREATE TABLE functions ( - functionid {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - triggerid {bigint} DEFAULT '0' NOT NULL, - lastvalue {varchar}(255), - function {varchar}(12) DEFAULT '' NOT NULL, - parameter {varchar}(255) DEFAULT '0' NOT NULL, + functionid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + triggerid bigint unsigned DEFAULT '0' NOT NULL, + lastvalue varchar(255) , + function varchar(12) DEFAULT '' NOT NULL, + parameter varchar(255) DEFAULT '0' NOT NULL, PRIMARY KEY (functionid) -) {create_table_opt}; - -CREATE INDEX functions_1 ON functions (triggerid); -CREATE INDEX functions_2 ON functions (itemid,function,parameter); +); +CREATE INDEX functions_1 on functions (triggerid); +CREATE INDEX functions_2 on functions (itemid,function,parameter); CREATE TABLE history ( - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {double}(16,4) DEFAULT '0.0000' NOT NULL -) {create_table_opt}; - -CREATE INDEX history_1 ON history (itemid, clock); + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value double(16,4) DEFAULT '0.0000' NOT NULL +); +CREATE INDEX history_1 on history (itemid,clock); CREATE TABLE history_sync ( - id {serial}, - nodeid {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {double}(16,4) DEFAULT '0.0000' NOT NULL, + id serial , + nodeid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value double(16,4) DEFAULT '0.0000' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX history_sync_1 ON history_sync (nodeid, id); +); +CREATE INDEX history_sync_1 on history_sync (nodeid,id); CREATE TABLE history_uint ( - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {bigint} DEFAULT '0' NOT NULL -) {create_table_opt}; - -CREATE INDEX history_uint_1 ON history_uint (itemid, clock); + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value bigint unsigned DEFAULT '0' NOT NULL +); +CREATE INDEX history_uint_1 on history_uint (itemid,clock); CREATE TABLE history_uint_sync ( - id {serial}, - nodeid {integer} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {bigint} DEFAULT '0' NOT NULL, + id serial , + nodeid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX history_uint_sync_1 ON history_uint_sync (nodeid, id); +); +CREATE INDEX history_uint_sync_1 on history_uint_sync (nodeid,id); CREATE TABLE history_str ( - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {varchar}(255) DEFAULT '' NOT NULL -) {create_table_opt}; - -CREATE INDEX history_str_1 ON history_str (itemid, clock); + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value varchar(255) DEFAULT '' NOT NULL +); +CREATE INDEX history_str_1 on history_str (itemid,clock); CREATE TABLE history_str_sync ( - id {serial}, - nodeid {integer} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {varchar}(255) DEFAULT '' NOT NULL, + id serial , + nodeid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX history_str_sync_1 ON history_str_sync (nodeid, id); +); +CREATE INDEX history_str_sync_1 on history_str_sync (nodeid,id); CREATE TABLE hosts ( - hostid {bigint} DEFAULT '0' NOT NULL, - host {varchar}(64) DEFAULT '' NOT NULL, - useip {integer} DEFAULT '1' NOT NULL, - ip {varchar}(15) DEFAULT '127.0.0.1' NOT NULL, - port {integer} DEFAULT '0' NOT NULL, - status {integer} DEFAULT '0' NOT NULL, - disable_until {integer} DEFAULT '0' NOT NULL, - error {varchar}(128) DEFAULT '' NOT NULL, - available {integer} DEFAULT '0' NOT NULL, - errors_from {integer} DEFAULT '0' NOT NULL, - PRIMARY KEY (hostid) -) {create_table_opt}; - -CREATE INDEX hosts_1 ON hosts (host); -CREATE INDEX hosts_2 ON hosts (status); + hostid bigint unsigned DEFAULT '0' NOT NULL, + host varchar(64) DEFAULT '' NOT NULL, + useip integer DEFAULT '1' NOT NULL, + ip varchar(15) DEFAULT '127.0.0.1' NOT NULL, + port integer DEFAULT '0' NOT NULL, + status integer DEFAULT '0' NOT NULL, + disable_until integer DEFAULT '0' NOT NULL, + error varchar(128) DEFAULT '' NOT NULL, + available integer DEFAULT '0' NOT NULL, + errors_from integer DEFAULT '0' NOT NULL, + PRIMARY KEY (hostid) +); +CREATE INDEX hosts_1 on hosts (host); +CREATE INDEX hosts_2 on hosts (status); CREATE TABLE items ( - itemid {bigint} DEFAULT '0' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, - snmp_community {varchar}(64) DEFAULT '' NOT NULL, - snmp_oid {varchar}(255) DEFAULT '' NOT NULL, - snmp_port {integer} DEFAULT '161' NOT NULL, - hostid {bigint} DEFAULT '0' NOT NULL, - description {varchar}(255) DEFAULT '' NOT NULL, - key_ {varchar}(64) DEFAULT '' NOT NULL, - delay {integer} DEFAULT '0' NOT NULL, - history {integer} DEFAULT '90' NOT NULL, - trends {integer} DEFAULT '365' NOT NULL, - nextcheck {integer} DEFAULT '0' NOT NULL, - lastvalue {varchar}(255) DEFAULT NULL, - lastclock {integer} DEFAULT NULL, - prevvalue {varchar}(255) DEFAULT NULL, - status {integer} DEFAULT '0' NOT NULL, - value_type {integer} DEFAULT '0' NOT NULL, - trapper_hosts {varchar}(255) DEFAULT '' NOT NULL, - units {varchar}(10) DEFAULT '' NOT NULL, - multiplier {integer} DEFAULT '0' NOT NULL, - delta {integer} DEFAULT '0' NOT NULL, - prevorgvalue {double}(16,4) DEFAULT NULL, - snmpv3_securityname {varchar}(64) DEFAULT '' NOT NULL, - snmpv3_securitylevel {integer} DEFAULT '0' NOT NULL, - snmpv3_authpassphrase {varchar}(64) DEFAULT '' NOT NULL, - snmpv3_privpassphrase {varchar}(64) DEFAULT '' NOT NULL, - - formula {varchar}(255) DEFAULT '0' NOT NULL, - error {varchar}(128) DEFAULT '' NOT NULL, - - lastlogsize {integer} DEFAULT '0' NOT NULL, - logtimefmt {varchar}(64) DEFAULT '' NOT NULL, - templateid {bigint} DEFAULT '0' NOT NULL, - valuemapid {bigint} DEFAULT '0' NOT NULL, - delay_flex {varchar}(255) DEFAULT '' NOT NULL, - - PRIMARY KEY (itemid) -) {create_table_opt}; - -CREATE INDEX items_1 ON items (hostid,key_); -CREATE INDEX items_2 ON items (nextcheck); -CREATE INDEX items_3 ON items (status); + itemid bigint unsigned DEFAULT '0' NOT NULL, + type integer DEFAULT '0' NOT NULL, + snmp_community varchar(64) DEFAULT '' NOT NULL, + snmp_oid varchar(255) DEFAULT '' NOT NULL, + snmp_port integer DEFAULT '161' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, + description varchar(255) DEFAULT '' NOT NULL, + key_ varchar(64) DEFAULT '' NOT NULL, + delay integer DEFAULT '0' NOT NULL, + history integer DEFAULT '90' NOT NULL, + trends integer DEFAULT '365' NOT NULL, + nextcheck integer DEFAULT '0' NOT NULL, + lastvalue varchar(255) NULL, + lastclock integer NULL, + prevvalue varchar(255) NULL, + status integer DEFAULT '0' NOT NULL, + value_type integer DEFAULT '0' NOT NULL, + trapper_hosts varchar(255) DEFAULT '' NOT NULL, + units varchar(10) DEFAULT '' NOT NULL, + multiplier integer DEFAULT '0' NOT NULL, + delta integer DEFAULT '0' NOT NULL, + prevorgvalue double(16,4) NULL, + snmpv3_securityname varchar(64) DEFAULT '' NOT NULL, + snmpv3_securitylevel integer DEFAULT '0' NOT NULL, + snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL, + snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL, + formula varchar(255) DEFAULT '0' NOT NULL, + error varchar(128) DEFAULT '' NOT NULL, + lastlogsize integer DEFAULT '0' NOT NULL, + logtimefmt varchar(64) DEFAULT '' NOT NULL, + templateid bigint unsigned DEFAULT '0' NOT NULL, + valuemapid bigint unsigned DEFAULT '0' NOT NULL, + delay_flex varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (itemid) +); +CREATE INDEX items_1 on items (hostid,key_); +CREATE INDEX items_2 on items (nextcheck); +CREATE INDEX items_3 on items (status); CREATE TABLE media ( - mediaid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - mediatypeid {bigint} DEFAULT '0' NOT NULL, - sendto {varchar}(100) DEFAULT '' NOT NULL, - active {integer} DEFAULT '0' NOT NULL, - severity {integer} DEFAULT '63' NOT NULL, - period {varchar}(100) DEFAULT '1-7,00:00-23:59' NOT NULL, - PRIMARY KEY (mediaid) -) {create_table_opt}; - -CREATE INDEX media_1 ON media (userid); -CREATE INDEX media_2 ON media (mediatypeid); + mediaid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + mediatypeid bigint unsigned DEFAULT '0' NOT NULL, + sendto varchar(100) DEFAULT '' NOT NULL, + active integer DEFAULT '0' NOT NULL, + severity integer DEFAULT '63' NOT NULL, + period varchar(100) DEFAULT '1-7,00:00-23:59' NOT NULL, + PRIMARY KEY (mediaid) +); +CREATE INDEX media_1 on media (userid); +CREATE INDEX media_2 on media (mediatypeid); CREATE TABLE media_type ( - mediatypeid {bigint} DEFAULT '0' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, - description {varchar}(100) DEFAULT '' NOT NULL, - smtp_server {varchar}(255) DEFAULT '' NOT NULL, - smtp_helo {varchar}(255) DEFAULT '' NOT NULL, - smtp_email {varchar}(255) DEFAULT '' NOT NULL, - exec_path {varchar}(255) DEFAULT '' NOT NULL, - gsm_modem {varchar}(255) DEFAULT '' NOT NULL, - PRIMARY KEY (mediatypeid) -) {create_table_opt}; - + mediatypeid bigint unsigned DEFAULT '0' NOT NULL, + type integer DEFAULT '0' NOT NULL, + description varchar(100) DEFAULT '' NOT NULL, + smtp_server varchar(255) DEFAULT '' NOT NULL, + smtp_helo varchar(255) DEFAULT '' NOT NULL, + smtp_email varchar(255) DEFAULT '' NOT NULL, + exec_path varchar(255) DEFAULT '' NOT NULL, + gsm_modem varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (mediatypeid) +); CREATE TABLE triggers ( - triggerid {bigint} DEFAULT '0' NOT NULL, - expression {varchar}(255) DEFAULT '' NOT NULL, - description {varchar}(255) DEFAULT '' NOT NULL, - url {varchar}(255) DEFAULT '' NOT NULL, - status {integer} DEFAULT '0' NOT NULL, - value {integer} DEFAULT '0' NOT NULL, - priority {integer} DEFAULT '0' NOT NULL, - lastchange {integer} DEFAULT '0' NOT NULL, - dep_level {integer} DEFAULT '0' NOT NULL, - comments {blob}, - error {varchar}(128) DEFAULT '' NOT NULL, - templateid {bigint} DEFAULT '0' NOT NULL, - PRIMARY KEY (triggerid) -) {create_table_opt}; - -CREATE INDEX triggers_1 ON triggers (status); -CREATE INDEX triggers_2 ON triggers (value); + triggerid bigint unsigned DEFAULT '0' NOT NULL, + expression varchar(255) DEFAULT '' NOT NULL, + description varchar(255) DEFAULT '' NOT NULL, + url varchar(255) DEFAULT '' NOT NULL, + status integer DEFAULT '0' NOT NULL, + value integer DEFAULT '0' NOT NULL, + priority integer DEFAULT '0' NOT NULL, + lastchange integer DEFAULT '0' NOT NULL, + dep_level integer DEFAULT '0' NOT NULL, + comments blob , + error varchar(128) DEFAULT '' NOT NULL, + templateid bigint unsigned DEFAULT '0' NOT NULL, + PRIMARY KEY (triggerid) +); +CREATE INDEX triggers_1 on triggers (status); +CREATE INDEX triggers_2 on triggers (value); CREATE TABLE trigger_depends ( - triggerdepid {bigint} DEFAULT '0' NOT NULL, - triggerid_down {bigint} DEFAULT '0' NOT NULL, - triggerid_up {bigint} DEFAULT '0' NOT NULL, - PRIMARY KEY (triggerdepid) -) {create_table_opt}; - -CREATE INDEX trigger_depends_1 ON trigger_depends (triggerid_down, triggerid_up); -CREATE INDEX trigger_depends_2 ON trigger_depends (triggerid_up); + triggerdepid bigint unsigned DEFAULT '0' NOT NULL, + triggerid_down bigint unsigned DEFAULT '0' NOT NULL, + triggerid_up bigint unsigned DEFAULT '0' NOT NULL, + PRIMARY KEY (triggerdepid) +); +CREATE INDEX trigger_depends_1 on trigger_depends (triggerid_down,triggerid_up); +CREATE INDEX trigger_depends_2 on trigger_depends (triggerid_up); CREATE TABLE users ( - userid {bigint} DEFAULT '0' NOT NULL, - alias {varchar}(100) DEFAULT '' NOT NULL, - name {varchar}(100) DEFAULT '' NOT NULL, - surname {varchar}(100) DEFAULT '' NOT NULL, - passwd {char}(32) DEFAULT '' NOT NULL, - url {varchar}(255) DEFAULT '' NOT NULL, - autologout {integer} DEFAULT '900' NOT NULL, - lang {varchar}(5) DEFAULT 'en_gb' NOT NULL, - refresh {integer} DEFAULT '30' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + alias varchar(100) DEFAULT '' NOT NULL, + name varchar(100) DEFAULT '' NOT NULL, + surname varchar(100) DEFAULT '' NOT NULL, + passwd char(32) DEFAULT '' NOT NULL, + url varchar(255) DEFAULT '' NOT NULL, + autologout integer DEFAULT '900' NOT NULL, + lang varchar(5) DEFAULT 'en_gb' NOT NULL, + refresh integer DEFAULT '30' NOT NULL, + type integer DEFAULT '0' NOT NULL, PRIMARY KEY (userid) -) {create_table_opt}; - -CREATE INDEX users_1 ON users (alias); +); +CREATE INDEX users_1 on users (alias); CREATE TABLE auditlog ( - auditid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - action {integer} DEFAULT '0' NOT NULL, - resourcetype {integer} DEFAULT '0' NOT NULL, - details {varchar}(128) DEFAULT '0' NOT NULL, + auditid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + action integer DEFAULT '0' NOT NULL, + resourcetype integer DEFAULT '0' NOT NULL, + details varchar(128) DEFAULT '0' NOT NULL, PRIMARY KEY (auditid) -) {create_table_opt}; - -CREATE INDEX auditlog_1 ON auditlog (userid,clock); -CREATE INDEX auditlog_2 ON auditlog (clock); +); +CREATE INDEX auditlog_1 on auditlog (userid,clock); +CREATE INDEX auditlog_2 on auditlog (clock); CREATE TABLE sessions ( - sessionid {varchar}(32) NOT NULL DEFAULT '', - userid {bigint} NOT NULL DEFAULT '0', - lastaccess {integer} NOT NULL DEFAULT '0', + sessionid varchar(32) DEFAULT '' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + lastaccess integer DEFAULT '0' NOT NULL, PRIMARY KEY (sessionid) -) {create_table_opt}; - +); CREATE TABLE rights ( - rightid {bigint} DEFAULT '0' NOT NULL, - groupid {bigint} DEFAULT '0' NOT NULL, - type {integer} DEFAULT '0' NOT NULL, - permission {integer} DEFAULT '0' NOT NULL, - id {bigint}, + rightid bigint unsigned DEFAULT '0' NOT NULL, + groupid bigint unsigned DEFAULT '0' NOT NULL, + type integer DEFAULT '0' NOT NULL, + permission integer DEFAULT '0' NOT NULL, + id bigint unsigned , PRIMARY KEY (rightid) -) {create_table_opt}; - -CREATE INDEX rights_1 ON rights (groupid); +); +CREATE INDEX rights_1 on rights (groupid); CREATE TABLE service_alarms ( - servicealarmid {bigint} DEFAULT '0' NOT NULL, - serviceid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {integer} DEFAULT '0' NOT NULL, + servicealarmid bigint unsigned DEFAULT '0' NOT NULL, + serviceid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value integer DEFAULT '0' NOT NULL, PRIMARY KEY (servicealarmid) -) {create_table_opt}; - -CREATE INDEX service_alarms_1 ON service_alarms (serviceid,clock); -CREATE INDEX service_alarms_2 ON service_alarms (clock); +); +CREATE INDEX service_alarms_1 on service_alarms (serviceid,clock); +CREATE INDEX service_alarms_2 on service_alarms (clock); CREATE TABLE profiles ( - profileid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - idx {varchar}(64) DEFAULT '' NOT NULL, - value {varchar}(255) DEFAULT '' NOT NULL, - valuetype {integer} DEFAULT 0 NOT NULL, + profileid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + idx varchar(64) DEFAULT '' NOT NULL, + value varchar(255) DEFAULT '' NOT NULL, + valuetype integer DEFAULT 0 NOT NULL, PRIMARY KEY (profileid) -) {create_table_opt}; - -CREATE INDEX profiles_1 ON profiles (userid,idx); +); +CREATE INDEX profiles_1 on profiles (userid,idx); CREATE TABLE screens ( - screenid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(255) DEFAULT 'Screen' NOT NULL, - hsize {integer} DEFAULT '1' NOT NULL, - vsize {integer} DEFAULT '1' NOT NULL, - PRIMARY KEY (screenid) -) {create_table_opt}; - + screenid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(255) DEFAULT 'Screen' NOT NULL, + hsize integer DEFAULT '1' NOT NULL, + vsize integer DEFAULT '1' NOT NULL, + PRIMARY KEY (screenid) +); CREATE TABLE screens_items ( - screenitemid {bigint} DEFAULT '0' NOT NULL, - screenid {bigint} DEFAULT '0' NOT NULL, - resourcetype {integer} DEFAULT '0' NOT NULL, - resourceid {bigint} DEFAULT '0' NOT NULL, - width {integer} DEFAULT '320' NOT NULL, - height {integer} DEFAULT '200' NOT NULL, - x {integer} DEFAULT '0' NOT NULL, - y {integer} DEFAULT '0' NOT NULL, - colspan {integer} DEFAULT '0' NOT NULL, - rowspan {integer} DEFAULT '0' NOT NULL, - elements {integer} DEFAULT '25' NOT NULL, - valign {integer} DEFAULT '0' NOT NULL, - halign {integer} DEFAULT '0' NOT NULL, - style {integer} DEFAULT '0' NOT NULL, - url {varchar}(255) DEFAULT '' NOT NULL, - PRIMARY KEY (screenitemid) -) {create_table_opt}; - + screenitemid bigint unsigned DEFAULT '0' NOT NULL, + screenid bigint unsigned DEFAULT '0' NOT NULL, + resourcetype integer DEFAULT '0' NOT NULL, + resourceid bigint unsigned DEFAULT '0' NOT NULL, + width integer DEFAULT '320' NOT NULL, + height integer DEFAULT '200' NOT NULL, + x integer DEFAULT '0' NOT NULL, + y integer DEFAULT '0' NOT NULL, + colspan integer DEFAULT '0' NOT NULL, + rowspan integer DEFAULT '0' NOT NULL, + elements integer DEFAULT '25' NOT NULL, + valign integer DEFAULT '0' NOT NULL, + halign integer DEFAULT '0' NOT NULL, + style integer DEFAULT '0' NOT NULL, + url varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (screenitemid) +); CREATE TABLE usrgrp ( - usrgrpid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(64) DEFAULT '' NOT NULL, + usrgrpid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(64) DEFAULT '' NOT NULL, PRIMARY KEY (usrgrpid) -) {create_table_opt}; - -CREATE INDEX usrgrp_1 ON usrgrp (name); +); +CREATE INDEX usrgrp_1 on usrgrp (name); CREATE TABLE users_groups ( - id {bigint} DEFAULT '0' NOT NULL, - usrgrpid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, + id bigint unsigned DEFAULT '0' NOT NULL, + usrgrpid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX users_groups_1 ON users_groups (usrgrpid,userid); +); +CREATE INDEX users_groups_1 on users_groups (usrgrpid,userid); CREATE TABLE trends ( - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - num {integer} DEFAULT '0' NOT NULL, - value_min {double}(16,4) DEFAULT '0.0000' NOT NULL, - value_avg {double}(16,4) DEFAULT '0.0000' NOT NULL, - value_max {double}(16,4) DEFAULT '0.0000' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + num integer DEFAULT '0' NOT NULL, + value_min double(16,4) DEFAULT '0.0000' NOT NULL, + value_avg double(16,4) DEFAULT '0.0000' NOT NULL, + value_max double(16,4) DEFAULT '0.0000' NOT NULL, PRIMARY KEY (itemid,clock) -) {create_table_opt}; - +); CREATE TABLE images ( - imageid {bigint} DEFAULT '0' NOT NULL, - imagetype {integer} DEFAULT '0' NOT NULL, - name {varchar}(64) DEFAULT '0' NOT NULL, - image {image_type} DEFAULT '' NOT NULL, + imageid bigint unsigned DEFAULT '0' NOT NULL, + imagetype integer DEFAULT '0' NOT NULL, + name varchar(64) DEFAULT '0' NOT NULL, + image longblob DEFAULT '' NOT NULL, PRIMARY KEY (imageid) -) {create_table_opt}; - -CREATE INDEX images_1 ON images (imagetype, name); +); +CREATE INDEX images_1 on images (imagetype,name); CREATE TABLE hosts_templates ( - hosttemplateid {bigint} DEFAULT '0' NOT NULL, - hostid {bigint} DEFAULT '0' NOT NULL, - templateid {bigint} DEFAULT '0' NOT NULL, + hosttemplateid bigint unsigned DEFAULT '0' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, + templateid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (hosttemplateid) -) {create_table_opt}; - -CREATE INDEX hosts_templates_1 ON hosts_templates (hostid, templateid); +); +CREATE INDEX hosts_templates_1 on hosts_templates (hostid,templateid); CREATE TABLE history_log ( - id {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - timestamp {integer} DEFAULT '0' NOT NULL, - source {varchar}(64) DEFAULT '' NOT NULL, - severity {integer} DEFAULT '0' NOT NULL, - value {history_log_type} DEFAULT '' NOT NULL, + id bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + timestamp integer DEFAULT '0' NOT NULL, + source varchar(64) DEFAULT '' NOT NULL, + severity integer DEFAULT '0' NOT NULL, + value text DEFAULT '' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX history_log_1 ON history_log (itemid, clock); +); +CREATE INDEX history_log_1 on history_log (itemid,clock); CREATE TABLE history_text ( - id {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - value {history_text_type} DEFAULT '' NOT NULL, + id bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + value text DEFAULT '' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - -CREATE INDEX history_text_1 ON history_text (itemid, clock); +); +CREATE INDEX history_text_1 on history_text (itemid,clock); CREATE TABLE hosts_profiles ( - hostid {bigint} DEFAULT '0' NOT NULL, - devicetype {varchar}(64) DEFAULT '' NOT NULL, - name {varchar}(64) DEFAULT '' NOT NULL, - os {varchar}(64) DEFAULT '' NOT NULL, - serialno {varchar}(64) DEFAULT '' NOT NULL, - tag {varchar}(64) DEFAULT '' NOT NULL, - macaddress {varchar}(64) DEFAULT '' NOT NULL, - hardware {blob} DEFAULT '' NOT NULL, - software {blob} DEFAULT '' NOT NULL, - contact {blob} DEFAULT '' NOT NULL, - location {blob} DEFAULT '' NOT NULL, - notes {blob} DEFAULT '' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, + devicetype varchar(64) DEFAULT '' NOT NULL, + name varchar(64) DEFAULT '' NOT NULL, + os varchar(64) DEFAULT '' NOT NULL, + serialno varchar(64) DEFAULT '' NOT NULL, + tag varchar(64) DEFAULT '' NOT NULL, + macaddress varchar(64) DEFAULT '' NOT NULL, + hardware blob DEFAULT '' NOT NULL, + software blob DEFAULT '' NOT NULL, + contact blob DEFAULT '' NOT NULL, + location blob DEFAULT '' NOT NULL, + notes blob DEFAULT '' NOT NULL, PRIMARY KEY (hostid) -) {create_table_opt}; - +); CREATE TABLE autoreg ( - id {bigint} DEFAULT '0' NOT NULL, - priority {integer} DEFAULT '0' NOT NULL, - pattern {varchar}(255) DEFAULT '' NOT NULL, - hostid {bigint} DEFAULT '0' NOT NULL, + id bigint unsigned DEFAULT '0' NOT NULL, + priority integer DEFAULT '0' NOT NULL, + pattern varchar(255) DEFAULT '' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (id) -) {create_table_opt}; - +); CREATE TABLE valuemaps ( - valuemapid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(64) DEFAULT '' NOT NULL, + valuemapid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(64) DEFAULT '' NOT NULL, PRIMARY KEY (valuemapid) -) {create_table_opt}; - -CREATE INDEX valuemaps_1 ON valuemaps (name); +); +CREATE INDEX valuemaps_1 on valuemaps (name); CREATE TABLE mappings ( - mappingid {bigint} DEFAULT '0' NOT NULL, - valuemapid {bigint} DEFAULT '0' NOT NULL, - value {varchar}(64) DEFAULT '' NOT NULL, - newvalue {varchar}(64) DEFAULT '' NOT NULL, + mappingid bigint unsigned DEFAULT '0' NOT NULL, + valuemapid bigint unsigned DEFAULT '0' NOT NULL, + value varchar(64) DEFAULT '' NOT NULL, + newvalue varchar(64) DEFAULT '' NOT NULL, PRIMARY KEY (mappingid) -) {create_table_opt}; - -CREATE INDEX mappings_1 ON mappings (valuemapid); +); +CREATE INDEX mappings_1 on mappings (valuemapid); CREATE TABLE housekeeper ( - housekeeperid {bigint} DEFAULT '0' NOT NULL, - tablename {varchar}(64) DEFAULT '' NOT NULL, - field {varchar}(64) DEFAULT '' NOT NULL, - value {integer} DEFAULT '0' NOT NULL, + housekeeperid bigint unsigned DEFAULT '0' NOT NULL, + tablename varchar(64) DEFAULT '' NOT NULL, + field varchar(64) DEFAULT '' NOT NULL, + value integer DEFAULT '0' NOT NULL, PRIMARY KEY (housekeeperid) -) {create_table_opt}; - +); CREATE TABLE acknowledges ( - acknowledgeid {bigint} DEFAULT '0' NOT NULL, - userid {bigint} DEFAULT '0' NOT NULL, - eventid {bigint} DEFAULT '0' NOT NULL, - clock {integer} DEFAULT '0' NOT NULL, - message {varchar}(255) DEFAULT '' NOT NULL, + acknowledgeid bigint unsigned DEFAULT '0' NOT NULL, + userid bigint unsigned DEFAULT '0' NOT NULL, + eventid bigint unsigned DEFAULT '0' NOT NULL, + clock integer DEFAULT '0' NOT NULL, + message varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (acknowledgeid) -) {create_table_opt}; - -CREATE INDEX acknowledges_1 ON acknowledges (userid); -CREATE INDEX acknowledges_2 ON acknowledges (eventid); -CREATE INDEX acknowledges_3 ON acknowledges (clock); +); +CREATE INDEX acknowledges_1 on acknowledges (userid); +CREATE INDEX acknowledges_2 on acknowledges (eventid); +CREATE INDEX acknowledges_3 on acknowledges (clock); CREATE TABLE applications ( - applicationid {bigint} DEFAULT '0' NOT NULL, - hostid {bigint} DEFAULT '0' NOT NULL, - name {varchar}(255) DEFAULT '' NOT NULL, - templateid {bigint} DEFAULT '0' NOT NULL, - PRIMARY KEY (applicationid) -) {create_table_opt}; - -CREATE INDEX applications_1 ON applications (templateid); -CREATE INDEX applications_2 ON applications (hostid,name); + applicationid bigint unsigned DEFAULT '0' NOT NULL, + hostid bigint unsigned DEFAULT '0' NOT NULL, + name varchar(255) DEFAULT '' NOT NULL, + templateid bigint unsigned DEFAULT '0' NOT NULL, + PRIMARY KEY (applicationid) +); +CREATE INDEX applications_1 on applications (templateid); +CREATE INDEX applications_2 on applications (hostid,name); CREATE TABLE items_applications ( - itemappid {bigint} DEFAULT '0' NOT NULL, - applicationid {bigint} DEFAULT '0' NOT NULL, - itemid {bigint} DEFAULT '0' NOT NULL, + itemappid bigint unsigned DEFAULT '0' NOT NULL, + applicationid bigint unsigned DEFAULT '0' NOT NULL, + itemid bigint unsigned DEFAULT '0' NOT NULL, PRIMARY KEY (itemappid) -) {create_table_opt}; - -CREATE INDEX items_applications_1 ON items_applications (applicationid,itemid); +); +CREATE INDEX items_applications_1 on items_applications (applicationid,itemid); CREATE TABLE help_items ( - itemtype {integer} DEFAULT '0' NOT NULL, - key_ {varchar}(64) DEFAULT '' NOT NULL, - description {varchar}(255) DEFAULT '' NOT NULL, - PRIMARY KEY (itemtype, key_) -) {create_table_opt}; + itemtype integer DEFAULT '0' NOT NULL, + key_ varchar(64) DEFAULT '' NOT NULL, + description varchar(255) DEFAULT '' NOT NULL, + PRIMARY KEY (itemtype,key_) +); diff --git a/frontends/php/exp_imp.php b/frontends/php/exp_imp.php new file mode 100644 index 00000000..f873ea8e --- /dev/null +++ b/frontends/php/exp_imp.php @@ -0,0 +1,216 @@ +<?php +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php + require_once "include/config.inc.php"; + require_once "include/forms.inc.php"; + + $page["title"] = "S_EXPORT_IMPORT"; + $page["file"] = "exp_imp.php"; + +include_once "include/page_header.php"; + + insert_confirm_javascript(); +?> +<?php + $fields=array( +// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION + "config"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1,2"), null), /* 0 - export, 1 - import, 2 - import hostlist */ + + "groupid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + "hosts"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + "items"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + "triggers"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + "graphs"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null), + + "update"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null) + /*, + "screens"=> array(T_ZBX_INT, O_OPT, null, DB_ID, null) */ +/* actions */ + ); + + check_fields($fields); + + $config = get_request('config', 0); + + validate_group(PERM_READ_ONLY); +?> +<?php + switch($config) + { + case 2: + $title = S_IMPORT_HOSTS_BIG; + $frm_title = S_IMPORT_HOSTS; + break; + case 1: + $title = S_IMPORT_BIG; + $frm_title = S_IMPORT; + break; + case 0: + default: + $title = S_EXPORT_BIG; + $frm_title = S_EXPORT; + } + + $form = new CForm(); + $cmbConfig = new CComboBox('config', $config, 'submit()'); + $cmbConfig->AddItem(0, S_EXPORT); + $cmbConfig->AddItem(1, S_IMPORT); + $cmbConfig->AddItem(2, S_IMPORT_HOSTS); + $form->AddItem($cmbConfig); + + show_table_header($title, $form); + echo BR; + + if($config == 1 || $config == 2) + { + $form = new CFormTable($frm_title,null,'post'); + $form->AddVar('config', $config); + $form->AddRow(S_IMPORT_FILE, new CFile('import')); + $form->AddItemToBottomRow(new CButton('import', S_IMPORT)); + $form->Show(); + } + else + { + $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,null,null,$ZBX_CURNODEID); + + $cmbGroups = new CComboBox("groupid",get_request("groupid",0),"submit()"); + $cmbGroups->AddItem(0,S_ALL_SMALL); + $result=DBselect("select distinct g.groupid,g.name from groups g,hosts_groups hg,hosts h". + " where h.hostid in (".$available_hosts.") ". + " and g.groupid=hg.groupid and h.hostid=hg.hostid". + " order by g.name"); + while($row=DBfetch($result)) + { + $cmbGroups->AddItem($row["groupid"],$row["name"]); + if($row["groupid"] == $_REQUEST["groupid"]) $correct_host = 1; + } + if(!isset($correct_host)) + { + unset($_REQUEST["groupid"]); + $cmbGroups->SetValue(0); + } + + $header =& get_table_header(S_HOSTS_BIG, array(S_GROUP.SPACE, $cmbGroups)); + + /* table HOSTS */ + $update = get_request('update', null); + + $form = new CForm(null,'post'); + $form->SetName('hosts'); + $form->AddVar("config",$config); + $form->AddVar('update', true); + $form->AddItem($header); + + $table = new CTableInfo(S_NO_HOSTS_DEFINED); + $table->SetHeader(array( + S_NAME, + S_IP, + S_PORT, + S_STATUS, + S_ITEMS, + S_TRIGGERS, + S_GRAPHS + /*, + S_SCREENS */ + )); + + $sql = "select h.* from"; + if(isset($_REQUEST["groupid"])) + { + $sql .= " hosts h,hosts_groups hg where"; + $sql .= " hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid and"; + } else $sql .= " hosts h where"; + $sql .= " h.hostid in (".$available_hosts.") ". + " order by h.host"; + + $result=DBselect($sql); + + while($row=DBfetch($result)) + { + $host=new CCol(array( + new CCheckBox('hosts['.$row['hostid'].']', + isset($_REQUEST['hosts'][$row['hostid']]) || !isset($update), + NULL,true), + SPACE, + $row["host"] + )); + + if($row["status"] == HOST_STATUS_MONITORED){ + $status=new CSpan(S_MONITORED, "off"); + } else if($row["status"] == HOST_STATUS_NOT_MONITORED) { + $status=new CLink(S_NOT_MONITORED, "on"); + } else if($row["status"] == HOST_STATUS_TEMPLATE) + $status=new CCol(S_TEMPLATE,"unknown"); + else if($row["status"] == HOST_STATUS_DELETED) + $status=new CCol(S_DELETED,"unknown"); + else + $status=S_UNKNOWN; + + $items = DBfetch(DBselect('select count(itemid) as cnt from items where hostid='.$row['hostid'])); + $triggers['cnt'] = 0; + $db_triggers = DBselect('select f.triggerid, i.hostid, count(distinct i.hostid) as cnt from functions f, items i '. + ' where f.itemid=i.itemid group by f.triggerid'); + while($db_tr = DBfetch($db_triggers)) if($db_tr['cnt'] == 1 && $db_tr['hostid'] == $row['hostid']) $triggers['cnt']++; + + $graphs['cnt'] = 0; + $db_graphs = DBselect('select gi.graphid, i.hostid, count(distinct i.hostid) as cnt from graphs_items gi, items i '. + ' where gi.itemid=i.itemid group by gi.graphid'); + while($db_tr = DBfetch($db_graphs)) if($db_tr['cnt'] == 1 && $db_tr['hostid'] == $row['hostid']) $graphs['cnt']++; + + /* $screens['cnt'] = 3; */ + + $table->AddRow(array( + $host, + $row["useip"]==1 ? $row["ip"] : "-", + $row["port"], + $status, + array(new CCheckBox('items['.$row['hostid'].']', + isset($_REQUEST['items'][$row['hostid']]) || !isset($update), + NULL,true), + $items['cnt']), + array(new CCheckBox('triggers['.$row['hostid'].']', + isset($_REQUEST['triggers'][$row['hostid']]) || !isset($update), + NULL,true), + $triggers['cnt']), + array(new CCheckBox('graphs['.$row['hostid'].']', + isset($_REQUEST['graphs'][$row['hostid']]) || !isset($update), + NULL,true), + $graphs['cnt']) + /*, + array(new CCheckBox('screens['.$row['hostid'].']', + isset($_REQUEST['screens'][$row['hostid']]) || !isset($update), + NULL,true), + $screens['cnt'])*/ + )); + $table->SetFooter(new CCol(new CButton('export', S_EXPORT))); + } + + $form->AddItem($table); + + $form->Show(); + } + +?> +<?php + +include_once "include/page_footer.php" + +?> diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index 22f2774b..53b4244c 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -616,11 +616,11 @@ include_once "include/page_header.php"; else $error = new CCol($row["error"],"on"); $show = array( - new CLink(S_ITEMS,"items.php?hostid=".$row["hostid"]), + new CLink(S_ITEMS,"items.php?hostid=".$row["hostid"],'action'), SPACE.":".SPACE, - new CLink(S_TRIGGERS,"triggers.php?hostid=".$row["hostid"]), + new CLink(S_TRIGGERS,"triggers.php?hostid=".$row["hostid"],'action'), SPACE.":".SPACE, - new CLink(S_GRAPHS,"graphs.php?hostid=".$row["hostid"]) + new CLink(S_GRAPHS,"graphs.php?hostid=".$row["hostid"],'action') ); $table->addRow(array( diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index a59214ee..56befd92 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -915,12 +915,18 @@ else " work_period=".zbx_dbstr($work_period)); } - function show_table_header($col1, $col2=SPACE) + function &get_table_header($col1, $col2=SPACE) { $table = new CTable(NULL,"header"); $table->SetCellSpacing(0); $table->SetCellPadding(1); $table->AddRow(array(new CCol($col1,"header_l"), new CCol($col2,"header_r"))); + return $table; + } + + function show_table_header($col1, $col2=SPACE) + { + $table =& get_table_header($col1, $col2); $table->Show(); } diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 83d465e6..c35b82a8 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -2316,25 +2316,19 @@ if($resourcetype == SCREEN_RESOURCE_GRAPH) { // User-defined graph - $result = DBselect("select distinct g.graphid,g.name,n.name as node_name ". - " from graphs g, nodes n, graphs_items gi, items i, hosts h ". - " where n.nodeid=".DBid2nodeid("g.graphid")." and g.graphid=gi.graphid ". - " and gi.itemid=i.itemid and h.hostid=i.hostid". - " and i.hostid not in (".get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT).")". - " order by node_name,host,name,graphid"); + $result = DBselect("select g.graphid,g.name,n.name as node_name, h.host". + " from graphs g left join graphs_items gi on g.graphid=gi.graphid left join items i on gi.itemid=i.itemid ". + " left join hosts h on h.hostid=i.hostid left join nodes n on n.nodeid=".DBid2nodeid("g.graphid"). + " where i.hostid not in (".get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT).")". + " group by graphid,name,node_name". + " order by node_name,host,name,graphid" + ); $cmbGraphs = new CComboBox("resourceid",$resourceid); while($row=DBfetch($result)) { - $db_host = DBfetch(get_hosts_by_graphid($row["graphid"])); - if($db_host) - { - $name = "(".$row["node_name"].") ".$db_host["host"].":".$row["name"]; - } - else - { - $name = $row["name"]; - } + $row["node_name"] = isset($row["node_name"]) ? "(".$row["node_name"].") " : ''; + $name = $row["node_name"].$row["host"].":".$row["name"]; $cmbGraphs->AddItem($row["graphid"],$name); } diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index 8b1ff8e7..0d5a3ecc 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -27,6 +27,17 @@ "S_DATE_FORMAT_YMD"=> "d M Y", "S_HTML_CHARSET"=> "iso-8859-1", +// exp_imp.php + "S_EXPORT_IMPORT"=> "Export/Import", + "S_IMPORT_FILE"=> "Import file", + "S_IMPORT"=> "Import", + "S_IMPORT_BIG"=> "IMPORT", + "S_IMPORT_HOSTS"=> "Import hosts", + "S_IMPORT_HOSTS_BIG"=> "IMPORT HOSTS", + "S_EXPORT"=> "Export", + "S_EXPORT_FILE"=> "Export file", + "S_EXPORT_BIG"=> "EXPORT", + // admin.php "S_PREVIOUS"=> "<< Previous", "S_NEXT"=> "Next >>", diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php index a5e96b7b..0fd17254 100644 --- a/frontends/php/include/page_header.php +++ b/frontends/php/include/page_header.php @@ -191,6 +191,7 @@ COpt::profiling_start("page"); "sub_pages"=>array("screenedit.php") ), array("url"=>"services.php" ,"label"=>S_IT_SERVICES ), + array("url"=>"exp_imp.php" ,"label"=>S_EXPORT_IMPORT ), array("url"=>"bulkloader.php" ,"label"=>S_MENU_BULKLOADER ), array("url"=>"popup.php") ) |