Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
features:nems-api [2018/08/25 10:12]
Robbie Ferguson
features:nems-api [2019/02/04 11:35] (current)
Line 82: Line 82:
 To filter the result set to records meeting some criteria, pass one or more Filter[] params. Each Filter is a urlencoded LQL filter (see the [mk-livestatus documentation]([[http://​mathias-kettner.com/​checkmk_livestatus.html#​H1:​LQL|http:​%%//​%%mathias-kettner.com/​checkmk_livestatus.html#​H1:​LQL]] - The Livestatus Query Language) for detailed LQL filter syntax). If more than one filter is specified, they are ANDed together. To get all hosts starting with "​api"​ in state OK (0): To filter the result set to records meeting some criteria, pass one or more Filter[] params. Each Filter is a urlencoded LQL filter (see the [mk-livestatus documentation]([[http://​mathias-kettner.com/​checkmk_livestatus.html#​H1:​LQL|http:​%%//​%%mathias-kettner.com/​checkmk_livestatus.html#​H1:​LQL]] - The Livestatus Query Language) for detailed LQL filter syntax). If more than one filter is specified, they are ANDed together. To get all hosts starting with "​api"​ in state OK (0):
  
-<​code>​http://​nems.local/​nems-api/​hosts?​Filter[]=name%20~%20%5Eapi&​Filter[]=state%20%3D%200</​code>​+<​code>​http://​nems.local/​nems-api/​hosts?​Filter[]=name ~ ^api&​Filter[]=state ​= 0</​code>​
  
 ==== Stats ==== ==== Stats ====
Line 88: Line 88:
 Stats queries allow you to get a count of objects matching a criteria. Stats queries return a list of counts and never take a Columns parameter. You can request several Stats with a single API call. You can also restrict the objects counted by adding Filters to your query. To count the number of hosts starting with "​api"​ in state OK: Stats queries allow you to get a count of objects matching a criteria. Stats queries return a list of counts and never take a Columns parameter. You can request several Stats with a single API call. You can also restrict the objects counted by adding Filters to your query. To count the number of hosts starting with "​api"​ in state OK:
  
-<​code>​http://​nems.local/​nems-api/​hosts?&​Stats[]=name%20~%20%5Eapi&​Filter[]=state%20%3D%200</​code>​+<​code>​http://​nems.local/​nems-api/​hosts?&​Stats[]=name ~ ^api&​Filter[]=state ​= 0</​code>​
  
 ===== Command Interface ===== ===== Command Interface =====
Line 114: Line 114:
 Existing scheduled downtimes for a host can be canceled. ''​%%cancel_downtime%%''​ expects the ''​%%downtime_id%%''​ parameter. Downtime IDs can be found by querying a host and extracting the ''​%%downtimes%%''​ array: Existing scheduled downtimes for a host can be canceled. ''​%%cancel_downtime%%''​ expects the ''​%%downtime_id%%''​ parameter. Downtime IDs can be found by querying a host and extracting the ''​%%downtimes%%''​ array:
  
-<​code>​curl -s https://​nems.local/​nems-api/​hosts?​Filter=name%20%3D%20my_host ​| jq '​.'​ | grep '​downtimes"'​ -A 2+<​code>​curl -s https://​nems.local/​nems-api/​hosts?​Filter=name ​= my_host ​| jq '​.'​ | grep '​downtimes"'​ -A 2
  
 "​downtimes":​ [ "​downtimes":​ [
  • features/nems-api.1535206366.txt.gz
  • Last modified: 2019/02/04 11:34
  • (external edit)