StackStorm-Exchange / stackstorm-zabbix

Apache License 2.0
16 stars 21 forks source link

register_st2_config_to_zabbix.py script failing with Error -32602: Invalid params #44

Open hv024036dba opened 3 years ago

hv024036dba commented 3 years ago

Hello All,

I'm trying to integrate zabbix with stack storm and the integration is failing when i am trying to run the script /opt/stackstorm/virtualenvs/zabbix/bin/python /opt/stackstorm/packs/zabbix/tools/register_st2_config_to_zabbix.py -z http://**.***.***.**/zabbix -u "Admin" -p "*****"

Error:

{code}

opt/stackstorm/virtualenvs/zabbix/bin/python /opt/stackstorm/packs/zabbix/tools/register_st2_config_to_zabbix.py -z http://**.***.***.**/zabbix -u "Admin" -p "***" Traceback (most recent call last): File "/opt/stackstorm/packs/zabbix/tools/register_st2_config_to_zabbix.py", line 191, in main() File "/opt/stackstorm/packs/zabbix/tools/register_st2_config_to_zabbix.py", line 176, in main mediatype_id = register_media_type(client, options, mediatype_id) File "/opt/stackstorm/packs/zabbix/tools/register_st2_config_to_zabbix.py", line 83, in register_media_type ret = client.mediatype.create(params) File "/opt/stackstorm/virtualenvs/zabbix/lib/python3.6/site-packages/pyzabbix/api.py", line 82, in fn args or kwargs File "/opt/stackstorm/virtualenvs/zabbix/lib/python3.6/site-packages/pyzabbix/api.py", line 250, in do_request raise ZabbixAPIException(msg, err['code']) pyzabbix.api.ZabbixAPIException: ("Error -32602: Invalid params., Media type is missing parameters: name while sending {'jsonrpc': '2.0', 'method': 'mediatype.create', 'params': {'description': 'StackStorm', 'type': '1', 'exec_path': 'st2_dispatch.py', 'exec_params': '-- CHANGE ME : api_url (e.g. https://st2-node/api/v1)\\n-- CHANGE ME : auth_url (e.g. https://st2-node/auth/v1)\\n-- CHANGE ME : login uername of StackStorm --\n-- CHANGE ME : login password of StackStorm --\n{ALERT.SENDTO}\n{ALERT.SUBJECT}\n{ALERT.MESSAGE}\n'}, 'id': '1', 'auth': 'b7e4b784f8dc6a930eccf97471f2b39'}", -32602) root@stockstorm:~#

{code}

I passed the zabbix login credentials correctly like wise before performing the actions i login to st2ctl from backend node

pqespindola commented 3 years ago

There were changes to the mediatype object from Zabbix 4.2 to 4.4: ZBXNEXT-5426 renamed “description” property to “name”

I changed "description" to "name" in register_st2_config_to_zabbix.py and it worked for me.

Maiky28 commented 2 years ago

I'm facing the same issue. I've been looking for the solution for several days without positive results. I have Zabbix 6.0