Team,
We had an ansible playbook which will be update the new email distro's to the existing Zabbix Action Operations using action.update API (version 5.4.4)
We upgraded Zabbix from 5.4.4 to 6.0.9 and post to that script is failing with the below error
Ansible Playbook Module
modified_operations => Input Details
This script was working fine with the version 5.4.4 and getting error for the newer version 6.0.9
We had an ansible playbook which will be update the new email distro's to the existing Zabbix Action Operations using action.update API (version 5.4.4)
We upgraded Zabbix from 5.4.4 to 6.0.9 and post to that script is failing with the below error
"json": {
"error": {
"code": -32602,
"data": "Invalid parameter "/1/operations/1": unexpected parameter "operationid".",
"message": "Invalid params."
"error": {
"code": -32602,
"data": "Invalid parameter "/1/operations/1": unexpected parameter "operationid".",
"message": "Invalid params."
- name: Update action with new user email
uri:
url: "{{ zabbix_url }}"
method: POST
headers:
Content-Type: "application/json"
body:
{
"jsonrpc": "2.0",
"method": "action.update",
"params": {
"actionid": "{{ action_id }}",
"operations": "{{ modified_operations }}"
},
"auth": "{{ zabbix_token }}",
"id": 1
}
body_format: json
status_code: 200
register: result
uri:
url: "{{ zabbix_url }}"
method: POST
headers:
Content-Type: "application/json"
body:
{
"jsonrpc": "2.0",
"method": "action.update",
"params": {
"actionid": "{{ action_id }}",
"operations": "{{ modified_operations }}"
},
"auth": "{{ zabbix_token }}",
"id": 1
}
body_format: json
status_code: 200
register: result
TASK [Loop through existing operations] => Current Operations Data
ok: [localhost] => (item={'operationid': '2247', 'actionid': '291', 'operationtype': '0', 'esc_period': '0', 'esc_step_from': '1', 'esc_step_to': '1', 'evaltype': '0', 'opconditions': [], 'opmessage': {'default_msg': '1', 'subject': '', 'message': '', 'mediatypeid': '0'}, 'opmessage_grp': [], 'opmessage_usr': [{'userid': '225'}]})
TASK [Display modified_operations] = > Contains the new user ID for the new email
ok: [localhost] => {
"msg": [
{
"actionid": "291",
"esc_period": "0",
"esc_step_from": "1",
"esc_step_to": "1",
"evaltype": "0",
"opconditions": [],
"operationid": "2247",
"operationtype": "0",
"opmessage": {
"default_msg": "1",
"mediatypeid": "0",
"message": "",
"subject": ""
},
"opmessage_grp": [],
"opmessage_usr": [
{
"userid": "225"
},
{
"userid": "274"
}
]
}
]
}
ok: [localhost] => (item={'operationid': '2247', 'actionid': '291', 'operationtype': '0', 'esc_period': '0', 'esc_step_from': '1', 'esc_step_to': '1', 'evaltype': '0', 'opconditions': [], 'opmessage': {'default_msg': '1', 'subject': '', 'message': '', 'mediatypeid': '0'}, 'opmessage_grp': [], 'opmessage_usr': [{'userid': '225'}]})
TASK [Display modified_operations] = > Contains the new user ID for the new email
ok: [localhost] => {
"msg": [
{
"actionid": "291",
"esc_period": "0",
"esc_step_from": "1",
"esc_step_to": "1",
"evaltype": "0",
"opconditions": [],
"operationid": "2247",
"operationtype": "0",
"opmessage": {
"default_msg": "1",
"mediatypeid": "0",
"message": "",
"subject": ""
},
"opmessage_grp": [],
"opmessage_usr": [
{
"userid": "225"
},
{
"userid": "274"
}
]
}
]
}