This method allows to retrieve scripts available on the given hosts此方法允许检索给定主机上可用的脚本.

    IDs of hosts to return scripts for要返回脚本的主机的ID.

    The method will automatically expand macros in the text该方法将自动在文本中展开宏.

    Retrieve scripts by host IDs通过主机ID检索脚本

    Retrieve all scripts available on hosts “30079” and “30073”检索主机“30079” 和“30073”上可用的所有脚本。.

    Response响应:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "30079": [
    5. {
    6. "scriptid": "3",
    7. "name": "Detect operating system",
    8. "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
    9. "host_access": "2",
    10. "usrgrpid": "7",
    11. "groupid": "0",
    12. "description": "",
    13. "confirmation": "",
    14. "type": "0",
    15. "execute_on": "1",
    16. "hostid": "10001"
    17. },
    18. {
    19. "scriptid": "1",
    20. "name": "Ping",
    21. "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
    22. "host_access": "2",
    23. "usrgrpid": "0",
    24. "groupid": "0",
    25. "confirmation": "",
    26. "type": "0",
    27. "execute_on": "1",
    28. "hostid": "10001"
    29. },
    30. {
    31. "scriptid": "2",
    32. "name": "Traceroute",
    33. "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
    34. "host_access": "2",
    35. "usrgrpid": "0",
    36. "groupid": "0",
    37. "description": "",
    38. "confirmation": "",
    39. "type": "0",
    40. "execute_on": "1",
    41. "hostid": "10001"
    42. }
    43. ],
    44. "30073": [
    45. {
    46. "scriptid": "3",
    47. "name": "Detect operating system",
    48. "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
    49. "host_access": "2",
    50. "usrgrpid": "7",
    51. "groupid": "0",
    52. "description": "",
    53. "confirmation": "",
    54. "type": "0",
    55. "hostid": "10001"
    56. },
    57. {
    58. "scriptid": "1",
    59. "name": "Ping",
    60. "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
    61. "host_access": "2",
    62. "usrgrpid": "0",
    63. "groupid": "0",
    64. "description": "",
    65. "confirmation": "",
    66. "type": "0",
    67. "execute_on": "1",
    68. "hostid": "10001"
    69. },
    70. {
    71. "scriptid": "2",
    72. "name": "Traceroute",
    73. "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
    74. "host_access": "2",
    75. "usrgrpid": "0",
    76. "groupid": "0",
    77. "description": "",
    78. "confirmation": "",
    79. "type": "0",
    80. "execute_on": "1",
    81. "hostid": "10001"
    82. }
    83. ]
    84. },
    85. }

    CScript::getScriptsByHosts() in frontends/php/include/classes/api/services/CScript.php.