hello guys,
I'm currently trying to script a creation of an auto-registration action on zabbix 3.0.0 using pyzabbix and I'm stuck on a problem.
Here is my script :
According to what I saw it is supposed to work but... no. 
Here is the error
Do you see where I made a mistake ?
Thank you !
I'm currently trying to script a creation of an auto-registration action on zabbix 3.0.0 using pyzabbix and I'm stuck on a problem.
Here is my script :
HTML Code:
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI("http://127.0.0.1/zabbix")
zapi.login("Admin", "xxxxxx")
parameters = "{'status': '0', 'def_shortdata': 'Auto registration: {HOST.HOST}', 'name': 'Auto registration', 'esc_period': '0', 'def_longdata': 'Host name: {HOST.HOST}\r\nHost IP: {HOST.IP}\r\nAgent port: {HOST.PORT}', 'eventsource': '2', 'actionid': '7', 'r_shortdata': '', 'r_longdata': u'', 'recovery_msg': '0', operations: [{'operationtype': 2}]}"
zapi.action.create(parameters)

Here is the error
HTML Code:
Traceback (most recent call last):
File "autoDiscoverAction.py", line 9, in <module>
zapi.action.create(parameters)
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 157, in fn
args or kwargs
File "/usr/lib/python2.7/site-packages/pyzabbix/__init__.py", line 134, in do_request
raise ZabbixAPIException(msg, response_json['error']['code'])
pyzabbix.ZabbixAPIException: (u'Error -32602: Invalid params., Incorrect parameter for action "{".', -32602)
Thank you !
Comment