Overview

ScienceOps offers a series of JSON endpoints that allow you to monitor the uptime and status of your models. In addition, you can get general information about models via these API endpoints. This page documents the available endpoints and provide examples of how to integrate them into various 3rd monitoring systems, such as NAGIOS and Panopta.

Overview of Endpoints

Versions >= v3.3.0 of ScienceOps contain several endpoints for getting the status and general information about your models:

Method Endpoint Notes
GET /api/models/{modelOwner}/{modelName}/check Returns uptime status & DB info of specified model
GET /api/models/{modelOwner}/{modelName} Returns DB info about specified model
GET /api/models Returns DB info about all deployed models
GET /{modelOwner}/models/{modelName}/ Returns NAGIOS-compliant uptime status information

The recommended endpoint for model monitoring is /api/models/{modelOwner}/{modelName}/check. This endpoint provides a response that lets you monitor the following:

  • if the model is online and responding to predictions
  • if the model is "up-to-date", with the latest deployed version of the model online
  • which version of the model is currently online
curl -X GET -H "Content-Type: application/json" --user testuser:73987b5basva2cab06bcce7cd301f117 https://sandbox.yhat.com/api/models/testuser/HelloWorld/check

# response
{
  "Name": "HelloWorld",
  "Owner": "testuser",
  "Online": true,     
  "Status": "online", # Possible values: online, offline, building
  "ActiveVersion": 2, # The version number that is currently online for this model
  "LatestVersion": 2 # The latest version number of the model that was deployed
}

/api/models/{modelOwner}/{modelName}

The /api/models/{modelOwner}/{modelName} endpoint returns all of the available information in the ScienceOps database about a given model. However unlike the check endpoint above, it does not return uptime status. This endpoint therefore can be used to get info about a model, but is not recommended to be used for monitoring.

curl -X GET -H "Content-Type: application/json" --user testuser:73987b5basva2cab06bcce7cd301f117 https://sandbox.yhat.com/api/models/testuser/HelloWorld

# response
{
  "model": {
    "Id": 126, # Internal model ID
    "Name": "HelloWorld",
    "NumVersions": 2, # Total number of versions of this model that have been deployed
    "ActiveVersion": 2, # The version number that is currently online for this model
    "LastDeployment": 5070, # Internal deployment ID
    "LastUpdated": "2017-01-12T23:23:23Z", # Last updated timestamp
    "LatestVersion": 2, # The latest version number of the model that was deployed
    "NumReplications": 1, # The number of replications (containers) online for this model
    "Status": "online", # Possible values: online, building, queued, failed, unit tests failed, asleep
    "Owner": "testuser"
  },
  "status": "OK" # General server status. Will respond with OK if request was successfully processed.
}

/api/models

The /api/models endpoint returns the same data as the /api/models/{modelOwner}/{modelName} but for all models currently deployed to the cluster.

curl -X GET -H "Content-Type: application/json" --user testuser:73987b5basva2cab06bcce7cd301f117 https://sandbox.yhat.com/api/models

# response
{
  "models":
  [{
    "Id": 126, # Internal model ID
    "Name": "HelloWorld",
    "NumVersions": 2, # Total number of versions of this model that have been deployed
    "ActiveVersion": 2, # The version number that is currently online for this model
    "LastDeployment": 5070, # Internal deployment ID
    "LastUpdated": "2017-01-12T23:23:23Z", #Last updated timestamp
    "LatestVersion": 2, # The latest version number of the model that was deployed
    "NumReplications": 1, # The number of replications (containers) online for this model
    "Status": "online", # Possible values: online, building, queued, failed, unit tests failed, asleep
    "Owner": "testuser"
  }
  ,
  ...
  {
    "Id": 379,
    "Name": "LinearRegression",
    "NumVersions": 1,
    "ActiveVersion": 1,
    "LastDeployment": 5109,
    "LastUpdated": "2017-03-21T19:41:40Z",
    "LatestVersion": 1,
    "NumReplications": 1,
    "Status": "online",
    "Owner": "bigdatabob"
  }],
  "status": "OK" # General server status. Will response OK if request was successfully processed.
}

/{modelOwner}/models/{modelName}/

The /{modelOwner}/models/{modelName}/ endpoint returns uptime status on a given model. It is designed to be configurable with NAGIOS plugins. It complies with the Nagios Plugin API.

curl -X GET -H "Content-Type: application/json" --user testuser:73987b5basva2cab06bcce7cd301f117 https://sandbox.yhat.com/testuser/models/HelloWorld

# response
{
  "status": "OK", # Possible Values: OK, WARNING, CRITICAL, UNKNOWN
  "message": "model online" # Includes a message about the model's current status
}

results matching ""

    No results matching ""