Áú»¢¶Ä²©

§¿§ä§à §á§Ö§â§Ö§Ó§à§Õ §ã§ä§â§Ñ§ß§Ú§è§í §Õ§à§Ü§å§Þ§Ö§ß§ä§Ñ§è§Ú§Ú §ã §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ. §±§à§Þ§à§Ô§Ú§ä§Ö §ß§Ñ§Þ §ã§Õ§Ö§Ý§Ñ§ä§î §Ö§Ô§à §Ý§å§é§ê§Ö.

script.getscriptsbyevents

§°§á§Ú§ã§Ñ§ß§Ú§Ö

object script.getscriptsbyevents(§á§Ñ§â§Ñ§Þ§Ö§ä§â§í §à§Ò§ì§Ö§Ü§ä§Ñ)

§¿§ä§à§ä §Þ§Ö§ä§à§Õ §á§à§Ù§Ó§à§Ý§ñ§Ö§ä §á§à§Ý§å§é§Ú§ä§î §Ó§ã§Ö §Õ§à§ã§ä§å§á§ß§í§Ö §ã§Ü§â§Ú§á§ä§í §Õ§Ý§ñ §Õ§Ñ§ß§ß§à§Ô§à §ã§à§Ò§í§ä§Ú§ñ §Ú§Ý§Ú §Ü§à§ß§Ü§â§Ö§ä§ß§í§Û §ã§Ü§â§Ú§á§ä, §Ö§ã§Ý§Ú §å§Ü§Ñ§Ù§Ñ§ß ID §ã§Ü§â§Ú§á§ä§Ñ. §¦§ã§Ý§Ú §á§â§Ö§Õ§à§ã§ä§Ñ§Ó§Ý§Ö§ß§à §Ù§ß§Ñ§é§Ö§ß§Ú§Ö manualinput, §à§ß§à §Ù§Ñ§Þ§Ö§ß§ñ§Ö§ä §Þ§Ñ§Ü§â§à§ã {MANUALINPUT} §ß§Ñ §å§Ü§Ñ§Ù§Ñ§ß§ß§à§Ö §Ù§ß§Ñ§é§Ö§ß§Ú§Ö.

§¿§ä§à§ä §Þ§Ö§ä§à§Õ §Õ§à§ã§ä§å§á§Ö§ß §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ñ§Þ §Ý§ð§Ò§à§Ô§à §ä§Ú§á§Ñ. §²§Ñ§Ù§â§Ö§ê§Ö§ß§Ú§ñ §ß§Ñ §Ó§í§Ù§à§Ó §Þ§Ö§ä§à§Õ§Ñ §Þ§à§Ø§ß§à §à§ä§à§Ù§Ó§Ñ§ä§î §Ó §ß§Ñ§ã§ä§â§à§Û§Ü§Ñ§ç §â§à§Ý§Ö§Û §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ñ. §¥§à§á§à§Ý§ß§Ú§ä§Ö§Ý§î§ß§å§ð §Ú§ß§æ§à§â§Þ§Ñ§è§Ú§ð §ã§Þ. §Ó §â§Ñ§Ù§Õ§Ö§Ý§Ö §²§à§Ý§Ú §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§Ö§Û.

Parameters

(string/array) IDs of events to return scripts for.

Return values

(object) Returns an object with event IDs as properties and arrays of available scripts as values.

The method will automatically expand macros in the confirmation text and url.

§±§â§Ú§Þ§Ö§â§í

Retrieve scripts by event IDs

Retrieve all scripts available to events "632" and "614".

Request:

{
           "jsonrpc": "2.0",
           "method": "script.getscriptsbyevents",
           "params": [
               "632",
               "614"
           ],
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "632": [
                   {
                       "scriptid": "3",
                       "name": "Detect operating system",
                       "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "7",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "1",
                       "name": "Ping",
                       "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "2",
                       "name": "Traceroute",
                       "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   }
               ],
               "614": [
                   {
                       "scriptid": "3",
                       "name": "Detect operating system",
                       "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "7",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "1",
                       "name": "Ping",
                       "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   },
                   {
                       "scriptid": "2",
                       "name": "Traceroute",
                       "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
                       "host_access": "2",
                       "usrgrpid": "0",
                       "groupid": "0",
                       "description": "",
                       "confirmation": "",
                       "type": "0",
                       "execute_on": "1",
                       "timeout": "30s",
                       "scope": "4",
                       "port": "",
                       "authtype": "0",
                       "username": "",
                       "password": "",
                       "publickey": "",
                       "privatekey": "",
                       "menu_path": "",
                       "url": "",
                       "new_window": "1",
                       "parameters": []
                   }
               ]
           },
           "id": 1
       }

Retrieve specific script with manualinput value.

Retrieve script with ID "4" on event "632" with manualinput value "dashboard.view".

Request:

{
           "jsonrpc": "2.0",
           "method": "script.getscriptsbyevents",
           "params": [
             {
               "eventid":  "632",
               "scriptid": "4",
               "manualinput": "dashboard.view"
             }
         ],
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
             "632": [
               {
                 "scriptid": "4",
                 "name": "Open Áú»¢¶Ä²© page",
                 "command": "",
                 "host_access": "2",
                 "usrgrpid": "0",
                 "groupid": "0",
                 "description": "",
                 "confirmation": "Are you sure you want to open page dashboard.view?",
                 "type": "6",
                 "execute_on": "2",
                 "timeout": "30s",
                 "scope": "4",
                 "port": "",
                 "authtype": "0",
                 "username": "",
                 "password": "",
                 "publickey": "",
                 "privatekey": "",
                 "menu_path": "",
                 "url": "http://localhost/ui/zabbix.php?action=dashboard.view",
                 "new_window": "1",
                 "manualinput": "1",
                 "manualinput_prompt": "Áú»¢¶Ä²© page to open:",
                 "manualinput_validator_type": "1",
                 "manualinput_validator": "dashboard.view,discovery.view",
                 "manualinput_default_value": "",
                 "parameters": []
               }
             ]
           },
           "id": 1
       }

Source

CScript::getScriptsByEvents() in ui/include/classes/api/services/CScript.php.