Seyren API Document v1

November 6, 2015 · View on GitHub

## Alerts API

Get check alerts

  • URL /api/checks/{checkId}/alerts

  • Method GET

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params
ParameterRequiredDescriptionType
startfalseIndex of the first resultint
itemsfalseNumber of resultats to returnint
  • Body

None

  • Response

GET /api/checks/540571f4f562fe8c51873ad1/alerts?items=10&start=0

{  
   "values":[  
      {  
         "id":"544c012636623111967d9094",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":700,
         "error":1000,
         "fromType":"WARN",
         "toType":"OK",
         "timestamp":1414267174986,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      },
      {  
         "id":"544c00ea36623111967d9093",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":100,
         "error":800,
         "fromType":"WARN",
         "toType":"WARN",
         "timestamp":1414267114984,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      },
...
      {  
         "id":"544bff0b36623111967d908b",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":100,
         "error":800,
         "fromType":"WARN",
         "toType":"WARN",
         "timestamp":1414266635230,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      }
   ],
   "items":10,
   "start":0,
   "total":95
}

Delete check alerts

  • URL /api/checks/{checkId}/alerts

  • Method DELETE

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params
ParameterRequiredDescriptionType
beforefalseDelete alerts before 'before' date for this check idDate
  • Body

    None

  • Response

DELETE /api/checks/540571f4f562fe8c51873ad1/alerts?before=2014-10-26T13:06:28%2B01:00

Return '204 No Content'

Get alerts

  • URL /api/alerts

  • Method GET

  • URL Params

None

  • Query Params
ParameterRequiredDescriptionType
startfalseIndex of the first resultint
itemsfalseNumber of resultats to returnint
  • Body

    None

  • Response

GET /api/alerts

{  
   "values":[  
      {  
         "id":"544c012636623111967d9094",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":700,
         "error":1000,
         "fromType":"WARN",
         "toType":"OK",
         "timestamp":1414267174986,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      },
      {  
         "id":"544c00ea36623111967d9093",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":100,
         "error":800,
         "fromType":"WARN",
         "toType":"WARN",
         "timestamp":1414267114984,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      },
...
      {  
         "id":"544bff0b36623111967d908b",
         "checkId":"540571f4f562fe8c51873ad1",
         "value":606.0,
         "target":"server1.filecount.whisper.files",
         "warn":100,
         "error":800,
         "fromType":"WARN",
         "toType":"WARN",
         "timestamp":1414266635230,
         "targetHash":"�b�'8��i\u0017pN�_�om"
      }
   ],
   "items":10,
   "start":0,
   "total":95
}

Charts API

Get chart image for a given check

  • URL /api/checks/{checkId}/image

  • Method GET

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params
ParameterRequiredDescriptionType
widthfalseWidth of the return imageint (1200 by default)
heightfalseHeight of the return imageint (350 by default)
fromfalseSpecifies the beginningString ("-24hours" by default)
totrueSpecifies the endString
hideThresholdsfalseHide thresholdsboolean
hideLegendfalseHide legendboolean
hideAxesfalseHide axesboolean
  • Body

    None

  • Response

GET /api/alerts

Return png image

Get chart image for a given target

  • URL /api/chart/{target}

  • Method GET

  • URL Params

ParameterRequiredDescriptionType
targettrueMetric nameString
  • Query Params
ParameterRequiredDescriptionType
widthfalseWidth of the return imageint (1200 by default)
heightfalseHeight of the return imageint (350 by default)
fromfalseSpecifies the beginningString ("-24hours" by default)
totrueSpecifies the endString
warnfalseWarn level valueString
errorfalseError level valueString
hideLegendfalseHide legendboolean
hideAxesfalseHide axesboolean
  • Body

    None

  • Response

GET /api/alerts

Return png image

Checks API

Search checks

See Checks resource javadoc

  • URL /api/checks

  • Method GET

  • URL Params

None

  • Query Params
ParameterRequiredDescriptionType
statefalsestates checksAlertType
enabledfalseenable/disable checkboolean
namefalse??String
fieldsfalseField name on which a regex will be appliedString
regexesfalseRegexpString
  • Body

    None

  • Response

GET /api/checks?enabled=true&state=ERROR&state=WARN&state=EXCEPTION&state=UNKNOWN

{  
   "values":[  
      {  
         "id":"540571f4f562fe8c51873ad1",
         "name":"Test",
         "description":"test",
         "target":"server1.filecount.whisper.files",
         "from":null,
         "until":null,
         "warn":"100",
         "error":"1000",
         "enabled":true,
         "live":false,
         "state":"WARN",
         "lastCheck":1414425107940,
         "subscriptions":[  
            {  
               "id":"54481212873059b3ba063d4e",
               "target":"xxxx",
               "type":"SLACK",
               "su":true,
               "mo":true,
               "tu":true,
               "we":true,
               "th":true,
               "fr":true,
               "sa":true,
               "ignoreWarn":false,
               "ignoreError":false,
               "ignoreOk":false,
               "fromTime":"0000",
               "toTime":"2359",
               "enabled":true
            }
         ]
      }
   ],
   "items":0,
   "start":0,
   "total":1
}

Create a check

  • URL /api/checks

  • Method POST

  • URL Params

None

  • Query Params

None

  • Body
ParameterRequiredDescriptionType
nametrueName of the checkString
descriptionfalseDescription of the checkString
targettrueName of the metric in graphiteString
warntrueWarn levelString
errortrueError levelString
enabledtrueEnable/Disable valueboolean
livefalseLive value (pickle protocol)boolean
fromfalseSpecifies the beginningString
untilfalseSpecifies the endString
  • Response

