├── 6.0 └── template_app_xenorchestra.yaml ├── 6.4 └── template_app_xenorchestra.yaml ├── 7.0 └── template_app_xenorchestra.yaml ├── 7.2 └── template_app_xenorchestra.yaml ├── Readme.md └── screenshots ├── hosts_and_xoa.png ├── pool_sr_latest_data.png ├── problems_view.png └── vm_latest_data.png /6.0/template_app_xenorchestra.yaml: -------------------------------------------------------------------------------- 1 | zabbix_export: 2 | version: '6.0' 3 | date: '2025-03-18T12:44:05Z' 4 | groups: 5 | - uuid: 1b837a3c078647049a0c00c61b4d57b5 6 | name: Hypervisors 7 | - uuid: 7df96b18c230490a9a0a9e2307226338 8 | name: Templates 9 | - uuid: 137f19e6e2dc4219b33553b812627bc2 10 | name: 'Virtual machines' 11 | templates: 12 | - uuid: 8d4ad92902e6440ca14dfa5256d8bf82 13 | template: 'XCP-NG Host via Xen Orchestra' 14 | name: 'XCP-NG Host via Xen Orchestra' 15 | groups: 16 | - name: Templates 17 | items: 18 | - uuid: d137a2d23e554eb7b98d1de0ce26dfb6 19 | name: 'CPU Cores' 20 | type: DEPENDENT 21 | key: xoa.host.cpu.cores 22 | delay: '0' 23 | preprocessing: 24 | - type: JSONPATH 25 | parameters: 26 | - $.CPUs.cpu_count 27 | master_item: 28 | key: xoa.host.raw 29 | - uuid: 0a1e66d4f0a4455abcfd9317c4c973b1 30 | name: 'CPU Sockets' 31 | type: DEPENDENT 32 | key: xoa.host.cpu.sockets 33 | delay: '0' 34 | preprocessing: 35 | - type: JSONPATH 36 | parameters: 37 | - $.CPUs.socket_count 38 | master_item: 39 | key: xoa.host.raw 40 | - uuid: 702c08f7b6d94be49fbfaef45b1b4174 41 | name: 'Host description' 42 | type: DEPENDENT 43 | key: xoa.host.description 44 | delay: '0' 45 | trends: '0' 46 | value_type: CHAR 47 | preprocessing: 48 | - type: JSONPATH 49 | parameters: 50 | - $.name_description 51 | - type: DISCARD_UNCHANGED_HEARTBEAT 52 | parameters: 53 | - 12h 54 | master_item: 55 | key: xoa.host.raw 56 | - uuid: a6343812baea4750b24def6a3ef71f70 57 | name: Enabled 58 | type: DEPENDENT 59 | key: xoa.host.enabled 60 | delay: '0' 61 | trends: '0' 62 | value_type: CHAR 63 | preprocessing: 64 | - type: JSONPATH 65 | parameters: 66 | - $.enabled 67 | master_item: 68 | key: xoa.host.raw 69 | - uuid: 604ae2b2e6b943c387edd492eddc8beb 70 | name: 'Hypervisor brand' 71 | type: DEPENDENT 72 | key: xoa.host.hv.brand 73 | delay: '0' 74 | trends: '0' 75 | value_type: CHAR 76 | preprocessing: 77 | - type: JSONPATH 78 | parameters: 79 | - $.productBrand 80 | - type: DISCARD_UNCHANGED_HEARTBEAT 81 | parameters: 82 | - 12h 83 | master_item: 84 | key: xoa.host.raw 85 | - uuid: 494f4ddea1cf40398641295be217878a 86 | name: 'Hypervisor version' 87 | type: DEPENDENT 88 | key: xoa.host.hv.version 89 | delay: '0' 90 | trends: '0' 91 | value_type: CHAR 92 | preprocessing: 93 | - type: JSONPATH 94 | parameters: 95 | - $.version 96 | - type: DISCARD_UNCHANGED_HEARTBEAT 97 | parameters: 98 | - 12h 99 | master_item: 100 | key: xoa.host.raw 101 | - uuid: c1c9cee844f34ff289b32559493af04f 102 | name: 'Hypervisor version build' 103 | type: DEPENDENT 104 | key: xoa.host.hv.version.build 105 | delay: '0' 106 | trends: '0' 107 | value_type: CHAR 108 | preprocessing: 109 | - type: JSONPATH 110 | parameters: 111 | - $.build 112 | - type: DISCARD_UNCHANGED_HEARTBEAT 113 | parameters: 114 | - 12h 115 | master_item: 116 | key: xoa.host.raw 117 | - uuid: ecf042cea23e45e89954fe6fc499be86 118 | name: 'HVM capable' 119 | type: DEPENDENT 120 | key: xoa.host.hvm.capable 121 | delay: '0' 122 | trends: '0' 123 | value_type: CHAR 124 | preprocessing: 125 | - type: JSONPATH 126 | parameters: 127 | - $.hvmCapable 128 | - type: DISCARD_UNCHANGED_HEARTBEAT 129 | parameters: 130 | - 1h 131 | master_item: 132 | key: xoa.host.raw 133 | - uuid: 4026336d2d97475e9019522c73535574 134 | name: 'Memory total' 135 | type: DEPENDENT 136 | key: xoa.host.memory.total 137 | delay: '0' 138 | units: B 139 | preprocessing: 140 | - type: JSONPATH 141 | parameters: 142 | - $.memory.size 143 | master_item: 144 | key: xoa.host.raw 145 | - uuid: 6181620d670c4e3cbeaad0babe89fc1b 146 | name: 'Memory used' 147 | type: DEPENDENT 148 | key: xoa.host.memory.used 149 | delay: '0' 150 | units: B 151 | preprocessing: 152 | - type: JSONPATH 153 | parameters: 154 | - $.memory.usage 155 | master_item: 156 | key: xoa.host.raw 157 | - uuid: ed5fe0b877ed469ebc0d4e4b32ff8a87 158 | name: 'Memory used percent' 159 | type: CALCULATED 160 | key: xoa.host.memory.used.percent 161 | delay: 5m 162 | value_type: FLOAT 163 | units: '%' 164 | params: 'last(//xoa.host.memory.used)/last(//xoa.host.memory.total)*100' 165 | triggers: 166 | - uuid: 29677931a1b944038a687c8c28c4d015 167 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 168 | name: 'Memory usage critical high' 169 | priority: HIGH 170 | - uuid: 9de3ff6c29d945a7b8ca5a2bb0a78493 171 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.WARN}' 172 | name: 'Memory usage exceeds {$XOA.MEMORY.WARN}' 173 | priority: WARNING 174 | dependencies: 175 | - name: 'Memory usage critical high' 176 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 177 | - uuid: 81a949d8376b43b0b620de6bcbe3d525 178 | name: 'XCP-NG Hosts: Get Missing Patches' 179 | type: HTTP_AGENT 180 | key: xoa.host.missingpatches.raw 181 | delay: 15m 182 | history: '0' 183 | trends: '0' 184 | value_type: TEXT 185 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}/missing_patches' 186 | headers: 187 | - name: Cookie 188 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 189 | - name: Accept 190 | value: application/json 191 | - uuid: 3725dfaac75643fcb3cfe0b852a26f70 192 | name: Hostname 193 | type: DEPENDENT 194 | key: xoa.host.name 195 | delay: '0' 196 | trends: '0' 197 | value_type: CHAR 198 | preprocessing: 199 | - type: JSONPATH 200 | parameters: 201 | - $.name_label 202 | - type: DISCARD_UNCHANGED_HEARTBEAT 203 | parameters: 204 | - 12h 205 | master_item: 206 | key: xoa.host.raw 207 | - uuid: 5b2435e1c5dd49c7be4b7cc1dc31e64d 208 | name: 'Power State' 209 | type: DEPENDENT 210 | key: xoa.host.power.state 211 | delay: '0' 212 | trends: '0' 213 | value_type: CHAR 214 | preprocessing: 215 | - type: JSONPATH 216 | parameters: 217 | - $.power_state 218 | master_item: 219 | key: xoa.host.raw 220 | triggers: 221 | - uuid: 484c668a58c54317a61a405b52cc43ec 222 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state)<>last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state,#2)' 223 | recovery_mode: NONE 224 | name: 'Power state changed' 225 | priority: INFO 226 | manual_close: 'YES' 227 | - uuid: 11c547b55c424e26bb02d87266980a6f 228 | name: 'XCP-NG Hosts: Get Values' 229 | type: HTTP_AGENT 230 | key: xoa.host.raw 231 | delay: 5m 232 | history: '0' 233 | trends: '0' 234 | value_type: TEXT 235 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}' 236 | headers: 237 | - name: Cookie 238 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 239 | - name: Accept 240 | value: application/json 241 | - uuid: ee2ab8db1e0f4d1f88df5fe6892eaf73 242 | name: 'Reboot required' 243 | type: DEPENDENT 244 | key: xoa.host.reboot.required 245 | delay: '0' 246 | trends: '0' 247 | value_type: CHAR 248 | preprocessing: 249 | - type: JSONPATH 250 | parameters: 251 | - $.rebootRequired 252 | master_item: 253 | key: xoa.host.raw 254 | triggers: 255 | - uuid: 06a3b195183a49d9ac6f37afa802e5a9 256 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.reboot.required)="true"' 257 | name: 'Reboot required for hosts' 258 | priority: WARNING 259 | - uuid: 077fd836ae1c420792fcf368fa43e8a3 260 | name: 'Number of running VMs' 261 | type: DEPENDENT 262 | key: xoa.host.runningvms 263 | delay: '0' 264 | preprocessing: 265 | - type: JSONPATH 266 | parameters: 267 | - $.residentVms 268 | - type: JAVASCRIPT 269 | parameters: 270 | - 'return JSON.parse(value).length' 271 | master_item: 272 | key: xoa.host.raw 273 | - uuid: 745f6fb406c34e3b8ec313a54b2c85cc 274 | name: 'Host start time' 275 | type: DEPENDENT 276 | key: xoa.host.starttime 277 | delay: '0' 278 | units: unixtime 279 | preprocessing: 280 | - type: JSONPATH 281 | parameters: 282 | - $.startTime 283 | - type: STR_REPLACE 284 | parameters: 285 | - 'null' 286 | - '0' 287 | - type: DISCARD_UNCHANGED_HEARTBEAT 288 | parameters: 289 | - 1h 290 | master_item: 291 | key: xoa.host.raw 292 | - uuid: dab4f3b69f5141048e914d87ed23dd69 293 | name: 'Number of Missing Patches' 294 | type: DEPENDENT 295 | key: xoa.hosts.missingpatches.count 296 | delay: '0' 297 | preprocessing: 298 | - type: JAVASCRIPT 299 | parameters: 300 | - 'return JSON.parse(value).length' 301 | master_item: 302 | key: xoa.host.missingpatches.raw 303 | triggers: 304 | - uuid: b4f671bc3ab8442c87147db31e815ffe 305 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.hosts.missingpatches.count)>{$XOA.HOST.MISSING.PATCHES.MAX}' 306 | name: 'Number of {$XOA.HOST.MISSING.PATCHES.MAX} missing patches exceeded' 307 | priority: WARNING 308 | tags: 309 | - tag: component 310 | value: hypervisor 311 | - tag: target 312 | value: xcp-ng 313 | macros: 314 | - macro: '{$XOA.AUTH.TOKEN}' 315 | value: CHANGE_IF_NEEDED 316 | description: 'Authentication Token generated on XOA UI' 317 | - macro: '{$XOA.HOST.MISSING.PATCHES.MAX}' 318 | value: '1' 319 | description: 'Maximum Number of missing patches allowed' 320 | - macro: '{$XOA.HOST.UUID}' 321 | value: CHANGE_IF_NEEDED 322 | description: 'Host UUID' 323 | - macro: '{$XOA.MEMORY.CRIT}' 324 | value: '90' 325 | description: 'Critical memory usage' 326 | - macro: '{$XOA.MEMORY.WARN}' 327 | value: '75' 328 | description: 'Warn when memory usage is above' 329 | - macro: '{$XOA.URL}' 330 | value: CHANGE_IF_NEEDED 331 | description: 'URL where XOA can be reached' 332 | valuemaps: 333 | - uuid: 7de0ad540b0f4fd5ab2b33ef9f79d440 334 | name: 'XOA Boolean' 335 | mappings: 336 | - value: '1' 337 | newvalue: 'true' 338 | - value: '0' 339 | newvalue: 'false' 340 | - uuid: b1aa3ddc4db246c3a5e71658dd5a9601 341 | template: 'XCP-NG VM via Xen Orchestra' 342 | name: 'XCP-NG VM via Xen Orchestra' 343 | groups: 344 | - name: Templates 345 | items: 346 | - uuid: 6a01a4edf2364313a72939d2dfb7789c 347 | name: 'vCPU active' 348 | type: DEPENDENT 349 | key: xoa.vm.cpu.active 350 | delay: '0' 351 | preprocessing: 352 | - type: JSONPATH 353 | parameters: 354 | - $.CPUs.number 355 | master_item: 356 | key: xoa.vms.raw 357 | - uuid: 2149aaf9d7904bf4b28f4aaa943f120e 358 | name: 'vCPU max' 359 | type: DEPENDENT 360 | key: xoa.vm.cpu.max 361 | delay: '0' 362 | preprocessing: 363 | - type: JSONPATH 364 | parameters: 365 | - $.CPUs.max 366 | master_item: 367 | key: xoa.vms.raw 368 | - uuid: 2bd0262b02754c49bf1388e392bff454 369 | name: 'VM description' 370 | type: DEPENDENT 371 | key: xoa.vm.description 372 | delay: '0' 373 | trends: '0' 374 | value_type: CHAR 375 | preprocessing: 376 | - type: JSONPATH 377 | parameters: 378 | - $.name_description 379 | - type: DISCARD_UNCHANGED_HEARTBEAT 380 | parameters: 381 | - 1d 382 | master_item: 383 | key: xoa.vms.raw 384 | - uuid: 011d9425a4bc4b4cb3cba08d878c0f83 385 | name: 'Xen PV driver version' 386 | type: DEPENDENT 387 | key: xoa.vm.driver.version 388 | delay: '0' 389 | trends: '0' 390 | value_type: CHAR 391 | preprocessing: 392 | - type: JSONPATH 393 | parameters: 394 | - $.pvDriversVersion 395 | - type: DISCARD_UNCHANGED_HEARTBEAT 396 | parameters: 397 | - 1h 398 | master_item: 399 | key: xoa.vms.raw 400 | - uuid: 86a3094485084862a3a2d4d1bd9333b2 401 | name: 'VM install time' 402 | type: DEPENDENT 403 | key: xoa.vm.installtime 404 | delay: '0' 405 | units: unixtime 406 | preprocessing: 407 | - type: JSONPATH 408 | parameters: 409 | - $.installTime 410 | - type: DISCARD_UNCHANGED_HEARTBEAT 411 | parameters: 412 | - 1d 413 | master_item: 414 | key: xoa.vms.raw 415 | - uuid: 37d6d0b60c654490b5d360b194538f15 416 | name: 'Management agent detected' 417 | type: DEPENDENT 418 | key: xoa.vm.management.agent 419 | delay: '0' 420 | trends: '0' 421 | value_type: CHAR 422 | preprocessing: 423 | - type: JSONPATH 424 | parameters: 425 | - $.managementAgentDetected 426 | master_item: 427 | key: xoa.vms.raw 428 | triggers: 429 | - uuid: 90dd8a29cfc3457aabb35ce8527683d4 430 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.management.agent)="false"' 431 | name: 'No management agent install on VM' 432 | priority: INFO 433 | manual_close: 'YES' 434 | - uuid: e72db9c5c0474d099be380a577aafd23 435 | name: 'Memory total' 436 | type: DEPENDENT 437 | key: xoa.vm.memory.total 438 | delay: '0' 439 | units: B 440 | preprocessing: 441 | - type: JSONPATH 442 | parameters: 443 | - $.memory.size 444 | master_item: 445 | key: xoa.vms.raw 446 | - uuid: c319917b771c46afbf2fdacf217216d1 447 | name: 'Virtualization mode' 448 | type: DEPENDENT 449 | key: xoa.vm.mode 450 | delay: '0' 451 | trends: '0' 452 | value_type: CHAR 453 | preprocessing: 454 | - type: JSONPATH 455 | parameters: 456 | - $.virtualizationMode 457 | - type: DISCARD_UNCHANGED_HEARTBEAT 458 | parameters: 459 | - 1d 460 | master_item: 461 | key: xoa.vms.raw 462 | - uuid: e5f39794e08c4aeb9b2f96abf5dc58dc 463 | name: 'VM name' 464 | type: DEPENDENT 465 | key: xoa.vm.name 466 | delay: '0' 467 | trends: '0' 468 | value_type: CHAR 469 | preprocessing: 470 | - type: JSONPATH 471 | parameters: 472 | - $.name_label 473 | - type: DISCARD_UNCHANGED_HEARTBEAT 474 | parameters: 475 | - 24h 476 | master_item: 477 | key: xoa.vms.raw 478 | - uuid: 5397b9f0460742899d91a127b52f2020 479 | name: 'OS Distribution' 480 | type: DEPENDENT 481 | key: xoa.vm.os.distro 482 | delay: '0' 483 | trends: '0' 484 | value_type: CHAR 485 | preprocessing: 486 | - type: JSONPATH 487 | parameters: 488 | - $.os_version.distro 489 | - type: DISCARD_UNCHANGED_HEARTBEAT 490 | parameters: 491 | - 1d 492 | master_item: 493 | key: xoa.vms.raw 494 | - uuid: 4126bf9d15464ecea0f7a0d0fe8fd8b8 495 | name: 'OS version' 496 | type: DEPENDENT 497 | key: xoa.vm.os.version 498 | delay: '0' 499 | trends: '0' 500 | value_type: CHAR 501 | preprocessing: 502 | - type: JSONPATH 503 | parameters: 504 | - $.os_version.name 505 | - type: DISCARD_UNCHANGED_HEARTBEAT 506 | parameters: 507 | - 1d 508 | master_item: 509 | key: xoa.vms.raw 510 | - uuid: 2415c2f666e64438ae682c0855c2831b 511 | name: 'Power State' 512 | type: DEPENDENT 513 | key: xoa.vm.power.state 514 | delay: '0' 515 | trends: '0' 516 | value_type: CHAR 517 | preprocessing: 518 | - type: JSONPATH 519 | parameters: 520 | - $.power_state 521 | master_item: 522 | key: xoa.vms.raw 523 | triggers: 524 | - uuid: 4f938791d96b4898860edf870a1bc72e 525 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state)<>last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state,#2)' 526 | recovery_mode: NONE 527 | name: 'State of VM changed' 528 | priority: AVERAGE 529 | manual_close: 'YES' 530 | - uuid: d3da95b5b2c64e5e82c893e9fbd82743 531 | name: 'Number of snapshots' 532 | type: DEPENDENT 533 | key: xoa.vm.snapshot 534 | delay: '0' 535 | preprocessing: 536 | - type: JSONPATH 537 | parameters: 538 | - $.snapshots 539 | - type: JAVASCRIPT 540 | parameters: 541 | - 'return JSON.parse(value).length' 542 | master_item: 543 | key: xoa.vms.raw 544 | triggers: 545 | - uuid: 353d88c34edc4ea3957a4ecc12e6db7b 546 | expression: 'min(/XCP-NG VM via Xen Orchestra/xoa.vm.snapshot,3600)>{$XOA.VM.NO.SNAPSHOTS.MAX}' 547 | name: 'Number of Snapshots exceeds {$XOA.VM.NO.SNAPSHOTS.MAX} for more than 1 hour' 548 | priority: WARNING 549 | - uuid: 889bc4bcaf0744f7ac14c36f45139cc8 550 | name: 'VM start time' 551 | type: DEPENDENT 552 | key: xoa.vm.starttime 553 | delay: '0' 554 | units: unixtime 555 | preprocessing: 556 | - type: JSONPATH 557 | parameters: 558 | - $.startTime 559 | - type: DISCARD_UNCHANGED_HEARTBEAT 560 | parameters: 561 | - 1h 562 | master_item: 563 | key: xoa.vms.raw 564 | - uuid: cb8d4b3b8a0442c2aa48853c6ab45af3 565 | name: 'Xen Tool Version' 566 | type: DEPENDENT 567 | key: xoa.vm.tools.version 568 | delay: '0' 569 | trends: '0' 570 | value_type: CHAR 571 | preprocessing: 572 | - type: JSONPATH 573 | parameters: 574 | - $.xenTools.version 575 | - type: DISCARD_UNCHANGED_HEARTBEAT 576 | parameters: 577 | - 1h 578 | master_item: 579 | key: xoa.vms.raw 580 | - uuid: 27f086c8cf754b789daf6868cf394172 581 | name: 'XCP-NG VMS: Get Values' 582 | type: HTTP_AGENT 583 | key: xoa.vms.raw 584 | delay: 5m 585 | history: '0' 586 | trends: '0' 587 | value_type: TEXT 588 | url: '{$XOA.URL}/rest/v0/vms/{$XOA.VM.UUID}' 589 | headers: 590 | - name: Cookie 591 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 592 | - name: Accept 593 | value: application/json 594 | tags: 595 | - tag: component 596 | value: hypervisor 597 | - tag: target 598 | value: guests 599 | macros: 600 | - macro: '{$XOA.AUTH.TOKEN}' 601 | value: CHANGE_IF_NEEDED 602 | description: 'Authentication Token generated on XOA UI' 603 | - macro: '{$XOA.HOST.UUID}' 604 | value: CHANGE_IF_NEEDED 605 | description: 'Host UUID' 606 | - macro: '{$XOA.URL}' 607 | value: CHANGE_IF_NEEDED 608 | description: 'URL where XOA can be reached' 609 | - macro: '{$XOA.VM.NO.SNAPSHOTS.MAX}' 610 | value: '1' 611 | description: 'Max number of snapshots allowed' 612 | - macro: '{$XOA.VM.UUID}' 613 | valuemaps: 614 | - uuid: 546880e65268446ba8d3b319f837b7eb 615 | name: 'XOA Boolean' 616 | mappings: 617 | - value: '1' 618 | newvalue: 'true' 619 | - value: '0' 620 | newvalue: 'false' 621 | - uuid: 5f69e71a0ed1418da4daf08e4dc22b7c 622 | template: 'Xen Orchestra by HTTP' 623 | name: 'Xen Orchestra by HTTP' 624 | groups: 625 | - name: Templates 626 | discovery_rules: 627 | - uuid: 4f543445aeb1465ebb10fe09d895c661 628 | name: 'Discovery Backups VM' 629 | type: SCRIPT 630 | key: xoa.backup.discovery 631 | delay: 1h 632 | params: | 633 | try { 634 | var params = JSON.parse(value); 635 | var req = new HttpRequest(); 636 | if (params.proxy != "CHANGE_IF_NEEDED") { 637 | req.setProxy(params.proxy) 638 | } 639 | req.addHeader('Cookie: authenticationToken=' + params.token); 640 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 641 | var response = req.get(encodeURI(server_url + '/rest/v0/backup/jobs/vm')); 642 | } catch (error) { 643 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/backup/jobs/vm Error: " + error); 644 | if (!Number.isInteger(error)) { 645 | return 520; 646 | } 647 | } 648 | var retVal = [] 649 | for (r = 0; r < JSON.parse(response).length; r++) { 650 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 651 | backupInfo = JSON.parse(resp); 652 | retVal.push({ 'url': JSON.parse(response)[r], 'uuid': backupInfo.id, 'name': backupInfo.name }); 653 | } 654 | return JSON.stringify(retVal); 655 | filter: 656 | conditions: 657 | - macro: '{#BACKUP.NAME}' 658 | value: '{$XOA.BACKUP.NOT_MATCHES}' 659 | operator: NOT_MATCHES_REGEX 660 | formulaid: A 661 | lifetime: 1d 662 | item_prototypes: 663 | - uuid: b9baccd3b3f24ae9bb58387dfc164b05 664 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup duration' 665 | type: CALCULATED 666 | key: 'xoa.backup.vm.duration[{#BACKUP.UUID}]' 667 | delay: 15m 668 | units: uptime 669 | params: '(last(//xoa.backup.vm.end[{#BACKUP.UUID}])-last(//xoa.backup.vm.start[{#BACKUP.UUID}]))' 670 | preprocessing: 671 | - type: DISCARD_UNCHANGED_HEARTBEAT 672 | parameters: 673 | - 1h 674 | tags: 675 | - tag: component 676 | value: backup 677 | - tag: target 678 | value: vm 679 | - uuid: d65c320702cc4d1cac28aa7c8597c1bf 680 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup end' 681 | type: DEPENDENT 682 | key: 'xoa.backup.vm.end[{#BACKUP.UUID}]' 683 | delay: '0' 684 | value_type: FLOAT 685 | units: unixtime 686 | preprocessing: 687 | - type: JSONPATH 688 | parameters: 689 | - $.end 690 | - type: JAVASCRIPT 691 | parameters: 692 | - 'return parseInt(value)' 693 | - type: MULTIPLIER 694 | parameters: 695 | - '0.001' 696 | master_item: 697 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 698 | tags: 699 | - tag: component 700 | value: backup 701 | - tag: target 702 | value: vm 703 | - uuid: 4ca54def98724bbbaa6d4e101c5a7aa4 704 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Name' 705 | type: DEPENDENT 706 | key: 'xoa.backup.vm.name[{#BACKUP.UUID}]' 707 | delay: '0' 708 | trends: '0' 709 | value_type: TEXT 710 | preprocessing: 711 | - type: JSONPATH 712 | parameters: 713 | - $.name 714 | - type: DISCARD_UNCHANGED_HEARTBEAT 715 | parameters: 716 | - 1h 717 | master_item: 718 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 719 | tags: 720 | - tag: component 721 | value: backup 722 | - tag: target 723 | value: vm 724 | - uuid: b16275be3b5741d9b199b3965856c86f 725 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Get job status' 726 | type: SCRIPT 727 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 728 | delay: 15m 729 | history: '0' 730 | trends: '0' 731 | value_type: TEXT 732 | params: | 733 | try { 734 | var params = JSON.parse(value); 735 | var req = new HttpRequest(); 736 | req.addHeader("Cookie: authenticationToken=" + params.token); 737 | var server_url = params.url.endsWith("/") ? params.url.slice(0, -1) : params.url; 738 | var response = req.get(encodeURI(server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid)); 739 | if (!response) { 740 | Zabbix.log(3, "XenOrchestra API Error: Empty response for URL " + server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid); 741 | return 501; 742 | } 743 | var backupLogUrls = JSON.parse(response); 744 | if (backupLogUrls.length === 0) { 745 | Zabbix.log(3, "XenOrchestra API Error: No backup logs found for job Id " + params.uuid); 746 | return 502; 747 | } 748 | } catch (error) { 749 | Zabbix.log(3, "XenOrchestra API Error: " + error); 750 | return 503; 751 | } 752 | 753 | try { 754 | var logUrl = backupLogUrls[backupLogUrls.length - 1]; 755 | var resp = req.get(encodeURI(server_url + logUrl)); 756 | if (!resp) { 757 | Zabbix.log(3, "XenOrchestra API Error: Empty response for log URL " + logUrl); 758 | return 504; 759 | } 760 | var backupLog = JSON.parse(resp); 761 | backupLog.url = logUrl; 762 | if (backupLog.jobId === params.uuid) { 763 | return JSON.stringify({ 764 | "url": backupLog.url, 765 | "params": params.uuid, 766 | "id": backupLog.id, 767 | "name": backupLog.jobName, 768 | "status": backupLog.status, 769 | "start": backupLog.start, 770 | "end": backupLog.end 771 | }); 772 | } 773 | return 505; 774 | } catch (error) { 775 | Zabbix.log(3, "XenOrchestra API Error: " + error); 776 | return 506; 777 | } 778 | timeout: 60s 779 | parameters: 780 | - name: proxy 781 | value: '{$XOA.PROXY.URL}' 782 | - name: token 783 | value: '{$XOA.AUTH.TOKEN}' 784 | - name: url 785 | value: '{$XOA.URL}' 786 | - name: uuid 787 | value: '{#BACKUP.UUID}' 788 | tags: 789 | - tag: component 790 | value: raw 791 | - tag: target 792 | value: vm 793 | - uuid: 1e36a34c950f4afbac07f89fb1d0cc17 794 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup start' 795 | type: DEPENDENT 796 | key: 'xoa.backup.vm.start[{#BACKUP.UUID}]' 797 | delay: '0' 798 | units: unixtime 799 | preprocessing: 800 | - type: JSONPATH 801 | parameters: 802 | - $.start 803 | - type: JAVASCRIPT 804 | parameters: 805 | - 'return parseInt(value)' 806 | - type: MULTIPLIER 807 | parameters: 808 | - '0.001' 809 | master_item: 810 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 811 | tags: 812 | - tag: component 813 | value: backup 814 | - tag: target 815 | value: vm 816 | - uuid: 880ff365a84c4b0e8cbb807655e0b70f 817 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Status' 818 | type: DEPENDENT 819 | key: 'xoa.backup.vm.status[{#BACKUP.UUID}]' 820 | delay: '0' 821 | trends: '0' 822 | value_type: TEXT 823 | preprocessing: 824 | - type: JSONPATH 825 | parameters: 826 | - $.status 827 | - type: DISCARD_UNCHANGED_HEARTBEAT 828 | parameters: 829 | - 1h 830 | master_item: 831 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 832 | tags: 833 | - tag: component 834 | value: backup 835 | - tag: target 836 | value: vm 837 | trigger_prototypes: 838 | - uuid: b7a1d34be70b45688df8d48d018d06eb 839 | expression: 'last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failed" or last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failure"' 840 | name: 'VM Backup {#BACKUP.NAME} has bad status' 841 | priority: AVERAGE 842 | tags: 843 | - tag: scope 844 | value: vm 845 | parameters: 846 | - name: proxy 847 | value: '{$XOA.PROXY.URL}' 848 | - name: token 849 | value: '{$XOA.AUTH.TOKEN}' 850 | - name: url 851 | value: '{$XOA.URL}' 852 | lld_macro_paths: 853 | - lld_macro: '{#BACKUP.NAME}' 854 | path: $.name 855 | - lld_macro: '{#BACKUP.URL}' 856 | path: $.url 857 | - lld_macro: '{#BACKUP.UUID}' 858 | path: $.uuid 859 | - uuid: 0f0abc26d9884936ad59800f1e2778a0 860 | name: 'Discovery Hosts' 861 | type: SCRIPT 862 | key: xoa.hosts.discovery 863 | delay: 1h 864 | params: | 865 | try { 866 | var params = JSON.parse(value); 867 | var req = new HttpRequest(); 868 | if (params.proxy != "CHANGE_IF_NEEDED") { 869 | req.setProxy(params.proxy) 870 | } 871 | req.addHeader('Cookie: authenticationToken=' + params.token); 872 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 873 | var response = req.get(encodeURI(server_url + '/rest/v0/hosts')); 874 | } catch (error) { 875 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 876 | if (!Number.isInteger(error)) { 877 | return 520; 878 | } 879 | } 880 | var retVal = [] 881 | for (r = 0; r < JSON.parse(response).length; r++) { 882 | try { 883 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 884 | hostInfo = JSON.parse(resp); 885 | retVal.push({ "url": JSON.parse(response)[r], "uuid": hostInfo.uuid, 'name': hostInfo.name_label }); 886 | } catch (error) { 887 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 888 | if (!Number.isInteger(error)) { 889 | return 520; 890 | } 891 | } 892 | } 893 | return JSON.stringify(retVal); 894 | lifetime: 1d 895 | host_prototypes: 896 | - uuid: 49e0b0dee6964027907b68867bd0bada 897 | host: '{#HOSTS.UUID}' 898 | name: 'HV-{#HOSTS.NAME}' 899 | group_links: 900 | - group: 901 | name: Hypervisors 902 | templates: 903 | - name: 'XCP-NG Host via Xen Orchestra' 904 | macros: 905 | - macro: '{$XOA.HOST.NAME}' 906 | value: '{#HOSTS.NAME}' 907 | - macro: '{$XOA.HOST.PATH}' 908 | value: '{#HOSTS.URL}' 909 | - macro: '{$XOA.HOST.UUID}' 910 | value: '{#HOSTS.UUID}' 911 | tags: 912 | - tag: component 913 | value: Hypervisors 914 | - tag: target 915 | value: XCP-NG 916 | parameters: 917 | - name: proxy 918 | value: '{$XOA.PROXY.URL}' 919 | - name: token 920 | value: '{$XOA.AUTH.TOKEN}' 921 | - name: url 922 | value: '{$XOA.URL}' 923 | lld_macro_paths: 924 | - lld_macro: '{#HOSTS.NAME}' 925 | path: $.name 926 | - lld_macro: '{#HOSTS.URL}' 927 | path: $.url 928 | - lld_macro: '{#HOSTS.UUID}' 929 | path: $.uuid 930 | - uuid: ba152d09c30a48fda5e2385615ebe76d 931 | name: 'Discovery Pools' 932 | type: SCRIPT 933 | key: xoa.pool.discovery 934 | delay: 1h 935 | params: | 936 | try { 937 | var params = JSON.parse(value); 938 | var req = new HttpRequest(); 939 | if (params.proxy != "CHANGE_IF_NEEDED") { 940 | req.setProxy(params.proxy) 941 | } 942 | req.addHeader('Cookie: authenticationToken=' + params.token); 943 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 944 | var response = req.get(encodeURI(server_url + '/rest/v0/pools')); 945 | } catch (error) { 946 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 947 | if (!Number.isInteger(error)) { 948 | return 520; 949 | } 950 | } 951 | var retVal = [] 952 | for (r = 0; r < JSON.parse(response).length; r++) { 953 | try { 954 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 955 | poolInfo = JSON.parse(resp); 956 | retVal.push({ "url": JSON.parse(response)[r], "uuid": poolInfo.uuid, 'name': poolInfo.name_label }); 957 | } catch (error) { 958 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 959 | if (!Number.isInteger(error)) { 960 | return 520; 961 | } 962 | } 963 | } 964 | return JSON.stringify(retVal); 965 | lifetime: 1d 966 | item_prototypes: 967 | - uuid: 7f4a8af6115b4128afb280c678bc4db9 968 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Cores' 969 | type: DEPENDENT 970 | key: 'xoa.pool.cpu.cores[{#POOL.URL}]' 971 | delay: '0' 972 | preprocessing: 973 | - type: JSONPATH 974 | parameters: 975 | - $.cpus.cores 976 | master_item: 977 | key: 'xoa.pool[{#POOL.URL}]' 978 | tags: 979 | - tag: component 980 | value: pool 981 | - tag: pool 982 | value: '{#POOL.NAME}' 983 | - uuid: f6d83eef5fd9449d97ac649bb0f6e40e 984 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Sockets' 985 | type: DEPENDENT 986 | key: 'xoa.pool.cpu.sockets[{#POOL.URL}]' 987 | delay: '0' 988 | preprocessing: 989 | - type: JSONPATH 990 | parameters: 991 | - $.cpus.sockets 992 | master_item: 993 | key: 'xoa.pool[{#POOL.URL}]' 994 | tags: 995 | - tag: component 996 | value: pool 997 | - tag: pool 998 | value: '{#POOL.NAME}' 999 | - uuid: 46a2c37e887a44af831a95b2962ee8c4 1000 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Description' 1001 | type: DEPENDENT 1002 | key: 'xoa.pool.description[{#POOL.URL}]' 1003 | delay: '0' 1004 | trends: '0' 1005 | value_type: CHAR 1006 | preprocessing: 1007 | - type: JSONPATH 1008 | parameters: 1009 | - $.name_description 1010 | - type: DISCARD_UNCHANGED_HEARTBEAT 1011 | parameters: 1012 | - 12h 1013 | master_item: 1014 | key: 'xoa.pool[{#POOL.URL}]' 1015 | tags: 1016 | - tag: component 1017 | value: pool 1018 | - tag: pool 1019 | value: '{#POOL.NAME}' 1020 | - uuid: 64981b8e1f7f49e7a4941ab0866df905 1021 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): HA enabled' 1022 | type: DEPENDENT 1023 | key: 'xoa.pool.ha.enabled[{#POOL.URL}]' 1024 | delay: '0' 1025 | trends: '0' 1026 | value_type: CHAR 1027 | preprocessing: 1028 | - type: JSONPATH 1029 | parameters: 1030 | - $.HA_enabled 1031 | master_item: 1032 | key: 'xoa.pool[{#POOL.URL}]' 1033 | tags: 1034 | - tag: component 1035 | value: pool 1036 | - tag: pool 1037 | value: '{#POOL.NAME}' 1038 | - uuid: bb14638e591940389e2ee1b437fa428f 1039 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Name' 1040 | type: DEPENDENT 1041 | key: 'xoa.pool.name[{#POOL.URL}]' 1042 | delay: '0' 1043 | trends: '0' 1044 | value_type: CHAR 1045 | preprocessing: 1046 | - type: JSONPATH 1047 | parameters: 1048 | - $.name_label 1049 | - type: DISCARD_UNCHANGED_HEARTBEAT 1050 | parameters: 1051 | - 6h 1052 | master_item: 1053 | key: 'xoa.pool[{#POOL.URL}]' 1054 | tags: 1055 | - tag: component 1056 | value: pool 1057 | - tag: pool 1058 | value: '{#POOL.NAME}' 1059 | - uuid: d119af9ee0794efa9c5a93ef01301a1a 1060 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Get Values' 1061 | type: HTTP_AGENT 1062 | key: 'xoa.pool[{#POOL.URL}]' 1063 | delay: 15m 1064 | history: '0' 1065 | trends: '0' 1066 | value_type: TEXT 1067 | url: '{$XOA.URL}{#POOL.URL}' 1068 | headers: 1069 | - name: Cookie 1070 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1071 | - name: Accept 1072 | value: application/json 1073 | tags: 1074 | - tag: component 1075 | value: raw 1076 | parameters: 1077 | - name: proxy 1078 | value: '{$XOA.PROXY.URL}' 1079 | - name: token 1080 | value: '{$XOA.AUTH.TOKEN}' 1081 | - name: url 1082 | value: '{$XOA.URL}' 1083 | lld_macro_paths: 1084 | - lld_macro: '{#POOL.NAME}' 1085 | path: $.name 1086 | - lld_macro: '{#POOL.URL}' 1087 | path: $.url 1088 | - lld_macro: '{#POOL.UUID}' 1089 | path: $.uuid 1090 | - uuid: 59ad3f67fa2644be8f8a63ceb7dd1039 1091 | name: 'Discovery SRs' 1092 | type: SCRIPT 1093 | key: xoa.sr.discovery 1094 | delay: 1h 1095 | params: | 1096 | try { 1097 | var params = JSON.parse(value); 1098 | var req = new HttpRequest(); 1099 | if (params.proxy != "CHANGE_IF_NEEDED") { 1100 | req.setProxy(params.proxy) 1101 | } 1102 | req.addHeader('Cookie: authenticationToken=' + params.token); 1103 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1104 | var response = req.get(encodeURI(server_url + '/rest/v0/srs')); 1105 | } catch (error) { 1106 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1107 | if (!Number.isInteger(error)) { 1108 | return 520; 1109 | } 1110 | } 1111 | var retVal = [] 1112 | for (r = 0; r < JSON.parse(response).length; r++) { 1113 | try { 1114 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1115 | srInfo = JSON.parse(resp); 1116 | retVal.push({ "url": JSON.parse(response)[r], "uuid": srInfo.uuid, 'name': srInfo.name_label }); 1117 | } catch (error) { 1118 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1119 | if (!Number.isInteger(error)) { 1120 | return 520; 1121 | } 1122 | } 1123 | } 1124 | return JSON.stringify(retVal); 1125 | filter: 1126 | conditions: 1127 | - macro: '{#SR.NAME}' 1128 | value: '{$XEN.SR.IGNORE}' 1129 | operator: NOT_MATCHES_REGEX 1130 | formulaid: A 1131 | lifetime: 1d 1132 | item_prototypes: 1133 | - uuid: 2c7ddde760c7485fbfd5afd06c0ca9f6 1134 | name: 'SR {#SR.NAME} ({#SR.UUID}): In maintenance mode' 1135 | type: DEPENDENT 1136 | key: 'xoa.sr.maintenance[{#SR.URL}]' 1137 | delay: '0' 1138 | trends: '0' 1139 | value_type: CHAR 1140 | preprocessing: 1141 | - type: JSONPATH 1142 | parameters: 1143 | - $.inMaintenanceMode 1144 | master_item: 1145 | key: 'xoa.sr.raw[{#SR.URL}]' 1146 | tags: 1147 | - tag: component 1148 | value: storage 1149 | - tag: repository 1150 | value: '{#SR.NAME}' 1151 | - uuid: ac01c8b01494403797fbdf84657ecbc1 1152 | name: 'SR {#SR.NAME} ({#SR.UUID}): Name' 1153 | type: DEPENDENT 1154 | key: 'xoa.sr.name[{#SR.URL}]' 1155 | delay: '0' 1156 | trends: '0' 1157 | value_type: CHAR 1158 | preprocessing: 1159 | - type: JSONPATH 1160 | parameters: 1161 | - $.name_label 1162 | - type: DISCARD_UNCHANGED_HEARTBEAT 1163 | parameters: 1164 | - 12h 1165 | master_item: 1166 | key: 'xoa.sr.raw[{#SR.URL}]' 1167 | tags: 1168 | - tag: component 1169 | value: storage 1170 | - tag: repository 1171 | value: '{#SR.NAME}' 1172 | - uuid: a9c8007dfb15454da2ec7d3b2ef78c36 1173 | name: 'SR {#SR.NAME} ({#SR.UUID}): Get Values' 1174 | type: HTTP_AGENT 1175 | key: 'xoa.sr.raw[{#SR.URL}]' 1176 | delay: 5m 1177 | history: '0' 1178 | trends: '0' 1179 | value_type: TEXT 1180 | url: '{$XOA.URL}{#SR.URL}' 1181 | headers: 1182 | - name: Cookie 1183 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1184 | - name: Accept 1185 | value: application/json 1186 | tags: 1187 | - tag: component 1188 | value: raw 1189 | - uuid: c3d42712ef4c4941b5d6dcf301abd4f5 1190 | name: 'SR {#SR.NAME} ({#SR.UUID}): Size' 1191 | type: DEPENDENT 1192 | key: 'xoa.sr.size[{#SR.URL}]' 1193 | delay: '0' 1194 | units: B 1195 | preprocessing: 1196 | - type: JSONPATH 1197 | parameters: 1198 | - $.size 1199 | master_item: 1200 | key: 'xoa.sr.raw[{#SR.URL}]' 1201 | tags: 1202 | - tag: component 1203 | value: storage 1204 | - tag: repository 1205 | value: '{#SR.NAME}' 1206 | - uuid: 5c9753ddfd4040a4b2f09bee5b218f37 1207 | name: 'SR {#SR.NAME} ({#SR.UUID}) Content Type' 1208 | type: DEPENDENT 1209 | key: 'xoa.sr.type.content[{#SR.URL}]' 1210 | delay: '0' 1211 | trends: '0' 1212 | value_type: CHAR 1213 | preprocessing: 1214 | - type: JSONPATH 1215 | parameters: 1216 | - $.content_type 1217 | - type: DISCARD_UNCHANGED_HEARTBEAT 1218 | parameters: 1219 | - 6h 1220 | master_item: 1221 | key: 'xoa.sr.raw[{#SR.URL}]' 1222 | tags: 1223 | - tag: component 1224 | value: storage 1225 | - tag: repository 1226 | value: '{#SR.NAME}' 1227 | - uuid: 09c0b4829e674fbaa3b80ce030f311f3 1228 | name: 'SR {#SR.NAME} ({#SR.UUID}): Type' 1229 | type: DEPENDENT 1230 | key: 'xoa.sr.type[{#SR.URL}]' 1231 | delay: '0' 1232 | trends: '0' 1233 | value_type: CHAR 1234 | preprocessing: 1235 | - type: JSONPATH 1236 | parameters: 1237 | - $.SR_type 1238 | - type: DISCARD_UNCHANGED_HEARTBEAT 1239 | parameters: 1240 | - 6h 1241 | master_item: 1242 | key: 'xoa.sr.raw[{#SR.URL}]' 1243 | tags: 1244 | - tag: component 1245 | value: storage 1246 | - tag: repository 1247 | value: '{#SR.NAME}' 1248 | - uuid: 3f678af9e8fc4c0dbfab055155749c2c 1249 | name: 'SR {#SR.NAME} ({#SR.UUID}): Used percentage' 1250 | type: CALCULATED 1251 | key: 'xoa.sr.used.percentage[{#SR.URL}]' 1252 | delay: 5m 1253 | value_type: FLOAT 1254 | units: '%' 1255 | params: 'last(//xoa.sr.used.physical[{#SR.URL}])/last(//xoa.sr.size[{#SR.URL}])*100' 1256 | tags: 1257 | - tag: component 1258 | value: storage 1259 | - tag: repository 1260 | value: '{#SR.NAME}' 1261 | trigger_prototypes: 1262 | - uuid: fb16b143e0ef45ea91eb423f2530cdd0 1263 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1264 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1265 | priority: HIGH 1266 | tags: 1267 | - tag: scope 1268 | value: storage 1269 | - uuid: 087dcb24233f4f3c8a88bc7d01abe3a4 1270 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.WARN}' 1271 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is low' 1272 | priority: WARNING 1273 | dependencies: 1274 | - name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1275 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1276 | tags: 1277 | - tag: scope 1278 | value: storage 1279 | - uuid: 57b22801aba547bfa90a3304a59f53dc 1280 | name: 'SR {#SR.NAME} ({#SR.UUID}): Physical Usage' 1281 | type: DEPENDENT 1282 | key: 'xoa.sr.used.physical[{#SR.URL}]' 1283 | delay: '0' 1284 | units: B 1285 | preprocessing: 1286 | - type: JSONPATH 1287 | parameters: 1288 | - $.physical_usage 1289 | master_item: 1290 | key: 'xoa.sr.raw[{#SR.URL}]' 1291 | tags: 1292 | - tag: component 1293 | value: storage 1294 | - tag: repository 1295 | value: '{#SR.NAME}' 1296 | parameters: 1297 | - name: proxy 1298 | value: '{$XOA.PROXY.URL}' 1299 | - name: token 1300 | value: '{$XOA.AUTH.TOKEN}' 1301 | - name: url 1302 | value: '{$XOA.URL}' 1303 | lld_macro_paths: 1304 | - lld_macro: '{#SR.NAME}' 1305 | path: $.name 1306 | - lld_macro: '{#SR.URL}' 1307 | path: $.url 1308 | - lld_macro: '{#SR.UUID}' 1309 | path: $.uuid 1310 | - uuid: 5485ca1d330d4dffa4a03579729428e6 1311 | name: 'Discovery VMs' 1312 | type: SCRIPT 1313 | key: xoa.vms.discovery 1314 | delay: 1h 1315 | params: | 1316 | try { 1317 | var params = JSON.parse(value); 1318 | var req = new HttpRequest(); 1319 | if (params.proxy != "CHANGE_IF_NEEDED") { 1320 | req.setProxy(params.proxy) 1321 | } 1322 | req.addHeader('Cookie: authenticationToken=' + params.token); 1323 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1324 | var response = req.get(encodeURI(server_url + '/rest/v0/vms')); 1325 | } catch (error) { 1326 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1327 | if (!Number.isInteger(error)) { 1328 | return 520; 1329 | } 1330 | } 1331 | var retVal = [] 1332 | for (r = 0; r < JSON.parse(response).length; r++) { 1333 | try { 1334 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1335 | vmsInfo = JSON.parse(resp); 1336 | retVal.push({ "url": JSON.parse(response)[r], "uuid": vmsInfo.uuid, 'name': vmsInfo.name_label }); 1337 | } catch (error) { 1338 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1339 | if (!Number.isInteger(error)) { 1340 | return 520; 1341 | } 1342 | } 1343 | } 1344 | return JSON.stringify(retVal); 1345 | filter: 1346 | conditions: 1347 | - macro: '{#VMS.NAME}' 1348 | value: '{$XOA.VM.IGNORE}' 1349 | operator: NOT_MATCHES_REGEX 1350 | formulaid: A 1351 | lifetime: 1d 1352 | host_prototypes: 1353 | - uuid: 78bf8b747c7547f2990fcf9f4bac56ae 1354 | host: '{#VMS.UUID}' 1355 | name: 'VM-{#VMS.NAME}' 1356 | group_links: 1357 | - group: 1358 | name: 'Virtual machines' 1359 | templates: 1360 | - name: 'XCP-NG VM via Xen Orchestra' 1361 | macros: 1362 | - macro: '{$XOA.VM.NAME}' 1363 | value: '{#VMS.NAME}' 1364 | - macro: '{$XOA.VM.PATH}' 1365 | value: '{#VMS.URL}' 1366 | - macro: '{$XOA.VM.UUID}' 1367 | value: '{#VMS.UUID}' 1368 | tags: 1369 | - tag: component 1370 | value: hypervisor 1371 | - tag: target 1372 | value: guest 1373 | parameters: 1374 | - name: proxy 1375 | value: '{$XOA.PROXY.URL}' 1376 | - name: token 1377 | value: '{$XOA.AUTH.TOKEN}' 1378 | - name: url 1379 | value: '{$XOA.URL}' 1380 | lld_macro_paths: 1381 | - lld_macro: '{#VMS.NAME}' 1382 | path: $.name 1383 | - lld_macro: '{#VMS.URL}' 1384 | path: $.url 1385 | - lld_macro: '{#VMS.UUID}' 1386 | path: $.uuid 1387 | httptests: 1388 | - uuid: 1458d489beef4863be6f18f36ac41a24 1389 | name: 'Check Token Validity' 1390 | delay: 5m 1391 | attempts: '3' 1392 | headers: 1393 | - name: Cookie 1394 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1395 | - name: Accept 1396 | value: application/json 1397 | steps: 1398 | - name: 'Check Token Validity' 1399 | url: '{$XOA.URL}/rest/v0' 1400 | follow_redirects: 'NO' 1401 | status_codes: '200' 1402 | tags: 1403 | - tag: component 1404 | value: hypervisor 1405 | - tag: target 1406 | value: xen 1407 | macros: 1408 | - macro: '{$XEN.SR.IGNORE}' 1409 | value: '^(DVD drives|XCP-ng Tools|Removable storage)$' 1410 | description: 'Do not discover following SRs' 1411 | - macro: '{$XOA.AUTH.TOKEN}' 1412 | value: CHANGE_IF_NEEDED 1413 | description: 'Authentication Token generated on XOA UI' 1414 | - macro: '{$XOA.BACKUP.NOT_MATCHES}' 1415 | value: CHANGE_IF_NEEDED 1416 | description: 'Ignore Backups with Names that match RegEx' 1417 | - macro: '{$XOA.PROXY.URL}' 1418 | value: CHANGE_IF_NEEDED 1419 | description: 'URL for a Proxy if used to reach XOA' 1420 | - macro: '{$XOA.SR.THRESHOLD.CRIT}' 1421 | value: '95' 1422 | description: 'Critical threshold for SR usage' 1423 | - macro: '{$XOA.SR.THRESHOLD.WARN}' 1424 | value: '75' 1425 | description: 'Warn threshold for SR usage' 1426 | - macro: '{$XOA.URL}' 1427 | value: CHANGE 1428 | description: 'URL where XOA can be reached' 1429 | - macro: '{$XOA.VM.IGNORE}' 1430 | value: '.*\[Importing.*' 1431 | description: 'Ignore VMs containing sting' 1432 | valuemaps: 1433 | - uuid: 0ec95555cba645f796a21bdece34349c 1434 | name: 'XOA Boolean' 1435 | mappings: 1436 | - value: '1' 1437 | newvalue: 'true' 1438 | - value: '0' 1439 | newvalue: 'false' 1440 | triggers: 1441 | - uuid: 728078ed899548faa3736110abb9d69e 1442 | expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=401' 1443 | recovery_mode: RECOVERY_EXPRESSION 1444 | recovery_expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=200' 1445 | name: 'Authentication Token for XenOrchestra is invalid' 1446 | priority: HIGH 1447 | -------------------------------------------------------------------------------- /6.4/template_app_xenorchestra.yaml: -------------------------------------------------------------------------------- 1 | zabbix_export: 2 | version: '6.4' 3 | template_groups: 4 | - uuid: 7df96b18c230490a9a0a9e2307226338 5 | name: Templates 6 | host_groups: 7 | - uuid: 1b837a3c078647049a0c00c61b4d57b5 8 | name: Hypervisors 9 | - uuid: 137f19e6e2dc4219b33553b812627bc2 10 | name: 'Virtual machines' 11 | templates: 12 | - uuid: 8d4ad92902e6440ca14dfa5256d8bf82 13 | template: 'XCP-NG Host via Xen Orchestra' 14 | name: 'XCP-NG Host via Xen Orchestra' 15 | groups: 16 | - name: Templates 17 | items: 18 | - uuid: d137a2d23e554eb7b98d1de0ce26dfb6 19 | name: 'CPU Cores' 20 | type: DEPENDENT 21 | key: xoa.host.cpu.cores 22 | delay: '0' 23 | preprocessing: 24 | - type: JSONPATH 25 | parameters: 26 | - $.CPUs.cpu_count 27 | master_item: 28 | key: xoa.host.raw 29 | - uuid: 0a1e66d4f0a4455abcfd9317c4c973b1 30 | name: 'CPU Sockets' 31 | type: DEPENDENT 32 | key: xoa.host.cpu.sockets 33 | delay: '0' 34 | preprocessing: 35 | - type: JSONPATH 36 | parameters: 37 | - $.CPUs.socket_count 38 | master_item: 39 | key: xoa.host.raw 40 | - uuid: 702c08f7b6d94be49fbfaef45b1b4174 41 | name: 'Host description' 42 | type: DEPENDENT 43 | key: xoa.host.description 44 | delay: '0' 45 | value_type: CHAR 46 | trends: '0' 47 | preprocessing: 48 | - type: JSONPATH 49 | parameters: 50 | - $.name_description 51 | - type: DISCARD_UNCHANGED_HEARTBEAT 52 | parameters: 53 | - 12h 54 | master_item: 55 | key: xoa.host.raw 56 | - uuid: a6343812baea4750b24def6a3ef71f70 57 | name: Enabled 58 | type: DEPENDENT 59 | key: xoa.host.enabled 60 | delay: '0' 61 | value_type: CHAR 62 | trends: '0' 63 | preprocessing: 64 | - type: JSONPATH 65 | parameters: 66 | - $.enabled 67 | master_item: 68 | key: xoa.host.raw 69 | - uuid: 604ae2b2e6b943c387edd492eddc8beb 70 | name: 'Hypervisor brand' 71 | type: DEPENDENT 72 | key: xoa.host.hv.brand 73 | delay: '0' 74 | value_type: CHAR 75 | trends: '0' 76 | preprocessing: 77 | - type: JSONPATH 78 | parameters: 79 | - $.productBrand 80 | - type: DISCARD_UNCHANGED_HEARTBEAT 81 | parameters: 82 | - 12h 83 | master_item: 84 | key: xoa.host.raw 85 | - uuid: 494f4ddea1cf40398641295be217878a 86 | name: 'Hypervisor version' 87 | type: DEPENDENT 88 | key: xoa.host.hv.version 89 | delay: '0' 90 | value_type: CHAR 91 | trends: '0' 92 | preprocessing: 93 | - type: JSONPATH 94 | parameters: 95 | - $.version 96 | - type: DISCARD_UNCHANGED_HEARTBEAT 97 | parameters: 98 | - 12h 99 | master_item: 100 | key: xoa.host.raw 101 | - uuid: c1c9cee844f34ff289b32559493af04f 102 | name: 'Hypervisor version build' 103 | type: DEPENDENT 104 | key: xoa.host.hv.version.build 105 | delay: '0' 106 | value_type: CHAR 107 | trends: '0' 108 | preprocessing: 109 | - type: JSONPATH 110 | parameters: 111 | - $.build 112 | - type: DISCARD_UNCHANGED_HEARTBEAT 113 | parameters: 114 | - 12h 115 | master_item: 116 | key: xoa.host.raw 117 | - uuid: ecf042cea23e45e89954fe6fc499be86 118 | name: 'HVM capable' 119 | type: DEPENDENT 120 | key: xoa.host.hvm.capable 121 | delay: '0' 122 | value_type: CHAR 123 | trends: '0' 124 | preprocessing: 125 | - type: JSONPATH 126 | parameters: 127 | - $.hvmCapable 128 | - type: DISCARD_UNCHANGED_HEARTBEAT 129 | parameters: 130 | - 1h 131 | master_item: 132 | key: xoa.host.raw 133 | - uuid: 4026336d2d97475e9019522c73535574 134 | name: 'Memory total' 135 | type: DEPENDENT 136 | key: xoa.host.memory.total 137 | delay: '0' 138 | units: B 139 | preprocessing: 140 | - type: JSONPATH 141 | parameters: 142 | - $.memory.size 143 | master_item: 144 | key: xoa.host.raw 145 | - uuid: 6181620d670c4e3cbeaad0babe89fc1b 146 | name: 'Memory used' 147 | type: DEPENDENT 148 | key: xoa.host.memory.used 149 | delay: '0' 150 | units: B 151 | preprocessing: 152 | - type: JSONPATH 153 | parameters: 154 | - $.memory.usage 155 | master_item: 156 | key: xoa.host.raw 157 | - uuid: ed5fe0b877ed469ebc0d4e4b32ff8a87 158 | name: 'Memory used percent' 159 | type: CALCULATED 160 | key: xoa.host.memory.used.percent 161 | delay: 5m 162 | value_type: FLOAT 163 | units: '%' 164 | params: 'last(//xoa.host.memory.used)/last(//xoa.host.memory.total)*100' 165 | triggers: 166 | - uuid: 29677931a1b944038a687c8c28c4d015 167 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 168 | name: 'Memory usage critical high' 169 | priority: HIGH 170 | - uuid: 9de3ff6c29d945a7b8ca5a2bb0a78493 171 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.WARN}' 172 | name: 'Memory usage exceeds {$XOA.MEMORY.WARN}' 173 | priority: WARNING 174 | dependencies: 175 | - name: 'Memory usage critical high' 176 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 177 | - uuid: 81a949d8376b43b0b620de6bcbe3d525 178 | name: 'XCP-NG Hosts: Get Missing Patches' 179 | type: HTTP_AGENT 180 | key: xoa.host.missingpatches.raw 181 | delay: 15m 182 | history: '0' 183 | value_type: TEXT 184 | trends: '0' 185 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}/missing_patches' 186 | headers: 187 | - name: Cookie 188 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 189 | - name: Accept 190 | value: application/json 191 | - uuid: 3725dfaac75643fcb3cfe0b852a26f70 192 | name: Hostname 193 | type: DEPENDENT 194 | key: xoa.host.name 195 | delay: '0' 196 | value_type: CHAR 197 | trends: '0' 198 | preprocessing: 199 | - type: JSONPATH 200 | parameters: 201 | - $.name_label 202 | - type: DISCARD_UNCHANGED_HEARTBEAT 203 | parameters: 204 | - 12h 205 | master_item: 206 | key: xoa.host.raw 207 | - uuid: 5b2435e1c5dd49c7be4b7cc1dc31e64d 208 | name: 'Power State' 209 | type: DEPENDENT 210 | key: xoa.host.power.state 211 | delay: '0' 212 | value_type: CHAR 213 | trends: '0' 214 | preprocessing: 215 | - type: JSONPATH 216 | parameters: 217 | - $.power_state 218 | master_item: 219 | key: xoa.host.raw 220 | triggers: 221 | - uuid: 484c668a58c54317a61a405b52cc43ec 222 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state)<>last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state,#2)' 223 | recovery_mode: NONE 224 | name: 'Power state changed' 225 | priority: INFO 226 | manual_close: 'YES' 227 | - uuid: 11c547b55c424e26bb02d87266980a6f 228 | name: 'XCP-NG Hosts: Get Values' 229 | type: HTTP_AGENT 230 | key: xoa.host.raw 231 | delay: 5m 232 | history: '0' 233 | value_type: TEXT 234 | trends: '0' 235 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}' 236 | headers: 237 | - name: Cookie 238 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 239 | - name: Accept 240 | value: application/json 241 | - uuid: ee2ab8db1e0f4d1f88df5fe6892eaf73 242 | name: 'Reboot required' 243 | type: DEPENDENT 244 | key: xoa.host.reboot.required 245 | delay: '0' 246 | value_type: CHAR 247 | trends: '0' 248 | preprocessing: 249 | - type: JSONPATH 250 | parameters: 251 | - $.rebootRequired 252 | master_item: 253 | key: xoa.host.raw 254 | triggers: 255 | - uuid: 06a3b195183a49d9ac6f37afa802e5a9 256 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.reboot.required)="true"' 257 | name: 'Reboot required for hosts' 258 | priority: WARNING 259 | - uuid: 077fd836ae1c420792fcf368fa43e8a3 260 | name: 'Number of running VMs' 261 | type: DEPENDENT 262 | key: xoa.host.runningvms 263 | delay: '0' 264 | preprocessing: 265 | - type: JSONPATH 266 | parameters: 267 | - $.residentVms 268 | - type: JAVASCRIPT 269 | parameters: 270 | - 'return JSON.parse(value).length' 271 | master_item: 272 | key: xoa.host.raw 273 | - uuid: 745f6fb406c34e3b8ec313a54b2c85cc 274 | name: 'Host start time' 275 | type: DEPENDENT 276 | key: xoa.host.starttime 277 | delay: '0' 278 | units: unixtime 279 | preprocessing: 280 | - type: JSONPATH 281 | parameters: 282 | - $.startTime 283 | - type: STR_REPLACE 284 | parameters: 285 | - 'null' 286 | - '0' 287 | - type: DISCARD_UNCHANGED_HEARTBEAT 288 | parameters: 289 | - 1h 290 | master_item: 291 | key: xoa.host.raw 292 | - uuid: dab4f3b69f5141048e914d87ed23dd69 293 | name: 'Number of Missing Patches' 294 | type: DEPENDENT 295 | key: xoa.hosts.missingpatches.count 296 | delay: '0' 297 | preprocessing: 298 | - type: JAVASCRIPT 299 | parameters: 300 | - 'return JSON.parse(value).length' 301 | master_item: 302 | key: xoa.host.missingpatches.raw 303 | triggers: 304 | - uuid: b4f671bc3ab8442c87147db31e815ffe 305 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.hosts.missingpatches.count)>{$XOA.HOST.MISSING.PATCHES.MAX}' 306 | name: 'Number of {$XOA.HOST.MISSING.PATCHES.MAX} missing patches exceeded' 307 | priority: WARNING 308 | tags: 309 | - tag: component 310 | value: hypervisor 311 | - tag: target 312 | value: xcp-ng 313 | macros: 314 | - macro: '{$XOA.AUTH.TOKEN}' 315 | value: CHANGE_IF_NEEDED 316 | description: 'Authentication Token generated on XOA UI' 317 | - macro: '{$XOA.HOST.MISSING.PATCHES.MAX}' 318 | value: '1' 319 | description: 'Maximum Number of missing patches allowed' 320 | - macro: '{$XOA.HOST.UUID}' 321 | value: CHANGE_IF_NEEDED 322 | description: 'Host UUID' 323 | - macro: '{$XOA.MEMORY.CRIT}' 324 | value: '90' 325 | description: 'Critical memory usage' 326 | - macro: '{$XOA.MEMORY.WARN}' 327 | value: '75' 328 | description: 'Warn when memory usage is above' 329 | - macro: '{$XOA.URL}' 330 | value: CHANGE_IF_NEEDED 331 | description: 'URL where XOA can be reached' 332 | valuemaps: 333 | - uuid: 7de0ad540b0f4fd5ab2b33ef9f79d440 334 | name: 'XOA Boolean' 335 | mappings: 336 | - value: '1' 337 | newvalue: 'true' 338 | - value: '0' 339 | newvalue: 'false' 340 | - uuid: b1aa3ddc4db246c3a5e71658dd5a9601 341 | template: 'XCP-NG VM via Xen Orchestra' 342 | name: 'XCP-NG VM via Xen Orchestra' 343 | groups: 344 | - name: Templates 345 | items: 346 | - uuid: 6a01a4edf2364313a72939d2dfb7789c 347 | name: 'vCPU active' 348 | type: DEPENDENT 349 | key: xoa.vm.cpu.active 350 | delay: '0' 351 | preprocessing: 352 | - type: JSONPATH 353 | parameters: 354 | - $.CPUs.number 355 | master_item: 356 | key: xoa.vms.raw 357 | - uuid: 2149aaf9d7904bf4b28f4aaa943f120e 358 | name: 'vCPU max' 359 | type: DEPENDENT 360 | key: xoa.vm.cpu.max 361 | delay: '0' 362 | preprocessing: 363 | - type: JSONPATH 364 | parameters: 365 | - $.CPUs.max 366 | master_item: 367 | key: xoa.vms.raw 368 | - uuid: 2bd0262b02754c49bf1388e392bff454 369 | name: 'VM description' 370 | type: DEPENDENT 371 | key: xoa.vm.description 372 | delay: '0' 373 | value_type: CHAR 374 | trends: '0' 375 | preprocessing: 376 | - type: JSONPATH 377 | parameters: 378 | - $.name_description 379 | - type: DISCARD_UNCHANGED_HEARTBEAT 380 | parameters: 381 | - 1d 382 | master_item: 383 | key: xoa.vms.raw 384 | - uuid: 011d9425a4bc4b4cb3cba08d878c0f83 385 | name: 'Xen PV driver version' 386 | type: DEPENDENT 387 | key: xoa.vm.driver.version 388 | delay: '0' 389 | value_type: CHAR 390 | trends: '0' 391 | preprocessing: 392 | - type: JSONPATH 393 | parameters: 394 | - $.pvDriversVersion 395 | - type: DISCARD_UNCHANGED_HEARTBEAT 396 | parameters: 397 | - 1h 398 | master_item: 399 | key: xoa.vms.raw 400 | - uuid: 86a3094485084862a3a2d4d1bd9333b2 401 | name: 'VM install time' 402 | type: DEPENDENT 403 | key: xoa.vm.installtime 404 | delay: '0' 405 | units: unixtime 406 | preprocessing: 407 | - type: JSONPATH 408 | parameters: 409 | - $.installTime 410 | - type: DISCARD_UNCHANGED_HEARTBEAT 411 | parameters: 412 | - 1d 413 | master_item: 414 | key: xoa.vms.raw 415 | - uuid: 37d6d0b60c654490b5d360b194538f15 416 | name: 'Management agent detected' 417 | type: DEPENDENT 418 | key: xoa.vm.management.agent 419 | delay: '0' 420 | value_type: CHAR 421 | trends: '0' 422 | preprocessing: 423 | - type: JSONPATH 424 | parameters: 425 | - $.managementAgentDetected 426 | master_item: 427 | key: xoa.vms.raw 428 | triggers: 429 | - uuid: 90dd8a29cfc3457aabb35ce8527683d4 430 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.management.agent)="false"' 431 | name: 'No management agent install on VM' 432 | priority: INFO 433 | manual_close: 'YES' 434 | - uuid: e72db9c5c0474d099be380a577aafd23 435 | name: 'Memory total' 436 | type: DEPENDENT 437 | key: xoa.vm.memory.total 438 | delay: '0' 439 | units: B 440 | preprocessing: 441 | - type: JSONPATH 442 | parameters: 443 | - $.memory.size 444 | master_item: 445 | key: xoa.vms.raw 446 | - uuid: c319917b771c46afbf2fdacf217216d1 447 | name: 'Virtualization mode' 448 | type: DEPENDENT 449 | key: xoa.vm.mode 450 | delay: '0' 451 | value_type: CHAR 452 | trends: '0' 453 | preprocessing: 454 | - type: JSONPATH 455 | parameters: 456 | - $.virtualizationMode 457 | - type: DISCARD_UNCHANGED_HEARTBEAT 458 | parameters: 459 | - 1d 460 | master_item: 461 | key: xoa.vms.raw 462 | - uuid: e5f39794e08c4aeb9b2f96abf5dc58dc 463 | name: 'VM name' 464 | type: DEPENDENT 465 | key: xoa.vm.name 466 | delay: '0' 467 | value_type: CHAR 468 | trends: '0' 469 | preprocessing: 470 | - type: JSONPATH 471 | parameters: 472 | - $.name_label 473 | - type: DISCARD_UNCHANGED_HEARTBEAT 474 | parameters: 475 | - 24h 476 | master_item: 477 | key: xoa.vms.raw 478 | - uuid: 5397b9f0460742899d91a127b52f2020 479 | name: 'OS Distribution' 480 | type: DEPENDENT 481 | key: xoa.vm.os.distro 482 | delay: '0' 483 | value_type: CHAR 484 | trends: '0' 485 | preprocessing: 486 | - type: JSONPATH 487 | parameters: 488 | - $.os_version.distro 489 | - type: DISCARD_UNCHANGED_HEARTBEAT 490 | parameters: 491 | - 1d 492 | master_item: 493 | key: xoa.vms.raw 494 | - uuid: 4126bf9d15464ecea0f7a0d0fe8fd8b8 495 | name: 'OS version' 496 | type: DEPENDENT 497 | key: xoa.vm.os.version 498 | delay: '0' 499 | value_type: CHAR 500 | trends: '0' 501 | preprocessing: 502 | - type: JSONPATH 503 | parameters: 504 | - $.os_version.name 505 | - type: DISCARD_UNCHANGED_HEARTBEAT 506 | parameters: 507 | - 1d 508 | master_item: 509 | key: xoa.vms.raw 510 | - uuid: 2415c2f666e64438ae682c0855c2831b 511 | name: 'Power State' 512 | type: DEPENDENT 513 | key: xoa.vm.power.state 514 | delay: '0' 515 | value_type: CHAR 516 | trends: '0' 517 | preprocessing: 518 | - type: JSONPATH 519 | parameters: 520 | - $.power_state 521 | master_item: 522 | key: xoa.vms.raw 523 | triggers: 524 | - uuid: 4f938791d96b4898860edf870a1bc72e 525 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state)<>last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state,#2)' 526 | recovery_mode: NONE 527 | name: 'State of VM changed' 528 | priority: AVERAGE 529 | manual_close: 'YES' 530 | - uuid: d3da95b5b2c64e5e82c893e9fbd82743 531 | name: 'Number of snapshots' 532 | type: DEPENDENT 533 | key: xoa.vm.snapshot 534 | delay: '0' 535 | preprocessing: 536 | - type: JSONPATH 537 | parameters: 538 | - $.snapshots 539 | - type: JAVASCRIPT 540 | parameters: 541 | - 'return JSON.parse(value).length' 542 | master_item: 543 | key: xoa.vms.raw 544 | triggers: 545 | - uuid: 353d88c34edc4ea3957a4ecc12e6db7b 546 | expression: 'min(/XCP-NG VM via Xen Orchestra/xoa.vm.snapshot,3600)>{$XOA.VM.NO.SNAPSHOTS.MAX}' 547 | name: 'Number of Snapshots exceeds {$XOA.VM.NO.SNAPSHOTS.MAX} for more than 1 hour' 548 | priority: WARNING 549 | - uuid: 889bc4bcaf0744f7ac14c36f45139cc8 550 | name: 'VM start time' 551 | type: DEPENDENT 552 | key: xoa.vm.starttime 553 | delay: '0' 554 | units: unixtime 555 | preprocessing: 556 | - type: JSONPATH 557 | parameters: 558 | - $.startTime 559 | - type: DISCARD_UNCHANGED_HEARTBEAT 560 | parameters: 561 | - 1h 562 | master_item: 563 | key: xoa.vms.raw 564 | - uuid: cb8d4b3b8a0442c2aa48853c6ab45af3 565 | name: 'Xen Tool Version' 566 | type: DEPENDENT 567 | key: xoa.vm.tools.version 568 | delay: '0' 569 | value_type: CHAR 570 | trends: '0' 571 | preprocessing: 572 | - type: JSONPATH 573 | parameters: 574 | - $.xenTools.version 575 | - type: DISCARD_UNCHANGED_HEARTBEAT 576 | parameters: 577 | - 1h 578 | master_item: 579 | key: xoa.vms.raw 580 | - uuid: 27f086c8cf754b789daf6868cf394172 581 | name: 'XCP-NG VMS: Get Values' 582 | type: HTTP_AGENT 583 | key: xoa.vms.raw 584 | delay: 5m 585 | history: '0' 586 | value_type: TEXT 587 | trends: '0' 588 | url: '{$XOA.URL}/rest/v0/vms/{$XOA.VM.UUID}' 589 | headers: 590 | - name: Cookie 591 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 592 | - name: Accept 593 | value: application/json 594 | tags: 595 | - tag: component 596 | value: hypervisor 597 | - tag: target 598 | value: guests 599 | macros: 600 | - macro: '{$XOA.AUTH.TOKEN}' 601 | value: CHANGE_IF_NEEDED 602 | description: 'Authentication Token generated on XOA UI' 603 | - macro: '{$XOA.HOST.UUID}' 604 | value: CHANGE_IF_NEEDED 605 | description: 'Host UUID' 606 | - macro: '{$XOA.URL}' 607 | value: CHANGE_IF_NEEDED 608 | description: 'URL where XOA can be reached' 609 | - macro: '{$XOA.VM.NO.SNAPSHOTS.MAX}' 610 | value: '1' 611 | description: 'Max number of snapshots allowed' 612 | - macro: '{$XOA.VM.UUID}' 613 | valuemaps: 614 | - uuid: 546880e65268446ba8d3b319f837b7eb 615 | name: 'XOA Boolean' 616 | mappings: 617 | - value: '1' 618 | newvalue: 'true' 619 | - value: '0' 620 | newvalue: 'false' 621 | - uuid: 5f69e71a0ed1418da4daf08e4dc22b7c 622 | template: 'Xen Orchestra by HTTP' 623 | name: 'Xen Orchestra by HTTP' 624 | groups: 625 | - name: Templates 626 | discovery_rules: 627 | - uuid: 4f543445aeb1465ebb10fe09d895c661 628 | name: 'Discovery Backups VM' 629 | type: SCRIPT 630 | key: xoa.backup.discovery 631 | delay: 1h 632 | params: | 633 | try { 634 | var params = JSON.parse(value); 635 | var req = new HttpRequest(); 636 | if (params.proxy != "CHANGE_IF_NEEDED") { 637 | req.setProxy(params.proxy) 638 | } 639 | req.addHeader('Cookie: authenticationToken=' + params.token); 640 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 641 | var response = req.get(encodeURI(server_url + '/rest/v0/backup/jobs/vm')); 642 | } catch (error) { 643 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/backup/jobs/vm Error: " + error); 644 | if (!Number.isInteger(error)) { 645 | return 520; 646 | } 647 | } 648 | var retVal = [] 649 | for (r = 0; r < JSON.parse(response).length; r++) { 650 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 651 | backupInfo = JSON.parse(resp); 652 | retVal.push({ 'url': JSON.parse(response)[r], 'uuid': backupInfo.id, 'name': backupInfo.name }); 653 | } 654 | return JSON.stringify(retVal); 655 | filter: 656 | conditions: 657 | - macro: '{#BACKUP.NAME}' 658 | value: '{$XOA.BACKUP.NOT_MATCHES}' 659 | operator: NOT_MATCHES_REGEX 660 | formulaid: A 661 | lifetime: 1d 662 | item_prototypes: 663 | - uuid: b9baccd3b3f24ae9bb58387dfc164b05 664 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup duration' 665 | type: CALCULATED 666 | key: 'xoa.backup.vm.duration[{#BACKUP.UUID}]' 667 | delay: 15m 668 | units: uptime 669 | params: '(last(//xoa.backup.vm.end[{#BACKUP.UUID}])-last(//xoa.backup.vm.start[{#BACKUP.UUID}]))' 670 | preprocessing: 671 | - type: DISCARD_UNCHANGED_HEARTBEAT 672 | parameters: 673 | - 1h 674 | tags: 675 | - tag: component 676 | value: backup 677 | - tag: target 678 | value: vm 679 | - uuid: d65c320702cc4d1cac28aa7c8597c1bf 680 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup end' 681 | type: DEPENDENT 682 | key: 'xoa.backup.vm.end[{#BACKUP.UUID}]' 683 | delay: '0' 684 | value_type: FLOAT 685 | units: unixtime 686 | preprocessing: 687 | - type: JSONPATH 688 | parameters: 689 | - $.end 690 | - type: JAVASCRIPT 691 | parameters: 692 | - 'return parseInt(value)' 693 | - type: MULTIPLIER 694 | parameters: 695 | - '0.001' 696 | master_item: 697 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 698 | tags: 699 | - tag: component 700 | value: backup 701 | - tag: target 702 | value: vm 703 | - uuid: 4ca54def98724bbbaa6d4e101c5a7aa4 704 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Name' 705 | type: DEPENDENT 706 | key: 'xoa.backup.vm.name[{#BACKUP.UUID}]' 707 | delay: '0' 708 | value_type: TEXT 709 | trends: '0' 710 | preprocessing: 711 | - type: JSONPATH 712 | parameters: 713 | - $.name 714 | master_item: 715 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 716 | tags: 717 | - tag: component 718 | value: backup 719 | - tag: target 720 | value: vm 721 | - uuid: b16275be3b5741d9b199b3965856c86f 722 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Get job status' 723 | type: SCRIPT 724 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 725 | delay: 15m 726 | history: '0' 727 | value_type: TEXT 728 | trends: '0' 729 | params: | 730 | try { 731 | var params = JSON.parse(value); 732 | var req = new HttpRequest(); 733 | req.addHeader("Cookie: authenticationToken=" + params.token); 734 | var server_url = params.url.endsWith("/") ? params.url.slice(0, -1) : params.url; 735 | var response = req.get(encodeURI(server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid)); 736 | if (!response) { 737 | Zabbix.log(3, "XenOrchestra API Error: Empty response for URL " + server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid); 738 | return 501; 739 | } 740 | var backupLogUrls = JSON.parse(response); 741 | if (backupLogUrls.length === 0) { 742 | Zabbix.log(3, "XenOrchestra API Error: No backup logs found for job Id " + params.uuid); 743 | return 502; 744 | } 745 | } catch (error) { 746 | Zabbix.log(3, "XenOrchestra API Error: " + error); 747 | return 503; 748 | } 749 | 750 | try { 751 | var logUrl = backupLogUrls[backupLogUrls.length - 1]; 752 | var resp = req.get(encodeURI(server_url + logUrl)); 753 | if (!resp) { 754 | Zabbix.log(3, "XenOrchestra API Error: Empty response for log URL " + logUrl); 755 | return 504; 756 | } 757 | var backupLog = JSON.parse(resp); 758 | backupLog.url = logUrl; 759 | if (backupLog.jobId === params.uuid) { 760 | return JSON.stringify({ 761 | "url": backupLog.url, 762 | "params": params.uuid, 763 | "id": backupLog.id, 764 | "name": backupLog.jobName, 765 | "status": backupLog.status, 766 | "start": backupLog.start, 767 | "end": backupLog.end 768 | }); 769 | } 770 | return 505; 771 | } catch (error) { 772 | Zabbix.log(3, "XenOrchestra API Error: " + error); 773 | return 506; 774 | } 775 | timeout: 60s 776 | parameters: 777 | - name: proxy 778 | value: '{$XOA.PROXY.URL}' 779 | - name: token 780 | value: '{$XOA.AUTH.TOKEN}' 781 | - name: url 782 | value: '{$XOA.URL}' 783 | - name: uuid 784 | value: '{#BACKUP.UUID}' 785 | tags: 786 | - tag: component 787 | value: raw 788 | - tag: target 789 | value: vm 790 | - uuid: 1e36a34c950f4afbac07f89fb1d0cc17 791 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup start' 792 | type: DEPENDENT 793 | key: 'xoa.backup.vm.start[{#BACKUP.UUID}]' 794 | delay: '0' 795 | units: unixtime 796 | preprocessing: 797 | - type: JSONPATH 798 | parameters: 799 | - $.start 800 | - type: JAVASCRIPT 801 | parameters: 802 | - 'return parseInt(value)' 803 | - type: MULTIPLIER 804 | parameters: 805 | - '0.001' 806 | master_item: 807 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 808 | tags: 809 | - tag: component 810 | value: backup 811 | - tag: target 812 | value: vm 813 | - uuid: 880ff365a84c4b0e8cbb807655e0b70f 814 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Status' 815 | type: DEPENDENT 816 | key: 'xoa.backup.vm.status[{#BACKUP.UUID}]' 817 | delay: '0' 818 | value_type: TEXT 819 | trends: '0' 820 | preprocessing: 821 | - type: JSONPATH 822 | parameters: 823 | - $.status 824 | - type: DISCARD_UNCHANGED_HEARTBEAT 825 | parameters: 826 | - 1h 827 | master_item: 828 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 829 | tags: 830 | - tag: component 831 | value: backup 832 | - tag: target 833 | value: vm 834 | trigger_prototypes: 835 | - uuid: b7a1d34be70b45688df8d48d018d06eb 836 | expression: 'last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failed" or last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failure"' 837 | name: 'VM Backup {#BACKUP.NAME} has bad status' 838 | priority: AVERAGE 839 | tags: 840 | - tag: scope 841 | value: vm 842 | parameters: 843 | - name: proxy 844 | value: '{$XOA.PROXY.URL}' 845 | - name: token 846 | value: '{$XOA.AUTH.TOKEN}' 847 | - name: url 848 | value: '{$XOA.URL}' 849 | lld_macro_paths: 850 | - lld_macro: '{#BACKUP.NAME}' 851 | path: $.name 852 | - lld_macro: '{#BACKUP.URL}' 853 | path: $.url 854 | - lld_macro: '{#BACKUP.UUID}' 855 | path: $.uuid 856 | - uuid: 0f0abc26d9884936ad59800f1e2778a0 857 | name: 'Discovery Hosts' 858 | type: SCRIPT 859 | key: xoa.hosts.discovery 860 | delay: 1h 861 | params: | 862 | try { 863 | var params = JSON.parse(value); 864 | var req = new HttpRequest(); 865 | if (params.proxy != "CHANGE_IF_NEEDED") { 866 | req.setProxy(params.proxy) 867 | } 868 | req.addHeader('Cookie: authenticationToken=' + params.token); 869 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 870 | var response = req.get(encodeURI(server_url + '/rest/v0/hosts')); 871 | } catch (error) { 872 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 873 | if (!Number.isInteger(error)) { 874 | return 520; 875 | } 876 | } 877 | var retVal = [] 878 | for (r = 0; r < JSON.parse(response).length; r++) { 879 | try { 880 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 881 | hostInfo = JSON.parse(resp); 882 | retVal.push({ "url": JSON.parse(response)[r], "uuid": hostInfo.uuid, 'name': hostInfo.name_label }); 883 | } catch (error) { 884 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 885 | if (!Number.isInteger(error)) { 886 | return 520; 887 | } 888 | } 889 | } 890 | return JSON.stringify(retVal); 891 | lifetime: 1d 892 | host_prototypes: 893 | - uuid: 49e0b0dee6964027907b68867bd0bada 894 | host: '{#HOSTS.UUID}' 895 | name: 'HV-{#HOSTS.NAME}' 896 | group_links: 897 | - group: 898 | name: Hypervisors 899 | templates: 900 | - name: 'XCP-NG Host via Xen Orchestra' 901 | macros: 902 | - macro: '{$XOA.HOST.NAME}' 903 | value: '{#HOSTS.NAME}' 904 | - macro: '{$XOA.HOST.PATH}' 905 | value: '{#HOSTS.URL}' 906 | - macro: '{$XOA.HOST.UUID}' 907 | value: '{#HOSTS.UUID}' 908 | tags: 909 | - tag: component 910 | value: Hypervisors 911 | - tag: target 912 | value: XCP-NG 913 | parameters: 914 | - name: proxy 915 | value: '{$XOA.PROXY.URL}' 916 | - name: token 917 | value: '{$XOA.AUTH.TOKEN}' 918 | - name: url 919 | value: '{$XOA.URL}' 920 | lld_macro_paths: 921 | - lld_macro: '{#HOSTS.NAME}' 922 | path: $.name 923 | - lld_macro: '{#HOSTS.URL}' 924 | path: $.url 925 | - lld_macro: '{#HOSTS.UUID}' 926 | path: $.uuid 927 | - uuid: ba152d09c30a48fda5e2385615ebe76d 928 | name: 'Discovery Pools' 929 | type: SCRIPT 930 | key: xoa.pool.discovery 931 | delay: 1h 932 | params: | 933 | try { 934 | var params = JSON.parse(value); 935 | var req = new HttpRequest(); 936 | if (params.proxy != "CHANGE_IF_NEEDED") { 937 | req.setProxy(params.proxy) 938 | } 939 | req.addHeader('Cookie: authenticationToken=' + params.token); 940 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 941 | var response = req.get(encodeURI(server_url + '/rest/v0/pools')); 942 | } catch (error) { 943 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 944 | if (!Number.isInteger(error)) { 945 | return 520; 946 | } 947 | } 948 | var retVal = [] 949 | for (r = 0; r < JSON.parse(response).length; r++) { 950 | try { 951 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 952 | poolInfo = JSON.parse(resp); 953 | retVal.push({ "url": JSON.parse(response)[r], "uuid": poolInfo.uuid, 'name': poolInfo.name_label }); 954 | } catch (error) { 955 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 956 | if (!Number.isInteger(error)) { 957 | return 520; 958 | } 959 | } 960 | } 961 | return JSON.stringify(retVal); 962 | lifetime: 1d 963 | item_prototypes: 964 | - uuid: 7f4a8af6115b4128afb280c678bc4db9 965 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Cores' 966 | type: DEPENDENT 967 | key: 'xoa.pool.cpu.cores[{#POOL.URL}]' 968 | delay: '0' 969 | preprocessing: 970 | - type: JSONPATH 971 | parameters: 972 | - $.cpus.cores 973 | master_item: 974 | key: 'xoa.pool[{#POOL.URL}]' 975 | tags: 976 | - tag: component 977 | value: pool 978 | - tag: pool 979 | value: '{#POOL.NAME}' 980 | - uuid: f6d83eef5fd9449d97ac649bb0f6e40e 981 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Sockets' 982 | type: DEPENDENT 983 | key: 'xoa.pool.cpu.sockets[{#POOL.URL}]' 984 | delay: '0' 985 | preprocessing: 986 | - type: JSONPATH 987 | parameters: 988 | - $.cpus.sockets 989 | master_item: 990 | key: 'xoa.pool[{#POOL.URL}]' 991 | tags: 992 | - tag: component 993 | value: pool 994 | - tag: pool 995 | value: '{#POOL.NAME}' 996 | - uuid: 46a2c37e887a44af831a95b2962ee8c4 997 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Description' 998 | type: DEPENDENT 999 | key: 'xoa.pool.description[{#POOL.URL}]' 1000 | delay: '0' 1001 | value_type: CHAR 1002 | trends: '0' 1003 | preprocessing: 1004 | - type: JSONPATH 1005 | parameters: 1006 | - $.name_description 1007 | - type: DISCARD_UNCHANGED_HEARTBEAT 1008 | parameters: 1009 | - 12h 1010 | master_item: 1011 | key: 'xoa.pool[{#POOL.URL}]' 1012 | tags: 1013 | - tag: component 1014 | value: pool 1015 | - tag: pool 1016 | value: '{#POOL.NAME}' 1017 | - uuid: 64981b8e1f7f49e7a4941ab0866df905 1018 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): HA enabled' 1019 | type: DEPENDENT 1020 | key: 'xoa.pool.ha.enabled[{#POOL.URL}]' 1021 | delay: '0' 1022 | value_type: CHAR 1023 | trends: '0' 1024 | preprocessing: 1025 | - type: JSONPATH 1026 | parameters: 1027 | - $.HA_enabled 1028 | master_item: 1029 | key: 'xoa.pool[{#POOL.URL}]' 1030 | tags: 1031 | - tag: component 1032 | value: pool 1033 | - tag: pool 1034 | value: '{#POOL.NAME}' 1035 | - uuid: bb14638e591940389e2ee1b437fa428f 1036 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Name' 1037 | type: DEPENDENT 1038 | key: 'xoa.pool.name[{#POOL.URL}]' 1039 | delay: '0' 1040 | value_type: CHAR 1041 | trends: '0' 1042 | preprocessing: 1043 | - type: JSONPATH 1044 | parameters: 1045 | - $.name_label 1046 | - type: DISCARD_UNCHANGED_HEARTBEAT 1047 | parameters: 1048 | - 6h 1049 | master_item: 1050 | key: 'xoa.pool[{#POOL.URL}]' 1051 | tags: 1052 | - tag: component 1053 | value: pool 1054 | - tag: pool 1055 | value: '{#POOL.NAME}' 1056 | - uuid: d119af9ee0794efa9c5a93ef01301a1a 1057 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Get Values' 1058 | type: HTTP_AGENT 1059 | key: 'xoa.pool[{#POOL.URL}]' 1060 | delay: 15m 1061 | history: '0' 1062 | value_type: TEXT 1063 | trends: '0' 1064 | url: '{$XOA.URL}{#POOL.URL}' 1065 | headers: 1066 | - name: Cookie 1067 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1068 | - name: Accept 1069 | value: application/json 1070 | tags: 1071 | - tag: component 1072 | value: raw 1073 | parameters: 1074 | - name: proxy 1075 | value: '{$XOA.PROXY.URL}' 1076 | - name: token 1077 | value: '{$XOA.AUTH.TOKEN}' 1078 | - name: url 1079 | value: '{$XOA.URL}' 1080 | lld_macro_paths: 1081 | - lld_macro: '{#POOL.NAME}' 1082 | path: $.name 1083 | - lld_macro: '{#POOL.URL}' 1084 | path: $.url 1085 | - lld_macro: '{#POOL.UUID}' 1086 | path: $.uuid 1087 | - uuid: 59ad3f67fa2644be8f8a63ceb7dd1039 1088 | name: 'Discovery SRs' 1089 | type: SCRIPT 1090 | key: xoa.sr.discovery 1091 | delay: 1h 1092 | params: | 1093 | try { 1094 | var params = JSON.parse(value); 1095 | var req = new HttpRequest(); 1096 | if (params.proxy != "CHANGE_IF_NEEDED") { 1097 | req.setProxy(params.proxy) 1098 | } 1099 | req.addHeader('Cookie: authenticationToken=' + params.token); 1100 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1101 | var response = req.get(encodeURI(server_url + '/rest/v0/srs')); 1102 | } catch (error) { 1103 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1104 | if (!Number.isInteger(error)) { 1105 | return 520; 1106 | } 1107 | } 1108 | var retVal = [] 1109 | for (r = 0; r < JSON.parse(response).length; r++) { 1110 | try { 1111 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1112 | srInfo = JSON.parse(resp); 1113 | retVal.push({ "url": JSON.parse(response)[r], "uuid": srInfo.uuid, 'name': srInfo.name_label }); 1114 | } catch (error) { 1115 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1116 | if (!Number.isInteger(error)) { 1117 | return 520; 1118 | } 1119 | } 1120 | } 1121 | return JSON.stringify(retVal); 1122 | filter: 1123 | conditions: 1124 | - macro: '{#SR.NAME}' 1125 | value: '{$XEN.SR.IGNORE}' 1126 | operator: NOT_MATCHES_REGEX 1127 | formulaid: A 1128 | lifetime: 1d 1129 | item_prototypes: 1130 | - uuid: 2c7ddde760c7485fbfd5afd06c0ca9f6 1131 | name: 'SR {#SR.NAME} ({#SR.UUID}): In maintenance mode' 1132 | type: DEPENDENT 1133 | key: 'xoa.sr.maintenance[{#SR.URL}]' 1134 | delay: '0' 1135 | value_type: CHAR 1136 | trends: '0' 1137 | preprocessing: 1138 | - type: JSONPATH 1139 | parameters: 1140 | - $.inMaintenanceMode 1141 | master_item: 1142 | key: 'xoa.sr.raw[{#SR.URL}]' 1143 | tags: 1144 | - tag: component 1145 | value: storage 1146 | - tag: repository 1147 | value: '{#SR.NAME}' 1148 | - uuid: ac01c8b01494403797fbdf84657ecbc1 1149 | name: 'SR {#SR.NAME} ({#SR.UUID}): Name' 1150 | type: DEPENDENT 1151 | key: 'xoa.sr.name[{#SR.URL}]' 1152 | delay: '0' 1153 | value_type: CHAR 1154 | trends: '0' 1155 | preprocessing: 1156 | - type: JSONPATH 1157 | parameters: 1158 | - $.name_label 1159 | - type: DISCARD_UNCHANGED_HEARTBEAT 1160 | parameters: 1161 | - 12h 1162 | master_item: 1163 | key: 'xoa.sr.raw[{#SR.URL}]' 1164 | tags: 1165 | - tag: component 1166 | value: storage 1167 | - tag: repository 1168 | value: '{#SR.NAME}' 1169 | - uuid: a9c8007dfb15454da2ec7d3b2ef78c36 1170 | name: 'SR {#SR.NAME} ({#SR.UUID}): Get Values' 1171 | type: HTTP_AGENT 1172 | key: 'xoa.sr.raw[{#SR.URL}]' 1173 | delay: 5m 1174 | history: '0' 1175 | value_type: TEXT 1176 | trends: '0' 1177 | url: '{$XOA.URL}{#SR.URL}' 1178 | headers: 1179 | - name: Cookie 1180 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1181 | - name: Accept 1182 | value: application/json 1183 | tags: 1184 | - tag: component 1185 | value: raw 1186 | - uuid: c3d42712ef4c4941b5d6dcf301abd4f5 1187 | name: 'SR {#SR.NAME} ({#SR.UUID}): Size' 1188 | type: DEPENDENT 1189 | key: 'xoa.sr.size[{#SR.URL}]' 1190 | delay: '0' 1191 | units: B 1192 | preprocessing: 1193 | - type: JSONPATH 1194 | parameters: 1195 | - $.size 1196 | master_item: 1197 | key: 'xoa.sr.raw[{#SR.URL}]' 1198 | tags: 1199 | - tag: component 1200 | value: storage 1201 | - tag: repository 1202 | value: '{#SR.NAME}' 1203 | - uuid: 5c9753ddfd4040a4b2f09bee5b218f37 1204 | name: 'SR {#SR.NAME} ({#SR.UUID}) Content Type' 1205 | type: DEPENDENT 1206 | key: 'xoa.sr.type.content[{#SR.URL}]' 1207 | delay: '0' 1208 | value_type: CHAR 1209 | trends: '0' 1210 | preprocessing: 1211 | - type: JSONPATH 1212 | parameters: 1213 | - $.content_type 1214 | - type: DISCARD_UNCHANGED_HEARTBEAT 1215 | parameters: 1216 | - 6h 1217 | master_item: 1218 | key: 'xoa.sr.raw[{#SR.URL}]' 1219 | tags: 1220 | - tag: component 1221 | value: storage 1222 | - tag: repository 1223 | value: '{#SR.NAME}' 1224 | - uuid: 09c0b4829e674fbaa3b80ce030f311f3 1225 | name: 'SR {#SR.NAME} ({#SR.UUID}): Type' 1226 | type: DEPENDENT 1227 | key: 'xoa.sr.type[{#SR.URL}]' 1228 | delay: '0' 1229 | value_type: CHAR 1230 | trends: '0' 1231 | preprocessing: 1232 | - type: JSONPATH 1233 | parameters: 1234 | - $.SR_type 1235 | - type: DISCARD_UNCHANGED_HEARTBEAT 1236 | parameters: 1237 | - 6h 1238 | master_item: 1239 | key: 'xoa.sr.raw[{#SR.URL}]' 1240 | tags: 1241 | - tag: component 1242 | value: storage 1243 | - tag: repository 1244 | value: '{#SR.NAME}' 1245 | - uuid: 3f678af9e8fc4c0dbfab055155749c2c 1246 | name: 'SR {#SR.NAME} ({#SR.UUID}): Used percentage' 1247 | type: CALCULATED 1248 | key: 'xoa.sr.used.percentage[{#SR.URL}]' 1249 | delay: 5m 1250 | value_type: FLOAT 1251 | units: '%' 1252 | params: 'last(//xoa.sr.used.physical[{#SR.URL}])/last(//xoa.sr.size[{#SR.URL}])*100' 1253 | tags: 1254 | - tag: component 1255 | value: storage 1256 | - tag: repository 1257 | value: '{#SR.NAME}' 1258 | trigger_prototypes: 1259 | - uuid: fb16b143e0ef45ea91eb423f2530cdd0 1260 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1261 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1262 | priority: HIGH 1263 | tags: 1264 | - tag: scope 1265 | value: storage 1266 | - uuid: 087dcb24233f4f3c8a88bc7d01abe3a4 1267 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.WARN}' 1268 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is low' 1269 | priority: WARNING 1270 | dependencies: 1271 | - name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1272 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1273 | tags: 1274 | - tag: scope 1275 | value: storage 1276 | - uuid: 57b22801aba547bfa90a3304a59f53dc 1277 | name: 'SR {#SR.NAME} ({#SR.UUID}): Physical Usage' 1278 | type: DEPENDENT 1279 | key: 'xoa.sr.used.physical[{#SR.URL}]' 1280 | delay: '0' 1281 | units: B 1282 | preprocessing: 1283 | - type: JSONPATH 1284 | parameters: 1285 | - $.physical_usage 1286 | master_item: 1287 | key: 'xoa.sr.raw[{#SR.URL}]' 1288 | tags: 1289 | - tag: component 1290 | value: storage 1291 | - tag: repository 1292 | value: '{#SR.NAME}' 1293 | parameters: 1294 | - name: proxy 1295 | value: '{$XOA.PROXY.URL}' 1296 | - name: token 1297 | value: '{$XOA.AUTH.TOKEN}' 1298 | - name: url 1299 | value: '{$XOA.URL}' 1300 | lld_macro_paths: 1301 | - lld_macro: '{#SR.NAME}' 1302 | path: $.name 1303 | - lld_macro: '{#SR.URL}' 1304 | path: $.url 1305 | - lld_macro: '{#SR.UUID}' 1306 | path: $.uuid 1307 | - uuid: 5485ca1d330d4dffa4a03579729428e6 1308 | name: 'Discovery VMs' 1309 | type: SCRIPT 1310 | key: xoa.vms.discovery 1311 | delay: 1h 1312 | params: | 1313 | try { 1314 | var params = JSON.parse(value); 1315 | var req = new HttpRequest(); 1316 | if (params.proxy != "CHANGE_IF_NEEDED") { 1317 | req.setProxy(params.proxy) 1318 | } 1319 | req.addHeader('Cookie: authenticationToken=' + params.token); 1320 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1321 | var response = req.get(encodeURI(server_url + '/rest/v0/vms')); 1322 | } catch (error) { 1323 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1324 | if (!Number.isInteger(error)) { 1325 | return 520; 1326 | } 1327 | } 1328 | var retVal = [] 1329 | for (r = 0; r < JSON.parse(response).length; r++) { 1330 | try { 1331 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1332 | vmsInfo = JSON.parse(resp); 1333 | retVal.push({ "url": JSON.parse(response)[r], "uuid": vmsInfo.uuid, 'name': vmsInfo.name_label }); 1334 | } catch (error) { 1335 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1336 | if (!Number.isInteger(error)) { 1337 | return 520; 1338 | } 1339 | } 1340 | } 1341 | return JSON.stringify(retVal); 1342 | filter: 1343 | conditions: 1344 | - macro: '{#VMS.NAME}' 1345 | value: '{$XOA.VM.IGNORE}' 1346 | operator: NOT_MATCHES_REGEX 1347 | formulaid: A 1348 | lifetime: 1d 1349 | host_prototypes: 1350 | - uuid: 78bf8b747c7547f2990fcf9f4bac56ae 1351 | host: '{#VMS.UUID}' 1352 | name: 'VM-{#VMS.NAME}' 1353 | group_links: 1354 | - group: 1355 | name: 'Virtual machines' 1356 | templates: 1357 | - name: 'XCP-NG VM via Xen Orchestra' 1358 | macros: 1359 | - macro: '{$XOA.VM.NAME}' 1360 | value: '{#VMS.NAME}' 1361 | - macro: '{$XOA.VM.PATH}' 1362 | value: '{#VMS.URL}' 1363 | - macro: '{$XOA.VM.UUID}' 1364 | value: '{#VMS.UUID}' 1365 | tags: 1366 | - tag: component 1367 | value: hypervisor 1368 | - tag: target 1369 | value: guest 1370 | parameters: 1371 | - name: proxy 1372 | value: '{$XOA.PROXY.URL}' 1373 | - name: token 1374 | value: '{$XOA.AUTH.TOKEN}' 1375 | - name: url 1376 | value: '{$XOA.URL}' 1377 | lld_macro_paths: 1378 | - lld_macro: '{#VMS.NAME}' 1379 | path: $.name 1380 | - lld_macro: '{#VMS.URL}' 1381 | path: $.url 1382 | - lld_macro: '{#VMS.UUID}' 1383 | path: $.uuid 1384 | httptests: 1385 | - uuid: 1458d489beef4863be6f18f36ac41a24 1386 | name: 'Check Token Validity' 1387 | delay: 5m 1388 | attempts: '3' 1389 | headers: 1390 | - name: Cookie 1391 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1392 | - name: Accept 1393 | value: application/json 1394 | steps: 1395 | - name: 'Check Token Validity' 1396 | url: '{$XOA.URL}/rest/v0' 1397 | follow_redirects: 'NO' 1398 | status_codes: '200' 1399 | tags: 1400 | - tag: component 1401 | value: hypervisor 1402 | - tag: target 1403 | value: xen 1404 | macros: 1405 | - macro: '{$XEN.SR.IGNORE}' 1406 | value: '^(DVD drives|XCP-ng Tools|Removable storage)$' 1407 | description: 'Do not discover following SRs' 1408 | - macro: '{$XOA.VM.IGNORE}' 1409 | value: '.*\[Importing.*' 1410 | description: 'Do not discover VMs containing Strings included in this regexp' 1411 | - macro: '{$XOA.AUTH.TOKEN}' 1412 | value: CHANGE_IF_NEEDED 1413 | description: 'Authentication Token generated on XOA UI' 1414 | - macro: '{$XOA.BACKUP.NOT_MATCHES}' 1415 | value: CHANGE_IF_NEEDED 1416 | description: 'Ignore Backups with Names that match RegEx' 1417 | - macro: '{$XOA.PROXY.URL}' 1418 | value: CHANGE_IF_NEEDED 1419 | description: 'URL for a Proxy if used to reach XOA' 1420 | - macro: '{$XOA.SR.THRESHOLD.CRIT}' 1421 | value: '95' 1422 | description: 'Critical threshold for SR usage' 1423 | - macro: '{$XOA.SR.THRESHOLD.WARN}' 1424 | value: '75' 1425 | description: 'Warn threshold for SR usage' 1426 | - macro: '{$XOA.URL}' 1427 | value: CHANGE 1428 | description: 'URL where XOA can be reached' 1429 | valuemaps: 1430 | - uuid: 0ec95555cba645f796a21bdece34349c 1431 | name: 'XOA Boolean' 1432 | mappings: 1433 | - value: '1' 1434 | newvalue: 'true' 1435 | - value: '0' 1436 | newvalue: 'false' 1437 | triggers: 1438 | - uuid: 728078ed899548faa3736110abb9d69e 1439 | expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=401' 1440 | recovery_mode: RECOVERY_EXPRESSION 1441 | recovery_expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=200' 1442 | name: 'Authentication Token for XenOrchestra is invalid' 1443 | priority: HIGH 1444 | -------------------------------------------------------------------------------- /7.2/template_app_xenorchestra.yaml: -------------------------------------------------------------------------------- 1 | zabbix_export: 2 | version: '7.2' 3 | template_groups: 4 | - uuid: 7df96b18c230490a9a0a9e2307226338 5 | name: Templates 6 | host_groups: 7 | - uuid: 1b837a3c078647049a0c00c61b4d57b5 8 | name: Hypervisors 9 | - uuid: 137f19e6e2dc4219b33553b812627bc2 10 | name: 'Virtual machines' 11 | templates: 12 | - uuid: 8d4ad92902e6440ca14dfa5256d8bf82 13 | template: 'XCP-NG Host via Xen Orchestra' 14 | name: 'XCP-NG Host via Xen Orchestra' 15 | groups: 16 | - name: Templates 17 | items: 18 | - uuid: d137a2d23e554eb7b98d1de0ce26dfb6 19 | name: 'CPU Cores' 20 | type: DEPENDENT 21 | key: xoa.host.cpu.cores 22 | history: 90d 23 | preprocessing: 24 | - type: JSONPATH 25 | parameters: 26 | - $.CPUs.cpu_count 27 | master_item: 28 | key: xoa.host.raw 29 | - uuid: 0a1e66d4f0a4455abcfd9317c4c973b1 30 | name: 'CPU Sockets' 31 | type: DEPENDENT 32 | key: xoa.host.cpu.sockets 33 | history: 90d 34 | preprocessing: 35 | - type: JSONPATH 36 | parameters: 37 | - $.CPUs.socket_count 38 | master_item: 39 | key: xoa.host.raw 40 | - uuid: 702c08f7b6d94be49fbfaef45b1b4174 41 | name: 'Host description' 42 | type: DEPENDENT 43 | key: xoa.host.description 44 | history: 90d 45 | value_type: CHAR 46 | preprocessing: 47 | - type: JSONPATH 48 | parameters: 49 | - $.name_description 50 | - type: DISCARD_UNCHANGED_HEARTBEAT 51 | parameters: 52 | - 12h 53 | master_item: 54 | key: xoa.host.raw 55 | - uuid: a6343812baea4750b24def6a3ef71f70 56 | name: Enabled 57 | type: DEPENDENT 58 | key: xoa.host.enabled 59 | history: 90d 60 | value_type: CHAR 61 | preprocessing: 62 | - type: JSONPATH 63 | parameters: 64 | - $.enabled 65 | master_item: 66 | key: xoa.host.raw 67 | - uuid: 604ae2b2e6b943c387edd492eddc8beb 68 | name: 'Hypervisor brand' 69 | type: DEPENDENT 70 | key: xoa.host.hv.brand 71 | history: 90d 72 | value_type: CHAR 73 | preprocessing: 74 | - type: JSONPATH 75 | parameters: 76 | - $.productBrand 77 | - type: DISCARD_UNCHANGED_HEARTBEAT 78 | parameters: 79 | - 12h 80 | master_item: 81 | key: xoa.host.raw 82 | - uuid: 494f4ddea1cf40398641295be217878a 83 | name: 'Hypervisor version' 84 | type: DEPENDENT 85 | key: xoa.host.hv.version 86 | history: 90d 87 | value_type: CHAR 88 | preprocessing: 89 | - type: JSONPATH 90 | parameters: 91 | - $.version 92 | - type: DISCARD_UNCHANGED_HEARTBEAT 93 | parameters: 94 | - 12h 95 | master_item: 96 | key: xoa.host.raw 97 | - uuid: c1c9cee844f34ff289b32559493af04f 98 | name: 'Hypervisor version build' 99 | type: DEPENDENT 100 | key: xoa.host.hv.version.build 101 | history: 90d 102 | value_type: CHAR 103 | preprocessing: 104 | - type: JSONPATH 105 | parameters: 106 | - $.build 107 | - type: DISCARD_UNCHANGED_HEARTBEAT 108 | parameters: 109 | - 12h 110 | master_item: 111 | key: xoa.host.raw 112 | - uuid: ecf042cea23e45e89954fe6fc499be86 113 | name: 'HVM capable' 114 | type: DEPENDENT 115 | key: xoa.host.hvm.capable 116 | history: 90d 117 | value_type: CHAR 118 | preprocessing: 119 | - type: JSONPATH 120 | parameters: 121 | - $.hvmCapable 122 | - type: DISCARD_UNCHANGED_HEARTBEAT 123 | parameters: 124 | - 1h 125 | master_item: 126 | key: xoa.host.raw 127 | - uuid: 4026336d2d97475e9019522c73535574 128 | name: 'Memory total' 129 | type: DEPENDENT 130 | key: xoa.host.memory.total 131 | history: 90d 132 | units: B 133 | preprocessing: 134 | - type: JSONPATH 135 | parameters: 136 | - $.memory.size 137 | master_item: 138 | key: xoa.host.raw 139 | - uuid: 6181620d670c4e3cbeaad0babe89fc1b 140 | name: 'Memory used' 141 | type: DEPENDENT 142 | key: xoa.host.memory.used 143 | history: 90d 144 | units: B 145 | preprocessing: 146 | - type: JSONPATH 147 | parameters: 148 | - $.memory.usage 149 | master_item: 150 | key: xoa.host.raw 151 | - uuid: ed5fe0b877ed469ebc0d4e4b32ff8a87 152 | name: 'Memory used percent' 153 | type: CALCULATED 154 | key: xoa.host.memory.used.percent 155 | delay: 5m 156 | history: 90d 157 | value_type: FLOAT 158 | units: '%' 159 | params: 'last(//xoa.host.memory.used)/last(//xoa.host.memory.total)*100' 160 | triggers: 161 | - uuid: 29677931a1b944038a687c8c28c4d015 162 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 163 | name: 'Memory usage critical high' 164 | priority: HIGH 165 | - uuid: 9de3ff6c29d945a7b8ca5a2bb0a78493 166 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.WARN}' 167 | name: 'Memory usage exceeds {$XOA.MEMORY.WARN}' 168 | priority: WARNING 169 | dependencies: 170 | - name: 'Memory usage critical high' 171 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.memory.used.percent)>{$XOA.MEMORY.CRIT}' 172 | - uuid: 81a949d8376b43b0b620de6bcbe3d525 173 | name: 'XCP-NG Hosts: Get Missing Patches' 174 | type: HTTP_AGENT 175 | key: xoa.host.missingpatches.raw 176 | delay: 15m 177 | history: '0' 178 | value_type: TEXT 179 | timeout: 3s 180 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}/missing_patches' 181 | headers: 182 | - name: Cookie 183 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 184 | - name: Accept 185 | value: application/json 186 | - uuid: 3725dfaac75643fcb3cfe0b852a26f70 187 | name: Hostname 188 | type: DEPENDENT 189 | key: xoa.host.name 190 | history: 90d 191 | value_type: CHAR 192 | preprocessing: 193 | - type: JSONPATH 194 | parameters: 195 | - $.name_label 196 | - type: DISCARD_UNCHANGED_HEARTBEAT 197 | parameters: 198 | - 12h 199 | master_item: 200 | key: xoa.host.raw 201 | - uuid: 5b2435e1c5dd49c7be4b7cc1dc31e64d 202 | name: 'Power State' 203 | type: DEPENDENT 204 | key: xoa.host.power.state 205 | history: 90d 206 | value_type: CHAR 207 | preprocessing: 208 | - type: JSONPATH 209 | parameters: 210 | - $.power_state 211 | master_item: 212 | key: xoa.host.raw 213 | triggers: 214 | - uuid: 484c668a58c54317a61a405b52cc43ec 215 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state)<>last(/XCP-NG Host via Xen Orchestra/xoa.host.power.state,#2)' 216 | recovery_mode: NONE 217 | name: 'Power state changed' 218 | priority: INFO 219 | manual_close: 'YES' 220 | - uuid: 11c547b55c424e26bb02d87266980a6f 221 | name: 'XCP-NG Hosts: Get Values' 222 | type: HTTP_AGENT 223 | key: xoa.host.raw 224 | delay: 5m 225 | history: '0' 226 | value_type: TEXT 227 | timeout: 3s 228 | url: '{$XOA.URL}/rest/v0/hosts/{$XOA.HOST.UUID}' 229 | headers: 230 | - name: Cookie 231 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 232 | - name: Accept 233 | value: application/json 234 | - uuid: ee2ab8db1e0f4d1f88df5fe6892eaf73 235 | name: 'Reboot required' 236 | type: DEPENDENT 237 | key: xoa.host.reboot.required 238 | history: 90d 239 | value_type: CHAR 240 | preprocessing: 241 | - type: JSONPATH 242 | parameters: 243 | - $.rebootRequired 244 | master_item: 245 | key: xoa.host.raw 246 | triggers: 247 | - uuid: 06a3b195183a49d9ac6f37afa802e5a9 248 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.host.reboot.required)="true"' 249 | name: 'Reboot required for hosts' 250 | priority: WARNING 251 | - uuid: 077fd836ae1c420792fcf368fa43e8a3 252 | name: 'Number of running VMs' 253 | type: DEPENDENT 254 | key: xoa.host.runningvms 255 | history: 90d 256 | preprocessing: 257 | - type: JSONPATH 258 | parameters: 259 | - $.residentVms 260 | - type: JAVASCRIPT 261 | parameters: 262 | - 'return JSON.parse(value).length' 263 | master_item: 264 | key: xoa.host.raw 265 | - uuid: 745f6fb406c34e3b8ec313a54b2c85cc 266 | name: 'Host start time' 267 | type: DEPENDENT 268 | key: xoa.host.starttime 269 | history: 90d 270 | units: unixtime 271 | preprocessing: 272 | - type: JSONPATH 273 | parameters: 274 | - $.startTime 275 | - type: STR_REPLACE 276 | parameters: 277 | - 'null' 278 | - '0' 279 | - type: DISCARD_UNCHANGED_HEARTBEAT 280 | parameters: 281 | - 1h 282 | master_item: 283 | key: xoa.host.raw 284 | - uuid: dab4f3b69f5141048e914d87ed23dd69 285 | name: 'Number of Missing Patches' 286 | type: DEPENDENT 287 | key: xoa.hosts.missingpatches.count 288 | history: 90d 289 | preprocessing: 290 | - type: JAVASCRIPT 291 | parameters: 292 | - 'return JSON.parse(value).length' 293 | master_item: 294 | key: xoa.host.missingpatches.raw 295 | triggers: 296 | - uuid: b4f671bc3ab8442c87147db31e815ffe 297 | expression: 'last(/XCP-NG Host via Xen Orchestra/xoa.hosts.missingpatches.count)>{$XOA.HOST.MISSING.PATCHES.MAX}' 298 | name: 'Number of {$XOA.HOST.MISSING.PATCHES.MAX} missing patches exceeded' 299 | priority: WARNING 300 | tags: 301 | - tag: component 302 | value: hypervisor 303 | - tag: target 304 | value: xcp-ng 305 | macros: 306 | - macro: '{$XOA.AUTH.TOKEN}' 307 | value: CHANGE_IF_NEEDED 308 | description: 'Authentication Token generated on XOA UI' 309 | - macro: '{$XOA.HOST.MISSING.PATCHES.MAX}' 310 | value: '1' 311 | description: 'Maximum Number of missing patches allowed' 312 | - macro: '{$XOA.HOST.UUID}' 313 | value: CHANGE_IF_NEEDED 314 | description: 'Host UUID' 315 | - macro: '{$XOA.MEMORY.CRIT}' 316 | value: '90' 317 | description: 'Critical memory usage' 318 | - macro: '{$XOA.MEMORY.WARN}' 319 | value: '75' 320 | description: 'Warn when memory usage is above' 321 | - macro: '{$XOA.URL}' 322 | value: CHANGE_IF_NEEDED 323 | description: 'URL where XOA can be reached' 324 | valuemaps: 325 | - uuid: 7de0ad540b0f4fd5ab2b33ef9f79d440 326 | name: 'XOA Boolean' 327 | mappings: 328 | - value: '1' 329 | newvalue: 'true' 330 | - value: '0' 331 | newvalue: 'false' 332 | - uuid: b1aa3ddc4db246c3a5e71658dd5a9601 333 | template: 'XCP-NG VM via Xen Orchestra' 334 | name: 'XCP-NG VM via Xen Orchestra' 335 | groups: 336 | - name: Templates 337 | items: 338 | - uuid: 6a01a4edf2364313a72939d2dfb7789c 339 | name: 'vCPU active' 340 | type: DEPENDENT 341 | key: xoa.vm.cpu.active 342 | history: 90d 343 | preprocessing: 344 | - type: JSONPATH 345 | parameters: 346 | - $.CPUs.number 347 | master_item: 348 | key: xoa.vms.raw 349 | - uuid: 2149aaf9d7904bf4b28f4aaa943f120e 350 | name: 'vCPU max' 351 | type: DEPENDENT 352 | key: xoa.vm.cpu.max 353 | history: 90d 354 | preprocessing: 355 | - type: JSONPATH 356 | parameters: 357 | - $.CPUs.max 358 | master_item: 359 | key: xoa.vms.raw 360 | - uuid: 2bd0262b02754c49bf1388e392bff454 361 | name: 'VM description' 362 | type: DEPENDENT 363 | key: xoa.vm.description 364 | history: 90d 365 | value_type: CHAR 366 | preprocessing: 367 | - type: JSONPATH 368 | parameters: 369 | - $.name_description 370 | - type: DISCARD_UNCHANGED_HEARTBEAT 371 | parameters: 372 | - 1d 373 | master_item: 374 | key: xoa.vms.raw 375 | - uuid: 011d9425a4bc4b4cb3cba08d878c0f83 376 | name: 'Xen PV driver version' 377 | type: DEPENDENT 378 | key: xoa.vm.driver.version 379 | history: 90d 380 | value_type: CHAR 381 | preprocessing: 382 | - type: JSONPATH 383 | parameters: 384 | - $.pvDriversVersion 385 | - type: DISCARD_UNCHANGED_HEARTBEAT 386 | parameters: 387 | - 1h 388 | master_item: 389 | key: xoa.vms.raw 390 | - uuid: 86a3094485084862a3a2d4d1bd9333b2 391 | name: 'VM install time' 392 | type: DEPENDENT 393 | key: xoa.vm.installtime 394 | history: 90d 395 | units: unixtime 396 | preprocessing: 397 | - type: JSONPATH 398 | parameters: 399 | - $.installTime 400 | - type: DISCARD_UNCHANGED_HEARTBEAT 401 | parameters: 402 | - 1d 403 | master_item: 404 | key: xoa.vms.raw 405 | - uuid: 37d6d0b60c654490b5d360b194538f15 406 | name: 'Management agent detected' 407 | type: DEPENDENT 408 | key: xoa.vm.management.agent 409 | history: 90d 410 | value_type: CHAR 411 | preprocessing: 412 | - type: JSONPATH 413 | parameters: 414 | - $.managementAgentDetected 415 | master_item: 416 | key: xoa.vms.raw 417 | triggers: 418 | - uuid: 90dd8a29cfc3457aabb35ce8527683d4 419 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.management.agent)="false"' 420 | name: 'No management agent install on VM' 421 | priority: INFO 422 | manual_close: 'YES' 423 | - uuid: e72db9c5c0474d099be380a577aafd23 424 | name: 'Memory total' 425 | type: DEPENDENT 426 | key: xoa.vm.memory.total 427 | history: 90d 428 | units: B 429 | preprocessing: 430 | - type: JSONPATH 431 | parameters: 432 | - $.memory.size 433 | master_item: 434 | key: xoa.vms.raw 435 | - uuid: c319917b771c46afbf2fdacf217216d1 436 | name: 'Virtualization mode' 437 | type: DEPENDENT 438 | key: xoa.vm.mode 439 | history: 90d 440 | value_type: CHAR 441 | preprocessing: 442 | - type: JSONPATH 443 | parameters: 444 | - $.virtualizationMode 445 | - type: DISCARD_UNCHANGED_HEARTBEAT 446 | parameters: 447 | - 1d 448 | master_item: 449 | key: xoa.vms.raw 450 | - uuid: e5f39794e08c4aeb9b2f96abf5dc58dc 451 | name: 'VM name' 452 | type: DEPENDENT 453 | key: xoa.vm.name 454 | history: 90d 455 | value_type: CHAR 456 | preprocessing: 457 | - type: JSONPATH 458 | parameters: 459 | - $.name_label 460 | - type: DISCARD_UNCHANGED_HEARTBEAT 461 | parameters: 462 | - 24h 463 | master_item: 464 | key: xoa.vms.raw 465 | - uuid: 5397b9f0460742899d91a127b52f2020 466 | name: 'OS Distribution' 467 | type: DEPENDENT 468 | key: xoa.vm.os.distro 469 | history: 90d 470 | value_type: CHAR 471 | preprocessing: 472 | - type: JSONPATH 473 | parameters: 474 | - $.os_version.distro 475 | - type: DISCARD_UNCHANGED_HEARTBEAT 476 | parameters: 477 | - 1d 478 | master_item: 479 | key: xoa.vms.raw 480 | - uuid: 4126bf9d15464ecea0f7a0d0fe8fd8b8 481 | name: 'OS version' 482 | type: DEPENDENT 483 | key: xoa.vm.os.version 484 | history: 90d 485 | value_type: CHAR 486 | preprocessing: 487 | - type: JSONPATH 488 | parameters: 489 | - $.os_version.name 490 | - type: DISCARD_UNCHANGED_HEARTBEAT 491 | parameters: 492 | - 1d 493 | master_item: 494 | key: xoa.vms.raw 495 | - uuid: 2415c2f666e64438ae682c0855c2831b 496 | name: 'Power State' 497 | type: DEPENDENT 498 | key: xoa.vm.power.state 499 | history: 90d 500 | value_type: CHAR 501 | preprocessing: 502 | - type: JSONPATH 503 | parameters: 504 | - $.power_state 505 | master_item: 506 | key: xoa.vms.raw 507 | triggers: 508 | - uuid: 4f938791d96b4898860edf870a1bc72e 509 | expression: 'last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state)<>last(/XCP-NG VM via Xen Orchestra/xoa.vm.power.state,#2)' 510 | recovery_mode: NONE 511 | name: 'State of VM changed' 512 | priority: AVERAGE 513 | manual_close: 'YES' 514 | - uuid: d3da95b5b2c64e5e82c893e9fbd82743 515 | name: 'Number of snapshots' 516 | type: DEPENDENT 517 | key: xoa.vm.snapshot 518 | history: 90d 519 | preprocessing: 520 | - type: JSONPATH 521 | parameters: 522 | - $.snapshots 523 | - type: JAVASCRIPT 524 | parameters: 525 | - 'return JSON.parse(value).length' 526 | master_item: 527 | key: xoa.vms.raw 528 | triggers: 529 | - uuid: 353d88c34edc4ea3957a4ecc12e6db7b 530 | expression: 'min(/XCP-NG VM via Xen Orchestra/xoa.vm.snapshot,3600)>{$XOA.VM.NO.SNAPSHOTS.MAX}' 531 | name: 'Number of Snapshots exceeds {$XOA.VM.NO.SNAPSHOTS.MAX} for more than 1 hour' 532 | priority: WARNING 533 | - uuid: 889bc4bcaf0744f7ac14c36f45139cc8 534 | name: 'VM start time' 535 | type: DEPENDENT 536 | key: xoa.vm.starttime 537 | history: 90d 538 | units: unixtime 539 | preprocessing: 540 | - type: JSONPATH 541 | parameters: 542 | - $.startTime 543 | - type: DISCARD_UNCHANGED_HEARTBEAT 544 | parameters: 545 | - 1h 546 | master_item: 547 | key: xoa.vms.raw 548 | - uuid: cb8d4b3b8a0442c2aa48853c6ab45af3 549 | name: 'Xen Tool Version' 550 | type: DEPENDENT 551 | key: xoa.vm.tools.version 552 | history: 90d 553 | value_type: CHAR 554 | preprocessing: 555 | - type: JSONPATH 556 | parameters: 557 | - $.xenTools.version 558 | - type: DISCARD_UNCHANGED_HEARTBEAT 559 | parameters: 560 | - 1h 561 | master_item: 562 | key: xoa.vms.raw 563 | - uuid: 27f086c8cf754b789daf6868cf394172 564 | name: 'XCP-NG VMS: Get Values' 565 | type: HTTP_AGENT 566 | key: xoa.vms.raw 567 | delay: 5m 568 | history: '0' 569 | value_type: TEXT 570 | timeout: 3s 571 | url: '{$XOA.URL}/rest/v0/vms/{$XOA.VM.UUID}' 572 | headers: 573 | - name: Cookie 574 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 575 | - name: Accept 576 | value: application/json 577 | tags: 578 | - tag: component 579 | value: hypervisor 580 | - tag: target 581 | value: guests 582 | macros: 583 | - macro: '{$XOA.AUTH.TOKEN}' 584 | value: CHANGE_IF_NEEDED 585 | description: 'Authentication Token generated on XOA UI' 586 | - macro: '{$XOA.HOST.UUID}' 587 | value: CHANGE_IF_NEEDED 588 | description: 'Host UUID' 589 | - macro: '{$XOA.URL}' 590 | value: CHANGE_IF_NEEDED 591 | description: 'URL where XOA can be reached' 592 | - macro: '{$XOA.VM.NO.SNAPSHOTS.MAX}' 593 | value: '1' 594 | description: 'Max number of snapshots allowed' 595 | - macro: '{$XOA.VM.UUID}' 596 | valuemaps: 597 | - uuid: 546880e65268446ba8d3b319f837b7eb 598 | name: 'XOA Boolean' 599 | mappings: 600 | - value: '1' 601 | newvalue: 'true' 602 | - value: '0' 603 | newvalue: 'false' 604 | - uuid: 5f69e71a0ed1418da4daf08e4dc22b7c 605 | template: 'Xen Orchestra by HTTP' 606 | name: 'Xen Orchestra by HTTP' 607 | groups: 608 | - name: Templates 609 | discovery_rules: 610 | - uuid: 4f543445aeb1465ebb10fe09d895c661 611 | name: 'Discovery Backups VM' 612 | type: SCRIPT 613 | key: xoa.backup.discovery 614 | delay: 1h 615 | params: | 616 | try { 617 | var params = JSON.parse(value); 618 | var req = new HttpRequest(); 619 | if (params.proxy != "CHANGE_IF_NEEDED") { 620 | req.setProxy(params.proxy) 621 | } 622 | req.addHeader('Cookie: authenticationToken=' + params.token); 623 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 624 | var response = req.get(encodeURI(server_url + '/rest/v0/backup/jobs/vm')); 625 | } catch (error) { 626 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/backup/jobs/vm Error: " + error); 627 | if (!Number.isInteger(error)) { 628 | return 520; 629 | } 630 | } 631 | var retVal = [] 632 | for (r = 0; r < JSON.parse(response).length; r++) { 633 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 634 | backupInfo = JSON.parse(resp); 635 | retVal.push({ 'url': JSON.parse(response)[r], 'uuid': backupInfo.id, 'name': backupInfo.name }); 636 | } 637 | return JSON.stringify(retVal); 638 | filter: 639 | conditions: 640 | - macro: '{#BACKUP.NAME}' 641 | value: '{$XOA.BACKUP.NOT_MATCHES}' 642 | operator: NOT_MATCHES_REGEX 643 | lifetime: 1d 644 | enabled_lifetime_type: DISABLE_NEVER 645 | item_prototypes: 646 | - uuid: b9baccd3b3f24ae9bb58387dfc164b05 647 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup duration' 648 | type: CALCULATED 649 | key: 'xoa.backup.vm.duration[{#BACKUP.UUID}]' 650 | delay: 15m 651 | history: 90d 652 | units: uptime 653 | params: '(last(//xoa.backup.vm.end[{#BACKUP.UUID}])-last(//xoa.backup.vm.start[{#BACKUP.UUID}]))' 654 | preprocessing: 655 | - type: DISCARD_UNCHANGED_HEARTBEAT 656 | parameters: 657 | - 1h 658 | tags: 659 | - tag: component 660 | value: backup 661 | - tag: target 662 | value: vm 663 | - uuid: d65c320702cc4d1cac28aa7c8597c1bf 664 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup end' 665 | type: DEPENDENT 666 | key: 'xoa.backup.vm.end[{#BACKUP.UUID}]' 667 | history: 90d 668 | value_type: FLOAT 669 | units: unixtime 670 | preprocessing: 671 | - type: JSONPATH 672 | parameters: 673 | - $.end 674 | - type: JAVASCRIPT 675 | parameters: 676 | - 'return parseInt(value)' 677 | - type: MULTIPLIER 678 | parameters: 679 | - '0.001' 680 | master_item: 681 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 682 | tags: 683 | - tag: component 684 | value: backup 685 | - tag: target 686 | value: vm 687 | - uuid: 4ca54def98724bbbaa6d4e101c5a7aa4 688 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Name' 689 | type: DEPENDENT 690 | key: 'xoa.backup.vm.name[{#BACKUP.UUID}]' 691 | history: 90d 692 | value_type: TEXT 693 | preprocessing: 694 | - type: JSONPATH 695 | parameters: 696 | - $.name 697 | master_item: 698 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 699 | tags: 700 | - tag: component 701 | value: backup 702 | - tag: target 703 | value: vm 704 | - uuid: b16275be3b5741d9b199b3965856c86f 705 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Get job status' 706 | type: SCRIPT 707 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 708 | delay: 15m 709 | history: '0' 710 | value_type: TEXT 711 | params: | 712 | try { 713 | var params = JSON.parse(value); 714 | var req = new HttpRequest(); 715 | req.addHeader("Cookie: authenticationToken=" + params.token); 716 | var server_url = params.url.endsWith("/") ? params.url.slice(0, -1) : params.url; 717 | var response = req.get(encodeURI(server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid)); 718 | if (!response) { 719 | Zabbix.log(3, "XenOrchestra API Error: Empty response for URL " + server_url + "/rest/v0/backup/logs?filter=jobId:" + params.uuid); 720 | return 501; 721 | } 722 | var backupLogUrls = JSON.parse(response); 723 | if (backupLogUrls.length === 0) { 724 | Zabbix.log(3, "XenOrchestra API Error: No backup logs found for job Id " + params.uuid); 725 | return 502; 726 | } 727 | } catch (error) { 728 | Zabbix.log(3, "XenOrchestra API Error: " + error); 729 | return 503; 730 | } 731 | 732 | try { 733 | var logUrl = backupLogUrls[backupLogUrls.length - 1]; 734 | var resp = req.get(encodeURI(server_url + logUrl)); 735 | if (!resp) { 736 | Zabbix.log(3, "XenOrchestra API Error: Empty response for log URL " + logUrl); 737 | return 504; 738 | } 739 | var backupLog = JSON.parse(resp); 740 | backupLog.url = logUrl; 741 | if (backupLog.jobId === params.uuid) { 742 | return JSON.stringify({ 743 | "url": backupLog.url, 744 | "params": params.uuid, 745 | "id": backupLog.id, 746 | "name": backupLog.jobName, 747 | "status": backupLog.status, 748 | "start": backupLog.start, 749 | "end": backupLog.end 750 | }); 751 | } 752 | return 505; 753 | } catch (error) { 754 | Zabbix.log(3, "XenOrchestra API Error: " + error); 755 | return 506; 756 | } 757 | timeout: 120s 758 | parameters: 759 | - name: proxy 760 | value: '{$XOA.PROXY.URL}' 761 | - name: token 762 | value: '{$XOA.AUTH.TOKEN}' 763 | - name: url 764 | value: '{$XOA.URL}' 765 | - name: uuid 766 | value: '{#BACKUP.UUID}' 767 | tags: 768 | - tag: component 769 | value: raw 770 | - tag: target 771 | value: vm 772 | - uuid: 1e36a34c950f4afbac07f89fb1d0cc17 773 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup start' 774 | type: DEPENDENT 775 | key: 'xoa.backup.vm.start[{#BACKUP.UUID}]' 776 | history: 90d 777 | units: unixtime 778 | preprocessing: 779 | - type: JSONPATH 780 | parameters: 781 | - $.start 782 | - type: JAVASCRIPT 783 | parameters: 784 | - 'return parseInt(value)' 785 | - type: MULTIPLIER 786 | parameters: 787 | - '0.001' 788 | master_item: 789 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 790 | tags: 791 | - tag: component 792 | value: backup 793 | - tag: target 794 | value: vm 795 | - uuid: 880ff365a84c4b0e8cbb807655e0b70f 796 | name: 'VM Backup {#BACKUP.NAME} ({#BACKUP.UUID}): Backup Status' 797 | type: DEPENDENT 798 | key: 'xoa.backup.vm.status[{#BACKUP.UUID}]' 799 | history: 90d 800 | value_type: TEXT 801 | preprocessing: 802 | - type: JSONPATH 803 | parameters: 804 | - $.status 805 | - type: DISCARD_UNCHANGED_HEARTBEAT 806 | parameters: 807 | - 1h 808 | master_item: 809 | key: 'xoa.backup.vm.raw[{#BACKUP.UUID}]' 810 | tags: 811 | - tag: component 812 | value: backup 813 | - tag: target 814 | value: vm 815 | trigger_prototypes: 816 | - uuid: b7a1d34be70b45688df8d48d018d06eb 817 | expression: 'last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failed" or last(/Xen Orchestra by HTTP/xoa.backup.vm.status[{#BACKUP.UUID}])="failure"' 818 | name: 'VM Backup {#BACKUP.NAME} has bad status' 819 | priority: AVERAGE 820 | tags: 821 | - tag: scope 822 | value: vm 823 | timeout: 3s 824 | parameters: 825 | - name: proxy 826 | value: '{$XOA.PROXY.URL}' 827 | - name: token 828 | value: '{$XOA.AUTH.TOKEN}' 829 | - name: url 830 | value: '{$XOA.URL}' 831 | lld_macro_paths: 832 | - lld_macro: '{#BACKUP.NAME}' 833 | path: $.name 834 | - lld_macro: '{#BACKUP.URL}' 835 | path: $.url 836 | - lld_macro: '{#BACKUP.UUID}' 837 | path: $.uuid 838 | - uuid: 0f0abc26d9884936ad59800f1e2778a0 839 | name: 'Discovery Hosts' 840 | type: SCRIPT 841 | key: xoa.hosts.discovery 842 | delay: 1h 843 | params: | 844 | try { 845 | var params = JSON.parse(value); 846 | var req = new HttpRequest(); 847 | if (params.proxy != "CHANGE_IF_NEEDED") { 848 | req.setProxy(params.proxy) 849 | } 850 | req.addHeader('Cookie: authenticationToken=' + params.token); 851 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 852 | var response = req.get(encodeURI(server_url + '/rest/v0/hosts')); 853 | } catch (error) { 854 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 855 | if (!Number.isInteger(error)) { 856 | return 520; 857 | } 858 | } 859 | var retVal = [] 860 | for (r = 0; r < JSON.parse(response).length; r++) { 861 | try { 862 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 863 | hostInfo = JSON.parse(resp); 864 | retVal.push({ "url": JSON.parse(response)[r], "uuid": hostInfo.uuid, 'name': hostInfo.name_label }); 865 | } catch (error) { 866 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/hosts Error: " + error); 867 | if (!Number.isInteger(error)) { 868 | return 520; 869 | } 870 | } 871 | } 872 | return JSON.stringify(retVal); 873 | lifetime: 1d 874 | enabled_lifetime_type: DISABLE_NEVER 875 | host_prototypes: 876 | - uuid: 49e0b0dee6964027907b68867bd0bada 877 | host: '{#HOSTS.UUID}' 878 | name: 'HV-{#HOSTS.NAME}' 879 | group_links: 880 | - group: 881 | name: Hypervisors 882 | templates: 883 | - name: 'XCP-NG Host via Xen Orchestra' 884 | macros: 885 | - macro: '{$XOA.HOST.NAME}' 886 | value: '{#HOSTS.NAME}' 887 | - macro: '{$XOA.HOST.PATH}' 888 | value: '{#HOSTS.URL}' 889 | - macro: '{$XOA.HOST.UUID}' 890 | value: '{#HOSTS.UUID}' 891 | tags: 892 | - tag: component 893 | value: Hypervisors 894 | - tag: target 895 | value: XCP-NG 896 | timeout: 3s 897 | parameters: 898 | - name: proxy 899 | value: '{$XOA.PROXY.URL}' 900 | - name: token 901 | value: '{$XOA.AUTH.TOKEN}' 902 | - name: url 903 | value: '{$XOA.URL}' 904 | lld_macro_paths: 905 | - lld_macro: '{#HOSTS.NAME}' 906 | path: $.name 907 | - lld_macro: '{#HOSTS.URL}' 908 | path: $.url 909 | - lld_macro: '{#HOSTS.UUID}' 910 | path: $.uuid 911 | - uuid: ba152d09c30a48fda5e2385615ebe76d 912 | name: 'Discovery Pools' 913 | type: SCRIPT 914 | key: xoa.pool.discovery 915 | delay: 1h 916 | params: | 917 | try { 918 | var params = JSON.parse(value); 919 | var req = new HttpRequest(); 920 | if (params.proxy != "CHANGE_IF_NEEDED") { 921 | req.setProxy(params.proxy) 922 | } 923 | req.addHeader('Cookie: authenticationToken=' + params.token); 924 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 925 | var response = req.get(encodeURI(server_url + '/rest/v0/pools')); 926 | } catch (error) { 927 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 928 | if (!Number.isInteger(error)) { 929 | return 520; 930 | } 931 | } 932 | var retVal = [] 933 | for (r = 0; r < JSON.parse(response).length; r++) { 934 | try { 935 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 936 | poolInfo = JSON.parse(resp); 937 | retVal.push({ "url": JSON.parse(response)[r], "uuid": poolInfo.uuid, 'name': poolInfo.name_label }); 938 | } catch (error) { 939 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/pools Error: " + error); 940 | if (!Number.isInteger(error)) { 941 | return 520; 942 | } 943 | } 944 | } 945 | return JSON.stringify(retVal); 946 | lifetime: 1d 947 | enabled_lifetime_type: DISABLE_NEVER 948 | item_prototypes: 949 | - uuid: 7f4a8af6115b4128afb280c678bc4db9 950 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Cores' 951 | type: DEPENDENT 952 | key: 'xoa.pool.cpu.cores[{#POOL.URL}]' 953 | history: 90d 954 | preprocessing: 955 | - type: JSONPATH 956 | parameters: 957 | - $.cpus.cores 958 | master_item: 959 | key: 'xoa.pool[{#POOL.URL}]' 960 | tags: 961 | - tag: component 962 | value: pool 963 | - tag: pool 964 | value: '{#POOL.NAME}' 965 | - uuid: f6d83eef5fd9449d97ac649bb0f6e40e 966 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): CPU Sockets' 967 | type: DEPENDENT 968 | key: 'xoa.pool.cpu.sockets[{#POOL.URL}]' 969 | history: 90d 970 | preprocessing: 971 | - type: JSONPATH 972 | parameters: 973 | - $.cpus.sockets 974 | master_item: 975 | key: 'xoa.pool[{#POOL.URL}]' 976 | tags: 977 | - tag: component 978 | value: pool 979 | - tag: pool 980 | value: '{#POOL.NAME}' 981 | - uuid: 46a2c37e887a44af831a95b2962ee8c4 982 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Description' 983 | type: DEPENDENT 984 | key: 'xoa.pool.description[{#POOL.URL}]' 985 | history: 90d 986 | value_type: CHAR 987 | preprocessing: 988 | - type: JSONPATH 989 | parameters: 990 | - $.name_description 991 | - type: DISCARD_UNCHANGED_HEARTBEAT 992 | parameters: 993 | - 12h 994 | master_item: 995 | key: 'xoa.pool[{#POOL.URL}]' 996 | tags: 997 | - tag: component 998 | value: pool 999 | - tag: pool 1000 | value: '{#POOL.NAME}' 1001 | - uuid: 64981b8e1f7f49e7a4941ab0866df905 1002 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): HA enabled' 1003 | type: DEPENDENT 1004 | key: 'xoa.pool.ha.enabled[{#POOL.URL}]' 1005 | history: 90d 1006 | value_type: CHAR 1007 | preprocessing: 1008 | - type: JSONPATH 1009 | parameters: 1010 | - $.HA_enabled 1011 | master_item: 1012 | key: 'xoa.pool[{#POOL.URL}]' 1013 | tags: 1014 | - tag: component 1015 | value: pool 1016 | - tag: pool 1017 | value: '{#POOL.NAME}' 1018 | - uuid: bb14638e591940389e2ee1b437fa428f 1019 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Name' 1020 | type: DEPENDENT 1021 | key: 'xoa.pool.name[{#POOL.URL}]' 1022 | history: 90d 1023 | value_type: CHAR 1024 | preprocessing: 1025 | - type: JSONPATH 1026 | parameters: 1027 | - $.name_label 1028 | - type: DISCARD_UNCHANGED_HEARTBEAT 1029 | parameters: 1030 | - 6h 1031 | master_item: 1032 | key: 'xoa.pool[{#POOL.URL}]' 1033 | tags: 1034 | - tag: component 1035 | value: pool 1036 | - tag: pool 1037 | value: '{#POOL.NAME}' 1038 | - uuid: d119af9ee0794efa9c5a93ef01301a1a 1039 | name: 'Pool {#POOL.NAME} ({#POOL.UUID}): Get Values' 1040 | type: HTTP_AGENT 1041 | key: 'xoa.pool[{#POOL.URL}]' 1042 | delay: 15m 1043 | history: '0' 1044 | value_type: TEXT 1045 | timeout: 3s 1046 | url: '{$XOA.URL}{#POOL.URL}' 1047 | headers: 1048 | - name: Cookie 1049 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1050 | - name: Accept 1051 | value: application/json 1052 | tags: 1053 | - tag: component 1054 | value: raw 1055 | timeout: 3s 1056 | parameters: 1057 | - name: proxy 1058 | value: '{$XOA.PROXY.URL}' 1059 | - name: token 1060 | value: '{$XOA.AUTH.TOKEN}' 1061 | - name: url 1062 | value: '{$XOA.URL}' 1063 | lld_macro_paths: 1064 | - lld_macro: '{#POOL.NAME}' 1065 | path: $.name 1066 | - lld_macro: '{#POOL.URL}' 1067 | path: $.url 1068 | - lld_macro: '{#POOL.UUID}' 1069 | path: $.uuid 1070 | - uuid: 59ad3f67fa2644be8f8a63ceb7dd1039 1071 | name: 'Discovery SRs' 1072 | type: SCRIPT 1073 | key: xoa.sr.discovery 1074 | delay: 1h 1075 | params: | 1076 | try { 1077 | var params = JSON.parse(value); 1078 | var req = new HttpRequest(); 1079 | if (params.proxy != "CHANGE_IF_NEEDED") { 1080 | req.setProxy(params.proxy) 1081 | } 1082 | req.addHeader('Cookie: authenticationToken=' + params.token); 1083 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1084 | var response = req.get(encodeURI(server_url + '/rest/v0/srs')); 1085 | } catch (error) { 1086 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1087 | if (!Number.isInteger(error)) { 1088 | return 520; 1089 | } 1090 | } 1091 | var retVal = [] 1092 | for (r = 0; r < JSON.parse(response).length; r++) { 1093 | try { 1094 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1095 | srInfo = JSON.parse(resp); 1096 | retVal.push({ "url": JSON.parse(response)[r], "uuid": srInfo.uuid, 'name': srInfo.name_label }); 1097 | } catch (error) { 1098 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/srs Error: " + error); 1099 | if (!Number.isInteger(error)) { 1100 | return 520; 1101 | } 1102 | } 1103 | } 1104 | return JSON.stringify(retVal); 1105 | filter: 1106 | conditions: 1107 | - macro: '{#SR.NAME}' 1108 | value: '{$XEN.SR.IGNORE}' 1109 | operator: NOT_MATCHES_REGEX 1110 | lifetime: 1d 1111 | enabled_lifetime_type: DISABLE_NEVER 1112 | item_prototypes: 1113 | - uuid: 2c7ddde760c7485fbfd5afd06c0ca9f6 1114 | name: 'SR {#SR.NAME} ({#SR.UUID}): In maintenance mode' 1115 | type: DEPENDENT 1116 | key: 'xoa.sr.maintenance[{#SR.URL}]' 1117 | history: 90d 1118 | value_type: CHAR 1119 | preprocessing: 1120 | - type: JSONPATH 1121 | parameters: 1122 | - $.inMaintenanceMode 1123 | master_item: 1124 | key: 'xoa.sr.raw[{#SR.URL}]' 1125 | tags: 1126 | - tag: component 1127 | value: storage 1128 | - tag: repository 1129 | value: '{#SR.NAME}' 1130 | - uuid: ac01c8b01494403797fbdf84657ecbc1 1131 | name: 'SR {#SR.NAME} ({#SR.UUID}): Name' 1132 | type: DEPENDENT 1133 | key: 'xoa.sr.name[{#SR.URL}]' 1134 | history: 90d 1135 | value_type: CHAR 1136 | preprocessing: 1137 | - type: JSONPATH 1138 | parameters: 1139 | - $.name_label 1140 | - type: DISCARD_UNCHANGED_HEARTBEAT 1141 | parameters: 1142 | - 12h 1143 | master_item: 1144 | key: 'xoa.sr.raw[{#SR.URL}]' 1145 | tags: 1146 | - tag: component 1147 | value: storage 1148 | - tag: repository 1149 | value: '{#SR.NAME}' 1150 | - uuid: a9c8007dfb15454da2ec7d3b2ef78c36 1151 | name: 'SR {#SR.NAME} ({#SR.UUID}): Get Values' 1152 | type: HTTP_AGENT 1153 | key: 'xoa.sr.raw[{#SR.URL}]' 1154 | delay: 5m 1155 | history: '0' 1156 | value_type: TEXT 1157 | timeout: 3s 1158 | url: '{$XOA.URL}{#SR.URL}' 1159 | headers: 1160 | - name: Cookie 1161 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1162 | - name: Accept 1163 | value: application/json 1164 | tags: 1165 | - tag: component 1166 | value: raw 1167 | - uuid: c3d42712ef4c4941b5d6dcf301abd4f5 1168 | name: 'SR {#SR.NAME} ({#SR.UUID}): Size' 1169 | type: DEPENDENT 1170 | key: 'xoa.sr.size[{#SR.URL}]' 1171 | history: 90d 1172 | units: B 1173 | preprocessing: 1174 | - type: JSONPATH 1175 | parameters: 1176 | - $.size 1177 | master_item: 1178 | key: 'xoa.sr.raw[{#SR.URL}]' 1179 | tags: 1180 | - tag: component 1181 | value: storage 1182 | - tag: repository 1183 | value: '{#SR.NAME}' 1184 | - uuid: 5c9753ddfd4040a4b2f09bee5b218f37 1185 | name: 'SR {#SR.NAME} ({#SR.UUID}) Content Type' 1186 | type: DEPENDENT 1187 | key: 'xoa.sr.type.content[{#SR.URL}]' 1188 | history: 90d 1189 | value_type: CHAR 1190 | preprocessing: 1191 | - type: JSONPATH 1192 | parameters: 1193 | - $.content_type 1194 | - type: DISCARD_UNCHANGED_HEARTBEAT 1195 | parameters: 1196 | - 6h 1197 | master_item: 1198 | key: 'xoa.sr.raw[{#SR.URL}]' 1199 | tags: 1200 | - tag: component 1201 | value: storage 1202 | - tag: repository 1203 | value: '{#SR.NAME}' 1204 | - uuid: 09c0b4829e674fbaa3b80ce030f311f3 1205 | name: 'SR {#SR.NAME} ({#SR.UUID}): Type' 1206 | type: DEPENDENT 1207 | key: 'xoa.sr.type[{#SR.URL}]' 1208 | history: 90d 1209 | value_type: CHAR 1210 | preprocessing: 1211 | - type: JSONPATH 1212 | parameters: 1213 | - $.SR_type 1214 | - type: DISCARD_UNCHANGED_HEARTBEAT 1215 | parameters: 1216 | - 6h 1217 | master_item: 1218 | key: 'xoa.sr.raw[{#SR.URL}]' 1219 | tags: 1220 | - tag: component 1221 | value: storage 1222 | - tag: repository 1223 | value: '{#SR.NAME}' 1224 | - uuid: 3f678af9e8fc4c0dbfab055155749c2c 1225 | name: 'SR {#SR.NAME} ({#SR.UUID}): Used percentage' 1226 | type: CALCULATED 1227 | key: 'xoa.sr.used.percentage[{#SR.URL}]' 1228 | delay: 5m 1229 | history: 90d 1230 | value_type: FLOAT 1231 | units: '%' 1232 | params: 'last(//xoa.sr.used.physical[{#SR.URL}])/last(//xoa.sr.size[{#SR.URL}])*100' 1233 | tags: 1234 | - tag: component 1235 | value: storage 1236 | - tag: repository 1237 | value: '{#SR.NAME}' 1238 | trigger_prototypes: 1239 | - uuid: fb16b143e0ef45ea91eb423f2530cdd0 1240 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1241 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1242 | priority: HIGH 1243 | tags: 1244 | - tag: scope 1245 | value: storage 1246 | - uuid: 087dcb24233f4f3c8a88bc7d01abe3a4 1247 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.WARN}' 1248 | name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is low' 1249 | priority: WARNING 1250 | dependencies: 1251 | - name: 'Free space on SR {#SR.NAME} ({#SR.UUID}) is critical low' 1252 | expression: 'last(/Xen Orchestra by HTTP/xoa.sr.used.percentage[{#SR.URL}])>{$XOA.SR.THRESHOLD.CRIT}' 1253 | tags: 1254 | - tag: scope 1255 | value: storage 1256 | - uuid: 57b22801aba547bfa90a3304a59f53dc 1257 | name: 'SR {#SR.NAME} ({#SR.UUID}): Physical Usage' 1258 | type: DEPENDENT 1259 | key: 'xoa.sr.used.physical[{#SR.URL}]' 1260 | history: 90d 1261 | units: B 1262 | preprocessing: 1263 | - type: JSONPATH 1264 | parameters: 1265 | - $.physical_usage 1266 | master_item: 1267 | key: 'xoa.sr.raw[{#SR.URL}]' 1268 | tags: 1269 | - tag: component 1270 | value: storage 1271 | - tag: repository 1272 | value: '{#SR.NAME}' 1273 | timeout: 3s 1274 | parameters: 1275 | - name: proxy 1276 | value: '{$XOA.PROXY.URL}' 1277 | - name: token 1278 | value: '{$XOA.AUTH.TOKEN}' 1279 | - name: url 1280 | value: '{$XOA.URL}' 1281 | lld_macro_paths: 1282 | - lld_macro: '{#SR.NAME}' 1283 | path: $.name 1284 | - lld_macro: '{#SR.URL}' 1285 | path: $.url 1286 | - lld_macro: '{#SR.UUID}' 1287 | path: $.uuid 1288 | - uuid: 5485ca1d330d4dffa4a03579729428e6 1289 | name: 'Discovery VMs' 1290 | type: SCRIPT 1291 | key: xoa.vms.discovery 1292 | delay: 1h 1293 | params: | 1294 | try { 1295 | var params = JSON.parse(value); 1296 | var req = new HttpRequest(); 1297 | if (params.proxy != "CHANGE_IF_NEEDED") { 1298 | req.setProxy(params.proxy) 1299 | } 1300 | req.addHeader('Cookie: authenticationToken=' + params.token); 1301 | var server_url = params.url.endsWith('/') ? params.url.slice(0, -1) : params.url; 1302 | var response = req.get(encodeURI(server_url + '/rest/v0/vms')); 1303 | } catch (error) { 1304 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1305 | if (!Number.isInteger(error)) { 1306 | return 520; 1307 | } 1308 | } 1309 | var retVal = [] 1310 | for (r = 0; r < JSON.parse(response).length; r++) { 1311 | try { 1312 | resp = req.get(encodeURI(server_url + JSON.parse(response)[r])); 1313 | vmsInfo = JSON.parse(resp); 1314 | retVal.push({ "url": JSON.parse(response)[r], "uuid": vmsInfo.uuid, 'name': vmsInfo.name_label }); 1315 | } catch (error) { 1316 | Zabbix.log(3, "XenOrchestra API fails" + server_url + "/rest/v0/vms Error: " + error); 1317 | if (!Number.isInteger(error)) { 1318 | return 520; 1319 | } 1320 | } 1321 | } 1322 | return JSON.stringify(retVal); 1323 | filter: 1324 | conditions: 1325 | - macro: '{#VMS.NAME}' 1326 | value: '{$XOA.VM.IGNORE}' 1327 | operator: NOT_MATCHES_REGEX 1328 | formulaid: A 1329 | lifetime: 1d 1330 | enabled_lifetime_type: DISABLE_NEVER 1331 | host_prototypes: 1332 | - uuid: 78bf8b747c7547f2990fcf9f4bac56ae 1333 | host: '{#VMS.UUID}' 1334 | name: 'VM-{#VMS.NAME}' 1335 | group_links: 1336 | - group: 1337 | name: 'Virtual machines' 1338 | templates: 1339 | - name: 'XCP-NG VM via Xen Orchestra' 1340 | macros: 1341 | - macro: '{$XOA.VM.NAME}' 1342 | value: '{#VMS.NAME}' 1343 | - macro: '{$XOA.VM.PATH}' 1344 | value: '{#VMS.URL}' 1345 | - macro: '{$XOA.VM.UUID}' 1346 | value: '{#VMS.UUID}' 1347 | tags: 1348 | - tag: component 1349 | value: hypervisor 1350 | - tag: target 1351 | value: guest 1352 | timeout: 3s 1353 | parameters: 1354 | - name: proxy 1355 | value: '{$XOA.PROXY.URL}' 1356 | - name: token 1357 | value: '{$XOA.AUTH.TOKEN}' 1358 | - name: url 1359 | value: '{$XOA.URL}' 1360 | lld_macro_paths: 1361 | - lld_macro: '{#VMS.NAME}' 1362 | path: $.name 1363 | - lld_macro: '{#VMS.URL}' 1364 | path: $.url 1365 | - lld_macro: '{#VMS.UUID}' 1366 | path: $.uuid 1367 | httptests: 1368 | - uuid: 1458d489beef4863be6f18f36ac41a24 1369 | name: 'Check Token Validity' 1370 | delay: 5m 1371 | attempts: '3' 1372 | headers: 1373 | - name: Cookie 1374 | value: 'authenticationToken={$XOA.AUTH.TOKEN}' 1375 | - name: Accept 1376 | value: application/json 1377 | steps: 1378 | - name: 'Check Token Validity' 1379 | url: '{$XOA.URL}/rest/v0' 1380 | follow_redirects: 'NO' 1381 | status_codes: '200' 1382 | tags: 1383 | - tag: component 1384 | value: hypervisor 1385 | - tag: target 1386 | value: xen 1387 | macros: 1388 | - macro: '{$XEN.SR.IGNORE}' 1389 | value: '^(DVD drives|XCP-ng Tools|Removable storage)$' 1390 | description: 'Do not discover following SRs' 1391 | - macro: '{$XOA.VM.IGNORE}' 1392 | value: '.*\[Importing.*' 1393 | description: 'Do not discover VMs containing Strings included in this regexp' 1394 | - macro: '{$XOA.AUTH.TOKEN}' 1395 | value: ADD_TOKEN_HERE 1396 | description: 'Authentication Token generated on XOA UI' 1397 | - macro: '{$XOA.BACKUP.NOT_MATCHES}' 1398 | value: CHANGE_IF_NEEDED 1399 | description: 'Ignore Backups with Names that match RegEx' 1400 | - macro: '{$XOA.PROXY.URL}' 1401 | value: CHANGE_IF_NEEDED 1402 | description: 'URL for a Proxy if used to reach XOA' 1403 | - macro: '{$XOA.SR.THRESHOLD.CRIT}' 1404 | value: '95' 1405 | description: 'Critical threshold for SR usage' 1406 | - macro: '{$XOA.SR.THRESHOLD.WARN}' 1407 | value: '75' 1408 | description: 'Warn threshold for SR usage' 1409 | - macro: '{$XOA.URL}' 1410 | value: CHANGE 1411 | description: 'URL where XOA can be reached' 1412 | valuemaps: 1413 | - uuid: 0ec95555cba645f796a21bdece34349c 1414 | name: 'XOA Boolean' 1415 | mappings: 1416 | - value: '1' 1417 | newvalue: 'true' 1418 | - value: '0' 1419 | newvalue: 'false' 1420 | triggers: 1421 | - uuid: 728078ed899548faa3736110abb9d69e 1422 | expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=401' 1423 | recovery_mode: RECOVERY_EXPRESSION 1424 | recovery_expression: 'last(/Xen Orchestra by HTTP/web.test.rspcode[Check Token Validity,Check Token Validity])=200' 1425 | name: 'Authentication Token for XenOrchestra is invalid' 1426 | priority: HIGH 1427 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # XenOrchestra 3 | 4 | ## Overview 5 | 6 | This template is designed for the effortless deployment of both XenOrchestra and XCP-NG monitoring and doesn't require any external scripts. 7 | 8 | The "XCP-NG Host via Xen Orchestra" and "XCP-NG VM via Xen Orchestra" templates are used by discovery and normally should not be manually linked to a host. 9 | 10 | ## Requirements 11 | 12 | Zabbix version: 6.0 and higher. 13 | 14 | ## Tested versions 15 | 16 | This template has been tested on: 17 | - XenOrchestra 5 CE (from sources) 18 | - Zabbix 6.0 19 | - Zabbix 6.4 20 | - Zabbix 7.0 21 | - Zabbix 7.2 22 | 23 | ## Author 24 | 25 | Thorsten Liepert 26 | 27 | ## Setup 28 | 29 | 1. [Generate](https://docs.xcp-ng.org/management/manage-at-scale/xo-api/#authentication) an access token at XenOrchestra for a [user](https://xen-orchestra.com/docs/users.html) with read access. 30 | 2. Create a host for the XenOrchestra host and link template "Xen Orchestra by HTTP" 31 | 3. Configure macro "{$XOA.AUTH.TOKEN}" with generated access token 32 | 4. Configure macro "{$XOA.URL}" with url to XenOrchestra e.g. https://xen.mydomain.com 33 | 5. (optional) Configure macro "{$XOA.PROXY.URL}" to use a proxy. 34 | 35 | ### Macros used 36 | 37 | |Name|Description|Default| 38 | |----|-----------|-------| 39 | |{$XOA.AUTH.TOKEN}|
authentication token for XenOrchestra API
|| 40 | |{$XOA.URL}|URL to XenOrchestra (https://xen.mydomain.com)
|| 41 | |{$XOA.PROXY.URL}|Proxy URL if needed to reach {$XOA.URL}
|| 42 | |{$XOA.SR.THRESHOLD.CRIT}|Critical threshold for storage repository usage in percent
|| 43 | |{$XOA.SR.THRESHOLD.WARN}|Warning threshold for storage repository usage in percent
|| 44 | 45 | ## Feedback 46 | 47 | Please report any issues with the template at [`https://github.com/bufanda/zabbix--template-xenorchestra`](https://github.com/bufanda/zabbix--template-xenorchestra) 48 | -------------------------------------------------------------------------------- /screenshots/hosts_and_xoa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bufanda/zabbix--template-xenorchestra/6b0e7074b9e6db0ab6f15856a3ac31343b6cedc8/screenshots/hosts_and_xoa.png -------------------------------------------------------------------------------- /screenshots/pool_sr_latest_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bufanda/zabbix--template-xenorchestra/6b0e7074b9e6db0ab6f15856a3ac31343b6cedc8/screenshots/pool_sr_latest_data.png -------------------------------------------------------------------------------- /screenshots/problems_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bufanda/zabbix--template-xenorchestra/6b0e7074b9e6db0ab6f15856a3ac31343b6cedc8/screenshots/problems_view.png -------------------------------------------------------------------------------- /screenshots/vm_latest_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bufanda/zabbix--template-xenorchestra/6b0e7074b9e6db0ab6f15856a3ac31343b6cedc8/screenshots/vm_latest_data.png --------------------------------------------------------------------------------