Browse Source

add infrastructure.search api

pull/14/head
Brett Langdon 11 years ago
parent
commit
6f3b077d49
2 changed files with 38 additions and 1 deletions
  1. +2
    -1
      lib/api/index.js
  2. +36
    -0
      lib/api/infrastructure.js

+ 2
- 1
lib/api/index.js View File

@ -3,7 +3,8 @@ var api = {
metric: require("./metric"),
event: require("./event"),
serviceCheck: require("./serviceCheck"),
user: require("./user")
user: require("./user"),
infrastructure: require("./infrastructure")
};
module.exports = function(obj){


+ 36
- 0
lib/api/infrastructure.js View File

@ -0,0 +1,36 @@
var client = require("../client");
/*section: infrastructure
*comment: |
* search for metrics or hosts
*params:
* query: |
* the query to use for search see [datadog docs](http://docs.datadoghq.com/api/#search)
* for examples of the query (e.g. "hosts:database", "metrics:system" or "test")
* callback: function(err, res)
*example: |
* ```javascript
* var dogapi = require("dogapi");
* var options = {
* api_key: "api_key",
* app_key: "app_key"
* };
* dogapi.initialize(options);
* dogapi.infrastructure.search("hosts:database", function(err, res){
* console.dir(res);
* });
* ```
*/
function search(query, callback){
var params = {
query: {
q: query
}
};
client.request("GET", "/search", params, callback);
}
module.exports = {
search: search
};

Loading…
Cancel
Save