diff --git a/index.html b/index.html index 55d4309..48666e4 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,8 @@ document.addEventListener("DOMContentLoaded", function(){hljs.initHighlightingOn
  • metric
  • +
  • monitor +
  • serviceCheck
  • tag @@ -337,6 +339,300 @@ dogapi.metric.query(then, now, query, function(err, res){ +
    +
    +

    monitor

    + +
    +

    create(type, query, properties, callback)

    +
    +

    create a new monitor

    +

    Parameters:

    +
    +
    type
    +

    one of "metric alert" or "service check"

    +
    +
    query
    +

    the monitor query to use, you probably want to read datadog's monitor create docs

    +
    +
    properties
    +

    optional, an object containing any of the following

    +
      +
    • name: the name of the monitor
    • +
    • message: the message for the monitor
    • +
    • options: an object, to see available options please see the monitor create docs
    • +
    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +var metricType = "metric alert";
    +var query = "avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100";
    +dogapi.monitor.create(metricType, query, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    get(monitorId, groupStates, callback)

    +
    +

    get an existing monitor's details

    +

    Parameters:

    +
    +
    monitorId
    +

    the id of the monitor

    +
    +
    groupStates
    +

    an array containing any of the following "all", "alert", "warn", or "no data"

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.get(1234, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    getAll(options, callback)

    +
    +

    get all monitors

    +

    Parameters:

    +
    +
    options
    +

    optional, an object containing any of the following

    +
      +
    • group_states: an array containing any of the following "all", "alert", "warn", or "no data"
    • +
    • tags: an array of "tag:value"'s to filter on
    • +
    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.getAll(function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    update(monitorId, query, properties, callback)

    +
    +

    update a monitor's details

    +

    Parameters:

    +
    +
    monitorId
    +

    the id of the monitor to edit

    +
    +
    query
    +

    the query that the monitor should have, see the monitor create docs for more info

    +
    +
    properties
    +

    optional, an object containing any of the following

    +
      +
    • name: the name of the monitor
    • +
    • message: the message for the monitor
    • +
    • options: an object, to see available options please see the monitor create docs
    • +
    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +var query = "avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100";
    +dogapi.monitor.update(1234, query, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    remove(monitorId, callback)

    +
    +

    delete an existing monitor

    +

    Parameters:

    +
    +
    monitorId
    +

    the id of the monitor to remove

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.remove(1234, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    mute(monitorId, options, callback)

    +
    +

    mute an existing monitor

    +

    Parameters:

    +
    +
    monitorId
    +

    the id of the monitor to mute

    +
    +
    options
    +

    optional, an object containing any of the following

    +
      +
    • scope: the scope to mute (e.g. "role:db")
    • +
    • end: POSIX timestamp indicating when the mute should end
    • +
    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.mute(1234, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    muteAll(callback)

    +
    +

    mute all monitors

    +

    Parameters:

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.muteAll(function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    unmute(monitorId, scope, callback)

    +
    +

    unmute an existing monitor

    +

    Parameters:

    +
    +
    monitorId
    +

    the id of the monitor to unmute

    +
    +
    scope
    +

    optional, a scope to apply the unmute to (e.g. "role:db")

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.unmute(1234, function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +
    +

    unmuteAll(callback)

    +
    +

    unmute all monitors

    +

    Parameters:

    +
    +
    callback
    +

    function(err, res)

    +
    +
    +
    +
    +
    var dogapi = require("dogapi");
    +var options = {
    +  api_key: "api_key",
    +  app_key: "app_key"
    +};
    +dogapi.initialize(options);
    +dogapi.monitor.unmuteAll(function(err, res){
    +  console.dir(res);
    +});
    +
    +
    +
    +

    serviceCheck

    @@ -392,14 +688,14 @@ dogapi.metric.query(then, now, query, function(err, res){

    tag

    -
    -

    get_all(source, callback)

    +
    +

    getAll(source, callback)

    get all host tags

    Parameters:

    @@ -419,7 +715,7 @@ var options = { app_key: "app_key" }; dogapi.initialize(options); -dogapi.tag.get_all(function(err, results){ +dogapi.tag.getAll(function(err, results){ console.dir(results); });