1<?php 2/* 3** Zabbix 4** Copyright (C) 2001-2021 Zabbix SIA 5** 6** This program is free software; you can redistribute it and/or modify 7** it under the terms of the GNU General Public License as published by 8** the Free Software Foundation; either version 2 of the License, or 9** (at your option) any later version. 10** 11** This program is distributed in the hope that it will be useful, 12** but WITHOUT ANY WARRANTY; without even the implied warranty of 13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14** GNU General Public License for more details. 15** 16** You should have received a copy of the GNU General Public License 17** along with this program; if not, write to the Free Software 18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19**/ 20 21 22/** 23 * Validate import data from Zabbix 4.4.x. 24 */ 25class C44XmlValidator extends CXmlValidatorGeneral { 26 27 private $PREPROCESSING_STEP_TYPE = [ 28 CXmlConstantValue::MULTIPLIER => CXmlConstantName::MULTIPLIER, 29 CXmlConstantValue::RTRIM => CXmlConstantName::RTRIM, 30 CXmlConstantValue::LTRIM => CXmlConstantName::LTRIM, 31 CXmlConstantValue::TRIM => CXmlConstantName::TRIM, 32 CXmlConstantValue::REGEX => CXmlConstantName::REGEX, 33 CXmlConstantValue::BOOL_TO_DECIMAL => CXmlConstantName::BOOL_TO_DECIMAL, 34 CXmlConstantValue::OCTAL_TO_DECIMAL => CXmlConstantName::OCTAL_TO_DECIMAL, 35 CXmlConstantValue::HEX_TO_DECIMAL => CXmlConstantName::HEX_TO_DECIMAL, 36 CXmlConstantValue::SIMPLE_CHANGE => CXmlConstantName::SIMPLE_CHANGE, 37 CXmlConstantValue::CHANGE_PER_SECOND => CXmlConstantName::CHANGE_PER_SECOND, 38 CXmlConstantValue::XMLPATH => CXmlConstantName::XMLPATH, 39 CXmlConstantValue::JSONPATH => CXmlConstantName::JSONPATH, 40 CXmlConstantValue::IN_RANGE => CXmlConstantName::IN_RANGE, 41 CXmlConstantValue::MATCHES_REGEX => CXmlConstantName::MATCHES_REGEX, 42 CXmlConstantValue::NOT_MATCHES_REGEX => CXmlConstantName::NOT_MATCHES_REGEX, 43 CXmlConstantValue::CHECK_JSON_ERROR => CXmlConstantName::CHECK_JSON_ERROR, 44 CXmlConstantValue::CHECK_XML_ERROR => CXmlConstantName::CHECK_XML_ERROR, 45 CXmlConstantValue::CHECK_REGEX_ERROR => CXmlConstantName::CHECK_REGEX_ERROR, 46 CXmlConstantValue::DISCARD_UNCHANGED => CXmlConstantName::DISCARD_UNCHANGED, 47 CXmlConstantValue::DISCARD_UNCHANGED_HEARTBEAT => CXmlConstantName::DISCARD_UNCHANGED_HEARTBEAT, 48 CXmlConstantValue::JAVASCRIPT => CXmlConstantName::JAVASCRIPT, 49 CXmlConstantValue::PROMETHEUS_PATTERN => CXmlConstantName::PROMETHEUS_PATTERN, 50 CXmlConstantValue::PROMETHEUS_TO_JSON => CXmlConstantName::PROMETHEUS_TO_JSON, 51 CXmlConstantValue::CSV_TO_JSON => CXmlConstantName::CSV_TO_JSON 52 ]; 53 54 private $PREPROCESSING_STEP_TYPE_DRULE = [ 55 CXmlConstantValue::REGEX => CXmlConstantName::REGEX, 56 CXmlConstantValue::XMLPATH => CXmlConstantName::XMLPATH, 57 CXmlConstantValue::JSONPATH => CXmlConstantName::JSONPATH, 58 CXmlConstantValue::NOT_MATCHES_REGEX => CXmlConstantName::NOT_MATCHES_REGEX, 59 CXmlConstantValue::CHECK_JSON_ERROR => CXmlConstantName::CHECK_JSON_ERROR, 60 CXmlConstantValue::CHECK_XML_ERROR => CXmlConstantName::CHECK_XML_ERROR, 61 CXmlConstantValue::DISCARD_UNCHANGED_HEARTBEAT => CXmlConstantName::DISCARD_UNCHANGED_HEARTBEAT, 62 CXmlConstantValue::JAVASCRIPT => CXmlConstantName::JAVASCRIPT, 63 CXmlConstantValue::PROMETHEUS_TO_JSON => CXmlConstantName::PROMETHEUS_TO_JSON, 64 CXmlConstantValue::CSV_TO_JSON => CXmlConstantName::CSV_TO_JSON 65 ]; 66 67 private $GRAPH_GRAPH_ITEM_CALC_FNC = [ 68 CXmlConstantValue::MIN => CXmlConstantName::MIN, 69 CXmlConstantValue::AVG => CXmlConstantName::AVG, 70 CXmlConstantValue::MAX => CXmlConstantName::MAX, 71 CXmlConstantValue::ALL => CXmlConstantName::ALL, 72 CXmlConstantValue::LAST => CXmlConstantName::LAST 73 ]; 74 75 private $GRAPH_GRAPH_ITEM_DRAWTYPE = [ 76 CXmlConstantValue::SINGLE_LINE => CXmlConstantName::SINGLE_LINE, 77 CXmlConstantValue::FILLED_REGION => CXmlConstantName::FILLED_REGION, 78 CXmlConstantValue::BOLD_LINE => CXmlConstantName::BOLD_LINE, 79 CXmlConstantValue::DOTTED_LINE => CXmlConstantName::DOTTED_LINE, 80 CXmlConstantValue::DASHED_LINE => CXmlConstantName::DASHED_LINE, 81 CXmlConstantValue::GRADIENT_LINE => CXmlConstantName::GRADIENT_LINE 82 ]; 83 84 private $GRAPH_TYPE = [ 85 CXmlConstantValue::NORMAL => CXmlConstantName::NORMAL, 86 CXmlConstantValue::STACKED => CXmlConstantName::STACKED, 87 CXmlConstantValue::PIE => CXmlConstantName::PIE, 88 CXmlConstantValue::EXPLODED => CXmlConstantName::EXPLODED 89 ]; 90 91 private $GRAPH_Y_TYPE = [ 92 CXmlConstantValue::CALCULATED => CXmlConstantName::CALCULATED, 93 CXmlConstantValue::FIXED => CXmlConstantName::FIXED, 94 CXmlConstantValue::ITEM => CXmlConstantName::ITEM 95 ]; 96 97 private $GRAPH_GRAPH_ITEM_YAXISSIDE = [ 98 CXmlConstantValue::LEFT => CXmlConstantName::LEFT, 99 CXmlConstantValue::RIGHT => CXmlConstantName::RIGHT 100 ]; 101 102 private $GRAPH_GRAPH_ITEM_TYPE = [ 103 CXmlConstantValue::SIMPLE => CXmlConstantName::SIMPLE, 104 CXmlConstantValue::GRAPH_SUM => CXmlConstantName::GRAPH_SUM 105 ]; 106 107 private $ITEM_INVENTORY_LINK = [ 108 CXmlConstantValue::NONE => CXmlConstantName::NONE, 109 CXmlConstantValue::ALIAS => CXmlConstantName::ALIAS, 110 CXmlConstantValue::ASSET_TAG => CXmlConstantName::ASSET_TAG, 111 CXmlConstantValue::CHASSIS => CXmlConstantName::CHASSIS, 112 CXmlConstantValue::CONTACT => CXmlConstantName::CONTACT, 113 CXmlConstantValue::CONTRACT_NUMBER => CXmlConstantName::CONTRACT_NUMBER, 114 CXmlConstantValue::DATE_HW_DECOMM => CXmlConstantName::DATE_HW_DECOMM, 115 CXmlConstantValue::DATE_HW_EXPIRY => CXmlConstantName::DATE_HW_EXPIRY, 116 CXmlConstantValue::DATE_HW_INSTALL => CXmlConstantName::DATE_HW_INSTALL, 117 CXmlConstantValue::DATE_HW_PURCHASE => CXmlConstantName::DATE_HW_PURCHASE, 118 CXmlConstantValue::DEPLOYMENT_STATUS => CXmlConstantName::DEPLOYMENT_STATUS, 119 CXmlConstantValue::HARDWARE => CXmlConstantName::HARDWARE, 120 CXmlConstantValue::HARDWARE_FULL => CXmlConstantName::HARDWARE_FULL, 121 CXmlConstantValue::HOST_NETMASK => CXmlConstantName::HOST_NETMASK, 122 CXmlConstantValue::HOST_NETWORKS => CXmlConstantName::HOST_NETWORKS, 123 CXmlConstantValue::HOST_ROUTER => CXmlConstantName::HOST_ROUTER, 124 CXmlConstantValue::HW_ARCH => CXmlConstantName::HW_ARCH, 125 CXmlConstantValue::INSTALLER_NAME => CXmlConstantName::INSTALLER_NAME, 126 CXmlConstantValue::LOCATION => CXmlConstantName::LOCATION, 127 CXmlConstantValue::LOCATION_LAT => CXmlConstantName::LOCATION_LAT, 128 CXmlConstantValue::LOCATION_LON => CXmlConstantName::LOCATION_LON, 129 CXmlConstantValue::MACADDRESS_A => CXmlConstantName::MACADDRESS_A, 130 CXmlConstantValue::MACADDRESS_B => CXmlConstantName::MACADDRESS_B, 131 CXmlConstantValue::MODEL => CXmlConstantName::MODEL, 132 CXmlConstantValue::NAME => CXmlConstantName::NAME, 133 CXmlConstantValue::NOTES => CXmlConstantName::NOTES, 134 CXmlConstantValue::OOB_IP => CXmlConstantName::OOB_IP, 135 CXmlConstantValue::OOB_NETMASK => CXmlConstantName::OOB_NETMASK, 136 CXmlConstantValue::OOB_ROUTER => CXmlConstantName::OOB_ROUTER, 137 CXmlConstantValue::OS => CXmlConstantName::OS, 138 CXmlConstantValue::OS_FULL => CXmlConstantName::OS_FULL, 139 CXmlConstantValue::OS_SHORT => CXmlConstantName::OS_SHORT, 140 CXmlConstantValue::POC_1_CELL => CXmlConstantName::POC_1_CELL, 141 CXmlConstantValue::POC_1_EMAIL => CXmlConstantName::POC_1_EMAIL, 142 CXmlConstantValue::POC_1_NAME => CXmlConstantName::POC_1_NAME, 143 CXmlConstantValue::POC_1_NOTES => CXmlConstantName::POC_1_NOTES, 144 CXmlConstantValue::POC_1_PHONE_A => CXmlConstantName::POC_1_PHONE_A, 145 CXmlConstantValue::POC_1_PHONE_B => CXmlConstantName::POC_1_PHONE_B, 146 CXmlConstantValue::POC_1_SCREEN => CXmlConstantName::POC_1_SCREEN, 147 CXmlConstantValue::POC_2_CELL => CXmlConstantName::POC_2_CELL, 148 CXmlConstantValue::POC_2_EMAIL => CXmlConstantName::POC_2_EMAIL, 149 CXmlConstantValue::POC_2_NAME => CXmlConstantName::POC_2_NAME, 150 CXmlConstantValue::POC_2_NOTES => CXmlConstantName::POC_2_NOTES, 151 CXmlConstantValue::POC_2_PHONE_A => CXmlConstantName::POC_2_PHONE_A, 152 CXmlConstantValue::POC_2_PHONE_B => CXmlConstantName::POC_2_PHONE_B, 153 CXmlConstantValue::POC_2_SCREEN => CXmlConstantName::POC_2_SCREEN, 154 CXmlConstantValue::SERIALNO_A => CXmlConstantName::SERIALNO_A, 155 CXmlConstantValue::SERIALNO_B => CXmlConstantName::SERIALNO_B, 156 CXmlConstantValue::SITE_ADDRESS_A => CXmlConstantName::SITE_ADDRESS_A, 157 CXmlConstantValue::SITE_ADDRESS_B => CXmlConstantName::SITE_ADDRESS_B, 158 CXmlConstantValue::SITE_ADDRESS_C => CXmlConstantName::SITE_ADDRESS_C, 159 CXmlConstantValue::SITE_CITY => CXmlConstantName::SITE_CITY, 160 CXmlConstantValue::SITE_COUNTRY => CXmlConstantName::SITE_COUNTRY, 161 CXmlConstantValue::SITE_NOTES => CXmlConstantName::SITE_NOTES, 162 CXmlConstantValue::SITE_RACK => CXmlConstantName::SITE_RACK, 163 CXmlConstantValue::SITE_STATE => CXmlConstantName::SITE_STATE, 164 CXmlConstantValue::SITE_ZIP => CXmlConstantName::SITE_ZIP, 165 CXmlConstantValue::SOFTWARE => CXmlConstantName::SOFTWARE, 166 CXmlConstantValue::SOFTWARE_APP_A => CXmlConstantName::SOFTWARE_APP_A, 167 CXmlConstantValue::SOFTWARE_APP_B => CXmlConstantName::SOFTWARE_APP_B, 168 CXmlConstantValue::SOFTWARE_APP_C => CXmlConstantName::SOFTWARE_APP_C, 169 CXmlConstantValue::SOFTWARE_APP_D => CXmlConstantName::SOFTWARE_APP_D, 170 CXmlConstantValue::SOFTWARE_APP_E => CXmlConstantName::SOFTWARE_APP_E, 171 CXmlConstantValue::SOFTWARE_FULL => CXmlConstantName::SOFTWARE_FULL, 172 CXmlConstantValue::TAG => CXmlConstantName::TAG, 173 CXmlConstantValue::TYPE => CXmlConstantName::TYPE, 174 CXmlConstantValue::TYPE_FULL => CXmlConstantName::TYPE_FULL, 175 CXmlConstantValue::URL_A => CXmlConstantName::URL_A, 176 CXmlConstantValue::URL_B => CXmlConstantName::URL_B, 177 CXmlConstantValue::URL_C => CXmlConstantName::URL_C, 178 CXmlConstantValue::VENDOR => CXmlConstantName::VENDOR 179 ]; 180 181 private $ITEM_POST_TYPE = [ 182 CXmlConstantValue::RAW => CXmlConstantName::RAW, 183 CXmlConstantValue::JSON => CXmlConstantName::JSON, 184 CXmlConstantValue::XML => CXmlConstantName::XML 185 ]; 186 187 private $ITEM_PREPROCESSING_ERROR_HANDLER = [ 188 CXmlConstantValue::ORIGINAL_ERROR => CXmlConstantName::ORIGINAL_ERROR, 189 CXmlConstantValue::DISCARD_VALUE => CXmlConstantName::DISCARD_VALUE, 190 CXmlConstantValue::CUSTOM_VALUE => CXmlConstantName::CUSTOM_VALUE, 191 CXmlConstantValue::CUSTOM_ERROR => CXmlConstantName::CUSTOM_ERROR 192 ]; 193 194 private $ITEM_REQUEST_METHOD = [ 195 CXmlConstantValue::GET => CXmlConstantName::GET, 196 CXmlConstantValue::POST => CXmlConstantName::POST, 197 CXmlConstantValue::PUT => CXmlConstantName::PUT, 198 CXmlConstantValue::HEAD => CXmlConstantName::HEAD 199 ]; 200 201 private $ITEM_RETRIEVE_MODE = [ 202 CXmlConstantValue::BODY => CXmlConstantName::BODY, 203 CXmlConstantValue::HEADERS => CXmlConstantName::HEADERS, 204 CXmlConstantValue::BOTH => CXmlConstantName::BOTH 205 ]; 206 207 private $ITEM_SNMPV3_SECURITYLEVEL = [ 208 CXmlConstantValue::NOAUTHNOPRIV => CXmlConstantName::NOAUTHNOPRIV, 209 CXmlConstantValue::AUTHNOPRIV => CXmlConstantName::AUTHNOPRIV, 210 CXmlConstantValue::AUTHPRIV => CXmlConstantName::AUTHPRIV 211 ]; 212 213 private $ITEM_TYPE = [ 214 CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE => CXmlConstantName::ZABBIX_PASSIVE, 215 CXmlConstantValue::ITEM_TYPE_SNMPV1 => CXmlConstantName::SNMPV1, 216 CXmlConstantValue::ITEM_TYPE_TRAP => CXmlConstantName::TRAP, 217 CXmlConstantValue::ITEM_TYPE_SIMPLE => CXmlConstantName::SIMPLE, 218 CXmlConstantValue::ITEM_TYPE_SNMPV2 => CXmlConstantName::SNMPV2, 219 CXmlConstantValue::ITEM_TYPE_INTERNAL => CXmlConstantName::INTERNAL, 220 CXmlConstantValue::ITEM_TYPE_SNMPV3 => CXmlConstantName::SNMPV3, 221 CXmlConstantValue::ITEM_TYPE_ZABBIX_ACTIVE => CXmlConstantName::ZABBIX_ACTIVE, 222 CXmlConstantValue::ITEM_TYPE_AGGREGATE => CXmlConstantName::AGGREGATE, 223 CXmlConstantValue::ITEM_TYPE_EXTERNAL => CXmlConstantName::EXTERNAL, 224 CXmlConstantValue::ITEM_TYPE_ODBC => CXmlConstantName::ODBC, 225 CXmlConstantValue::ITEM_TYPE_IPMI => CXmlConstantName::IPMI, 226 CXmlConstantValue::ITEM_TYPE_SSH => CXmlConstantName::SSH, 227 CXmlConstantValue::ITEM_TYPE_TELNET => CXmlConstantName::TELNET, 228 CXmlConstantValue::ITEM_TYPE_CALCULATED => CXmlConstantName::CALCULATED, 229 CXmlConstantValue::ITEM_TYPE_JMX => CXmlConstantName::JMX, 230 CXmlConstantValue::ITEM_TYPE_SNMP_TRAP => CXmlConstantName::SNMP_TRAP, 231 CXmlConstantValue::ITEM_TYPE_DEPENDENT => CXmlConstantName::DEPENDENT, 232 CXmlConstantValue::ITEM_TYPE_HTTP_AGENT => CXmlConstantName::HTTP_AGENT 233 ]; 234 235 private $ITEM_TYPE_DRULE = [ 236 CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE => CXmlConstantName::ZABBIX_PASSIVE, 237 CXmlConstantValue::ITEM_TYPE_SNMPV1 => CXmlConstantName::SNMPV1, 238 CXmlConstantValue::ITEM_TYPE_TRAP => CXmlConstantName::TRAP, 239 CXmlConstantValue::ITEM_TYPE_SIMPLE => CXmlConstantName::SIMPLE, 240 CXmlConstantValue::ITEM_TYPE_SNMPV2 => CXmlConstantName::SNMPV2, 241 CXmlConstantValue::ITEM_TYPE_INTERNAL => CXmlConstantName::INTERNAL, 242 CXmlConstantValue::ITEM_TYPE_SNMPV3 => CXmlConstantName::SNMPV3, 243 CXmlConstantValue::ITEM_TYPE_ZABBIX_ACTIVE => CXmlConstantName::ZABBIX_ACTIVE, 244 CXmlConstantValue::ITEM_TYPE_EXTERNAL => CXmlConstantName::EXTERNAL, 245 CXmlConstantValue::ITEM_TYPE_ODBC => CXmlConstantName::ODBC, 246 CXmlConstantValue::ITEM_TYPE_IPMI => CXmlConstantName::IPMI, 247 CXmlConstantValue::ITEM_TYPE_SSH => CXmlConstantName::SSH, 248 CXmlConstantValue::ITEM_TYPE_TELNET => CXmlConstantName::TELNET, 249 CXmlConstantValue::ITEM_TYPE_JMX => CXmlConstantName::JMX, 250 CXmlConstantValue::ITEM_TYPE_DEPENDENT => CXmlConstantName::DEPENDENT, 251 CXmlConstantValue::ITEM_TYPE_HTTP_AGENT => CXmlConstantName::HTTP_AGENT 252 ]; 253 254 private $ITEM_VALUE_TYPE = [ 255 CXmlConstantValue::FLOAT => CXmlConstantName::FLOAT, 256 CXmlConstantValue::CHAR => CXmlConstantName::CHAR, 257 CXmlConstantValue::LOG => CXmlConstantName::LOG, 258 CXmlConstantValue::UNSIGNED => CXmlConstantName::UNSIGNED, 259 CXmlConstantValue::TEXT => CXmlConstantName::TEXT 260 ]; 261 262 private $TRIGGER_PRIORITY = [ 263 CXmlConstantValue::NOT_CLASSIFIED => CXmlConstantName::NOT_CLASSIFIED, 264 CXmlConstantValue::INFO => CXmlConstantName::INFO, 265 CXmlConstantValue::WARNING => CXmlConstantName::WARNING, 266 CXmlConstantValue::AVERAGE => CXmlConstantName::AVERAGE, 267 CXmlConstantValue::HIGH => CXmlConstantName::HIGH, 268 CXmlConstantValue::DISASTER => CXmlConstantName::DISASTER 269 ]; 270 271 private $TRIGGER_RECOVERY_MODE = [ 272 CXmlConstantValue::TRIGGER_EXPRESSION => CXmlConstantName::EXPRESSION, 273 CXmlConstantValue::TRIGGER_RECOVERY_EXPRESSION => CXmlConstantName::RECOVERY_EXPRESSION, 274 CXmlConstantValue::TRIGGER_NONE => CXmlConstantName::NONE 275 ]; 276 277 /** 278 * Legacy screen resource types. 279 */ 280 private const SCREEN_RESOURCE_TYPE_GRAPH = 0; 281 private const SCREEN_RESOURCE_TYPE_SIMPLE_GRAPH = 1; 282 private const SCREEN_RESOURCE_TYPE_PLAIN_TEXT = 3; 283 private const SCREEN_RESOURCE_TYPE_CLOCK = 7; 284 private const SCREEN_RESOURCE_TYPE_LLD_SIMPLE_GRAPH = 19; 285 private const SCREEN_RESOURCE_TYPE_LLD_GRAPH = 20; 286 287 /** 288 * Get validation rules schema. 289 * 290 * @return array 291 */ 292 public function getSchema() { 293 return ['type' => XML_ARRAY, 'rules' => [ 294 'version' => ['type' => XML_STRING | XML_REQUIRED], 295 'date' => ['type' => XML_STRING, 'ex_validate' => [$this, 'validateDateTime']], 296 'groups' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'group', 'rules' => [ 297 'group' => ['type' => XML_ARRAY, 'rules' => [ 298 'name' => ['type' => XML_STRING | XML_REQUIRED] 299 ]] 300 ]], 301 'hosts' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'host', 'rules' => [ 302 'host' => ['type' => XML_ARRAY, 'rules' => [ 303 'host' => ['type' => XML_STRING | XML_REQUIRED], 304 'name' => ['type' => XML_STRING, 'default' => ''], 305 'description' => ['type' => XML_STRING, 'default' => ''], 306 'proxy' => ['type' => XML_ARRAY, 'rules' => [ 307 'name' => ['type' => XML_STRING | XML_REQUIRED] 308 ]], 309 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 310 'ipmi_authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::XML_DEFAULT, 'in' => [CXmlConstantValue::XML_DEFAULT => CXmlConstantName::XML_DEFAULT, CXmlConstantValue::NONE => CXmlConstantName::NONE, CXmlConstantValue::MD2 => CXmlConstantName::MD2, CXmlConstantValue::MD5 => CXmlConstantName::MD5, CXmlConstantValue::STRAIGHT => CXmlConstantName::STRAIGHT, CXmlConstantValue::OEM => CXmlConstantName::OEM, CXmlConstantValue::RMCP_PLUS => CXmlConstantName::RMCP_PLUS]], 311 'ipmi_privilege' => ['type' => XML_STRING, 'default' => CXmlConstantValue::USER, 'in' => [CXmlConstantValue::CALLBACK => CXmlConstantName::CALLBACK, CXmlConstantValue::USER => CXmlConstantName::USER, CXmlConstantValue::OPERATOR => CXmlConstantName::OPERATOR, CXmlConstantValue::ADMIN => CXmlConstantName::ADMIN, CXmlConstantValue::OEM => CXmlConstantName::OEM]], 312 'ipmi_username' => ['type' => XML_STRING, 'default' => ''], 313 'ipmi_password' => ['type' => XML_STRING, 'default' => ''], 314 'tls_connect' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO_ENCRYPTION, 'in' => [CXmlConstantValue::NO_ENCRYPTION => CXmlConstantName::NO_ENCRYPTION, CXmlConstantValue::TLS_PSK => CXmlConstantName::TLS_PSK, CXmlConstantValue::TLS_CERTIFICATE => CXmlConstantName::TLS_CERTIFICATE]], 315 'tls_accept' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'option', 'default' => CXmlConstantValue::NO_ENCRYPTION, 'export' => [$this, 'hostTlsAcceptExport'], 'rules' => [ 316 'option' => ['type' => XML_STRING, 'in' => [CXmlConstantValue::NO_ENCRYPTION => CXmlConstantName::NO_ENCRYPTION, CXmlConstantValue::TLS_PSK => CXmlConstantName::TLS_PSK, CXmlConstantValue::TLS_CERTIFICATE => CXmlConstantName::TLS_CERTIFICATE]] 317 ]], 318 'tls_issuer' => ['type' => XML_STRING, 'default' => ''], 319 'tls_subject' => ['type' => XML_STRING, 'default' => ''], 320 'tls_psk_identity' => ['type' => XML_STRING, 'default' => ''], 321 'tls_psk' => ['type' => XML_STRING, 'default' => ''], 322 'templates' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'template', 'rules' => [ 323 'template' => ['type' => XML_ARRAY, 'rules' => [ 324 'name' => ['type' => XML_STRING | XML_REQUIRED] 325 ]] 326 ]], 327 'groups' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'group', 'rules' => [ 328 'group' => ['type' => XML_ARRAY, 'rules' => [ 329 'name' => ['type' => XML_STRING | XML_REQUIRED] 330 ]] 331 ]], 332 'interfaces' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'interface', 'rules' => [ 333 'interface' => ['type' => XML_ARRAY, 'rules' => [ 334 'default' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 335 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ZABBIX, 'in' => [CXmlConstantValue::ZABBIX => CXmlConstantName::ZABBIX, CXmlConstantValue::SNMP => CXmlConstantName::SNMP, CXmlConstantValue::IPMI => CXmlConstantName::IPMI, CXmlConstantValue::JMX => CXmlConstantName::JMX]], 336 'useip' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 337 'ip' => ['type' => XML_STRING, 'default' => '127.0.0.1'], 338 'dns' => ['type' => XML_STRING, 'default' => ''], 339 'port' => ['type' => XML_STRING, 'default' => '10050'], 340 'bulk' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 341 'interface_ref' => ['type' => XML_STRING | XML_REQUIRED] 342 ]] 343 ]], 344 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 345 'application' => ['type' => XML_ARRAY, 'rules' => [ 346 'name' => ['type' => XML_STRING | XML_REQUIRED] 347 ]] 348 ]], 349 'items' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'item', 'rules' => [ 350 'item' => ['type' => XML_ARRAY, 'rules' => [ 351 'name' => ['type' => XML_STRING | XML_REQUIRED], 352 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE], 353 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 354 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 355 'key' => ['type' => XML_STRING | XML_REQUIRED], 356 'delay' => ['type' => XML_STRING, 'default' => '1m'], 357 'history' => ['type' => XML_STRING, 'default' => '90d'], 358 'trends' => ['type' => XML_STRING, 'default' => '365d'], 359 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 360 'value_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::UNSIGNED, 'in' => $this->ITEM_VALUE_TYPE], 361 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 362 'units' => ['type' => XML_STRING, 'default' => ''], 363 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 364 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 365 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 366 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 367 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 368 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 369 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 370 'params' => ['type' => XML_STRING, 'default' => ''], 371 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 372 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 373 'username' => ['type' => XML_STRING, 'default' => ''], 374 'password' => ['type' => XML_STRING, 'default' => ''], 375 'publickey' => ['type' => XML_STRING, 'default' => ''], 376 'privatekey' => ['type' => XML_STRING, 'default' => ''], 377 'port' => ['type' => XML_STRING, 'default' => ''], 378 'description' => ['type' => XML_STRING, 'default' => ''], 379 'inventory_link' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => $this->ITEM_INVENTORY_LINK], 380 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 381 'application' => ['type' => XML_ARRAY, 'rules' => [ 382 'name' => ['type' => XML_STRING | XML_REQUIRED] 383 ]] 384 ]], 385 'valuemap' => ['type' => XML_ARRAY, 'rules' => [ 386 'name' => ['type' => XML_STRING | XML_REQUIRED] 387 ]], 388 'logtimefmt' => ['type' => XML_STRING, 'default' => ''], 389 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 390 'step' => ['type' => XML_ARRAY, 'rules' => [ 391 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE], 392 'params' => ['type' => XML_STRING | XML_REQUIRED], 393 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 394 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 395 ]] 396 ]], 397 'interface_ref' => ['type' => XML_STRING], 398 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 399 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 400 'key' => ['type' => XML_STRING | XML_REQUIRED] 401 ]], 402 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 403 'url' => ['type' => XML_STRING, 'default' => ''], 404 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 405 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 406 'name' => ['type' => XML_STRING | XML_REQUIRED], 407 'value' => ['type' => XML_STRING, 'default' => ''] 408 ]] 409 ]], 410 'posts' => ['type' => XML_STRING, 'default' => ''], 411 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 412 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 413 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 414 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 415 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 416 'header' => ['type' => XML_ARRAY, 'rules' => [ 417 'name' => ['type' => XML_STRING | XML_REQUIRED], 418 'value' => ['type' => XML_STRING | XML_REQUIRED] 419 ]] 420 ]], 421 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 422 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 423 'output_format' => ['type' => XML_STRING, 'default' => CXmlConstantValue::OUTPUT_FORMAT_RAW, 'in' => [CXmlConstantValue::OUTPUT_FORMAT_RAW => CXmlConstantName::RAW, CXmlConstantValue::OUTPUT_FORMAT_JSON => CXmlConstantName::JSON]], 424 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 425 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 426 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 427 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 428 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 429 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 430 'triggers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger', 'rules' => [ 431 'trigger' => ['type' => XML_ARRAY, 'rules' => [ 432 'expression' => ['type' => XML_STRING | XML_REQUIRED], 433 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 434 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 435 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 436 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 437 'name' => ['type' => XML_STRING | XML_REQUIRED], 438 'opdata' => ['type' => XML_STRING, 'default' => ''], 439 'url' => ['type' => XML_STRING, 'default' => ''], 440 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 441 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 442 'description' => ['type' => XML_STRING, 'default' => ''], 443 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 444 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 445 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 446 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 447 'name' => ['type' => XML_STRING | XML_REQUIRED], 448 'expression' => ['type' => XML_STRING | XML_REQUIRED], 449 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 450 ]] 451 ]], 452 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 453 'tag' => ['type' => XML_ARRAY, 'rules' => [ 454 'tag' => ['type' => XML_STRING | XML_REQUIRED], 455 'value' => ['type' => XML_STRING, 'default' => ''] 456 ]] 457 ]] 458 ]] 459 ]] 460 ]] 461 ]], 462 'discovery_rules' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'discovery_rule', 'rules' => [ 463 'discovery_rule' => ['type' => XML_ARRAY, 'rules' => [ 464 'name' => ['type' => XML_STRING | XML_REQUIRED], 465 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE_DRULE], 466 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 467 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 468 'key' => ['type' => XML_STRING | XML_REQUIRED], 469 'delay' => ['type' => XML_STRING, 'default' => '1m'], 470 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 471 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 472 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 473 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 474 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 475 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 476 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 477 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 478 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 479 'params' => ['type' => XML_STRING, 'default' => ''], 480 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 481 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 482 'username' => ['type' => XML_STRING, 'default' => ''], 483 'password' => ['type' => XML_STRING, 'default' => ''], 484 'publickey' => ['type' => XML_STRING, 'default' => ''], 485 'privatekey' => ['type' => XML_STRING, 'default' => ''], 486 'port' => ['type' => XML_STRING, 'default' => ''], 487 'filter' => ['type' => XML_ARRAY, 'import' => [$this, 'itemFilterImport'], 'rules' => [ 488 'evaltype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::AND_OR, 'in' => [CXmlConstantValue::AND_OR => CXmlConstantName::AND_OR, CXmlConstantValue::XML_AND => CXmlConstantName::XML_AND, CXmlConstantValue::XML_OR => CXmlConstantName::XML_OR, CXmlConstantValue::FORMULA => CXmlConstantName::FORMULA]], 489 'formula' => ['type' => XML_STRING, 'default' => ''], 490 'conditions' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'condition', 'rules' => [ 491 'condition' => ['type' => XML_ARRAY, 'rules' => [ 492 'macro' => ['type' => XML_STRING | XML_REQUIRED], 493 'value' => ['type' => XML_STRING, 'default' => ''], 494 'operator' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CONDITION_MATCHES_REGEX, 'in' => [CXmlConstantValue::CONDITION_MATCHES_REGEX => CXmlConstantName::MATCHES_REGEX, CXmlConstantValue::CONDITION_NOT_MATCHES_REGEX => CXmlConstantName::NOT_MATCHES_REGEX]], 495 'formulaid' => ['type' => XML_STRING | XML_REQUIRED] 496 ]] 497 ]] 498 ]], 499 'lifetime' => ['type' => XML_STRING, 'default' => '30d'], 500 'description' => ['type' => XML_STRING, 'default' => ''], 501 'interface_ref' => ['type' => XML_STRING], 502 'item_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'item_prototype', 'rules' => [ 503 'item_prototype' => ['type' => XML_ARRAY, 'rules' => [ 504 'name' => ['type' => XML_STRING | XML_REQUIRED], 505 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE], 506 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 507 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 508 'key' => ['type' => XML_STRING | XML_REQUIRED], 509 'delay' => ['type' => XML_STRING, 'default' => '1m'], 510 'history' => ['type' => XML_STRING, 'default' => '90d'], 511 'trends' => ['type' => XML_STRING, 'default' => '365d'], 512 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 513 'value_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::UNSIGNED, 'in' => $this->ITEM_VALUE_TYPE], 514 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 515 'units' => ['type' => XML_STRING, 'default' => ''], 516 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 517 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 518 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 519 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 520 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 521 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 522 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 523 'params' => ['type' => XML_STRING, 'default' => ''], 524 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 525 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 526 'username' => ['type' => XML_STRING, 'default' => ''], 527 'password' => ['type' => XML_STRING, 'default' => ''], 528 'publickey' => ['type' => XML_STRING, 'default' => ''], 529 'privatekey' => ['type' => XML_STRING, 'default' => ''], 530 'port' => ['type' => XML_STRING, 'default' => ''], 531 'description' => ['type' => XML_STRING, 'default' => ''], 532 'inventory_link' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => $this->ITEM_INVENTORY_LINK], 533 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 534 'application' => ['type' => XML_ARRAY, 'rules' => [ 535 'name' => ['type' => XML_STRING | XML_REQUIRED] 536 ]] 537 ]], 538 'application_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application_prototype', 'rules' => [ 539 'application_prototype' => ['type' => XML_ARRAY, 'rules' => [ 540 'name' => ['type' => XML_STRING | XML_REQUIRED] 541 ]] 542 ]], 543 'valuemap' => ['type' => XML_ARRAY, 'rules' => [ 544 'name' => ['type' => XML_STRING | XML_REQUIRED] 545 ]], 546 'logtimefmt' => ['type' => XML_STRING, 'default' => ''], 547 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 548 'step' => ['type' => XML_ARRAY, 'rules' => [ 549 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE], 550 'params' => ['type' => XML_STRING | XML_REQUIRED], 551 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 552 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 553 ]] 554 ]], 555 'interface_ref' => ['type' => XML_STRING], 556 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 557 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 558 'key' => ['type' => XML_STRING | XML_REQUIRED] 559 ]], 560 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 561 'url' => ['type' => XML_STRING, 'default' => ''], 562 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 563 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 564 'name' => ['type' => XML_STRING | XML_REQUIRED], 565 'value' => ['type' => XML_STRING, 'default' => ''] 566 ]] 567 ]], 568 'posts' => ['type' => XML_STRING, 'default' => ''], 569 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 570 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 571 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 572 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 573 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 574 'header' => ['type' => XML_ARRAY, 'rules' => [ 575 'name' => ['type' => XML_STRING | XML_REQUIRED], 576 'value' => ['type' => XML_STRING | XML_REQUIRED] 577 ]] 578 ]], 579 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 580 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 581 'output_format' => ['type' => XML_STRING, 'default' => CXmlConstantValue::OUTPUT_FORMAT_RAW, 'in' => [CXmlConstantValue::OUTPUT_FORMAT_RAW => CXmlConstantName::RAW, CXmlConstantValue::OUTPUT_FORMAT_JSON => CXmlConstantName::JSON]], 582 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 583 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 584 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 585 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 586 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 587 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 588 'trigger_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger_prototype', 'rules' => [ 589 'trigger_prototype' => ['type' => XML_ARRAY, 'rules' => [ 590 'expression' => ['type' => XML_STRING | XML_REQUIRED], 591 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 592 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 593 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 594 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 595 'name' => ['type' => XML_STRING | XML_REQUIRED], 596 'opdata' => ['type' => XML_STRING, 'default' => ''], 597 'url' => ['type' => XML_STRING, 'default' => ''], 598 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 599 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 600 'description' => ['type' => XML_STRING, 'default' => ''], 601 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 602 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 603 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 604 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 605 'name' => ['type' => XML_STRING | XML_REQUIRED], 606 'expression' => ['type' => XML_STRING | XML_REQUIRED], 607 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 608 ]] 609 ]], 610 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 611 'tag' => ['type' => XML_ARRAY, 'rules' => [ 612 'tag' => ['type' => XML_STRING | XML_REQUIRED], 613 'value' => ['type' => XML_STRING, 'default' => ''] 614 ]] 615 ]] 616 ]] 617 ]] 618 ]] 619 ]], 620 'trigger_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger_prototype', 'rules' => [ 621 'trigger_prototype' => ['type' => XML_ARRAY, 'rules' => [ 622 'expression' => ['type' => XML_STRING | XML_REQUIRED], 623 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 624 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 625 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 626 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 627 'name' => ['type' => XML_STRING | XML_REQUIRED], 628 'opdata' => ['type' => XML_STRING, 'default' => ''], 629 'url' => ['type' => XML_STRING, 'default' => ''], 630 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 631 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 632 'description' => ['type' => XML_STRING, 'default' => ''], 633 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 634 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 635 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 636 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 637 'name' => ['type' => XML_STRING | XML_REQUIRED], 638 'expression' => ['type' => XML_STRING | XML_REQUIRED], 639 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 640 ]] 641 ]], 642 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 643 'tag' => ['type' => XML_ARRAY, 'rules' => [ 644 'tag' => ['type' => XML_STRING | XML_REQUIRED], 645 'value' => ['type' => XML_STRING, 'default' => ''] 646 ]] 647 ]] 648 ]] 649 ]], 650 'graph_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'graph_prototype', 'rules' => [ 651 'graph_prototype' => ['type' => XML_ARRAY, 'rules' => [ 652 'name' => ['type' => XML_STRING | XML_REQUIRED], 653 'width' => ['type' => XML_STRING, 'default' => '900'], 654 'height' => ['type' => XML_STRING, 'default' => '200'], 655 'yaxismin' => ['type' => XML_STRING, 'default' => '0'], 656 'yaxismax' => ['type' => XML_STRING, 'default' => '100'], 657 'show_work_period' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 658 'show_triggers' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 659 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NORMAL, 'in' => $this->GRAPH_TYPE], 660 'show_legend' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 661 'show_3d' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 662 'percent_left' => ['type' => XML_STRING, 'default' => '0'], 663 'percent_right' => ['type' => XML_STRING, 'default' => '0'], 664 // The tag 'ymin_type_1' should be validated before the 'ymin_item_1' because it is used in 'ex_validate' method. 665 'ymin_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 666 'ymin_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMinItem'], 'export' => [$this, 'graphMinItemExport']], 667 // The tag 'ymax_type_1' should be validated before the 'ymax_item_1' because it is used in 'ex_validate' method. 668 'ymax_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 669 'ymax_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMaxItem'], 'export' => [$this, 'graphMaxItemExport']], 670 'graph_items' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'graph_item', 'ex_validate' => [$this, 'validateGraphItems'], 'rules' => [ 671 'graph_item' => ['type' => XML_ARRAY, 'rules' => [ 672 'sortorder' => ['type' => XML_STRING, 'default' => '0'], 673 'drawtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE_LINE, 'in' => $this->GRAPH_GRAPH_ITEM_DRAWTYPE], 674 'color' => ['type' => XML_STRING, 'default' => '009600'], 675 'yaxisside' => ['type' => XML_STRING, 'default' => CXmlConstantValue::LEFT, 'in' => $this->GRAPH_GRAPH_ITEM_YAXISSIDE], 676 'calc_fnc' => ['type' => XML_STRING, 'default' => CXmlConstantValue::AVG, 'in' => $this->GRAPH_GRAPH_ITEM_CALC_FNC], 677 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SIMPLE, 'in' => $this->GRAPH_GRAPH_ITEM_TYPE], 678 'item' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 679 'host' => ['type' => XML_STRING | XML_REQUIRED], 680 'key' => ['type' => XML_STRING | XML_REQUIRED] 681 ]] 682 ]] 683 ]] 684 ]] 685 ]], 686 'host_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'host_prototype', 'rules' => [ 687 'host_prototype' => ['type' => XML_ARRAY, 'rules' => [ 688 'host' => ['type' => XML_STRING | XML_REQUIRED], 689 'name' => ['type' => XML_STRING, 'default' => ''], 690 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 691 'inventory_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::INV_MODE_MANUAL, 'in' => [CXmlConstantValue::INV_MODE_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::INV_MODE_MANUAL => CXmlConstantName::MANUAL, CXmlConstantValue::INV_MODE_AUTOMATIC => CXmlConstantName::AUTOMATIC]], 692 'group_links' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'group_link', 'rules' => [ 693 'group_link' => ['type' => XML_ARRAY, 'rules' => [ 694 'group' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 695 'name' => ['type' => XML_STRING | XML_REQUIRED] 696 ]] 697 ]] 698 ]], 699 'group_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'group_prototype', 'rules' => [ 700 'group_prototype' => ['type' => XML_ARRAY, 'rules' => [ 701 'name' => ['type' => XML_STRING | XML_REQUIRED] 702 ]] 703 ]], 704 'templates' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'template', 'rules' => [ 705 'template' => ['type' => XML_ARRAY, 'rules' => [ 706 'name' => ['type' => XML_STRING | XML_REQUIRED] 707 ]] 708 ]] 709 ]] 710 ]], 711 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 712 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 713 'key' => ['type' => XML_STRING | XML_REQUIRED] 714 ]], 715 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 716 'url' => ['type' => XML_STRING, 'default' => ''], 717 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 718 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 719 'name' => ['type' => XML_STRING | XML_REQUIRED], 720 'value' => ['type' => XML_STRING, 'default' => ''] 721 ]] 722 ]], 723 'posts' => ['type' => XML_STRING, 'default' => ''], 724 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 725 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 726 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 727 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 728 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 729 'header' => ['type' => XML_ARRAY, 'rules' => [ 730 'name' => ['type' => XML_STRING | XML_REQUIRED], 731 'value' => ['type' => XML_STRING | XML_REQUIRED] 732 ]] 733 ]], 734 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 735 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 736 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 737 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 738 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 739 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 740 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 741 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 742 'lld_macro_paths' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'lld_macro_path', 'rules' => [ 743 'lld_macro_path' => ['type' => XML_ARRAY, 'rules' => [ 744 'lld_macro' => ['type' => XML_STRING | XML_REQUIRED], 745 'path' => ['type' => XML_STRING | XML_REQUIRED] 746 ]] 747 ]], 748 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 749 'step' => ['type' => XML_ARRAY, 'rules' => [ 750 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE_DRULE], 751 'params' => ['type' => XML_STRING | XML_REQUIRED], 752 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 753 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 754 ]] 755 ]] 756 ]] 757 ]], 758 'httptests' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'httptest', 'rules' => [ 759 'httptest' => ['type' => XML_ARRAY, 'rules' => [ 760 'name' => ['type' => XML_STRING | XML_REQUIRED], 761 'application' => ['type' => XML_ARRAY, 'rules' => [ 762 'name' => ['type' => XML_STRING | XML_REQUIRED] 763 ]], 764 'delay' => ['type' => XML_STRING, 'default' => '1m'], 765 'attempts' => ['type' => XML_STRING, 'default' => '1'], 766 'agent' => ['type' => XML_STRING, 'default' => 'Zabbix'], 767 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 768 'variables' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'variable', 'rules' => [ 769 'variable' => ['type' => XML_ARRAY, 'rules' => [ 770 'name' => ['type' => XML_STRING | XML_REQUIRED], 771 'value' => ['type' => XML_STRING | XML_REQUIRED] 772 ]] 773 ]], 774 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 775 'header' => ['type' => XML_ARRAY, 'rules' => [ 776 'name' => ['type' => XML_STRING | XML_REQUIRED], 777 'value' => ['type' => XML_STRING | XML_REQUIRED] 778 ]] 779 ]], 780 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 781 'authentication' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => [CXmlConstantValue::NONE => CXmlConstantName::NONE, CXmlConstantValue::BASIC => CXmlConstantName::BASIC, CXmlConstantValue::NTLM => CXmlConstantName::NTLM]], 782 'http_user' => ['type' => XML_STRING, 'default' => ''], 783 'http_password' => ['type' => XML_STRING, 'default' => ''], 784 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 785 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 786 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 787 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 788 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 789 'steps' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'step', 'rules' => [ 790 'step' => ['type' => XML_ARRAY, 'rules' => [ 791 'name' => ['type' => XML_STRING | XML_REQUIRED], 792 'url' => ['type' => XML_STRING | XML_REQUIRED], 793 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 794 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 795 'name' => ['type' => XML_STRING | XML_REQUIRED], 796 'value' => ['type' => XML_STRING, 'default' => ''] 797 ]] 798 ]], 799 'posts' => ['type' => 0, 'ex_validate' => [$this, 'validateHttpPosts']], 800 'variables' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'variable', 'rules' => [ 801 'variable' => ['type' => XML_ARRAY, 'rules' => [ 802 'name' => ['type' => XML_STRING | XML_REQUIRED], 803 'value' => ['type' => XML_STRING | XML_REQUIRED] 804 ]] 805 ]], 806 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 807 'header' => ['type' => XML_ARRAY, 'rules' => [ 808 'name' => ['type' => XML_STRING | XML_REQUIRED], 809 'value' => ['type' => XML_STRING | XML_REQUIRED] 810 ]] 811 ]], 812 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 813 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 814 'timeout' => ['type' => XML_STRING, 'default' => '15s'], 815 'required' => ['type' => XML_STRING, 'default' => ''], 816 'status_codes' => ['type' => XML_STRING, 'default' => ''] 817 ]] 818 ]] 819 ]] 820 ]], 821 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 822 'tag' => ['type' => XML_ARRAY, 'rules' => [ 823 'tag' => ['type' => XML_STRING | XML_REQUIRED], 824 'value' => ['type' => XML_STRING, 'default' => ''] 825 ]] 826 ]], 827 'macros' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'macro', 'rules' => [ 828 'macro' => ['type' => XML_ARRAY, 'rules' => [ 829 'macro' => ['type' => XML_STRING | XML_REQUIRED], 830 'value' => ['type' => XML_STRING, 'default' => ''], 831 'description' => ['type' => XML_STRING, 'default' => ''] 832 ]] 833 ]], 834 'inventory' => ['type' => XML_ARRAY, 'rules' => [ 835 'type' => ['type' => XML_STRING, 'default' => ''], 836 'type_full' => ['type' => XML_STRING, 'default' => ''], 837 'name' => ['type' => XML_STRING, 'default' => ''], 838 'alias' => ['type' => XML_STRING, 'default' => ''], 839 'os' => ['type' => XML_STRING, 'default' => ''], 840 'os_full' => ['type' => XML_STRING, 'default' => ''], 841 'os_short' => ['type' => XML_STRING, 'default' => ''], 842 'serialno_a' => ['type' => XML_STRING, 'default' => ''], 843 'serialno_b' => ['type' => XML_STRING, 'default' => ''], 844 'tag' => ['type' => XML_STRING, 'default' => ''], 845 'asset_tag' => ['type' => XML_STRING, 'default' => ''], 846 'macaddress_a' => ['type' => XML_STRING, 'default' => ''], 847 'macaddress_b' => ['type' => XML_STRING, 'default' => ''], 848 'hardware' => ['type' => XML_STRING, 'default' => ''], 849 'hardware_full' => ['type' => XML_STRING, 'default' => ''], 850 'software' => ['type' => XML_STRING, 'default' => ''], 851 'software_full' => ['type' => XML_STRING, 'default' => ''], 852 'software_app_a' => ['type' => XML_STRING, 'default' => ''], 853 'software_app_b' => ['type' => XML_STRING, 'default' => ''], 854 'software_app_c' => ['type' => XML_STRING, 'default' => ''], 855 'software_app_d' => ['type' => XML_STRING, 'default' => ''], 856 'software_app_e' => ['type' => XML_STRING, 'default' => ''], 857 'contact' => ['type' => XML_STRING, 'default' => ''], 858 'location' => ['type' => XML_STRING, 'default' => ''], 859 'location_lat' => ['type' => XML_STRING, 'default' => ''], 860 'location_lon' => ['type' => XML_STRING, 'default' => ''], 861 'notes' => ['type' => XML_STRING, 'default' => ''], 862 'chassis' => ['type' => XML_STRING, 'default' => ''], 863 'model' => ['type' => XML_STRING, 'default' => ''], 864 'hw_arch' => ['type' => XML_STRING, 'default' => ''], 865 'vendor' => ['type' => XML_STRING, 'default' => ''], 866 'contract_number' => ['type' => XML_STRING, 'default' => ''], 867 'installer_name' => ['type' => XML_STRING, 'default' => ''], 868 'deployment_status' => ['type' => XML_STRING, 'default' => ''], 869 'url_a' => ['type' => XML_STRING, 'default' => ''], 870 'url_b' => ['type' => XML_STRING, 'default' => ''], 871 'url_c' => ['type' => XML_STRING, 'default' => ''], 872 'host_networks' => ['type' => XML_STRING, 'default' => ''], 873 'host_netmask' => ['type' => XML_STRING, 'default' => ''], 874 'host_router' => ['type' => XML_STRING, 'default' => ''], 875 'oob_ip' => ['type' => XML_STRING, 'default' => ''], 876 'oob_netmask' => ['type' => XML_STRING, 'default' => ''], 877 'oob_router' => ['type' => XML_STRING, 'default' => ''], 878 'date_hw_purchase' => ['type' => XML_STRING, 'default' => ''], 879 'date_hw_install' => ['type' => XML_STRING, 'default' => ''], 880 'date_hw_expiry' => ['type' => XML_STRING, 'default' => ''], 881 'date_hw_decomm' => ['type' => XML_STRING, 'default' => ''], 882 'site_address_a' => ['type' => XML_STRING, 'default' => ''], 883 'site_address_b' => ['type' => XML_STRING, 'default' => ''], 884 'site_address_c' => ['type' => XML_STRING, 'default' => ''], 885 'site_city' => ['type' => XML_STRING, 'default' => ''], 886 'site_state' => ['type' => XML_STRING, 'default' => ''], 887 'site_country' => ['type' => XML_STRING, 'default' => ''], 888 'site_zip' => ['type' => XML_STRING, 'default' => ''], 889 'site_rack' => ['type' => XML_STRING, 'default' => ''], 890 'site_notes' => ['type' => XML_STRING, 'default' => ''], 891 'poc_1_name' => ['type' => XML_STRING, 'default' => ''], 892 'poc_1_email' => ['type' => XML_STRING, 'default' => ''], 893 'poc_1_phone_a' => ['type' => XML_STRING, 'default' => ''], 894 'poc_1_phone_b' => ['type' => XML_STRING, 'default' => ''], 895 'poc_1_cell' => ['type' => XML_STRING, 'default' => ''], 896 'poc_1_screen' => ['type' => XML_STRING, 'default' => ''], 897 'poc_1_notes' => ['type' => XML_STRING, 'default' => ''], 898 'poc_2_name' => ['type' => XML_STRING, 'default' => ''], 899 'poc_2_email' => ['type' => XML_STRING, 'default' => ''], 900 'poc_2_phone_a' => ['type' => XML_STRING, 'default' => ''], 901 'poc_2_phone_b' => ['type' => XML_STRING, 'default' => ''], 902 'poc_2_cell' => ['type' => XML_STRING, 'default' => ''], 903 'poc_2_screen' => ['type' => XML_STRING, 'default' => ''], 904 'poc_2_notes' => ['type' => XML_STRING, 'default' => ''] 905 ]], 906 'inventory_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::INV_MODE_MANUAL, 'in' => [CXmlConstantValue::INV_MODE_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::INV_MODE_MANUAL => CXmlConstantName::MANUAL, CXmlConstantValue::INV_MODE_AUTOMATIC => CXmlConstantName::AUTOMATIC]] 907 ]] 908 ]], 909 'templates' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'template', 'rules' => [ 910 'template' => ['type' => XML_ARRAY, 'rules' => [ 911 'template' => ['type' => XML_STRING | XML_REQUIRED], 912 'name' => ['type' => XML_STRING, 'default' => ''], 913 'description' => ['type' => XML_STRING, 'default' => ''], 914 'templates' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'template', 'rules' => [ 915 'template' => ['type' => XML_ARRAY, 'rules' => [ 916 'name' => ['type' => XML_STRING | XML_REQUIRED] 917 ]] 918 ]], 919 'groups' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'group', 'rules' => [ 920 'group' => ['type' => XML_ARRAY, 'rules' => [ 921 'name' => ['type' => XML_STRING | XML_REQUIRED] 922 ]] 923 ]], 924 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 925 'application' => ['type' => XML_ARRAY, 'rules' => [ 926 'name' => ['type' => XML_STRING | XML_REQUIRED] 927 ]] 928 ]], 929 'items' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'item', 'rules' => [ 930 'item' => ['type' => XML_ARRAY, 'rules' => [ 931 'name' => ['type' => XML_STRING | XML_REQUIRED], 932 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE], 933 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 934 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 935 'key' => ['type' => XML_STRING | XML_REQUIRED], 936 'delay' => ['type' => XML_STRING, 'default' => '1m'], 937 'history' => ['type' => XML_STRING, 'default' => '90d'], 938 'trends' => ['type' => XML_STRING, 'default' => '365d'], 939 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 940 'value_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::UNSIGNED, 'in' => $this->ITEM_VALUE_TYPE], 941 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 942 'units' => ['type' => XML_STRING, 'default' => ''], 943 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 944 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 945 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 946 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 947 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 948 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 949 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 950 'params' => ['type' => XML_STRING, 'default' => ''], 951 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 952 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 953 'username' => ['type' => XML_STRING, 'default' => ''], 954 'password' => ['type' => XML_STRING, 'default' => ''], 955 'publickey' => ['type' => XML_STRING, 'default' => ''], 956 'privatekey' => ['type' => XML_STRING, 'default' => ''], 957 'port' => ['type' => XML_STRING, 'default' => ''], 958 'description' => ['type' => XML_STRING, 'default' => ''], 959 'inventory_link' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => $this->ITEM_INVENTORY_LINK], 960 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 961 'application' => ['type' => XML_ARRAY, 'rules' => [ 962 'name' => ['type' => XML_STRING | XML_REQUIRED] 963 ]] 964 ]], 965 'valuemap' => ['type' => XML_ARRAY, 'rules' => [ 966 'name' => ['type' => XML_STRING | XML_REQUIRED] 967 ]], 968 'logtimefmt' => ['type' => XML_STRING, 'default' => ''], 969 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 970 'step' => ['type' => XML_ARRAY, 'rules' => [ 971 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE], 972 'params' => ['type' => XML_STRING | XML_REQUIRED], 973 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 974 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 975 ]] 976 ]], 977 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 978 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 979 'key' => ['type' => XML_STRING | XML_REQUIRED] 980 ]], 981 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 982 'url' => ['type' => XML_STRING, 'default' => ''], 983 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 984 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 985 'name' => ['type' => XML_STRING | XML_REQUIRED], 986 'value' => ['type' => XML_STRING, 'default' => ''] 987 ]] 988 ]], 989 'posts' => ['type' => XML_STRING, 'default' => ''], 990 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 991 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 992 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 993 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 994 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 995 'header' => ['type' => XML_ARRAY, 'rules' => [ 996 'name' => ['type' => XML_STRING | XML_REQUIRED], 997 'value' => ['type' => XML_STRING | XML_REQUIRED] 998 ]] 999 ]], 1000 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 1001 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 1002 'output_format' => ['type' => XML_STRING, 'default' => CXmlConstantValue::OUTPUT_FORMAT_RAW, 'in' => [CXmlConstantValue::OUTPUT_FORMAT_RAW => CXmlConstantName::RAW, CXmlConstantValue::OUTPUT_FORMAT_JSON => CXmlConstantName::JSON]], 1003 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1004 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 1005 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 1006 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 1007 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1008 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1009 'triggers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger', 'rules' => [ 1010 'trigger' => ['type' => XML_ARRAY, 'rules' => [ 1011 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1012 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 1013 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 1014 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 1015 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 1016 'name' => ['type' => XML_STRING | XML_REQUIRED], 1017 'opdata' => ['type' => XML_STRING, 'default' => ''], 1018 'url' => ['type' => XML_STRING, 'default' => ''], 1019 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1020 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 1021 'description' => ['type' => XML_STRING, 'default' => ''], 1022 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 1023 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1024 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 1025 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 1026 'name' => ['type' => XML_STRING | XML_REQUIRED], 1027 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1028 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 1029 ]] 1030 ]], 1031 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 1032 'tag' => ['type' => XML_ARRAY, 'rules' => [ 1033 'tag' => ['type' => XML_STRING | XML_REQUIRED], 1034 'value' => ['type' => XML_STRING, 'default' => ''] 1035 ]] 1036 ]] 1037 ]] 1038 ]] 1039 ]] 1040 ]], 1041 'discovery_rules' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'discovery_rule', 'rules' => [ 1042 'discovery_rule' => ['type' => XML_ARRAY, 'rules' => [ 1043 'name' => ['type' => XML_STRING | XML_REQUIRED], 1044 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE_DRULE], 1045 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 1046 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 1047 'key' => ['type' => XML_STRING | XML_REQUIRED], 1048 'delay' => ['type' => XML_STRING, 'default' => '1m'], 1049 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1050 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 1051 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 1052 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 1053 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 1054 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 1055 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 1056 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 1057 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 1058 'params' => ['type' => XML_STRING, 'default' => ''], 1059 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 1060 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 1061 'username' => ['type' => XML_STRING, 'default' => ''], 1062 'password' => ['type' => XML_STRING, 'default' => ''], 1063 'publickey' => ['type' => XML_STRING, 'default' => ''], 1064 'privatekey' => ['type' => XML_STRING, 'default' => ''], 1065 'port' => ['type' => XML_STRING, 'default' => ''], 1066 'filter' => ['type' => XML_ARRAY, 'import' => [$this, 'itemFilterImport'], 'rules' => [ 1067 'evaltype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::AND_OR, 'in' => [CXmlConstantValue::AND_OR => CXmlConstantName::AND_OR, CXmlConstantValue::XML_AND => CXmlConstantName::XML_AND, CXmlConstantValue::XML_OR => CXmlConstantName::XML_OR, CXmlConstantValue::FORMULA => CXmlConstantName::FORMULA]], 1068 'formula' => ['type' => XML_STRING, 'default' => ''], 1069 'conditions' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'condition', 'rules' => [ 1070 'condition' => ['type' => XML_ARRAY, 'rules' => [ 1071 'macro' => ['type' => XML_STRING | XML_REQUIRED], 1072 'value' => ['type' => XML_STRING, 'default' => ''], 1073 'operator' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CONDITION_MATCHES_REGEX, 'in' => [CXmlConstantValue::CONDITION_MATCHES_REGEX => CXmlConstantName::MATCHES_REGEX, CXmlConstantValue::CONDITION_NOT_MATCHES_REGEX => CXmlConstantName::NOT_MATCHES_REGEX]], 1074 'formulaid' => ['type' => XML_STRING | XML_REQUIRED] 1075 ]] 1076 ]] 1077 ]], 1078 'lifetime' => ['type' => XML_STRING, 'default' => '30d'], 1079 'description' => ['type' => XML_STRING, 'default' => ''], 1080 'item_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'item_prototype', 'rules' => [ 1081 'item_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1082 'name' => ['type' => XML_STRING | XML_REQUIRED], 1083 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ITEM_TYPE_ZABBIX_PASSIVE, 'in' => $this->ITEM_TYPE], 1084 'snmp_community' => ['type' => XML_STRING, 'default' => ''], 1085 'snmp_oid' => ['type' => XML_STRING, 'default' => ''], 1086 'key' => ['type' => XML_STRING | XML_REQUIRED], 1087 'delay' => ['type' => XML_STRING, 'default' => '1m'], 1088 'history' => ['type' => XML_STRING, 'default' => '90d'], 1089 'trends' => ['type' => XML_STRING, 'default' => '365d'], 1090 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1091 'value_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::UNSIGNED, 'in' => $this->ITEM_VALUE_TYPE], 1092 'allowed_hosts' => ['type' => XML_STRING, 'default' => ''], 1093 'units' => ['type' => XML_STRING, 'default' => ''], 1094 'snmpv3_contextname' => ['type' => XML_STRING, 'default' => ''], 1095 'snmpv3_securityname' => ['type' => XML_STRING, 'default' => ''], 1096 'snmpv3_securitylevel' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOAUTHNOPRIV, 'in' => $this->ITEM_SNMPV3_SECURITYLEVEL], 1097 'snmpv3_authprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_MD5, 'in' => [CXmlConstantValue::SNMPV3_MD5 => CXmlConstantName::MD5, CXmlConstantValue::SNMPV3_SHA1 => CXmlConstantName::SHA]], 1098 'snmpv3_authpassphrase' => ['type' => XML_STRING, 'default' => ''], 1099 'snmpv3_privprotocol' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SNMPV3_DES, 'in' => [CXmlConstantValue::SNMPV3_DES => CXmlConstantName::DES, CXmlConstantValue::SNMPV3_AES128 => CXmlConstantName::AES]], 1100 'snmpv3_privpassphrase' => ['type' => XML_STRING, 'default' => ''], 1101 'params' => ['type' => XML_STRING, 'default' => ''], 1102 'ipmi_sensor' => ['type' => XML_STRING, 'default' => ''], 1103 'authtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'ex_validate' => [$this, 'validateAuthType'], 'ex_rules' => [$this, 'getAuthTypeExtendedRules'], 'export' => [$this, 'itemAuthtypeExport']], 1104 'username' => ['type' => XML_STRING, 'default' => ''], 1105 'password' => ['type' => XML_STRING, 'default' => ''], 1106 'publickey' => ['type' => XML_STRING, 'default' => ''], 1107 'privatekey' => ['type' => XML_STRING, 'default' => ''], 1108 'port' => ['type' => XML_STRING, 'default' => ''], 1109 'description' => ['type' => XML_STRING, 'default' => ''], 1110 'inventory_link' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => $this->ITEM_INVENTORY_LINK], 1111 'applications' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application', 'rules' => [ 1112 'application' => ['type' => XML_ARRAY, 'rules' => [ 1113 'name' => ['type' => XML_STRING | XML_REQUIRED] 1114 ]] 1115 ]], 1116 'application_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'application_prototype', 'rules' => [ 1117 'application_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1118 'name' => ['type' => XML_STRING | XML_REQUIRED] 1119 ]] 1120 ]], 1121 'valuemap' => ['type' => XML_ARRAY, 'rules' => [ 1122 'name' => ['type' => XML_STRING | XML_REQUIRED] 1123 ]], 1124 'logtimefmt' => ['type' => XML_STRING, 'default' => ''], 1125 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 1126 'step' => ['type' => XML_ARRAY, 'rules' => [ 1127 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE], 1128 'params' => ['type' => XML_STRING | XML_REQUIRED], 1129 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 1130 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 1131 ]] 1132 ]], 1133 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 1134 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 1135 'key' => ['type' => XML_STRING | XML_REQUIRED] 1136 ]], 1137 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 1138 'url' => ['type' => XML_STRING, 'default' => ''], 1139 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 1140 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 1141 'name' => ['type' => XML_STRING | XML_REQUIRED], 1142 'value' => ['type' => XML_STRING, 'default' => ''] 1143 ]] 1144 ]], 1145 'posts' => ['type' => XML_STRING, 'default' => ''], 1146 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 1147 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1148 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 1149 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 1150 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 1151 'header' => ['type' => XML_ARRAY, 'rules' => [ 1152 'name' => ['type' => XML_STRING | XML_REQUIRED], 1153 'value' => ['type' => XML_STRING | XML_REQUIRED] 1154 ]] 1155 ]], 1156 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 1157 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 1158 'output_format' => ['type' => XML_STRING, 'default' => CXmlConstantValue::OUTPUT_FORMAT_RAW, 'in' => [CXmlConstantValue::OUTPUT_FORMAT_RAW => CXmlConstantName::RAW, CXmlConstantValue::OUTPUT_FORMAT_JSON => CXmlConstantName::JSON]], 1159 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1160 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 1161 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 1162 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 1163 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1164 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1165 'trigger_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger_prototype', 'rules' => [ 1166 'trigger_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1167 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1168 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 1169 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 1170 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 1171 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 1172 'name' => ['type' => XML_STRING | XML_REQUIRED], 1173 'opdata' => ['type' => XML_STRING, 'default' => ''], 1174 'url' => ['type' => XML_STRING, 'default' => ''], 1175 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1176 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 1177 'description' => ['type' => XML_STRING, 'default' => ''], 1178 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 1179 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1180 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 1181 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 1182 'name' => ['type' => XML_STRING | XML_REQUIRED], 1183 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1184 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 1185 ]] 1186 ]], 1187 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 1188 'tag' => ['type' => XML_ARRAY, 'rules' => [ 1189 'tag' => ['type' => XML_STRING | XML_REQUIRED], 1190 'value' => ['type' => XML_STRING, 'default' => ''] 1191 ]] 1192 ]] 1193 ]] 1194 ]] 1195 ]] 1196 ]], 1197 'trigger_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger_prototype', 'rules' => [ 1198 'trigger_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1199 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1200 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 1201 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 1202 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 1203 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 1204 'name' => ['type' => XML_STRING | XML_REQUIRED], 1205 'opdata' => ['type' => XML_STRING, 'default' => ''], 1206 'url' => ['type' => XML_STRING, 'default' => ''], 1207 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1208 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 1209 'description' => ['type' => XML_STRING, 'default' => ''], 1210 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 1211 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1212 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 1213 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 1214 'name' => ['type' => XML_STRING | XML_REQUIRED], 1215 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1216 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 1217 ]] 1218 ]], 1219 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 1220 'tag' => ['type' => XML_ARRAY, 'rules' => [ 1221 'tag' => ['type' => XML_STRING | XML_REQUIRED], 1222 'value' => ['type' => XML_STRING, 'default' => ''] 1223 ]] 1224 ]] 1225 ]] 1226 ]], 1227 'graph_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'graph_prototype', 'rules' => [ 1228 'graph_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1229 'name' => ['type' => XML_STRING | XML_REQUIRED], 1230 'width' => ['type' => XML_STRING, 'default' => '900'], 1231 'height' => ['type' => XML_STRING, 'default' => '200'], 1232 'yaxismin' => ['type' => XML_STRING, 'default' => '0'], 1233 'yaxismax' => ['type' => XML_STRING, 'default' => '100'], 1234 'show_work_period' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1235 'show_triggers' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1236 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NORMAL, 'in' => $this->GRAPH_TYPE], 1237 'show_legend' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1238 'show_3d' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1239 'percent_left' => ['type' => XML_STRING, 'default' => '0'], 1240 'percent_right' => ['type' => XML_STRING, 'default' => '0'], 1241 // The tag 'ymin_type_1' should be validated before the 'ymin_item_1' because it is used in 'ex_validate' method. 1242 'ymin_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 1243 'ymin_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMinItem'], 'export' => [$this, 'graphMinItemExport']], 1244 // The tag 'ymax_type_1' should be validated before the 'ymax_item_1' because it is used in 'ex_validate' method. 1245 'ymax_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 1246 'ymax_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMaxItem'], 'export' => [$this, 'graphMaxItemExport']], 1247 'graph_items' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'graph_item', 'ex_validate' => [$this, 'validateGraphItems'], 'rules' => [ 1248 'graph_item' => ['type' => XML_ARRAY, 'rules' => [ 1249 'sortorder' => ['type' => XML_STRING, 'default' => '0'], 1250 'drawtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE_LINE, 'in' => $this->GRAPH_GRAPH_ITEM_DRAWTYPE], 1251 'color' => ['type' => XML_STRING, 'default' => '009600'], 1252 'yaxisside' => ['type' => XML_STRING, 'default' => CXmlConstantValue::LEFT, 'in' => $this->GRAPH_GRAPH_ITEM_YAXISSIDE], 1253 'calc_fnc' => ['type' => XML_STRING, 'default' => CXmlConstantValue::AVG, 'in' => $this->GRAPH_GRAPH_ITEM_CALC_FNC], 1254 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SIMPLE, 'in' => $this->GRAPH_GRAPH_ITEM_TYPE], 1255 'item' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1256 'host' => ['type' => XML_STRING | XML_REQUIRED], 1257 'key' => ['type' => XML_STRING | XML_REQUIRED] 1258 ]] 1259 ]] 1260 ]] 1261 ]] 1262 ]], 1263 'host_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'host_prototype', 'rules' => [ 1264 'host_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1265 'host' => ['type' => XML_STRING | XML_REQUIRED], 1266 'name' => ['type' => XML_STRING, 'default' => ''], 1267 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1268 'group_links' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'group_link', 'rules' => [ 1269 'group_link' => ['type' => XML_ARRAY, 'rules' => [ 1270 'group' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1271 'name' => ['type' => XML_STRING | XML_REQUIRED] 1272 ]] 1273 ]] 1274 ]], 1275 'group_prototypes' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'group_prototype', 'rules' => [ 1276 'group_prototype' => ['type' => XML_ARRAY, 'rules' => [ 1277 'name' => ['type' => XML_STRING | XML_REQUIRED] 1278 ]] 1279 ]], 1280 'templates' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'template', 'rules' => [ 1281 'template' => ['type' => XML_ARRAY, 'rules' => [ 1282 'name' => ['type' => XML_STRING | XML_REQUIRED] 1283 ]] 1284 ]] 1285 ]] 1286 ]], 1287 'jmx_endpoint' => ['type' => XML_STRING, 'default' => ''], 1288 'master_item' => ['type' => XML_ARRAY, 'ex_validate' => [$this, 'validateMasterItem'], 'rules' => [ 1289 'key' => ['type' => XML_STRING | XML_REQUIRED] 1290 ]], 1291 'timeout' => ['type' => XML_STRING, 'default' => '3s'], 1292 'url' => ['type' => XML_STRING, 'default' => ''], 1293 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 1294 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 1295 'name' => ['type' => XML_STRING | XML_REQUIRED], 1296 'value' => ['type' => XML_STRING, 'default' => ''] 1297 ]] 1298 ]], 1299 'posts' => ['type' => XML_STRING, 'default' => ''], 1300 'status_codes' => ['type' => XML_STRING, 'default' => '200'], 1301 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1302 'post_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::RAW, 'in' => $this->ITEM_POST_TYPE], 1303 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 1304 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 1305 'header' => ['type' => XML_ARRAY, 'rules' => [ 1306 'name' => ['type' => XML_STRING | XML_REQUIRED], 1307 'value' => ['type' => XML_STRING | XML_REQUIRED] 1308 ]] 1309 ]], 1310 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 1311 'request_method' => ['type' => XML_STRING, 'default' => CXmlConstantValue::GET, 'in' => $this->ITEM_REQUEST_METHOD], 1312 'allow_traps' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1313 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 1314 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 1315 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 1316 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1317 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1318 'lld_macro_paths' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'lld_macro_path', 'rules' => [ 1319 'lld_macro_path' => ['type' => XML_ARRAY, 'rules' => [ 1320 'lld_macro' => ['type' => XML_STRING | XML_REQUIRED], 1321 'path' => ['type' => XML_STRING | XML_REQUIRED] 1322 ]] 1323 ]], 1324 'preprocessing' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'step', 'rules' => [ 1325 'step' => ['type' => XML_ARRAY, 'rules' => [ 1326 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => $this->PREPROCESSING_STEP_TYPE_DRULE], 1327 'params' => ['type' => XML_STRING | XML_REQUIRED], 1328 'error_handler' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ORIGINAL_ERROR, 'in' => $this->ITEM_PREPROCESSING_ERROR_HANDLER], 1329 'error_handler_params' => ['type' => XML_STRING, 'default' => ''] 1330 ]] 1331 ]] 1332 ]] 1333 ]], 1334 'httptests' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'httptest', 'rules' => [ 1335 'httptest' => ['type' => XML_ARRAY, 'rules' => [ 1336 'name' => ['type' => XML_STRING | XML_REQUIRED], 1337 'application' => ['type' => XML_ARRAY, 'rules' => [ 1338 'name' => ['type' => XML_STRING | XML_REQUIRED] 1339 ]], 1340 'delay' => ['type' => XML_STRING, 'default' => '1m'], 1341 'attempts' => ['type' => XML_STRING, 'default' => '1'], 1342 'agent' => ['type' => XML_STRING, 'default' => 'Zabbix'], 1343 'http_proxy' => ['type' => XML_STRING, 'default' => ''], 1344 'variables' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'variable', 'rules' => [ 1345 'variable' => ['type' => XML_ARRAY, 'rules' => [ 1346 'name' => ['type' => XML_STRING | XML_REQUIRED], 1347 'value' => ['type' => XML_STRING | XML_REQUIRED] 1348 ]] 1349 ]], 1350 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 1351 'header' => ['type' => XML_ARRAY, 'rules' => [ 1352 'name' => ['type' => XML_STRING | XML_REQUIRED], 1353 'value' => ['type' => XML_STRING | XML_REQUIRED] 1354 ]] 1355 ]], 1356 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1357 'authentication' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => [CXmlConstantValue::NONE => CXmlConstantName::NONE, CXmlConstantValue::BASIC => CXmlConstantName::BASIC, CXmlConstantValue::NTLM => CXmlConstantName::NTLM]], 1358 'http_user' => ['type' => XML_STRING, 'default' => ''], 1359 'http_password' => ['type' => XML_STRING, 'default' => ''], 1360 'verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1361 'verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1362 'ssl_cert_file' => ['type' => XML_STRING, 'default' => ''], 1363 'ssl_key_file' => ['type' => XML_STRING, 'default' => ''], 1364 'ssl_key_password' => ['type' => XML_STRING, 'default' => ''], 1365 'steps' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'step', 'rules' => [ 1366 'step' => ['type' => XML_ARRAY, 'rules' => [ 1367 'name' => ['type' => XML_STRING | XML_REQUIRED], 1368 'url' => ['type' => XML_STRING | XML_REQUIRED], 1369 'query_fields' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'query_field', 'rules' => [ 1370 'query_field' => ['type' => XML_ARRAY, 'rules' => [ 1371 'name' => ['type' => XML_STRING | XML_REQUIRED], 1372 'value' => ['type' => XML_STRING, 'default' => ''] 1373 ]] 1374 ]], 1375 'posts' => ['type' => 0, 'ex_validate' => [$this, 'validateHttpPosts']], 1376 'variables' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'variable', 'rules' => [ 1377 'variable' => ['type' => XML_ARRAY, 'rules' => [ 1378 'name' => ['type' => XML_STRING | XML_REQUIRED], 1379 'value' => ['type' => XML_STRING | XML_REQUIRED] 1380 ]] 1381 ]], 1382 'headers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'header', 'rules' => [ 1383 'header' => ['type' => XML_ARRAY, 'rules' => [ 1384 'name' => ['type' => XML_STRING | XML_REQUIRED], 1385 'value' => ['type' => XML_STRING | XML_REQUIRED] 1386 ]] 1387 ]], 1388 'follow_redirects' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1389 'retrieve_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::BODY, 'in' => $this->ITEM_RETRIEVE_MODE], 1390 'timeout' => ['type' => XML_STRING, 'default' => '15s'], 1391 'required' => ['type' => XML_STRING, 'default' => ''], 1392 'status_codes' => ['type' => XML_STRING, 'default' => ''] 1393 ]] 1394 ]] 1395 ]] 1396 ]], 1397 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 1398 'tag' => ['type' => XML_ARRAY, 'rules' => [ 1399 'tag' => ['type' => XML_STRING | XML_REQUIRED], 1400 'value' => ['type' => XML_STRING, 'default' => ''] 1401 ]] 1402 ]], 1403 'macros' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'macro', 'rules' => [ 1404 'macro' => ['type' => XML_ARRAY, 'rules' => [ 1405 'macro' => ['type' => XML_STRING | XML_REQUIRED], 1406 'value' => ['type' => XML_STRING, 'default' => ''], 1407 'description' => ['type' => XML_STRING, 'default' => ''] 1408 ]] 1409 ]], 1410 'screens' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'screen', 'rules' => [ 1411 'screen' => ['type' => XML_ARRAY, 'rules' => [ 1412 'name' => ['type' => XML_STRING | XML_REQUIRED], 1413 'hsize' => ['type' => XML_STRING | XML_REQUIRED], 1414 'vsize' => ['type' => XML_STRING | XML_REQUIRED], 1415 'screen_items' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'screen_item', 'rules' => [ 1416 'screen_item' => ['type' => XML_ARRAY, 'rules' => [ 1417 // The tag 'resourcetype' should be validated before the 'resource' because it is used in 'ex_validate' method. 1418 'resourcetype' => ['type' => XML_STRING | XML_REQUIRED], 1419 // The tag 'style' should be validated before the 'resource' because it is used in 'ex_validate' method. 1420 'style' => ['type' => XML_STRING | XML_REQUIRED], 1421 'resource' => ['type' => XML_REQUIRED, 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateScreenItemResource']], 1422 'width' => ['type' => XML_STRING | XML_REQUIRED], 1423 'height' => ['type' => XML_STRING | XML_REQUIRED], 1424 'x' => ['type' => XML_STRING | XML_REQUIRED], 1425 'y' => ['type' => XML_STRING | XML_REQUIRED], 1426 'colspan' => ['type' => XML_STRING | XML_REQUIRED], 1427 'rowspan' => ['type' => XML_STRING | XML_REQUIRED], 1428 'elements' => ['type' => XML_STRING | XML_REQUIRED], 1429 'valign' => ['type' => XML_STRING | XML_REQUIRED], 1430 'halign' => ['type' => XML_STRING | XML_REQUIRED], 1431 'dynamic' => ['type' => XML_STRING | XML_REQUIRED], 1432 'sort_triggers' => ['type' => XML_STRING | XML_REQUIRED], 1433 'url' => ['type' => XML_STRING | XML_REQUIRED], 1434 'application' => ['type' => XML_STRING | XML_REQUIRED], 1435 'max_columns' => ['type' => XML_STRING | XML_REQUIRED] 1436 ]] 1437 ]] 1438 ]] 1439 ]], 1440 'inventory_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::INV_MODE_MANUAL, 'in' => [CXmlConstantValue::INV_MODE_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::INV_MODE_MANUAL => CXmlConstantName::MANUAL, CXmlConstantValue::INV_MODE_AUTOMATIC => CXmlConstantName::AUTOMATIC]] 1441 ]] 1442 ]], 1443 'triggers' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'trigger', 'rules' => [ 1444 'trigger' => ['type' => XML_ARRAY, 'rules' => [ 1445 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1446 'recovery_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_EXPRESSION, 'in' => $this->TRIGGER_RECOVERY_MODE], 1447 'recovery_expression' => ['type' => XML_STRING, 'default' => ''], 1448 'correlation_mode' => ['type' => XML_STRING, 'default' => CXmlConstantValue::TRIGGER_DISABLED, 'in' => [CXmlConstantValue::TRIGGER_DISABLED => CXmlConstantName::DISABLED, CXmlConstantValue::TRIGGER_TAG_VALUE => CXmlConstantName::TAG_VALUE]], 1449 'correlation_tag' => ['type' => XML_STRING, 'default' => ''], 1450 'name' => ['type' => XML_STRING | XML_REQUIRED], 1451 'opdata' => ['type' => XML_STRING, 'default' => ''], 1452 'url' => ['type' => XML_STRING, 'default' => ''], 1453 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1454 'priority' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NOT_CLASSIFIED, 'in' => $this->TRIGGER_PRIORITY], 1455 'description' => ['type' => XML_STRING, 'default' => ''], 1456 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE, 'in' => [CXmlConstantValue::SINGLE => CXmlConstantName::SINGLE, CXmlConstantValue::MULTIPLE => CXmlConstantName::MULTIPLE]], 1457 'manual_close' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1458 'dependencies' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'dependency', 'rules' => [ 1459 'dependency' => ['type' => XML_ARRAY, 'rules' => [ 1460 'name' => ['type' => XML_STRING | XML_REQUIRED], 1461 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1462 'recovery_expression' => ['type' => XML_STRING, 'default' => ''] 1463 ]] 1464 ]], 1465 'tags' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'tag', 'rules' => [ 1466 'tag' => ['type' => XML_ARRAY, 'rules' => [ 1467 'tag' => ['type' => XML_STRING | XML_REQUIRED], 1468 'value' => ['type' => XML_STRING, 'default' => ''] 1469 ]] 1470 ]] 1471 ]] 1472 ]], 1473 'graphs' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'graph', 'rules' => [ 1474 'graph' => ['type' => XML_ARRAY, 'rules' => [ 1475 'name' => ['type' => XML_STRING | XML_REQUIRED], 1476 'width' => ['type' => XML_STRING, 'default' => '900'], 1477 'height' => ['type' => XML_STRING, 'default' => '200'], 1478 'yaxismin' => ['type' => XML_STRING, 'default' => '0'], 1479 'yaxismax' => ['type' => XML_STRING, 'default' => '100'], 1480 'show_work_period' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1481 'show_triggers' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1482 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NORMAL, 'in' => $this->GRAPH_TYPE], 1483 'show_legend' => ['type' => XML_STRING, 'default' => CXmlConstantValue::YES, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1484 'show_3d' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1485 'percent_left' => ['type' => XML_STRING, 'default' => '0'], 1486 'percent_right' => ['type' => XML_STRING, 'default' => '0'], 1487 // The tag 'ymin_type_1' should be validated before the 'ymin_item_1' because it is used in 'ex_validate' method. 1488 'ymin_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 1489 'ymin_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMinItem'], 'export' => [$this, 'graphMinItemExport']], 1490 // The tag 'ymax_type_1' should be validated before the 'ymax_item_1' because it is used in 'ex_validate' method. 1491 'ymax_type_1' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CALCULATED, 'in' => $this->GRAPH_Y_TYPE], 1492 'ymax_item_1' => ['type' => 0, 'default' => '0', 'preprocessor' => [$this, 'transformZero2Array'], 'ex_validate' => [$this, 'validateYMaxItem'], 'export' => [$this, 'graphMaxItemExport']], 1493 'graph_items' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'graph_item', 'ex_validate' => [$this, 'validateGraphItems'], 'rules' => [ 1494 'graph_item' => ['type' => XML_ARRAY, 'rules' => [ 1495 'sortorder' => ['type' => XML_STRING, 'default' => '0'], 1496 'drawtype' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SINGLE_LINE, 'in' => $this->GRAPH_GRAPH_ITEM_DRAWTYPE], 1497 'color' => ['type' => XML_STRING, 'default' => '009600'], 1498 'yaxisside' => ['type' => XML_STRING, 'default' => CXmlConstantValue::LEFT, 'in' => $this->GRAPH_GRAPH_ITEM_YAXISSIDE], 1499 'calc_fnc' => ['type' => XML_STRING, 'default' => CXmlConstantValue::AVG, 'in' => $this->GRAPH_GRAPH_ITEM_CALC_FNC], 1500 'type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SIMPLE, 'in' => $this->GRAPH_GRAPH_ITEM_TYPE], 1501 'item' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1502 'host' => ['type' => XML_STRING | XML_REQUIRED], 1503 'key' => ['type' => XML_STRING | XML_REQUIRED] 1504 ]] 1505 ]] 1506 ]] 1507 ]] 1508 ]], 1509 'images' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'image', 'rules' => [ 1510 'image' => ['type' => XML_ARRAY, 'rules' => [ 1511 'name' => ['type' => XML_STRING | XML_REQUIRED], 1512 'imagetype' => ['type' => XML_STRING | XML_REQUIRED], 1513 'encodedImage' => ['type' => XML_STRING | XML_REQUIRED] 1514 ]] 1515 ]], 1516 'maps' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'map', 'rules' => [ 1517 'map' => ['type' => XML_ARRAY, 'rules' => [ 1518 'name' => ['type' => XML_STRING | XML_REQUIRED], 1519 'width' => ['type' => XML_STRING | XML_REQUIRED], 1520 'height' => ['type' => XML_STRING | XML_REQUIRED], 1521 'label_type' => ['type' => XML_STRING | XML_REQUIRED], 1522 'label_location' => ['type' => XML_STRING | XML_REQUIRED], 1523 'highlight' => ['type' => XML_STRING | XML_REQUIRED], 1524 'expandproblem' => ['type' => XML_STRING | XML_REQUIRED], 1525 'markelements' => ['type' => XML_STRING | XML_REQUIRED], 1526 'show_unack' => ['type' => XML_STRING | XML_REQUIRED], 1527 'severity_min' => ['type' => XML_STRING | XML_REQUIRED], 1528 'show_suppressed' => ['type' => XML_STRING | XML_REQUIRED], 1529 'grid_size' => ['type' => XML_STRING | XML_REQUIRED], 1530 'grid_show' => ['type' => XML_STRING | XML_REQUIRED], 1531 'grid_align' => ['type' => XML_STRING | XML_REQUIRED], 1532 'label_format' => ['type' => XML_STRING | XML_REQUIRED], 1533 'label_type_host' => ['type' => XML_STRING | XML_REQUIRED], 1534 'label_type_hostgroup' => ['type' => XML_STRING | XML_REQUIRED], 1535 'label_type_trigger' => ['type' => XML_STRING | XML_REQUIRED], 1536 'label_type_map' => ['type' => XML_STRING | XML_REQUIRED], 1537 'label_type_image' => ['type' => XML_STRING | XML_REQUIRED], 1538 'label_string_host' => ['type' => XML_STRING | XML_REQUIRED], 1539 'label_string_hostgroup' => ['type' => XML_STRING | XML_REQUIRED], 1540 'label_string_trigger' => ['type' => XML_STRING | XML_REQUIRED], 1541 'label_string_map' => ['type' => XML_STRING | XML_REQUIRED], 1542 'label_string_image' => ['type' => XML_STRING | XML_REQUIRED], 1543 'expand_macros' => ['type' => XML_STRING | XML_REQUIRED], 1544 'background' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1545 'name' => ['type' => XML_STRING] 1546 ]], 1547 'iconmap' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1548 'name' => ['type' => XML_STRING] 1549 ]], 1550 'urls' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'url', 'rules' => [ 1551 'url' => ['type' => XML_ARRAY, 'rules' => [ 1552 'name' => ['type' => XML_STRING | XML_REQUIRED], 1553 'url' => ['type' => XML_STRING | XML_REQUIRED], 1554 'elementtype' => ['type' => XML_STRING | XML_REQUIRED] 1555 ]] 1556 ]], 1557 'selements' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'selement', 'rules' => [ 1558 'selement' => ['type' => XML_ARRAY, 'rules' => [ 1559 // The tag 'elementtype' should be validated before the 'elements' because it is used in 'ex_required' and 'ex_validate' methods. 1560 'elementtype' => ['type' => XML_STRING | XML_REQUIRED], 1561 'elements' => ['type' => 0, 'ex_required' => [$this, 'requiredMapElement'], 'ex_validate' => [$this, 'validateMapElements'], 'ex_rules' => [$this, 'getMapElementsExtendedRules']], 1562 'label' => ['type' => XML_STRING | XML_REQUIRED], 1563 'label_location' => ['type' => XML_STRING | XML_REQUIRED], 1564 'x' => ['type' => XML_STRING | XML_REQUIRED], 1565 'y' => ['type' => XML_STRING | XML_REQUIRED], 1566 'elementsubtype' => ['type' => XML_STRING | XML_REQUIRED], 1567 'areatype' => ['type' => XML_STRING | XML_REQUIRED], 1568 'width' => ['type' => XML_STRING | XML_REQUIRED], 1569 'height' => ['type' => XML_STRING | XML_REQUIRED], 1570 'viewtype' => ['type' => XML_STRING | XML_REQUIRED], 1571 'use_iconmap' => ['type' => XML_STRING | XML_REQUIRED], 1572 'selementid' => ['type' => XML_STRING | XML_REQUIRED], 1573 'icon_off' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1574 'name' => ['type' => XML_STRING | XML_REQUIRED] 1575 ]], 1576 'icon_on' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1577 'name' => ['type' => XML_STRING] 1578 ]], 1579 'icon_disabled' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1580 'name' => ['type' => XML_STRING] 1581 ]], 1582 'icon_maintenance' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1583 'name' => ['type' => XML_STRING] 1584 ]], 1585 'application' => ['type' => XML_STRING | XML_REQUIRED], 1586 'urls' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'url', 'rules' => [ 1587 'url' => ['type' => XML_ARRAY, 'rules' => [ 1588 'name' => ['type' => XML_STRING | XML_REQUIRED], 1589 'url' => ['type' => XML_STRING | XML_REQUIRED] 1590 ]] 1591 ]] 1592 ]] 1593 ]], 1594 'shapes' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'shape', 'rules' => [ 1595 'shape' => ['type' => XML_ARRAY, 'rules' => [ 1596 'type' => ['type' => XML_STRING | XML_REQUIRED], 1597 'x' => ['type' => XML_STRING | XML_REQUIRED], 1598 'y' => ['type' => XML_STRING | XML_REQUIRED], 1599 'width' => ['type' => XML_STRING | XML_REQUIRED], 1600 'height' => ['type' => XML_STRING | XML_REQUIRED], 1601 'text' => ['type' => XML_STRING | XML_REQUIRED], 1602 'font' => ['type' => XML_STRING | XML_REQUIRED], 1603 'font_size' => ['type' => XML_STRING | XML_REQUIRED], 1604 'font_color' => ['type' => XML_STRING | XML_REQUIRED], 1605 'text_halign' => ['type' => XML_STRING | XML_REQUIRED], 1606 'text_valign' => ['type' => XML_STRING | XML_REQUIRED], 1607 'border_type' => ['type' => XML_STRING | XML_REQUIRED], 1608 'border_width' => ['type' => XML_STRING | XML_REQUIRED], 1609 'border_color' => ['type' => XML_STRING | XML_REQUIRED], 1610 'background_color' => ['type' => XML_STRING | XML_REQUIRED], 1611 'zindex' => ['type' => XML_STRING | XML_REQUIRED] 1612 ]] 1613 ]], 1614 'lines' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'line', 'rules' => [ 1615 'line' => ['type' => XML_ARRAY, 'rules' => [ 1616 'x1' => ['type' => XML_STRING | XML_REQUIRED], 1617 'y1' => ['type' => XML_STRING | XML_REQUIRED], 1618 'x2' => ['type' => XML_STRING | XML_REQUIRED], 1619 'y2' => ['type' => XML_STRING | XML_REQUIRED], 1620 'line_type' => ['type' => XML_STRING | XML_REQUIRED], 1621 'line_width' => ['type' => XML_STRING | XML_REQUIRED], 1622 'line_color' => ['type' => XML_STRING | XML_REQUIRED], 1623 'zindex' => ['type' => XML_STRING | XML_REQUIRED] 1624 ]] 1625 ]], 1626 'links' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'link', 'rules' => [ 1627 'link' => ['type' => XML_ARRAY, 'rules' => [ 1628 'drawtype' => ['type' => XML_STRING | XML_REQUIRED], 1629 'color' => ['type' => XML_STRING | XML_REQUIRED], 1630 'label' => ['type' => XML_STRING | XML_REQUIRED], 1631 'selementid1' => ['type' => XML_STRING | XML_REQUIRED], 1632 'selementid2' => ['type' => XML_STRING | XML_REQUIRED], 1633 'linktriggers' => ['type' => XML_INDEXED_ARRAY | XML_REQUIRED, 'prefix' => 'linktrigger', 'rules' => [ 1634 'linktrigger' => ['type' => XML_ARRAY, 'rules' => [ 1635 'drawtype' => ['type' => XML_STRING | XML_REQUIRED], 1636 'color' => ['type' => XML_STRING | XML_REQUIRED], 1637 'trigger' => ['type' => XML_ARRAY | XML_REQUIRED, 'rules' => [ 1638 'description' => ['type' => XML_STRING | XML_REQUIRED], 1639 'expression' => ['type' => XML_STRING | XML_REQUIRED], 1640 'recovery_expression' => ['type' => XML_STRING | XML_REQUIRED] 1641 ]] 1642 ]] 1643 ]] 1644 ]] 1645 ]] 1646 ]] 1647 ]], 1648 'media_types' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'media_type', 'rules' => [ 1649 'media_type' => ['type' => XML_ARRAY, 'rules' => [ 1650 'name' => ['type' => XML_STRING | XML_REQUIRED], 1651 'type' => ['type' => XML_STRING | XML_REQUIRED, 'in' => [CXmlConstantValue::MEDIA_TYPE_EMAIL => CXmlConstantName::EMAIL, CXmlConstantValue::MEDIA_TYPE_SCRIPT => CXmlConstantName::SCRIPT, CXmlConstantValue::MEDIA_TYPE_SMS => CXmlConstantName::SMS, CXmlConstantValue::MEDIA_TYPE_WEBHOOK => CXmlConstantName::WEBHOOK]], 1652 'smtp_server' => ['type' => XML_STRING, 'default' => ''], 1653 'smtp_port' => ['type' => XML_STRING, 'default' => '25'], 1654 'smtp_helo' => ['type' => XML_STRING, 'default' => ''], 1655 'smtp_email' => ['type' => XML_STRING, 'default' => ''], 1656 'smtp_security' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => [CXmlConstantValue::NONE => CXmlConstantName::NONE, CXmlConstantValue::STARTTLS => CXmlConstantName::STARTTLS, CXmlConstantValue::SSL_OR_TLS => CXmlConstantName::SSL_OR_TLS]], 1657 'smtp_verify_host' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1658 'smtp_verify_peer' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1659 'smtp_authentication' => ['type' => XML_STRING, 'default' => CXmlConstantValue::SMTP_AUTHENTICATION_NONE, 'in' => [CXmlConstantValue::SMTP_AUTHENTICATION_NONE => CXmlConstantName::SMTP_AUTHENTICATION_NONE, CXmlConstantValue::SMTP_AUTHENTICATION_PASSWORD => CXmlConstantName::SMTP_AUTHENTICATION_PASSWORD]], 1660 'username' => ['type' => XML_STRING, 'default' => ''], 1661 'password' => ['type' => XML_STRING, 'default' => ''], 1662 'content_type' => ['type' => XML_STRING, 'default' => CXmlConstantValue::CONTENT_TYPE_HTML, 'in' => [CXmlConstantValue::CONTENT_TYPE_TEXT => CXmlConstantName::CONTENT_TYPE_TEXT, CXmlConstantValue::CONTENT_TYPE_HTML => CXmlConstantName::CONTENT_TYPE_HTML]], 1663 'script_name' => ['type' => XML_STRING, 'default' => ''], 1664 'parameters' => ['type' => 0, 'ex_validate' => [$this, 'validateMediaTypeParameters'], 'ex_rules' => [$this, 'getMediaTypeParametersExtendedRules'], 'export' => [$this, 'mediaTypeParametersExport']], 1665 'gsm_modem' => ['type' => XML_STRING, 'default' => ''], 1666 'status' => ['type' => XML_STRING, 'default' => CXmlConstantValue::ENABLED, 'in' => [CXmlConstantValue::ENABLED => CXmlConstantName::ENABLED, CXmlConstantValue::DISABLED => CXmlConstantName::DISABLED]], 1667 'max_sessions' => ['type' => XML_STRING, 'default' => '1'], 1668 'attempts' => ['type' => XML_STRING, 'default' => '3'], 1669 'attempt_interval' => ['type' => XML_STRING, 'default' => '10s'], 1670 'script' => ['type' => XML_STRING, 'default' => ''], 1671 'timeout' => ['type' => XML_STRING, 'default' => '30s'], 1672 'process_tags' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1673 'show_event_menu' => ['type' => XML_STRING, 'default' => CXmlConstantValue::NO, 'in' => [CXmlConstantValue::NO => CXmlConstantName::NO, CXmlConstantValue::YES => CXmlConstantName::YES]], 1674 'event_menu_url' => ['type' => XML_STRING, 'default' => ''], 1675 'event_menu_name' => ['type' => XML_STRING, 'default' => ''], 1676 'description' => ['type' => XML_STRING, 'default' => ''] 1677 ]] 1678 ]], 1679 'value_maps' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'value_map', 'rules' => [ 1680 'value_map' => ['type' => XML_ARRAY, 'rules' => [ 1681 'name' => ['type' => XML_STRING | XML_REQUIRED], 1682 'mappings' => ['type' => XML_INDEXED_ARRAY, 'prefix' => 'mapping', 'rules' => [ 1683 'mapping' => ['type' => XML_ARRAY, 'rules' => [ 1684 'value' => ['type' => XML_STRING, 'default' => ''], 1685 'newvalue' => ['type' => XML_STRING, 'default' => ''] 1686 ]] 1687 ]] 1688 ]] 1689 ]] 1690 ]]; 1691 } 1692 1693 /** 1694 * Base validation function. 1695 * 1696 * @param array $data Import data. 1697 * @param string $path XML path (for error reporting). 1698 * 1699 * @throws Exception if $data does not correspond to validation rules. 1700 * 1701 * @return array Validator does some manipulations for the incoming data. For example, converts empty tags to an 1702 * array, if desired. Converted array is returned. 1703 */ 1704 public function validate(array $data, string $path) { 1705 return $this->doValidate($this->getSchema(), $data, $path); 1706 } 1707 1708 /** 1709 * Validate date and time format. 1710 * 1711 * @param string $data Import data. 1712 * @param array $parent_data Data's parent array. 1713 * @param string $path XML path (for error reporting). 1714 * 1715 * @throws Exception if the date or time is invalid. 1716 * 1717 * @return string 1718 */ 1719 public function validateDateTime($data, array $parent_data = null, $path) { 1720 if (!preg_match('/^20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[01])T(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]Z$/', $data)) { 1721 throw new Exception(_s('Invalid tag "%1$s": %2$s.', $path, _s('"%1$s" is expected', _x('YYYY-MM-DDThh:mm:ssZ', 'XML date and time format')))); 1722 } 1723 1724 return $data; 1725 } 1726 1727 /** 1728 * Checking the map element for requirement. 1729 * 1730 * @param array $parent_data Data's parent array. 1731 * 1732 * @throws Exception if the check is failed. 1733 * 1734 * @return bool 1735 */ 1736 public function requiredMapElement(array $parent_data = null) { 1737 if (zbx_is_int($parent_data['elementtype'])) { 1738 switch ($parent_data['elementtype']) { 1739 case SYSMAP_ELEMENT_TYPE_HOST: 1740 case SYSMAP_ELEMENT_TYPE_MAP: 1741 case SYSMAP_ELEMENT_TYPE_TRIGGER: 1742 case SYSMAP_ELEMENT_TYPE_HOST_GROUP: 1743 return true; 1744 } 1745 } 1746 1747 return false; 1748 } 1749 1750 /** 1751 * Validate map elements. 1752 * 1753 * @param array|string $data Import data. 1754 * @param array $parent_data Data's parent array. 1755 * @param string $path XML path. 1756 * 1757 * @throws Exception if the map elements are invalid. 1758 * 1759 * @return array|string 1760 */ 1761 public function validateMapElements($data, array $parent_data = null, $path) { 1762 $rules = $this->getMapElementsExtendedRules($parent_data); 1763 1764 return $this->doValidate($rules, $data, $path); 1765 } 1766 1767 /** 1768 * Validate "screen_item/resource" tag. 1769 * 1770 * @param array|string $data Import data. 1771 * @param array $parent_data Data's parent array. 1772 * @param string $path XML path. 1773 * 1774 * @throws Exception if the map element is invalid. 1775 * 1776 * @return array|string 1777 */ 1778 public function validateScreenItemResource($data, array $parent_data = null, $path) { 1779 if (zbx_is_int($parent_data['resourcetype'])) { 1780 switch ($parent_data['resourcetype']) { 1781 case self::SCREEN_RESOURCE_TYPE_GRAPH: 1782 case self::SCREEN_RESOURCE_TYPE_LLD_GRAPH: 1783 $rules = ['type' => XML_ARRAY, 'rules' => [ 1784 'name' => ['type' => XML_STRING | XML_REQUIRED], 1785 'host' => ['type' => XML_STRING | XML_REQUIRED] 1786 ]]; 1787 break; 1788 1789 case self::SCREEN_RESOURCE_TYPE_CLOCK: 1790 if ($parent_data['style'] != TIME_TYPE_HOST) { 1791 return $data; 1792 } 1793 // break; is not missing here 1794 1795 case self::SCREEN_RESOURCE_TYPE_SIMPLE_GRAPH: 1796 case self::SCREEN_RESOURCE_TYPE_LLD_SIMPLE_GRAPH: 1797 case self::SCREEN_RESOURCE_TYPE_PLAIN_TEXT: 1798 $rules = ['type' => XML_ARRAY, 'rules' => [ 1799 'key' => ['type' => XML_STRING | XML_REQUIRED], 1800 'host' => ['type' => XML_STRING | XML_REQUIRED] 1801 ]]; 1802 break; 1803 1804 default: 1805 return $data; 1806 } 1807 1808 $data = $this->doValidate($rules, $data, $path); 1809 } 1810 1811 return $data; 1812 } 1813 1814 /** 1815 * Validate "ymin_item_1" tag. 1816 * 1817 * @param string $data Import data. 1818 * @param array $parent_data Data's parent array. 1819 * @param string $path XML path. 1820 * 1821 * @throws Exception if the element is invalid. 1822 * 1823 * @return array 1824 */ 1825 public function validateYMinItem($data, array $parent_data = null, $path) { 1826 if (array_key_exists('ymin_type_1', $parent_data)) { 1827 if (($parent_data['ymin_type_1'] == GRAPH_YAXIS_TYPE_ITEM_VALUE || $parent_data['ymin_type_1'] == CXmlConstantName::ITEM)) { 1828 $rules = ['type' => XML_ARRAY, 'rules' => [ 1829 'host' => ['type' => XML_STRING | XML_REQUIRED], 1830 'key' => ['type' => XML_STRING | XML_REQUIRED] 1831 ]]; 1832 } 1833 else { 1834 $rules = ['type' => XML_ARRAY, 'rules' => []]; 1835 } 1836 } 1837 else { 1838 $rules = ['type' => XML_ARRAY, 'rules' => []]; 1839 } 1840 1841 return $this->doValidate($rules, $data, $path); 1842 } 1843 1844 /** 1845 * Validate "ymax_item_1" tag. 1846 * 1847 * @param string $data Import data. 1848 * @param array $parent_data Data's parent array. 1849 * @param string $path XML path. 1850 * 1851 * @throws Exception if the element is invalid. 1852 * 1853 * @return array 1854 */ 1855 public function validateYMaxItem($data, array $parent_data = null, $path) { 1856 if (array_key_exists('ymax_type_1', $parent_data)) { 1857 if (($parent_data['ymax_type_1'] == GRAPH_YAXIS_TYPE_ITEM_VALUE || $parent_data['ymax_type_1'] == CXmlConstantName::ITEM)) { 1858 $rules = ['type' => XML_ARRAY, 'rules' => [ 1859 'host' => ['type' => XML_STRING | XML_REQUIRED], 1860 'key' => ['type' => XML_STRING | XML_REQUIRED] 1861 ]]; 1862 } 1863 else { 1864 $rules = ['type' => XML_ARRAY, 'rules' => []]; 1865 } 1866 } 1867 else { 1868 $rules = ['type' => XML_ARRAY, 'rules' => []]; 1869 } 1870 1871 return $this->doValidate($rules, $data, $path); 1872 } 1873 1874 /** 1875 * Validate media type "parameters" tag. 1876 * 1877 * @param string $data Import data. 1878 * @param array $parent_data Data's parent array. 1879 * @param string $path XML path. 1880 * 1881 * @throws Exception if the element is invalid. 1882 * 1883 * @return array 1884 */ 1885 public function validateMediaTypeParameters($data, array $parent_data, $path) { 1886 $rules = $this->getMediaTypeParametersExtendedRules($parent_data); 1887 1888 return $this->doValidate($rules, $data, $path); 1889 } 1890 1891 /** 1892 * Transforms tags containing zero into an empty array. 1893 * 1894 * @param mixed $value 1895 * 1896 * @return mixed Converted value. 1897 */ 1898 public function transformZero2Array($value) { 1899 return ($value === '0') ? [] : $value; 1900 } 1901 1902 /** 1903 * Validate "posts" tag of http test step. 1904 * 1905 * @param array|string $data Import data. 1906 * @param array $parent_data Data's parent array. 1907 * @param string $path XML path. 1908 * 1909 * @throws Exception if the element is invalid. 1910 * 1911 * @return array 1912 */ 1913 public function validateHttpPosts($data, array $parent_data = null, $path) { 1914 if (is_array($data)) { 1915 // Posts can be an HTTP pair array. 1916 $rules = ['type' => XML_INDEXED_ARRAY, 'prefix' => 'post_field', 'rules' => [ 1917 'post_field' => ['type' => XML_ARRAY, 'rules' => [ 1918 'name' => ['type' => XML_STRING | XML_REQUIRED], 1919 'value' => ['type' => XML_STRING | XML_REQUIRED] 1920 ]] 1921 ]]; 1922 } 1923 else { 1924 // Posts can be string. 1925 $rules = ['type' => XML_STRING, 'default' => '']; 1926 } 1927 1928 return $this->doValidate($rules, $data, $path); 1929 } 1930 1931 /** 1932 * Validate master item. 1933 * 1934 * @param string $data Import data. 1935 * @param array $parent_data Data's parent array. 1936 * @param string $path XML path. 1937 * 1938 * @throws Exception if the element is invalid. 1939 * 1940 * @return array 1941 */ 1942 public function validateMasterItem($data, array $parent_data = null, $path) { 1943 $prefix = substr(strrchr($path, '/'), 1); 1944 $rules = ['type' => XML_ARRAY | XML_REQUIRED, 'prefix' => $prefix, 'rules' => ['key' => ['type' => XML_STRING]]]; 1945 1946 if ($parent_data['type'] == ITEM_TYPE_DEPENDENT) { 1947 $rules['rules']['key']['type'] |= XML_REQUIRED; 1948 } 1949 1950 return $this->doValidate($rules, $data, $path); 1951 } 1952 1953 /** 1954 * Validate authtype. 1955 * 1956 * @param string $data Import data. 1957 * @param array $parent_data Data's parent array. 1958 * @param string $path XML path. 1959 * 1960 * @throws Exception if the element is invalid. 1961 * 1962 * @return array 1963 */ 1964 public function validateAuthType($data, array $parent_data = null, $path) { 1965 $rules = $this->getAuthTypeExtendedRules($parent_data); 1966 1967 return $this->doValidate($rules, $data, $path); 1968 } 1969 1970 /** 1971 * Validate graph_items tag. 1972 * 1973 * @param array $data Import data. 1974 * @param array $parent_data Data's parent array. 1975 * @param string $path XML path. 1976 * 1977 * @throws Exception if the element is invalid. 1978 * 1979 * @return array 1980 */ 1981 public function validateGraphItems(array $data, array $parent_data = null, $path) { 1982 if (!$data) { 1983 throw new Exception(_s('Invalid tag "%1$s": %2$s.', $path, _s('the tag "%1$s" is missing', 'graph_item'))); 1984 } 1985 1986 return $data; 1987 } 1988 1989 /** 1990 * Get extended validation rules. 1991 * 1992 * @param array $data Import data. 1993 * 1994 * @return array 1995 */ 1996 public function getAuthTypeExtendedRules(array $data) { 1997 if (array_key_exists('type', $data)) { 1998 if ($data['type'] == CXmlConstantValue::ITEM_TYPE_SSH || $data['type'] == CXmlConstantName::SSH) { 1999 return ['type' => XML_STRING, 'default' => CXmlConstantValue::PASSWORD, 'in' => [CXmlConstantValue::PASSWORD => CXmlConstantName::PASSWORD, CXmlConstantValue::PUBLIC_KEY => CXmlConstantName::PUBLIC_KEY]]; 2000 } 2001 } 2002 2003 return ['type' => XML_STRING, 'default' => CXmlConstantValue::NONE, 'in' => [CXmlConstantValue::NONE => CXmlConstantName::NONE, CXmlConstantValue::BASIC => CXmlConstantName::BASIC, CXmlConstantValue::NTLM => CXmlConstantName::NTLM, CXmlConstantValue::KERBEROS => CXmlConstantName::KERBEROS]]; 2004 } 2005 2006 /** 2007 * Get extended validation rules for map elements. 2008 * 2009 * @param array $data Import data. 2010 * 2011 * @return array 2012 */ 2013 public function getMapElementsExtendedRules(array $data) { 2014 if (array_key_exists('elementtype', $data)) { 2015 switch ($data['elementtype']) { 2016 case SYSMAP_ELEMENT_TYPE_HOST: 2017 return ['type' => XML_INDEXED_ARRAY, 'prefix' => 'element', 'rules' => [ 2018 'element' => ['type' => XML_ARRAY, 'rules' => [ 2019 'host' => ['type' => XML_STRING | XML_REQUIRED] 2020 ]] 2021 ]]; 2022 // no break; 2023 2024 case SYSMAP_ELEMENT_TYPE_MAP: 2025 case SYSMAP_ELEMENT_TYPE_HOST_GROUP: 2026 return ['type' => XML_INDEXED_ARRAY, 'prefix' => 'element', 'rules' => [ 2027 'element' => ['type' => XML_ARRAY, 'rules' => [ 2028 'name' => ['type' => XML_STRING | XML_REQUIRED] 2029 ]] 2030 ]]; 2031 // no break; 2032 2033 case SYSMAP_ELEMENT_TYPE_TRIGGER: 2034 return ['type' => XML_INDEXED_ARRAY, 'prefix' => 'element', 'rules' => [ 2035 'element' => ['type' => XML_ARRAY, 'rules' => [ 2036 'description' => ['type' => XML_STRING | XML_REQUIRED], 2037 'expression' => ['type' => XML_STRING | XML_REQUIRED], 2038 'recovery_expression' => ['type' => XML_STRING | XML_REQUIRED] 2039 ]] 2040 ]]; 2041 // no break; 2042 2043 case SYSMAP_ELEMENT_TYPE_IMAGE: 2044 return ['type' => XML_ARRAY, 'rules' => []]; 2045 // no break; 2046 } 2047 } 2048 2049 return ['type' => XML_ARRAY, 'rules' => []]; 2050 } 2051 2052 /** 2053 * Get extended validation rules for media type "parameters" tag. 2054 * 2055 * @param array $data Import data. 2056 * 2057 * @return array 2058 */ 2059 public function getMediaTypeParametersExtendedRules(array $data) { 2060 switch ($data['type']) { 2061 case CXmlConstantName::SCRIPT: 2062 case CXmlConstantValue::MEDIA_TYPE_SCRIPT: 2063 return ['type' => XML_INDEXED_ARRAY, 'prefix' => 'parameter', 'rules' => [ 2064 'parameter' => ['type' => XML_STRING] 2065 ]]; 2066 2067 case CXmlConstantName::WEBHOOK: 2068 case CXmlConstantValue::MEDIA_TYPE_WEBHOOK: 2069 return ['type' => XML_INDEXED_ARRAY, 'prefix' => 'parameter', 'rules' => [ 2070 'parameter' => ['type' => XML_ARRAY, 'rules' => [ 2071 'name' => ['type' => XML_STRING | XML_REQUIRED], 2072 'value' => ['type' => XML_STRING, 'default' => ''] 2073 ]] 2074 ]]; 2075 2076 default: 2077 return ['type' => XML_ARRAY, 'rules' => []]; 2078 } 2079 } 2080 2081 /** 2082 * Export check for ymax_item_1 if ymax_type_1 === ITEM. 2083 * 2084 * @param array $data Export data. 2085 * 2086 * @throws Exception if the element is invalid. 2087 * 2088 * @return array 2089 */ 2090 public function graphMaxItemExport(array $data) { 2091 if ($data['ymax_type_1'] == CXmlConstantValue::ITEM 2092 && array_key_exists('ymax_item_1', $data) 2093 && (!array_key_exists('host', $data['ymax_item_1']) 2094 || !array_key_exists('key', $data['ymax_item_1']))) { 2095 throw new Exception(_s('Invalid tag "%1$s": %2$s.', 'ymax_item_1', _('an array is expected'))); 2096 } 2097 2098 return $data['ymax_item_1']; 2099 } 2100 2101 /** 2102 * Export check for ymin_item_1 if ymin_type_1 === ITEM. 2103 * 2104 * @param array $data Export data. 2105 * 2106 * @throws Exception if the element is invalid. 2107 * 2108 * @return array 2109 */ 2110 public function graphMinItemExport(array $data) { 2111 if ($data['ymin_type_1'] == CXmlConstantValue::ITEM 2112 && array_key_exists('ymin_item_1', $data) 2113 && (!array_key_exists('host', $data['ymin_item_1']) 2114 || !array_key_exists('key', $data['ymin_item_1']))) { 2115 throw new Exception(_s('Invalid tag "%1$s": %2$s.', 'ymin_item_1', _('an array is expected'))); 2116 } 2117 2118 return $data['ymin_item_1']; 2119 } 2120 2121 /** 2122 * Export check for authtype tag. 2123 * 2124 * @param array $data Export data. 2125 * 2126 * @throws Exception if the element is invalid. 2127 * 2128 * @return string Tag constant. 2129 */ 2130 public function itemAuthtypeExport(array $data) { 2131 if ($data['type'] != CXmlConstantValue::ITEM_TYPE_HTTP_AGENT 2132 && $data['type'] != CXmlConstantValue::ITEM_TYPE_SSH) { 2133 return CXmlConstantName::NONE; 2134 } 2135 2136 $rules = $this->getAuthTypeExtendedRules($data); 2137 2138 if (!array_key_exists($data['authtype'], $rules['in'])) { 2139 throw new Exception(_s('Invalid tag "%1$s": %2$s.', 2140 'authtype', _s('unexpected constant value "%1$s"', $data['type']) 2141 )); 2142 } 2143 2144 return $rules['in'][$data['authtype']]; 2145 } 2146 2147 /** 2148 * Export transformation for tls_accept tag. 2149 * 2150 * @param array $data Export data. 2151 * 2152 * @throws Exception if the element is invalid. 2153 * 2154 * @return array 2155 */ 2156 public function hostTlsAcceptExport(array $data) { 2157 $consts = [ 2158 CXmlConstantValue::NO_ENCRYPTION => [CXmlConstantName::NO_ENCRYPTION], 2159 CXmlConstantValue::TLS_PSK => [CXmlConstantName::TLS_PSK], 2160 CXmlConstantValue::NO_ENCRYPTION | CXmlConstantValue::TLS_PSK => [ 2161 CXmlConstantName::NO_ENCRYPTION, 2162 CXmlConstantName::TLS_PSK 2163 ], 2164 CXmlConstantValue::TLS_CERTIFICATE => [CXmlConstantName::TLS_CERTIFICATE], 2165 CXmlConstantValue::NO_ENCRYPTION | CXmlConstantValue::TLS_CERTIFICATE => [ 2166 CXmlConstantName::NO_ENCRYPTION, 2167 CXmlConstantName::TLS_CERTIFICATE 2168 ], 2169 CXmlConstantValue::TLS_PSK | CXmlConstantValue::TLS_CERTIFICATE => [ 2170 CXmlConstantName::TLS_PSK, 2171 CXmlConstantName::TLS_CERTIFICATE 2172 ], 2173 CXmlConstantValue::NO_ENCRYPTION | CXmlConstantValue::TLS_PSK | CXmlConstantValue::TLS_CERTIFICATE => [ 2174 CXmlConstantName::NO_ENCRYPTION, 2175 CXmlConstantName::TLS_PSK, 2176 CXmlConstantName::TLS_CERTIFICATE 2177 ] 2178 ]; 2179 2180 if (!array_key_exists($data['tls_accept'], $consts)) { 2181 throw new Exception(_s('Invalid tag "%1$s": %2$s.', 2182 'tls_accept', _s('unexpected constant "%1$s"', $data['tls_accept']) 2183 )); 2184 } 2185 2186 return $consts[$data['tls_accept']]; 2187 } 2188 2189 /** 2190 * Export transformation for media type "parameters" tag. 2191 * 2192 * @param array $data Export data. 2193 * 2194 * @throws Exception if the element is invalid. 2195 * 2196 * @return array 2197 */ 2198 public function mediaTypeParametersExport(array $data) { 2199 switch ($data['type']) { 2200 case CXmlConstantValue::MEDIA_TYPE_SCRIPT: 2201 return $this->scriptParameterExport($data); 2202 2203 case CXmlConstantValue::MEDIA_TYPE_WEBHOOK: 2204 return $data['parameters']; 2205 2206 default: 2207 return []; 2208 } 2209 } 2210 2211 /** 2212 * Import check for filter tag. 2213 * API validation throws an error when filter tag is an empty array. 2214 * 2215 * @param array $data Import data. 2216 * 2217 * @return array 2218 */ 2219 public function itemFilterImport(array $data) { 2220 if (!array_key_exists('filter', $data)) { 2221 return [ 2222 'conditions' => '', 2223 'evaltype' => CXmlConstantName::AND_OR, 2224 'formula' => '' 2225 ]; 2226 } 2227 2228 return $data['filter']; 2229 } 2230 2231 /** 2232 * Converts script parameters to an array. 2233 * 2234 * @param array $data Export data. 2235 * @param string $data['parameters] Script parameters. 2236 * 2237 * @return array 2238 */ 2239 public function scriptParameterExport(array $data) { 2240 return explode("\n", substr($data['parameters'], 0, -1)); 2241 } 2242} 2243