object script.getscriptsbyevents(object parameters)
Aquest m¨¨tode permet recuperar tots els scripts disponibles en l'esdeveniment donat o un script espec¨ªfic si es proporciona l'ID de l'script. Quan es proporciona l'entrada manual, substitueix la macro {MANUALINPUT} pel valor especificat.
Aquest m¨¨tode ¨¦s disponible per a usuaris de qualsevol tipus. Els permisos per cridar al m¨¨tode es poden revocar a la configuraci¨® del rol d'usuari. Veieu Rols d'usuari per a m¨¦s informaci¨®.
(objecte/matriu)
El m¨¨tode admet un objecte o matriu d'objectes amb els par¨¤metres seg¨¹ents.
±Ê²¹°ù¨¤³¾±ð³Ù°ù±ð | Tipus | ¶Ù±ð²õ³¦°ù¾±±è³¦¾±¨® |
---|---|---|
eventid | ID | ID de l'esdeveniment per a retornar scripts. Ha d'¨¦sser ¨²nic. Comportament del par¨¤metre: - obligatori |
scriptid | ID | ID de l'script a retornar. |
manualinput | string | Valor del valor de macro {MANUALINPUT} proporcionat per l'usuari. |
(objecte)
Retorna un objecte amb ID d'esdeveniment com a propietats i matrius de scripts disponibles com a valors. Si es proporciona l'ID d'script, el valor associat ¨¦s una matriu que cont¨¦ l'script espec¨ªfic.
El m¨¨tode ampliar¨¤ autom¨¤ticament les macros al text de "confirmaci¨®", Text del "indicador d'entrada manual" i "url".
Si es proporciona el par¨¤metre d'entrada manual, la macro {MANUALINPUT} es resoldr¨¤ amb el valor especificat.
Recupera tots els scripts disponibles dels esdeveniments "632" i "614".
{
"jsonrpc": "2.0",
"method": "script.getscriptsbyevents",
"params": [
{
"eventid": "632"
},
{
"eventid": "614"
}
],
"id": 1
}
Resposta:
{
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "0",
"manualinput_validator": "",
"manualinput_default_value": "",
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "0",
"manualinput_validator": "",
"manualinput_default_value": "",
"parameters": []
},
{
"scriptid": "4",
"name": "Open Áú»¢¶Ä²© page",
"command": "",
"host_access": "2",
"usrgrpid": "0",
"groupid": "0",
"description": "",
"confirmation": "Are you sure you want to open page *UNKNOWN*?",
"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=*UNKNOWN*",
"new_window": "1",
"manualinput": "1",
"manualinput_prompt": "Áú»¢¶Ä²© page to open:",
"manualinput_validator_type": "1",
"manualinput_validator": "dashboard.view,discovery.view",
"manualinput_default_value": "",
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "0",
"manualinput_validator": "",
"manualinput_default_value": "",
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "1",
"manualinput_validator": "",
"manualinput_default_value": "",
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "0",
"manualinput_validator": "",
"manualinput_default_value": "",
"parameters": []
},
{
"scriptid": "4",
"name": "Open Áú»¢¶Ä²© page",
"command": "",
"host_access": "2",
"usrgrpid": "0",
"groupid": "0",
"description": "",
"confirmation": "Are you sure you want to open page *UNKNOWN*?",
"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=*UNKNOWN*",
"new_window": "1",
"manualinput": "1",
"manualinput_prompt": "Áú»¢¶Ä²© page to open:",
"manualinput_validator_type": "1",
"manualinput_validator": "dashboard.view,discovery.view",
"manualinput_default_value": "",
"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",
"manualinput": "0",
"manualinput_prompt": "",
"manualinput_validator_type": "0",
"manualinput_validator": "",
"manualinput_default_value": "",
"parameters": []
}
]
},
"id": 1
}
Recupera l'script amb ID "4" a l'esdeveniment "632" amb el valor d'entrada manual "dashboard.view".
{
"jsonrpc": "2.0",
"method": "script.getscriptsbyevents",
"params": [
{
"eventid": "632",
"scriptid": "4",
"manualinput": "dashboard.view"
}
],
"id": 1
}
Resposta:
{
"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
}
CScript::getScriptsByEvents() in ui/include/classes/api/services/CScript.php.