Skip to content

Instantly share code, notes, and snippets.

@ojgarciab
Last active January 17, 2023 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojgarciab/2b7987130d24f5f012fc5919401ae64f to your computer and use it in GitHub Desktop.
Save ojgarciab/2b7987130d24f5f012fc5919401ae64f to your computer and use it in GitHub Desktop.
{
"content": [
{
"type": "TYPE",
"availableHostnames": [
"host1",
"host2",
"host3",
"host4"
]
}
]
}
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2023-01-17T14:13:18Z</date>
<groups>
<group>
<name>Virtual machines</name>
</group>
</groups>
<hosts>
<host>
<host>Test LLD</host>
<name>Test LLD</name>
<groups>
<group>
<name>Virtual machines</name>
</group>
</groups>
<interfaces>
<interface>
<interface_ref>if1</interface_ref>
</interface>
</interfaces>
<applications>
<application>
<name>Hosts</name>
</application>
<application>
<name>Test JSON</name>
</application>
</applications>
<items>
<item>
<name>Get JSON</name>
<type>HTTP_AGENT</type>
<key>data</key>
<history>1d</history>
<trends>0</trends>
<value_type>TEXT</value_type>
<applications>
<application>
<name>Test JSON</name>
</application>
</applications>
<interface_ref>if1</interface_ref>
<timeout>10s</timeout>
<url>https://gist.githubusercontent.com/ojgarciab/2b7987130d24f5f012fc5919401ae64f/raw/32057db762cb72b1c6a99236b36cca53c0e1c19d/data.json</url>
<follow_redirects>NO</follow_redirects>
</item>
<item>
<name>Check data content</name>
<type>DEPENDENT</type>
<key>data.check</key>
<delay>0</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.content[?(@.type == &quot;TYPE&quot;)].availableHostnames.first()</params>
</step>
</preprocessing>
<master_item>
<key>data</key>
</master_item>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>Test LLD</name>
<type>DEPENDENT</type>
<key>test.lld</key>
<delay>0</delay>
<lifetime>1d</lifetime>
<item_prototypes>
<item_prototype>
<name>Ping {#TEST}</name>
<type>SIMPLE</type>
<key>icmpping[{#TEST}]</key>
<applications>
<application>
<name>Hosts</name>
</application>
</applications>
<interface_ref>if1</interface_ref>
</item_prototype>
</item_prototypes>
<master_item>
<key>data</key>
</master_item>
<lld_macro_paths>
<lld_macro_path>
<lld_macro>{#TEST}</lld_macro>
<path>$.first()</path>
</lld_macro_path>
</lld_macro_paths>
<preprocessing>
<step>
<type>JSONPATH</type>
<params>$.content[?(@.type == &quot;TYPE&quot;)].availableHostnames</params>
</step>
</preprocessing>
</discovery_rule>
</discovery_rules>
<inventory_mode>DISABLED</inventory_mode>
</host>
</hosts>
</zabbix_export>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment