Hello,
I m trying to create template with web scenarios through zabbix api (through salt originally https://docs.saltstack.com/en/latest..._template.html ).
Problem is zabbix api doenst return errors, I assume there is some mistake in my json, but zabbix api returns
At first I thought its salt state which doesnt return anything so I tried using something different. "pyzabbix" with simple json example, It does create template, but no webscenario and no errors. How can I get proper debug output from zabbix? or can someone point out where mistake is in my httptest json example?
PS I tried many variations this is very simplified down json. But trying to guess in the dark is hard.
PPS I can create web scenario directly to host, but I want to make a template.
I m trying to create template with web scenarios through zabbix api (through salt originally https://docs.saltstack.com/en/latest..._template.html ).
Problem is zabbix api doenst return errors, I assume there is some mistake in my json, but zabbix api returns
Code:
{'jsonrpc': '2.0', 'result': {'templateids': ['10282']}, 'id': '1'}
PS I tried many variations this is very simplified down json. But trying to guess in the dark is hard.
PPS I can create web scenario directly to host, but I want to make a template.
Code:
from pyzabbix.api import ZabbixAPI
import pdb
# Create ZabbixAPI class instance
zapi = ZabbixAPI(url='http://10.10.10.102/zabbix/', user='Admin', password='zabbix')
# Get all monitored hosts
result1 = zapi.host.get(monitored_hosts=1, output='extend')
# Get all disabled hosts
result2 = zapi.do_request('template.create',
{
"host": "Linux templateaa",
"groups": {
"groupid": 1
},
"applications": {
"name": "web checks"
},
"httptests": {
"name": "google.lt",
"steps": {
"name": "google.lt",
"url": "https://google.lt",
"status_codes": 200,
"no": 1
}
}
})
print ("\nprinting result below")
print ( result2)
#pdb.set_trace()
# Logout from Zabbix
zapi.user.logout()
Comment