【问题标题】:chef automate api to get the compliance reports for all nodes not workingchef 自动化 api 以获取所有节点不工作的合规性报告
【发布时间】:2021-09-11 17:20:57
【问题描述】:

我计划获取所有节点的主厨自动化报告(包括节点描述、配置文件、通过/失败控制)。

到目前为止,根据链接https://docs.chef.io/automate/api/#operation/ReportingService_ListReports 使用自动化 api 获得了单个节点的报告。

代码是

  1. 使用服务器 fqdn 检索单个节点的报告 ID。

curl -s --insecure -H "api-token: XXXXXXXXXXXXXXX" https://automate.com/api/v0/compliance/reporting/reports -d '{ "过滤器": [{"type":"node_name","values":["test.com"]}]}'

  1. 使用上述 ID,提取单个节点的合规性报告。

curl -s --insecure -H "api-token: XXXXXXXXXXXXXXXXXXXXXXXX" https://automate.com/api/v0/compliance/reporting/reports/id/YYYYYYXXXXXXXXUUUUUUU -d {}

您能否建议有关提取所有节点而不是单个节点的合规性报告的 api。

【问题讨论】:

    标签: api automation chef-infra devops azure-devops-rest-api


    【解决方案1】:

    您需要在请求中使用 "page""per_page" 参数。

    per_page - 告诉 Automate 在每页结果中包含多少结果。

    page - 返回结果集的哪一页

    如果您有 100 个节点,则以下应返回其中 10 个节点的结果 (21-30)

    卷曲... -d {"per_page":10, "page":3}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-26
      • 2018-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-24
      相关资源
      最近更新 更多