|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<zabbix_export> |
| 3 | + <version>5.0</version> |
| 4 | + <date>2022-01-30T15:56:04Z</date> |
| 5 | + <groups> |
| 6 | + <group> |
| 7 | + <name>Templates</name> |
| 8 | + </group> |
| 9 | + </groups> |
| 10 | + <templates> |
| 11 | + <template> |
| 12 | + <template>Template Home Assistant API</template> |
| 13 | + <name>Template Home Assistant API</name> |
| 14 | + <groups> |
| 15 | + <group> |
| 16 | + <name>Templates</name> |
| 17 | + </group> |
| 18 | + </groups> |
| 19 | + <applications> |
| 20 | + <application> |
| 21 | + <name>Home Assistant</name> |
| 22 | + </application> |
| 23 | + </applications> |
| 24 | + <items> |
| 25 | + <item> |
| 26 | + <name>API Status</name> |
| 27 | + <type>HTTP_AGENT</type> |
| 28 | + <key>ha_api_status</key> |
| 29 | + <delay>3m</delay> |
| 30 | + <trends>0</trends> |
| 31 | + <value_type>TEXT</value_type> |
| 32 | + <applications> |
| 33 | + <application> |
| 34 | + <name>Home Assistant</name> |
| 35 | + </application> |
| 36 | + </applications> |
| 37 | + <preprocessing> |
| 38 | + <step> |
| 39 | + <type>JSONPATH</type> |
| 40 | + <params>$.body.message</params> |
| 41 | + </step> |
| 42 | + </preprocessing> |
| 43 | + <url>{$HA_HTTP_PROTOCOL}://{HOST.CONN}:{$HA_HTTP_PORT}/api/</url> |
| 44 | + <headers> |
| 45 | + <header> |
| 46 | + <name>Authorization</name> |
| 47 | + <value>Bearer {$HA_TOKEN}</value> |
| 48 | + </header> |
| 49 | + </headers> |
| 50 | + <output_format>JSON</output_format> |
| 51 | + <verify_peer>YES</verify_peer> |
| 52 | + <triggers> |
| 53 | + <trigger> |
| 54 | + <expression>{regexp(^API running\.$)}=0</expression> |
| 55 | + <name>API is not running</name> |
| 56 | + <opdata>Current status: {ITEM.LASTVALUE1}</opdata> |
| 57 | + <priority>WARNING</priority> |
| 58 | + </trigger> |
| 59 | + </triggers> |
| 60 | + </item> |
| 61 | + </items> |
| 62 | + <discovery_rules> |
| 63 | + <discovery_rule> |
| 64 | + <name>Discover Entities</name> |
| 65 | + <type>HTTP_AGENT</type> |
| 66 | + <key>ha_entities</key> |
| 67 | + <delay>60m</delay> |
| 68 | + <lifetime>7d</lifetime> |
| 69 | + <item_prototypes> |
| 70 | + <item_prototype> |
| 71 | + <name>Entity {#HA_ENTITY_NAME} State</name> |
| 72 | + <type>HTTP_AGENT</type> |
| 73 | + <key>ha_entity_state[{#HA_ENTITY_ID}]</key> |
| 74 | + <delay>15m</delay> |
| 75 | + <trends>0</trends> |
| 76 | + <value_type>TEXT</value_type> |
| 77 | + <applications> |
| 78 | + <application> |
| 79 | + <name>Home Assistant</name> |
| 80 | + </application> |
| 81 | + </applications> |
| 82 | + <preprocessing> |
| 83 | + <step> |
| 84 | + <type>JSONPATH</type> |
| 85 | + <params>$.body.state</params> |
| 86 | + </step> |
| 87 | + </preprocessing> |
| 88 | + <url>{$HA_HTTP_PROTOCOL}://{HOST.CONN}/api/states/{#HA_ENTITY_ID}</url> |
| 89 | + <headers> |
| 90 | + <header> |
| 91 | + <name>Authorization</name> |
| 92 | + <value>Bearer {$HA_TOKEN}</value> |
| 93 | + </header> |
| 94 | + </headers> |
| 95 | + <output_format>JSON</output_format> |
| 96 | + <verify_peer>YES</verify_peer> |
| 97 | + <trigger_prototypes> |
| 98 | + <trigger_prototype> |
| 99 | + <expression>{regexp(^unavailable$)}=1</expression> |
| 100 | + <name>Entity {#HA_ENTITY_NAME} is unavailable</name> |
| 101 | + <priority>WARNING</priority> |
| 102 | + <dependencies> |
| 103 | + <dependency> |
| 104 | + <name>API is not running</name> |
| 105 | + <expression>{Template Home Assistant API:ha_api_status.regexp(^API running\.$)}=0</expression> |
| 106 | + </dependency> |
| 107 | + </dependencies> |
| 108 | + </trigger_prototype> |
| 109 | + </trigger_prototypes> |
| 110 | + </item_prototype> |
| 111 | + </item_prototypes> |
| 112 | + <url>{$HA_HTTP_PROTOCOL}://{HOST.CONN}/api/states</url> |
| 113 | + <headers> |
| 114 | + <header> |
| 115 | + <name>Authorization</name> |
| 116 | + <value>Bearer {$HA_TOKEN}</value> |
| 117 | + </header> |
| 118 | + </headers> |
| 119 | + <verify_peer>YES</verify_peer> |
| 120 | + <lld_macro_paths> |
| 121 | + <lld_macro_path> |
| 122 | + <lld_macro>{#HA_ENTITY_ID}</lld_macro> |
| 123 | + <path>$.entity_id</path> |
| 124 | + </lld_macro_path> |
| 125 | + <lld_macro_path> |
| 126 | + <lld_macro>{#HA_ENTITY_NAME}</lld_macro> |
| 127 | + <path>$.attributes.friendly_name</path> |
| 128 | + </lld_macro_path> |
| 129 | + </lld_macro_paths> |
| 130 | + </discovery_rule> |
| 131 | + </discovery_rules> |
| 132 | + <macros> |
| 133 | + <macro> |
| 134 | + <macro>{$HA_HTTP_PORT}</macro> |
| 135 | + <value>443</value> |
| 136 | + <description>http(s) port</description> |
| 137 | + </macro> |
| 138 | + <macro> |
| 139 | + <macro>{$HA_HTTP_PROTOCOL}</macro> |
| 140 | + <value>https</value> |
| 141 | + <description>http or https</description> |
| 142 | + </macro> |
| 143 | + <macro> |
| 144 | + <macro>{$HA_TOKEN}</macro> |
| 145 | + <description>Home Assistant Long-Lived Access Token</description> |
| 146 | + </macro> |
| 147 | + </macros> |
| 148 | + </template> |
| 149 | + </templates> |
| 150 | +</zabbix_export> |
0 commit comments