GET /api/reports
List all reports

Examples

GET /api/hosts/host260/reports
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": " host = host260",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "metrics": {
        "time": {
          "schedule": 0.00083,
          "service": 0.149739,
          "mailalias": 0.000283,
          "cron": 0.000419,
          "config_retrieval": 16.3637869358063,
          "package": 0.003989,
          "filebucket": 0.000171,
          "file": 0.007025,
          "exec": 0.000299
        },
        "resources": {
          "total": 33
        },
        "changes": {},
        "events": {
          "total": 0
        }
      },
      "created_at": "2018-11-15 19:02:19 UTC",
      "updated_at": "2018-11-15 19:02:19 UTC",
      "id": 1,
      "host_id": 1,
      "host_name": "host260",
      "reported_at": "2018-11-15 19:02:19 UTC",
      "status": {
        "applied": 0,
        "restarted": 0,
        "failed": 0,
        "failed_restarts": 0,
        "skipped": 0,
        "pending": 0
      }
    }
  ]
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

search
optional

filter results

Validations:

  • Must be a String

order
optional

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
optional

paginate results

Validations:

  • Must be a String

per_page
optional

number of entries per request

Validations:

  • Must be a String


GET /api/reports/:id
Show a report

Examples

GET /api/reports/1
200
{
  "metrics": {
    "time": {
      "schedule": 0.00083,
      "service": 0.149739,
      "mailalias": 0.000283,
      "cron": 0.000419,
      "config_retrieval": 16.3637869358063,
      "package": 0.003989,
      "filebucket": 0.000171,
      "file": 0.007025,
      "exec": 0.000299
    },
    "resources": {
      "total": 33
    },
    "changes": {},
    "events": {
      "total": 0
    }
  },
  "created_at": "2018-11-15 19:02:19 UTC",
  "updated_at": "2018-11-15 19:02:19 UTC",
  "id": 1,
  "host_id": 1,
  "host_name": "host262",
  "reported_at": "2018-11-15 19:02:19 UTC",
  "status": {
    "applied": 0,
    "restarted": 0,
    "failed": 0,
    "failed_restarts": 0,
    "skipped": 0,
    "pending": 0
  },
  "logs": [],
  "summary": "Success"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/reports
Create a report

Examples

POST /api/reports
{
  "report": {
    "host": "rhel6n01.corp.com",
    "reported_at": "2010-11-19 02:39:04 UTC",
    "metrics": {},
    "status": {
      "applied": 0,
      "failed": 0,
      "failed_restarts": 0,
      "pending": 0,
      "restarted": 0,
      "skipped": 0
    },
    "logs": [
      {
        "log": {
          "sources": {
            "source": "Puppet"
          },
          "messages": {
            "message": "Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find node 'rhel6n01.corp.com'; cannot compile"
          },
          "level": "err"
        }
      },
      {
        "log": {
          "sources": {
            "source": "Puppet"
          },
          "messages": {
            "message": "Using cached catalog"
          },
          "level": "notice"
        }
      },
      {
        "log": {
          "sources": {
            "source": "Puppet"
          },
          "messages": {
            "message": "Could not retrieve catalog; skipping run"
          },
          "level": "err"
        }
      }
    ]
  }
}
201
{
  "metrics": {},
  "created_at": "2018-11-15 19:02:02 UTC",
  "updated_at": "2018-11-15 19:02:02 UTC",
  "id": 1,
  "host_id": 1,
  "host_name": "rhel6n01.corp.com",
  "reported_at": "2010-11-19 02:39:04 UTC",
  "status": {
    "applied": 0,
    "restarted": 0,
    "failed": 0,
    "failed_restarts": 0,
    "skipped": 0,
    "pending": 0
  },
  "logs": [
    {
      "level": "err",
      "source": {
        "source": "Puppet"
      },
      "message": {
        "message": "Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find node 'rhel6n01.corp.com'; cannot compile"
      }
    },
    {
      "level": "notice",
      "source": {
        "source": "Puppet"
      },
      "message": {
        "message": "Using cached catalog"
      }
    },
    {
      "level": "err",
      "source": {
        "source": "Puppet"
      },
      "message": {
        "message": "Could not retrieve catalog; skipping run"
      }
    }
  ],
  "summary": "Success"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

report
required

Validations:

  • Must be a Hash

report[host]
required

Hostname or certname

Validations:

  • Must be a String

report[reported_at]
required

UTC time of report

Validations:

  • Must be a String

report[status]
required

Hash of status type totals

Validations:

  • Must be a Hash

report[metrics]
required

Hash of report metrics, can be just {}

Validations:

  • Must be a Hash

report[logs]
optional , nil allowed

Optional array of log hashes

Validations:

  • Must be an array of any type


DELETE /api/reports/:id
Delete a report

Examples

DELETE /api/reports/1
{
  "report": {}
}
200
{
  "id": 1,
  "host_id": 1,
  "reported_at": "2018-11-15T19:02:20.530Z",
  "created_at": "2018-11-15T19:02:20.532Z",
  "updated_at": "2018-11-15T19:02:20.532Z",
  "status": {
    "applied": 0,
    "restarted": 0,
    "failed": 0,
    "failed_restarts": 0,
    "skipped": 0,
    "pending": 0
  },
  "metrics": {
    "time": {
      "schedule": 0.00083,
      "service": 0.149739,
      "mailalias": 0.000283,
      "cron": 0.000419,
      "config_retrieval": 16.3637869358063,
      "package": 0.003989,
      "filebucket": 0.000171,
      "file": 0.007025,
      "exec": 0.000299
    },
    "resources": {
      "total": 33
    },
    "changes": {},
    "events": {
      "total": 0
    }
  },
  "origin": null
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String


GET /api/hosts/:host_id/reports/last
Show the last report for a host

Examples

GET /api/hosts/host263/reports/last
404
{
  "error": {
    "message": "Resource report not found by id ''"
  }
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.