-
Problem report
-
Resolution: Fixed
-
Trivial
-
6.0.21
-
MBP M1, macOS 13.5.1, Rancher Desktop.
-
Sprint 104 (Sep 2023), Sprint 105 (Oct 2023)
-
0.25
Steps to reproduce:
- Fresh container deployment (see attached compose file)
- Do API call
- Check results
CASE 1 (With "selectActions") -> NOK
Result:
API call:
curl --location --request GET 'http://[ZABBIX_FE_HOST]/api_jsonrpc.php' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "script.get", "params": { "selectActions": "extend" }, "auth": "[AUTH_TOKEN]", "id": 1 }'
Response:
{ "jsonrpc": "2.0", "result": [ { "scriptid": "1", "name": "Ping", "command": "ping -c 3 {HOST.CONN}; case $? in [01]) true;; *) false;; esac", "host_access": "2", "usrgrpid": "0", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "actions": [], "parameters": [] }, { "scriptid": "2", "name": "Traceroute", "command": "/usr/bin/traceroute {HOST.CONN}", "host_access": "2", "usrgrpid": "0", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "actions": [], "parameters": [] }, { "scriptid": "2", "name": "Traceroute", "command": "/usr/bin/traceroute {HOST.CONN}", "host_access": "2", "usrgrpid": "0", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "actions": [], "parameters": [] } ], "id": 1 }
Expected:
Scripts with ID 1, 2 and 3. Script with ID 3 "Detect operating system" is missing. Instead, script with ID 2 is listed twice!
CASE 2 (Without using the "selectActions") -> OK
Result:
API call:
curl --location --request GET 'http://[ZABBIX_FE_HOST]/api_jsonrpc.php' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "script.get", "params": {}, "auth": "[AUTH_TOKEN]", "id": 1 }'
Response:
{ "jsonrpc": "2.0", "result": [ { "scriptid": "1", "name": "Ping", "command": "ping -c 3 {HOST.CONN}; case $? in [01]) true;; *) false;; esac", "host_access": "2", "usrgrpid": "0", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "parameters": [] }, { "scriptid": "2", "name": "Traceroute", "command": "/usr/bin/traceroute {HOST.CONN}", "host_access": "2", "usrgrpid": "0", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "parameters": [] }, { "scriptid": "3", "name": "Detect operating system", "command": "sudo /usr/bin/nmap -O {HOST.CONN}", "host_access": "2", "usrgrpid": "7", "groupid": "0", "description": "", "confirmation": "", "type": "0", "execute_on": "2", "timeout": "30s", "scope": "2", "port": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "menu_path": "", "parameters": [] } ], "id": 1 }
Expected:
ALL GOOD. All configured scripts (1, 2 and 3) are correctly listed in the response.
CASE 3 (With "selectActions" AND "output" filtering) -> OK
Result:
API call:
curl --location --request GET 'http://[ZABBIX_FE_HOST]/api_jsonrpc.php' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "script.get", "params": { "output": [ "name", "scriptid" ], "selectActions": "extend" }, "auth": "[AUTH_TOKEN]", "id": 1 }'
Response:
{ "jsonrpc": "2.0", "result": [ { "scriptid": "1", "name": "Ping", "actions": [] }, { "scriptid": "2", "name": "Traceroute", "actions": [] }, { "scriptid": "3", "name": "Detect operating system", "actions": [], "scope": "2" } ], "id": 1 }
Expected:
ALL GOOD. All configured scripts (1, 2 and 3) are correctly listed in the response.
Summary
Case 2 and Case 3 are both listing the correct amount of scripts in the API response. However, in Case 1 where the "selectActions": "extend" is used and the output is not filtered like in Case 3, three scripts are listed but the last script with ID 3 is missing. Instead of script with 3, the second last script with ID 2 is a second time listed.
I assume this is not how it should work...
THX
br/alan