POST /api/checks

{  
   "name":"111",
   "description":"222",
   "target":"333",
   "warn":"666",
   "error":"777",
   "enabled":true,
   "live":false,
   "totalMetric":0,
   "from":"444",
   "until":"555"
}

Response '201 Created'

Get a check

  • URL /api/checks/{checkId}

  • Method GET

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params

None

  • Body

None

  • Response

GET /api/checks/540571f4f562fe8c51873ad1

{  
   "id":"540571f4f562fe8c51873ad1",
   "name":"Test",
   "description":"test",
   "target":"server1.filecount.whisper.files",
   "from":null,
   "until":null,
   "warn":"100",
   "error":"1000",
   "enabled":true,
   "live":false,
   "state":"WARN",
   "lastCheck":1414444752519,
   "subscriptions":[  
      {  
         "id":"54481212873059b3ba063d4e",
         "target":"xxxx",
         "type":"SLACK",
         "su":true,
         "mo":true,
         "tu":true,
         "we":true,
         "th":true,
         "fr":true,
         "sa":true,
         "ignoreWarn":false,
         "ignoreError":false,
         "ignoreOk":false,
         "fromTime":"0000",
         "toTime":"2359",
         "enabled":true
      }
   ]
}

Update a check

  • URL /api/checks/{checkId}

  • Method PUT

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params

None

  • Body
ParameterRequiredDescriptionType
nametrueName of the checkString
descriptionfalseDescription of the checkString
targettrueName of the metric in graphiteString
warntrueWarn levelString
errortrueError levelString
enabledtrueEnable/Disable valueboolean
livefalseLive value (pickle protocol)boolean
fromfalseSpecifies the beginningString
untilfalseSpecifies the endString
statefalseSpecifies the stateString
  • Response

PUT /api/checks/540571f4f562fe8c51873ad1

{  
   "id": "540571f4f562fe8c51873ad1",
   "name":"2222",
   "description":"2222",
   "target":"3333",
   "warn":"6666",
   "error":"7777",
   "enabled":true,
   "live":false,
   "from":"4444",
   "until":"5555",
   "state": "OK"
}

Return '200 OK'

Delete a check

  • URL /api/checks/{checkId}

  • Method DELETE

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Query Params

None

  • Body

None

  • Response

DELETE /api/checks/540571f4f562fe8c51873ad1

Return '204 No Content'

Config API

Get Seyren configuration

  • URL /config

  • Method GET

  • URL Params

    None

  • Query Params

    None

  • Body

    None

  • Response

{
  "baseUrl":"http://localhost:8080/seyren",
  "graphsEnabled":true,
  "graphiteCarbonPickleEnabled":false
}

## Metrics API

Get metric count

  • URL /api/metrics/{target}/total

  • Method GET

  • URL Params

ParameterRequiredDescriptionType
targettrueReturn metric countString
  • Body

    None

  • Response

GET /metrics/path.metric.xxx/total

{ "path.metric.xxx": 3 }

Subscriptions API

Create a subscription

  • URL /checks/{checkId}/subscriptions

  • Method POST

  • URL Params

    None

  • Query Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
  • Body

    None

  • Response

POST /api/checks/540571f4f562fe8c51873ad1/subscriptions

{  
   "target":"test@gmail.com",
   "type":"EMAIL",
   "ignoreWarn":false,
   "ignoreError":false,
   "ignoreOk":false,
   "notifyOnWarn":true,
   "notifyOnError":true,
   "notifyOnOk":true,
   "fromTime":"0000",
   "toTime":"2359",
   "su":true,
   "mo":true,
   "tu":true,
   "we":true,
   "th":true,
   "fr":true,
   "sa":true,
   "enabled":true
}

Return '201 Created'

Update a subscription

  • URL /api/checks/{checkId}/subscriptions/{subscriptionId}

  • Method PUT

  • URL Params

    None

  • Query Params

    None

  • Body

    None

  • Response

PUT /api/checks/540571f4f562fe8c51873ad1/subscriptions

{  
   "target":"test@gmail.com",
   "type":"EMAIL",
   "ignoreWarn":false,
   "ignoreError":false,
   "ignoreOk":false,
   "notifyOnWarn":true,
   "notifyOnError":true,
   "notifyOnOk":true,
   "fromTime":"0000",
   "toTime":"2359",
   "su":true,
   "mo":true,
   "tu":true,
   "we":true,
   "th":true,
   "fr":true,
   "sa":true,
   "enabled":true
}

Return '204 No Content'

Delete a subscription

  • URL /api/checks/{checkId}/subscriptions/{subscriptionId}

  • Method DELETE

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
subscriptionIdtruesubscription idString
  • Query Params

    None

  • Body

    None

  • Response

DELETE /api/checks/540571f4f562fe8c51873ad1/subscriptions/544eb9608730756ff45c52a5

Return '204 No Content'

Test a subscription

  • URL /api/checks/{checkId}/subscriptions/{subscriptionId}/test

  • Method PUT

  • URL Params

ParameterRequiredDescriptionType
checkIdtrueCheck idString
subscriptionIdtrueSubscription idString
  • Query Params

    None

  • Body

    None

  • Response

PUT /api/checks/540571f4f562fe8c51873ad1/subscriptions/54481212873059b3ba063d4e/test

Return '204 No Content'