If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to REGISTER before you can post. To start viewing messages, select the forum that you want to visit from the selection below.
Reviewing what I have in place, I didn't use a media type, but something similar. In the operations of the auto registration action, I have a:
Run remote commands on hosts: some-host-with-API-enabled (I run where the web frontend is installed), type custom script, execute on zabbix-agent, commands "/etc/zabbix/update_autoreg.py {HOST.HOST1}"
My sanitized script is below, I'm turning on host inventory, so the calls to add the JMX interface will be different. This is using the pyzabbix api (pip install pyzabbix).
#!/usr/bin/python
"""
Set host inventory to automatic.
"""
from pyzabbix import ZabbixAPI
import json, sys, time
#print sys.argv[1]
time.sleep(5)
# The hostname at which the Zabbix web interface is available
ZABBIX_SERVER = 'https://localhost/zabbix'
zapi = ZabbixAPI(ZABBIX_SERVER)
# Login to the Zabbix API
zapi.login('user',' password')
Comment