通过主机获取脚本

    此方法允许任何用户使用。可以在用户角色设置中撤销调用此方法的权限。更多信息见User roles

    (对象) 返回一个以主机ID为属性、以可用脚本数组为值的对象。 ::: notetip 此方法会自动拓展confirmation 中的宏. :::

    通过主机ID检索脚本

    相应:

    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. "execute_on": "1",
    27. "hostid": "10001"
    28. },
    29. {
    30. "scriptid": "2",
    31. "name": "Traceroute",
    32. "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
    33. "host_access": "2",
    34. "usrgrpid": "0",
    35. "groupid": "0",
    36. "description": "",
    37. "confirmation": "",
    38. "type": "0",
    39. "execute_on": "1",
    40. "hostid": "10001"
    41. }
    42. ],
    43. "30073": [
    44. {
    45. "scriptid": "3",
    46. "name": "Detect operating system",
    47. "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
    48. "host_access": "2",
    49. "usrgrpid": "7",
    50. "groupid": "0",
    51. "description": "",
    52. "confirmation": "",
    53. "type": "0",
    54. },
    55. {
    56. "scriptid": "1",
    57. "name": "Ping",
    58. "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
    59. "host_access": "2",
    60. "usrgrpid": "0",
    61. "groupid": "0",
    62. "description": "",
    63. "confirmation": "",
    64. "type": "0",
    65. "execute_on": "1",
    66. "hostid": "10001"
    67. },
    68. {
    69. "scriptid": "2",
    70. "name": "Traceroute",
    71. "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
    72. "host_access": "2",
    73. "usrgrpid": "0",
    74. "groupid": "0",
    75. "description": "",
    76. "confirmation": "",
    77. "type": "0",
    78. "execute_on": "1",
    79. "hostid": "10001"
    80. }
    81. ]
    82. },
    83. }