1CREATE INDEX actions_1 on actions (eventsource,status);
2CREATE TABLE auditlog_details (
3        auditdetailid           bigint          DEFAULT '0'     NOT NULL,
4        auditid         bigint          DEFAULT '0'     NOT NULL,
5        table_name              varchar(64)             DEFAULT ''      NOT NULL,
6        field_name              varchar(64)             DEFAULT ''      NOT NULL,
7        oldvalue                text            DEFAULT ''      NOT NULL,
8        newvalue                text            DEFAULT ''      NOT NULL,
9        PRIMARY KEY (auditdetailid)
10) with OIDS;
11CREATE INDEX auditlog_details_1 on auditlog_details (auditid);
12alter table auditlog add       ip              varchar(39)             DEFAULT ''      NOT NULL;
13alter table auditlog add        resourceid              bigint          DEFAULT '0'     NOT NULL;
14alter table auditlog add        resourcename            varchar(255)            DEFAULT ''      NOT NULL;
15CREATE TABLE autoreg_host (
16        autoreg_hostid          bigint          DEFAULT '0'     NOT NULL,
17        proxy_hostid            bigint          DEFAULT '0'     NOT NULL,
18        host            varchar(64)             DEFAULT ''      NOT NULL,
19        PRIMARY KEY (autoreg_hostid)
20) with OIDS;
21CREATE UNIQUE INDEX autoreg_host_1 on autoreg_host (proxy_hostid,host);
22alter table config add dropdown_first_entry            integer         DEFAULT '1'     NOT NULL;
23alter table config add dropdown_first_remember         integer         DEFAULT '1'     NOT NULL;
24alter table config add discovery_groupid               bigint          DEFAULT '0'     NOT NULL;
25alter table config add max_in_table            integer         DEFAULT '50'    NOT NULL;
26alter table config add search_limit            integer         DEFAULT '1000'  NOT NULL;
27alter table dchecks add snmpv3_securityname             varchar(64)             DEFAULT ''      NOT NULL;
28alter table dchecks add snmpv3_securitylevel            integer         DEFAULT '0'     NOT NULL;
29alter table dchecks add snmpv3_authpassphrase           varchar(64)             DEFAULT ''      NOT NULL;
30alter table dchecks add snmpv3_privpassphrase           varchar(64)             DEFAULT ''      NOT NULL;
31
32CREATE INDEX dchecks_1 on dchecks (druleid);
33
34alter table dservices add dcheckid                bigint          DEFAULT '0'     NOT NULL;
35alter table dservices add ip              varchar(39)             DEFAULT ''      NOT NULL;
36
37update dservices set ip=(select dhosts.ip from dhosts where dservices.dhostid=dhosts.dhostid);
38
39alter table dhosts drop ip;
40
41CREATE INDEX dhosts_1 on dhosts (druleid);
42alter table drules add unique_dcheckid         bigint          DEFAULT '0'     NOT NULL;
43-- See also dhosts.sql
44
45CREATE UNIQUE INDEX dservices_1 on dservices (dcheckid,type,key_,ip,port);
46CREATE INDEX dservices_2 on dservices (dhostid);
47CREATE INDEX escalations_2 on escalations (status,nextcheck);
48DROP INDEX events_2;
49CREATE INDEX events_2 on events (clock, objectid);
50CREATE TABLE expressions (
51        expressionid            bigint          DEFAULT '0'     NOT NULL,
52        regexpid                bigint          DEFAULT '0'     NOT NULL,
53        expression              varchar(255)            DEFAULT ''      NOT NULL,
54        expression_type         integer         DEFAULT '0'     NOT NULL,
55        exp_delimiter           varchar(1)              DEFAULT ''      NOT NULL,
56        case_sensitive          integer         DEFAULT '0'     NOT NULL,
57        PRIMARY KEY (expressionid)
58) with OIDS;
59CREATE INDEX expressions_1 on expressions (regexpid);
60CREATE TABLE globalmacro (
61        globalmacroid           bigint          DEFAULT '0'     NOT NULL,
62        macro           varchar(64)             DEFAULT ''      NOT NULL,
63        value           varchar(255)            DEFAULT ''      NOT NULL,
64        PRIMARY KEY (globalmacroid)
65) with OIDS;
66CREATE INDEX globalmacro_1 on globalmacro (macro);
67CREATE TABLE graphs_items_tmp (
68        gitemid         bigint          DEFAULT '0'     NOT NULL,
69        graphid         bigint          DEFAULT '0'     NOT NULL,
70        itemid          bigint          DEFAULT '0'     NOT NULL,
71        drawtype                integer         DEFAULT '0'     NOT NULL,
72        sortorder               integer         DEFAULT '0'     NOT NULL,
73        color           varchar(6)              DEFAULT '009600'        NOT NULL,
74        yaxisside               integer         DEFAULT '1'     NOT NULL,
75        calc_fnc                integer         DEFAULT '2'     NOT NULL,
76        type            integer         DEFAULT '0'     NOT NULL,
77        periods_cnt             integer         DEFAULT '5'     NOT NULL,
78        PRIMARY KEY (gitemid)
79) with OIDS;
80
81insert into graphs_items_tmp select gitemid,graphid,itemid,drawtype,sortorder,color,yaxisside,calc_fnc,type,periods_cnt from graphs_items;
82drop table graphs_items;
83alter table graphs_items_tmp rename to graphs_items;
84
85CREATE INDEX graphs_items_1 on graphs_items (itemid);
86CREATE INDEX graphs_items_2 on graphs_items (graphid);
87alter table graphs add ymin_type               integer         DEFAULT '0'     NOT NULL;
88alter table graphs add ymax_type               integer         DEFAULT '0'     NOT NULL;
89alter table graphs add ymin_itemid             bigint          DEFAULT '0'     NOT NULL;
90alter table graphs add ymax_itemid             bigint          DEFAULT '0'     NOT NULL;
91
92update graphs set ymin_type=yaxistype;
93update graphs set ymax_type=yaxistype;
94
95alter table graphs drop yaxistype;
96CREATE TABLE graph_theme (
97        graphthemeid            bigint          DEFAULT '0'     NOT NULL,
98        description             varchar(64)             DEFAULT ''      NOT NULL,
99        theme           varchar(64)             DEFAULT ''      NOT NULL,
100        backgroundcolor         varchar(6)              DEFAULT 'F0F0F0'        NOT NULL,
101        graphcolor              varchar(6)              DEFAULT 'FFFFFF'        NOT NULL,
102        graphbordercolor                varchar(6)              DEFAULT '222222'        NOT NULL,
103        gridcolor               varchar(6)              DEFAULT 'CCCCCC'        NOT NULL,
104        maingridcolor           varchar(6)              DEFAULT 'AAAAAA'        NOT NULL,
105        gridbordercolor         varchar(6)              DEFAULT '000000'        NOT NULL,
106        textcolor               varchar(6)              DEFAULT '202020'        NOT NULL,
107        highlightcolor          varchar(6)              DEFAULT 'AA4444'        NOT NULL,
108        leftpercentilecolor             varchar(6)              DEFAULT '11CC11'        NOT NULL,
109        rightpercentilecolor            varchar(6)              DEFAULT 'CC1111'        NOT NULL,
110        noneworktimecolor               varchar(6)              DEFAULT 'E0E0E0'        NOT NULL,
111        gridview                integer         DEFAULT 1       NOT NULL,
112        legendview              integer         DEFAULT 1       NOT NULL,
113        PRIMARY KEY (graphthemeid)
114) with OIDS;
115CREATE INDEX graph_theme_1 on graph_theme (description);
116CREATE INDEX graph_theme_2 on graph_theme (theme);
117
118INSERT INTO graph_theme VALUES (1,'Original Blue','css_ob.css','F0F0F0','FFFFFF','333333','CCCCCC','AAAAAA','000000','222222','AA4444','11CC11','CC1111','E0E0E0',1,1);
119INSERT INTO graph_theme VALUES (2,'Black & Blue','css_bb.css','333333','0A0A0A','888888','222222','4F4F4F','EFEFEF','0088FF','CC4444','1111FF','FF1111','1F1F1F',1,1);
120alter table groups add internal                integer         DEFAULT '0'     NOT NULL;
121drop table help_items;
122
123CREATE TABLE help_items (
124        itemtype                integer         DEFAULT '0'     NOT NULL,
125        key_            varchar(255)            DEFAULT ''      NOT NULL,
126        description             varchar(255)            DEFAULT ''      NOT NULL,
127        PRIMARY KEY (itemtype,key_)
128) with OIDS;
129
130insert into help_items values (3,'icmpping[<ip>,<count>,<interval>,<size>,<timeout>]','Checks if server is accessible by ICMP ping. 0 - ICMP ping fails. 1 - ICMP ping successful. One of zabbix_server processes performs ICMP pings once per PingerFrequency seconds.');
131insert into help_items values (3,'icmppingloss[<ip>,<count>,<interval>,<size>,<timeout>]','Returns percentage of lost ICMP ping packets.');
132insert into help_items values (3,'icmppingsec[<ip>,<count>,<interval>,<size>,<timeout>,<type>]','Returns ICMP ping response time in seconds. Example: 0.02');
133insert into help_items values (3,'ftp<,port>','Checks if FTP server is running and accepting connections. 0 - FTP server is down. 1 - FTP server is running.');
134insert into help_items values (3,'http<,port>','Checks if HTTP (web) server is running and accepting connections. 0 - HTTP server is down. 1 - HTTP server is running.');
135insert into help_items values (3,'imap<,port>','Checks if IMAP server is running and accepting connections. 0 - IMAP server is down. 1 - IMAP server is running.');
136insert into help_items values (3,'ldap<,port>','Checks if LDAP server is running and accepting connections. 0 - LDAP server is down. 1 - LDAP server is running.');
137insert into help_items values (3,'nntp<,port>','Checks if NNTP server is running and accepting connections. 0 - NNTP server is down. 1 - NNTP server is running.');
138insert into help_items values (3,'ntp<,port>','Checks if NTP server is running and accepting connections. 0 - NTP server is down. 1 - NTP server is running.');
139insert into help_items values (3,'pop<,port>','Checks if POP server is running and accepting connections. 0 - POP server is down. 1 - POP server is running.');
140insert into help_items values (3,'smtp<,port>','Checks if SMTP server is running and accepting connections. 0 - SMTP server is down. 1 - SMTP server is running.');
141insert into help_items values (3,'ssh<,port>','Checks if SSH server is running and accepting connections. 0 - SSH server is down. 1 - SSH server is running.');
142insert into help_items values (3,'tcp,port','Checks if TCP service is running and accepting connections on port. 0 - the service on the port is down. 1 - the service is running.');
143insert into help_items values (3,'ftp_perf<,port>','Checks if FTP server is running and accepting connections. 0 - FTP server is down. Otherwise, number of seconds spent connecting to FTP server.');
144insert into help_items values (3,'http_perf<,port>','Checks if HTTP (web) server is running and accepting connections. 0 - HTTP server is down. Otherwise, number of seconds spent connecting to HTTP server.');
145insert into help_items values (3,'imap_perf<,port>','Checks if IMAP server is running and accepting connections. 0 - IMAP server is down. Otherwise, number of seconds spent connecting to IMAP server.');
146insert into help_items values (3,'ldap_perf<,port>','Checks if LDAP server is running and accepting connections. 0 - LDAP server is down. Otherwise, number of seconds spent connecting to LDAP server.');
147insert into help_items values (3,'nntp_perf<,port>','Checks if NNTP server is running and accepting connections. 0 - NNTP server is down. Otherwise, number of seconds spent connecting to NNTP server.');
148insert into help_items values (3,'ntp_perf<,port>','Checks if NTP server is running and accepting connections. 0 - NTP server is down. Otherwise, number of seconds spent connecting to NTP server.');
149insert into help_items values (3,'pop_perf<,port>','Checks if POP server is running and accepting connections. 0 - POP server is down. Otherwise, number of milliseconds spent connecting to POP server.');
150insert into help_items values (3,'smtp_perf<,port>','Checks if SMTP server is running and accepting connections. 0 - SMTP server is down. Otherwise, number of seconds spent connecting to SMTP server.');
151insert into help_items values (3,'ssh_perf<,port>','Checks if SSH server is running and accepting connections. 0 - SSH server is down. Otherwise, number of seconds spent connecting to SSH server.');
152insert into help_items values (3,'tcp_perf,port','Checks if TCP service is running and accepting connections on port. 0 - the service on the port is down. Otherwise, number of seconds spent connecting to TCP service.');
153
154insert into help_items values (5,'zabbix[boottime]','Startup time of Zabbix server, Unix timestamp.');
155insert into help_items values (5,'zabbix[history]','Number of values stored in table HISTORY.');
156insert into help_items values (5,'zabbix[history_log]','Number of values stored in table HISTORY_LOG.');
157insert into help_items values (5,'zabbix[history_str]','Number of values stored in table HISTORY_STR.');
158insert into help_items values (5,'zabbix[history_text]','Number of values stored in table HISTORY_TEXT.');
159insert into help_items values (5,'zabbix[history_uint]','Number of values stored in table HISTORY_UINT.');
160insert into help_items values (5,'zabbix[items]','Number of items in Zabbix database.');
161insert into help_items values (5,'zabbix[items_unsupported]','Number of unsupported items in Zabbix database.');
162insert into help_items values (5,'zabbix[log]','Stores warning and error messages generated by Zabbix server.');
163insert into help_items values (5,'zabbix[proxy,<name>,<param>]','Time of proxy last access. Name - proxy name. Param - lastaccess. Unix timestamp.');
164insert into help_items values (5,'zabbix[queue<,from><,to>]','Number of items in the queue which are delayed by from to to seconds, inclusive.');
165insert into help_items values (5,'zabbix[rcache,<cache>,<mode>]','Configuration cache statistics. Cache - buffer (modes: pfree, total, used, free).');
166insert into help_items values (5,'zabbix[trends]','Number of values stored in table TRENDS.');
167insert into help_items values (5,'zabbix[trends_uint]','Number of values stored in table TRENDS_UINT.');
168insert into help_items values (5,'zabbix[triggers]','Number of triggers in Zabbix database.');
169insert into help_items values (5,'zabbix[uptime]','Uptime of Zabbix server process in seconds.');
170insert into help_items values (5,'zabbix[wcache,<cache>,<mode>]','Data cache statistics. Cache - one of values (modes: all, float, uint, str, log, text), history (modes: pfree, total, used, free), trend (modes: pfree, total, used, free), text (modes: pfree, total, used, free).');
171insert into help_items values (5,'zabbix[process,<type>,<num>,<state>]','Time a particular Zabbix process or a group of processes (identified by <type> and <num>) spent in <state> in percentage.');
172
173insert into help_items values (8,'grpfunc[<Group>,<Key>,<func>,<param>]','Aggregate checks do not require any agent running on a host being monitored. Zabbix server collects aggregate information by doing direct database queries. See Zabbix Manual.');
174
175insert into help_items values(0,'agent.ping','Check the agent usability. Always return 1. Can be used as a TCP ping.');
176insert into help_items values(0,'agent.version','Version of zabbix_agent(d) running on monitored host. String value. Example of returned value: 1.1');
177insert into help_items values(0,'kernel.maxfiles','Maximum number of opened files supported by OS.');
178insert into help_items values(0,'kernel.maxproc','Maximum number of processes supported by OS.');
179insert into help_items values(0,'net.if.collisions[if]','Out-of-window collision. Collisions count.');
180insert into help_items values(0,'net.if.in[if <,mode>]','Network interface input statistic. Integer value. If mode is missing bytes is used.');
181insert into help_items values(0,'net.if.out[if <,mode>]','Network interface output statistic. Integer value. If mode is missing bytes is used.');
182insert into help_items values(0,'net.if.total[if <,mode>]','Sum of network interface incoming and outgoing statistics. Integer value. Mode - one of bytes (default), packets, errors or dropped');
183insert into help_items values(0,'net.if.list','List of network interfaces. Text value.');
184insert into help_items values(0,'net.tcp.dns[ip, zone]','Checks if DNS service is up. 0 - DNS is down, 1 - DNS is up.');
185insert into help_items values(0,'net.tcp.dns.query[ip, zone, type]','Performs a query for the record type specified by the parameter type');
186insert into help_items values(0,'net.tcp.listen[port]','Checks if this port is in LISTEN state. 0 - it is not, 1 - it is in LISTEN state.');
187insert into help_items values(0,'net.tcp.port[<ip>, port]','Check, if it is possible to make TCP connection to the port number. 0 - cannot connect, 1 - can connect. IP address is optional. If ip is missing, 127.0.0.1 is used. Example: net.tcp.port[,80]');
188insert into help_items values(0,'net.tcp.service[service <,ip> <,port>]','Check if service server is running and accepting connections. 0 - service is down, 1 - service is running. If ip is missing 127.0.0.1 is used. If port number is missing, default service port is used. Example: net.tcp.service[ftp,,45].');
189insert into help_items values(0,'net.tcp.service.perf[service <,ip> <,port>]','Check performance of service "service". 0 - service is down, sec - number of seconds spent on connection to the service. If ip is missing 127.0.0.1 is used.  If port number is missing, default service port is used.');
190insert into help_items values(0,'proc.mem[<name> <,user> <,mode> <,cmdline>]','Memory used by process with name name running under user user. Memory used by processes. Process name, user and mode is optional. If name or user is missing all processes will be calculated. If mode is missing sum is used. Example: proc.mem[,root]');
191insert into help_items values(0,'proc.num[<name> <,user> <,state> <,cmdline>]','Number of processes with name name running under user user having state state. Process name, user and state are optional. Examples: proc.num[,mysql]; proc.num[apache2,www-data]; proc.num[,oracle,sleep,oracleZABBIX]');
192insert into help_items values(0,'system.cpu.intr','Device interrupts.');
193insert into help_items values(0,'system.cpu.load[<cpu> <,mode>]','CPU(s) load. Processor load. The cpu and mode are optional. If cpu is missing all is used. If mode is missing avg1 is used. Note that this is not percentage.');
194insert into help_items values(0,'system.cpu.switches','Context switches.');
195insert into help_items values(0,'system.cpu.util[<cpu> <,type> <,mode>]','CPU(s) utilisation. Processor load in percents. The cpu, type and mode are optional. If cpu is missing all is used.  If type is missing user is used. If mode is missing avg1 is used.');
196insert into help_items values(0,'system.boottime','Timestamp of system boot.');
197insert into help_items values(0,'system.cpu.num','Number of available proccessors.');
198insert into help_items values(0,'system.hostname[<type>]','Returns hostname (or NetBIOS name (by default) on Windows). String value. Example of returned value: www.zabbix.com');
199insert into help_items values(0,'system.localtime','System local time. Time in seconds.');
200insert into help_items values(0,'system.run[command,<mode&gt]','Run specified command on the host.');
201insert into help_items values(0,'system.swap.in[<swap> <,type>]','Swap in. If type is count - swapins is returned. If type is pages - pages swapped in is returned. If swap is missing all is used.');
202insert into help_items values(0,'system.swap.out[<swap> <,type>]','Swap out. If type is count - swapouts is returned. If type is pages - pages swapped in is returned. If swap is missing all is used.');
203insert into help_items values(0,'system.swap.size[<swap> <,mode>]','Swap space. Number of bytes. If swap is missing all is used. If mode is missing free is used.');
204insert into help_items values(0,'system.uname','Returns detailed host information. String value');
205insert into help_items values(0,'system.uptime','System uptime in seconds.');
206insert into help_items values(0,'system.users.num','Number of users connected. Command who is used on agent side.');
207insert into help_items values(0,'vfs.dev.read[device <,type> <,mode>]','Device read statistics.');
208insert into help_items values(0,'vfs.dev.write[device <,type> <,mode>]','Device write statistics.');
209insert into help_items values(0,'vfs.file.cksum[file]','Calculate check sum of a given file. Check sum of the file calculate by standard algorithm used by UNIX utility cksum. Example: vfs.file.cksum[/etc/passwd]');
210insert into help_items values(0,'vfs.file.exists[file]','Check file existence. 0 - file does not exist, 1 - file exists');
211insert into help_items values(0,'vfs.file.md5sum[file]','Calculate MD5 check sum of a given file. String MD5 hash of the file. Can be used for files less than 64MB, unsupported otherwise. Example: vfs.file.md5sum[/usr/local/etc/zabbix3/zabbix_agentd.conf]');
212insert into help_items values(0,'vfs.file.regexp[file,regexp]','Find string in a file. Matched string');
213insert into help_items values(0,'vfs.file.regmatch[file,regexp]','Find string in a file. 0 - expression not found, 1 - found');
214insert into help_items values(0,'vfs.file.size[file]','Size of a given file. Size in bytes. File must have read permissions for user zabbix. Example: vfs.file.size[/var/log/syslog]');
215insert into help_items values(0,'vfs.file.time[file <,mode>]','File time information. Number of seconds.	The mode is optional. If mode is missing modify is used.');
216insert into help_items values(0,'vfs.fs.inode[fs <,mode>]','Number of inodes for a given volume. If mode is missing total is used.');
217insert into help_items values(0,'vfs.fs.size[fs <,mode>]','Calculate disk space for a given volume. Disk space in KB. If mode is missing total is used.  In case of mounted volume, unused disk space for local file system is returned. Example: vfs.fs.size[/tmp,free].');
218insert into help_items values(0,'vm.memory.size[<mode>]','Amount of memory size in bytes. If mode is missing total is used.');
219insert into help_items values(0,'web.page.get[host,<path>,<port>]','Get content of web page. Default path is /');
220insert into help_items values(0,'web.page.perf[host,<path>,<port>]','Get timing of loading full web page. Default path is /');
221insert into help_items values(0,'web.page.regexp[host,<path>,<port>,<regexp>,<length>]','Get first occurrence of regexp in web page. Default path is /');
222insert into help_items values(0,'perf_counter[counter, interval]','Value of any performance counter, where "counter" parameter is the counter path and "interval" parameter is a number of last seconds, for which the agent returns an average value.');
223insert into help_items values(0,'service_state[service]','State of service. 0 - running, 1 - paused, 2 - start pending, 3 - pause pending, 4 - continue pending, 5 - stop pending, 6 - stopped, 7 - unknown, 255 - no such service');
224insert into help_items values(0,'proc_info[<process>,<attribute>,<type>]','Different information about specific process(es)');
225insert into help_items values(0,'system.stat[resource <,type>]','Virtual memory statistics.');
226
227insert into help_items values(7,'agent.ping','Check the agent usability. Always return 1. Can be used as a TCP ping.');
228insert into help_items values(7,'agent.version','Version of zabbix_agent(d) running on monitored host. String value. Example of returned value: 1.1');
229insert into help_items values(7,'kernel.maxfiles','Maximum number of opened files supported by OS.');
230insert into help_items values(7,'kernel.maxproc','Maximum number of processes supported by OS.');
231insert into help_items values(7,'net.if.collisions[if]','Out-of-window collision. Collisions count.');
232insert into help_items values(7,'net.if.in[if <,mode>]','Network interface input statistic. Integer value. If mode is missing bytes is used.');
233insert into help_items values(7,'net.if.out[if <,mode>]','Network interface output statistic. Integer value. If mode is missing bytes is used.');
234insert into help_items values(7,'net.if.total[if <,mode>]','Sum of network interface incoming and outgoing statistics. Integer value. Mode - one of bytes (default), packets, errors or dropped');
235insert into help_items values(7,'net.if.list','List of network interfaces. Text value.');
236insert into help_items values(7,'net.tcp.dns[ip, zone]','Checks if DNS service is up. 0 - DNS is down, 1 - DNS is up.');
237insert into help_items values(7,'net.tcp.dns.query[ip, zone, type]','Performs a query for the record type specified by the parameter type');
238insert into help_items values(7,'net.tcp.listen[port]','Checks if this port is in LISTEN state. 0 - it is not, 1 - it is in LISTEN state.');
239insert into help_items values(7,'net.tcp.port[<ip>, port]','Check, if it is possible to make TCP connection to the port number. 0 - cannot connect, 1 - can connect. IP address is optional. If ip is missing, 127.0.0.1 is used. Example: net.tcp.port[,80]');
240insert into help_items values(7,'net.tcp.service[service <,ip> <,port>]','Check if service server is running and accepting connections. 0 - service is down, 1 - service is running. If ip is missing 127.0.0.1 is used. If port number is missing, default service port is used. Example: net.tcp.service[ftp,,45].');
241insert into help_items values(7,'net.tcp.service.perf[service <,ip> <,port>]','Check performance of service "service". 0 - service is down, sec - number of seconds spent on connection to the service. If ip is missing 127.0.0.1 is used.  If port number is missing, default service port is used.');
242insert into help_items values(7,'proc.mem[<name> <,user> <,mode> <,cmdline>]','Memory used by process with name name running under user user. Memory used by processes. Process name, user and mode is optional. If name or user is missing all processes will be calculated. If mode is missing sum is used. Example: proc.mem[,root]');
243insert into help_items values(7,'proc.num[<name> <,user> <,state> <,cmdline>]','Number of processes with name name running under user user having state state. Process name, user and state are optional. Examples: proc.num[,mysql]; proc.num[apache2,www-data]; proc.num[,oracle,sleep,oracleZABBIX]');
244insert into help_items values(7,'system.cpu.intr','Device interrupts.');
245insert into help_items values(7,'system.cpu.load[<cpu> <,mode>]','CPU(s) load. Processor load. The cpu and mode are optional. If cpu is missing all is used. If mode is missing avg1 is used. Note that this is not percentage.');
246insert into help_items values(7,'system.cpu.switches','Context switches.');
247insert into help_items values(7,'system.cpu.util[<cpu> <,type> <,mode>]','CPU(s) utilisation. Processor load in percents. The cpu, type and mode are optional. If cpu is missing all is used.  If type is missing user is used. If mode is missing avg1 is used.');
248insert into help_items values(7,'system.boottime','Timestamp of system boot.');
249insert into help_items values(7,'system.cpu.num','Number of available proccessors.');
250insert into help_items values(7,'system.hostname[<type>]','Returns hostname (or NetBIOS name (by default) on Windows). String value. Example of returned value: www.zabbix.com');
251insert into help_items values(7,'system.localtime','System local time. Time in seconds.');
252insert into help_items values(7,'system.run[command,<mode&gt]','Run specified command on the host.');
253insert into help_items values(7,'system.swap.in[<swap> <,type>]','Swap in. If type is count - swapins is returned. If type is pages - pages swapped in is returned. If swap is missing all is used.');
254insert into help_items values(7,'system.swap.out[<swap> <,type>]','Swap out. If type is count - swapouts is returned. If type is pages - pages swapped in is returned. If swap is missing all is used.');
255insert into help_items values(7,'system.swap.size[<swap> <,mode>]','Swap space. Number of bytes. If swap is missing all is used. If mode is missing free is used.');
256insert into help_items values(7,'system.uname','Returns detailed host information. String value');
257insert into help_items values(7,'system.uptime','System uptime in seconds.');
258insert into help_items values(7,'system.users.num','Number of users connected. Command who is used on agent side.');
259insert into help_items values(7,'vfs.dev.read[device <,type> <,mode>]','Device read statistics.');
260insert into help_items values(7,'vfs.dev.write[device <,type> <,mode>]','Device write statistics.');
261insert into help_items values(7,'vfs.file.cksum[file]','Calculate check sum of a given file. Check sum of the file calculate by standard algorithm used by UNIX utility cksum. Example: vfs.file.cksum[/etc/passwd]');
262insert into help_items values(7,'vfs.file.exists[file]','Check file existence. 0 - file does not exist, 1 - file exists');
263insert into help_items values(7,'vfs.file.md5sum[file]','Calculate MD5 check sum of a given file. String MD5 hash of the file. Can be used for files less than 64MB, unsupported otherwise. Example: vfs.file.md5sum[/usr/local/etc/zabbix3/zabbix_agentd.conf]');
264insert into help_items values(7,'vfs.file.regexp[file,regexp]','Find string in a file. Matched string');
265insert into help_items values(7,'vfs.file.regmatch[file,regexp]','Find string in a file. 0 - expression not found, 1 - found');
266insert into help_items values(7,'vfs.file.size[file]','Size of a given file. Size in bytes. File must have read permissions for user zabbix. Example: vfs.file.size[/var/log/syslog]');
267insert into help_items values(7,'vfs.file.time[file<, mode>]','File time information. Number of seconds.	The mode is optional. If mode is missing modify is used.');
268insert into help_items values(7,'vfs.fs.inode[fs <,mode>]','Number of inodes for a given volume. If mode is missing total is used.');
269insert into help_items values(7,'vfs.fs.size[fs <,mode>]','Calculate disk space for a given volume. Disk space in KB. If mode is missing total is used.  In case of mounted volume, unused disk space for local file system is returned. Example: vfs.fs.size[/tmp,free].');
270insert into help_items values(7,'vm.memory.size[<mode>]','Amount of memory size in bytes. If mode is missing total is used.');
271insert into help_items values(7,'web.page.get[host,<path>,<port>]','Get content of web page. Default path is /');
272insert into help_items values(7,'web.page.perf[host,<path>,<port>]','Get timing of loading full web page. Default path is /');
273insert into help_items values(7,'web.page.regexp[host,<path>,<port>,<regexp>,<length>]','Get first occurrence of regexp in web page. Default path is /');
274insert into help_items values(7,'perf_counter[counter]','Value of any performance counter, where parameter is the counter path.');
275insert into help_items values(7,'service_state[service]','State of service. 0 - running, 1 - paused, 2 - start pending, 3 - pause pending, 4 - continue pending, 5 - stop pending, 6 - stopped, 7 - unknown, 255 - no such service');
276insert into help_items values(7,'proc_info[<process>,<attribute>,<type>]','Different information about specific process(es)');
277insert into help_items values(7,'log[file,<pattern>,<encoding>,<maxlines>]','Monitoring of log file. pattern - regular expression');
278insert into help_items values(7,'logrt[file_format,<pattern>,<encoding>,<maxlines>]', 'Monitoring of log file with rotation. fileformat - [path][regexp], pattern - regular expression');
279insert into help_items values(7,'eventlog[logtype,<pattern>,<severity>,<source>,<eventid>,<maxlines>]','Monitoring of Windows event logs. pattern, severity, eventid - regular expressions');
280insert into help_items values(7,'system.stat[resource <,type>]','Virtual memory statistics.');
281alter table history_log add logeventid              integer         DEFAULT '0'     NOT NULL;
282
283CREATE UNIQUE INDEX history_log_2 on history_log (itemid,id);
284CREATE UNIQUE INDEX history_text_2 on history_text (itemid,id);
285ALTER TABLE history_uint ALTER COLUMN value TYPE numeric(20);
286ALTER TABLE history_uint ALTER COLUMN value SET DEFAULT '0';
287ALTER TABLE history_uint ALTER COLUMN value SET NOT NULL;
288ALTER TABLE history_uint_sync ALTER COLUMN value TYPE numeric(20);
289ALTER TABLE history_uint_sync ALTER COLUMN value SET DEFAULT '0';
290ALTER TABLE history_uint_sync ALTER COLUMN value SET NOT NULL;
291CREATE TABLE hostmacro (
292        hostmacroid             bigint          DEFAULT '0'     NOT NULL,
293        hostid          bigint          DEFAULT '0'     NOT NULL,
294        macro           varchar(64)             DEFAULT ''      NOT NULL,
295        value           varchar(255)            DEFAULT ''      NOT NULL,
296        PRIMARY KEY (hostmacroid)
297) with OIDS;
298CREATE INDEX hostmacro_1 on hostmacro (hostid,macro);
299drop index hosts_groups_groups_1;
300
301CREATE INDEX hosts_groups_1 on hosts_groups (hostid,groupid);
302CREATE INDEX hosts_groups_2 on hosts_groups (groupid);
303alter table hosts add maintenanceid bigint DEFAULT '0' NOT NULL;
304alter table hosts add maintenance_status integer DEFAULT '0' NOT NULL;
305alter table hosts add maintenance_type integer DEFAULT '0' NOT NULL;
306alter table hosts add maintenance_from integer DEFAULT '0' NOT NULL;
307alter table hosts add ipmi_ip varchar(64) DEFAULT '127.0.0.1' NOT NULL;
308alter table hosts add ipmi_errors_from integer DEFAULT '0' NOT NULL;
309alter table hosts add snmp_errors_from integer DEFAULT '0' NOT NULL;
310alter table hosts add ipmi_error varchar(128) DEFAULT '' NOT NULL;
311alter table hosts add snmp_error varchar(128) DEFAULT '' NOT NULL;
312ALTER TABLE hosts ALTER COLUMN inbytes TYPE numeric(20);
313ALTER TABLE hosts ALTER COLUMN inbytes SET DEFAULT '0';
314ALTER TABLE hosts ALTER COLUMN inbytes SET NOT NULL;
315ALTER TABLE hosts ALTER COLUMN outbytes TYPE numeric(20);
316ALTER TABLE hosts ALTER COLUMN outbytes SET DEFAULT '0';
317ALTER TABLE hosts ALTER COLUMN outbytes SET NOT NULL;
318CREATE INDEX hosts_templates_2 on hosts_templates (templateid);
319alter table httptest add authentication          integer         DEFAULT '0'     NOT NULL;
320alter table httptest add http_user               varchar(64)             DEFAULT ''      NOT NULL;
321alter table httptest add http_password           varchar(64)             DEFAULT ''      NOT NULL;
322
323CREATE INDEX httptest_2 on httptest (name);
324CREATE INDEX httptest_3 on httptest (status);
325alter table items drop nextcheck;
326alter table items add data_type               integer         DEFAULT '0'     NOT NULL;
327alter table items add authtype                integer         DEFAULT '0'     NOT NULL;
328alter table items add username                varchar(64)             DEFAULT ''      NOT NULL;
329alter table items add password                varchar(64)             DEFAULT ''      NOT NULL;
330alter table items add publickey               varchar(64)             DEFAULT ''      NOT NULL;
331alter table items add privatekey              varchar(64)             DEFAULT ''      NOT NULL;
332alter table items add mtime                   integer         DEFAULT '0'     NOT NULL;
333
334UPDATE items SET units='Bps' WHERE type=9 AND units='bps';
335CREATE TABLE maintenances_groups (
336        maintenance_groupid             bigint          DEFAULT '0'     NOT NULL,
337        maintenanceid           bigint          DEFAULT '0'     NOT NULL,
338        groupid         bigint          DEFAULT '0'     NOT NULL,
339        PRIMARY KEY (maintenance_groupid)
340) with OIDS;
341CREATE INDEX maintenances_groups_1 on maintenances_groups (maintenanceid,groupid);
342CREATE TABLE maintenances_hosts (
343        maintenance_hostid              bigint          DEFAULT '0'     NOT NULL,
344        maintenanceid           bigint          DEFAULT '0'     NOT NULL,
345        hostid          bigint          DEFAULT '0'     NOT NULL,
346        PRIMARY KEY (maintenance_hostid)
347) with OIDS;
348CREATE INDEX maintenances_hosts_1 on maintenances_hosts (maintenanceid,hostid);
349CREATE TABLE maintenances (
350        maintenanceid           bigint          DEFAULT '0'     NOT NULL,
351        name            varchar(128)            DEFAULT ''      NOT NULL,
352        maintenance_type                integer         DEFAULT '0'     NOT NULL,
353        description             text            DEFAULT ''      NOT NULL,
354        active_since            integer         DEFAULT '0'     NOT NULL,
355        active_till             integer         DEFAULT '0'     NOT NULL,
356        PRIMARY KEY (maintenanceid)
357) with OIDS;
358CREATE INDEX maintenances_1 on maintenances (active_since,active_till);
359CREATE TABLE maintenances_windows (
360        maintenance_timeperiodid                bigint          DEFAULT '0'     NOT NULL,
361        maintenanceid           bigint          DEFAULT '0'     NOT NULL,
362        timeperiodid            bigint          DEFAULT '0'     NOT NULL,
363        PRIMARY KEY (maintenance_timeperiodid)
364) with OIDS;
365CREATE INDEX maintenances_windows_1 on maintenances_windows (maintenanceid,timeperiodid);
366DROP TABLE node_cksum;
367CREATE TABLE node_cksum (
368	nodeid		integer		DEFAULT '0'	NOT NULL,
369	tablename		varchar(64)		DEFAULT ''	NOT NULL,
370	recordid		bigint		DEFAULT '0'	NOT NULL,
371	cksumtype		integer		DEFAULT '0'	NOT NULL,
372	cksum		text		DEFAULT ''	NOT NULL,
373	sync		char(128)		DEFAULT ''	NOT NULL
374) with OIDS;
375CREATE INDEX node_cksum_1 on node_cksum (nodeid,cksumtype,tablename,recordid);
376CREATE TABLE opmediatypes (
377        opmediatypeid           bigint          DEFAULT '0'     NOT NULL,
378        operationid             bigint          DEFAULT '0'     NOT NULL,
379        mediatypeid             bigint          DEFAULT '0'     NOT NULL,
380        PRIMARY KEY (opmediatypeid)
381) with OIDS;
382CREATE UNIQUE INDEX opmediatypes_1 on opmediatypes (operationid);
383CREATE INDEX profiles_2 on profiles (userid,profileid);
384CREATE TABLE proxy_autoreg_host (
385        id              serial                  NOT NULL,
386        clock           integer         DEFAULT '0'     NOT NULL,
387        host            varchar(64)             DEFAULT ''      NOT NULL,
388        PRIMARY KEY (id)
389) with OIDS;
390CREATE INDEX proxy_autoreg_host_1 on proxy_autoreg_host (clock);
391CREATE TABLE proxy_dhistory_tmp (
392        id              serial                  NOT NULL,
393        clock           integer         DEFAULT '0'     NOT NULL,
394        druleid         bigint          DEFAULT '0'     NOT NULL,
395        type            integer         DEFAULT '0'     NOT NULL,
396        ip              varchar(39)             DEFAULT ''      NOT NULL,
397        port            integer         DEFAULT '0'     NOT NULL,
398        key_            varchar(255)            DEFAULT ''      NOT NULL,
399        value           varchar(255)            DEFAULT ''      NOT NULL,
400        status          integer         DEFAULT '0'     NOT NULL,
401        dcheckid                bigint          DEFAULT '0'     NOT NULL,
402        PRIMARY KEY (id)
403) with OIDS;
404
405insert into proxy_dhistory_tmp select id,clock,druleid,type,ip,port,key_,value,status,0 from proxy_dhistory;
406drop table proxy_dhistory;
407alter table proxy_dhistory_tmp rename to proxy_dhistory;
408
409CREATE INDEX proxy_dhistory_1 on proxy_dhistory (clock);
410alter table proxy_history add logeventid              integer         DEFAULT '0'     NOT NULL;
411CREATE TABLE regexps (
412        regexpid                bigint          DEFAULT '0'     NOT NULL,
413        name            varchar(128)            DEFAULT ''      NOT NULL,
414        test_string             text            DEFAULT ''      NOT NULL,
415        PRIMARY KEY (regexpid)
416) with OIDS;
417CREATE INDEX regexps_1 on regexps (name);
418CREATE INDEX rights_2 on rights (id);
419CREATE INDEX services_1 on services (triggerid);
420CREATE INDEX sessions_1 on sessions (userid, status);
421CREATE TABLE sysmaps_elements_tmp (
422        selementid              bigint          DEFAULT '0'     NOT NULL,
423        sysmapid                bigint          DEFAULT '0'     NOT NULL,
424        elementid               bigint          DEFAULT '0'     NOT NULL,
425        elementtype             integer         DEFAULT '0'     NOT NULL,
426        iconid_off              bigint          DEFAULT '0'     NOT NULL,
427        iconid_on               bigint          DEFAULT '0'     NOT NULL,
428        iconid_unknown          bigint          DEFAULT '0'     NOT NULL,
429        label           varchar(255)            DEFAULT ''      NOT NULL,
430        label_location          integer                 NULL,
431        x               integer         DEFAULT '0'     NOT NULL,
432        y               integer         DEFAULT '0'     NOT NULL,
433        url             varchar(255)            DEFAULT ''      NOT NULL,
434        iconid_disabled         bigint          DEFAULT '0'     NOT NULL,
435	iconid_maintenance      bigint          DEFAULT '0'     NOT NULL,
436        PRIMARY KEY (selementid)
437) with OIDS;
438
439insert into sysmaps_elements_tmp select selementid,sysmapid,elementid,elementtype,iconid_off,iconid_on,iconid_unknown,label,label_location,x,y,url,iconid_disabled from sysmaps_elements;
440drop table sysmaps_elements;
441alter table sysmaps_elements_tmp rename to sysmaps_elements;
442CREATE TABLE sysmaps_links_tmp (
443	linkid			bigint		DEFAULT 0		NOT NULL,
444	sysmapid		bigint		DEFAULT 0		NOT NULL,
445	selementid1		bigint		DEFAULT 0		NOT NULL,
446	selementid2		bigint		DEFAULT 0		NOT NULL,
447	drawtype		integer		DEFAULT 0		NOT NULL,
448	color			varchar(6)	DEFAULT '000000'	NOT NULL,
449	label			varchar(255)	DEFAULT ''		NOT NULL,
450	PRIMARY KEY (linkid)
451) with OIDS;
452
453insert into sysmaps_links_tmp select linkid,sysmapid,selementid1,selementid2,drawtype,color,'' from sysmaps_links;
454drop table sysmaps_links;
455alter table sysmaps_links_tmp rename to sysmaps_links;
456CREATE TABLE sysmaps_tmp (
457	sysmapid		bigint		DEFAULT '0'	NOT NULL,
458	name		varchar(128)		DEFAULT ''	NOT NULL,
459	width		integer		DEFAULT '0'	NOT NULL,
460	height		integer		DEFAULT '0'	NOT NULL,
461	backgroundid		bigint		DEFAULT '0'	NOT NULL,
462	label_type		integer		DEFAULT '0'	NOT NULL,
463	label_location		integer		DEFAULT '0'	NOT NULL,
464	highlight		integer		DEFAULT '1'	NOT NULL,
465	PRIMARY KEY (sysmapid)
466) with OIDS;
467
468insert into sysmaps_tmp select sysmapid,name,width,height,backgroundid,label_type,label_location,1 from sysmaps;
469drop table sysmaps;
470alter table sysmaps_tmp rename to sysmaps;
471
472CREATE INDEX sysmaps_1 on sysmaps (name);
473CREATE TABLE timeperiods (
474        timeperiodid            bigint          DEFAULT '0'     NOT NULL,
475        timeperiod_type         integer         DEFAULT '0'     NOT NULL,
476        every           integer         DEFAULT '0'     NOT NULL,
477        month           integer         DEFAULT '0'     NOT NULL,
478        dayofweek               integer         DEFAULT '0'     NOT NULL,
479        day             integer         DEFAULT '0'     NOT NULL,
480        start_time              integer         DEFAULT '0'     NOT NULL,
481        period          integer         DEFAULT '0'     NOT NULL,
482        start_date              integer         DEFAULT '0'     NOT NULL,
483        PRIMARY KEY (timeperiodid)
484) with OIDS;
485ALTER TABLE trends_uint ALTER COLUMN value_min TYPE numeric(20);
486ALTER TABLE trends_uint ALTER COLUMN value_avg TYPE numeric(20);
487ALTER TABLE trends_uint ALTER COLUMN value_max TYPE numeric(20);
488ALTER TABLE trends_uint ALTER COLUMN value_min SET DEFAULT '0';
489ALTER TABLE trends_uint ALTER COLUMN value_avg SET DEFAULT '0';
490ALTER TABLE trends_uint ALTER COLUMN value_max SET DEFAULT '0';
491ALTER TABLE trends_uint ALTER COLUMN value_min SET NOT NULL;
492ALTER TABLE trends_uint ALTER COLUMN value_avg SET NOT NULL;
493ALTER TABLE trends_uint ALTER COLUMN value_max SET NOT NULL;
494CREATE TABLE user_history (
495        userhistoryid           bigint          DEFAULT '0'     NOT NULL,
496        userid          bigint          DEFAULT '0'     NOT NULL,
497        title1          varchar(255)            DEFAULT ''      NOT NULL,
498        url1            varchar(255)            DEFAULT ''      NOT NULL,
499        title2          varchar(255)            DEFAULT ''      NOT NULL,
500        url2            varchar(255)            DEFAULT ''      NOT NULL,
501        title3          varchar(255)            DEFAULT ''      NOT NULL,
502        url3            varchar(255)            DEFAULT ''      NOT NULL,
503        title4          varchar(255)            DEFAULT ''      NOT NULL,
504        url4            varchar(255)            DEFAULT ''      NOT NULL,
505        title5          varchar(255)            DEFAULT ''      NOT NULL,
506        url5            varchar(255)            DEFAULT ''      NOT NULL,
507        PRIMARY KEY (userhistoryid)
508) with OIDS;
509CREATE UNIQUE INDEX user_history_1 on user_history (userid);
510alter table users add rows_per_page           integer         DEFAULT 50      NOT NULL;
511alter table usrgrp add api_access              integer         DEFAULT '0'     NOT NULL;
512alter table usrgrp add debug_mode              integer         DEFAULT '0'     NOT NULL;
513