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