|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
<script type="text/javascript" src="//highlightjs.org/static/highlight.pack.js">
|
|
|
</script>
|
|
|
<script type="text/javascript">
|
|
|
document.addEventListener("DOMContentLoaded", function(){hljs.initHighlightingOnLoad();});</script>
|
|
|
<link rel="stylesheet" href="//highlightjs.org/static/styles/github.css" />
|
|
|
<link rel="stylesheet" href="//getbootstrap.com/dist/css/bootstrap.min.css" />
|
|
|
</head>
|
|
|
<body>
|
|
|
<a class="btn btn-default" href="#top" style="position:fixed;bottom:1rem;right:1rem;z-index:100000;color:#000">Jump To Top</a>
|
|
|
<div id="top" class="container-fluid">
|
|
|
<div class="row">
|
|
|
<div class="col-sm-12">
|
|
|
<h1>Node Dogapi</h1>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role=""><a href="#comment">comment</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#downtime">downtime</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#event">event</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#graph">graph</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#host">host</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#infrastructure">infrastructure</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#metric">metric</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#monitor">monitor</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#serviceCheck">serviceCheck</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#tag">tag</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#user">user</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#client">client</a>
|
|
|
</li>
|
|
|
<li role=""><a href="#dogapi">dogapi</a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
<section id="comment" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">comment</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#comment-create">create</a></li>
|
|
|
<li role"presentation"><a href="#comment-update">update</a></li>
|
|
|
<li role"presentation"><a href="#comment-remove">remove</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="comment-create">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">create(message, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>create a new comment</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>message</dt>
|
|
|
<dd><p>the message of the comment</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>handle: the handle to associate the comment with (e.g. "user@domain.com")</li>
|
|
|
<li>related_event_id: the event to associate the comment with</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.comment.create("a comment message", function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="comment-update">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">update(commentId, message, handle, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>update an existing comment</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>commentId</dt>
|
|
|
<dd><p>the id of the comment to update</p>
|
|
|
</dd>
|
|
|
<dt>message</dt>
|
|
|
<dd><p>the message of the comment</p>
|
|
|
</dd>
|
|
|
<dt>handle</dt>
|
|
|
<dd><p><em>optional</em>, the handle to associate the comment with (e.g. "user@domain.com")</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.comment.update(1234, "new message", function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="comment-remove">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">remove(commentId, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>remove a comment</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>commentId</dt>
|
|
|
<dd><p>the id of the comment to remove</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.comment.remove(1234, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="downtime" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">downtime</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#downtime-create">create</a></li>
|
|
|
<li role"presentation"><a href="#downtime-update">update</a></li>
|
|
|
<li role"presentation"><a href="#downtime-remove">remove</a></li>
|
|
|
<li role"presentation"><a href="#downtime-get">get</a></li>
|
|
|
<li role"presentation"><a href="#downtime-getAll">getAll</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="downtime-create">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">create(scope, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>schedule a new downtime</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>scope</dt>
|
|
|
<dd><p>string scope that the downtime should apply to (e.g. "env:staging")</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>start: POSIX timestamp for when the downtime should start</li>
|
|
|
<li>end: POSIX timestamp for when the downtime should end</li>
|
|
|
<li>message: a string message to accompany the downtime</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.downtime.create("env:staging", function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="downtime-update">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">update(downtimeId, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>update an existing downtime</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>downtimeId</dt>
|
|
|
<dd><p>the id the downtie to update</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>scope: the scope the downtime should be changed to (e.g. "env:staging")</li>
|
|
|
<li>start: POSIX timestamp for when the downtime should start</li>
|
|
|
<li>end: POSIX timestamp for when the downtime should end</li>
|
|
|
<li>message: a string message to accompany the downtime</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var properties = {
|
|
|
scope: "env:staging"
|
|
|
};
|
|
|
dogapi.downtime.update(1234, properties, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="downtime-remove">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">remove(downtimeId, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>delete a scheduled downtime</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>downtimeId</dt>
|
|
|
<dd><p>the id of the downtime</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.downtime.remove(1234, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="downtime-get">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">get(downtimeId, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get a scheduled downtimes details</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>downtimeId</dt>
|
|
|
<dd><p>the id of the downtime</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.downtime.get(1234, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="downtime-getAll">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">getAll(callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get all downtimes details</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.downtime.getAll(function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="event" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">event</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#event-create">create</a></li>
|
|
|
<li role"presentation"><a href="#event-get">get</a></li>
|
|
|
<li role"presentation"><a href="#event-query">query</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="event-create">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">create(title, text, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>create a new event</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>title</dt>
|
|
|
<dd><p>the title of the event</p>
|
|
|
</dd>
|
|
|
<dt>text</dt>
|
|
|
<dd><p>the body of the event</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p>an <em>optional</em> object continaing any of the following additional optional properties</p>
|
|
|
<ul>
|
|
|
<li>date_happened: POSIX timestamp of when it happened</li>
|
|
|
<li>priority: "normal" or "low" [defualt: "normal"]</li>
|
|
|
<li>host: the host name to associate with the event</li>
|
|
|
<li>tags: array of "tag:value"'s to associate with the event</li>
|
|
|
<li>alert_type: "error", "warning", "info" or "success" [defualt: "info"]</li>
|
|
|
<li>aggregation_key: an arbitrary string used to aggregate like events</li>
|
|
|
<li>source_type_name: options: "nagios", "hudson", "jenkins", "user", "my apps", "feed", "chef", "puppet", "git", "bitbucket", "fabric", "capistrano"</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript"> var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var title = "some new event";
|
|
|
var text = "IT HAPPENED!";
|
|
|
dogapi.event.create(title, text, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
title = "another event";
|
|
|
text = "IT HAPPENED AGAIN!";
|
|
|
var properties = {
|
|
|
tags: ["some:tag"],
|
|
|
alert_type: "error"
|
|
|
};
|
|
|
dogapi.event.create(title, text, properties, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="event-get">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">get(eventId, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get event details from the provided event id</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>eventId</dt>
|
|
|
<dd><p>the id of the event to fetch</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript"> var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.event.get(10005, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="event-query">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">query(start, end, parameters, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>query the event stream</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>start</dt>
|
|
|
<dd><p>POSIX timestamp for start of query</p>
|
|
|
</dd>
|
|
|
<dt>end</dt>
|
|
|
<dd><p>POSIX timestamp for end of query</p>
|
|
|
</dd>
|
|
|
<dt>parameters</dt>
|
|
|
<dd><p><em>optional</em> parameters to use for the query</p>
|
|
|
<ul>
|
|
|
<li>priority: "low" or "normal"</li>
|
|
|
<li>sources: comma separated list of sources (e.g. "jenkins,user")</li>
|
|
|
<li>tags: comma separated list of tags (e.g. "tag:value1,tag:value2")</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript"> var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var now = parseInt(new Date().getTime() / 1000);
|
|
|
var then = now - 3600; // an hour ago
|
|
|
var parameters = {
|
|
|
tags: "some:tag",
|
|
|
sources: "jenkins"
|
|
|
};
|
|
|
dogapi.event.query(then, now, parameters, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="graph" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">graph</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#graph-snapshot">snapshot</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="graph-snapshot">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">snapshot(query, from, to, eventQuery, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>take a snapshot of a metric query</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>query</dt>
|
|
|
<dd><p>the metric query to use for the snapshot</p>
|
|
|
</dd>
|
|
|
<dt>from</dt>
|
|
|
<dd><p>POSIX timestamp for the beginning of the query</p>
|
|
|
</dd>
|
|
|
<dt>to</dt>
|
|
|
<dd><p>POSIX timestamp for the end of the query</p>
|
|
|
</dd>
|
|
|
<dt>eventQuery</dt>
|
|
|
<dd><p><em>optional</em>, an event query to overlay event bands on the snapshot</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var query = "system.cpu.idle{*}";
|
|
|
var to = dogapi.now();
|
|
|
var from = from - 3600; // an hour ago
|
|
|
dogapi.graph.snapshot(query, from, to, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="host" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">host</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#host-mute">mute</a></li>
|
|
|
<li role"presentation"><a href="#host-unmute">unmute</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="host-mute">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">mute(hostname, options, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>mute the given host, if it is not already muted</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname of the host to mute</p>
|
|
|
</dd>
|
|
|
<dt>options</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>end: POSIX timestamp for when the mute should end</li>
|
|
|
<li>override: whether or not to override the end for an existing mute</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.host.mute("my.host.name", function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="host-unmute">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">unmute(hostname, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>unmute the given host, if it is not already unmuted</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname of the host to unmute</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.host.unmute("my.host.name", function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="infrastructure" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">infrastructure</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#infrastructure-search">search</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="infrastructure-search">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">search(query, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>search for metrics or hosts</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>query</dt>
|
|
|
<dd><p>the query to use for search see <a href="http://docs.datadoghq.com/api/#search">datadog docs</a>
|
|
|
for examples of the query (e.g. "hosts:database", "metrics:system" or "test")</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="metric" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">metric</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#metric-send">send</a></li>
|
|
|
<li role"presentation"><a href="#metric-send_all">send_all</a></li>
|
|
|
<li role"presentation"><a href="#metric-query">query</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="metric-send">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">send(metric, points, extra, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>submit a new metric</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>metric</dt>
|
|
|
<dd><p>the metric name</p>
|
|
|
</dd>
|
|
|
<dt>points</dt>
|
|
|
<dd><p>single datapoint or array of [timestamp, datapoint], if a single point
|
|
|
is given "now" is used as the timestamp</p>
|
|
|
</dd>
|
|
|
<dt>extra</dt>
|
|
|
<dd><p><em>optional</em>, object which can contain the following keys</p>
|
|
|
<ul>
|
|
|
<li>host: the host source of the metric</li>
|
|
|
<li>tags: array of "tag:value"'s to use for the metric</li>
|
|
|
<li>metric_type: which metric type to use ("gauge" or "counter") [default: gauge]</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.metric.send("my.metric", 1000, function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
var now = parseInt(new Date().getTime() / 1000);
|
|
|
dogapi.metric.send("my.metric", [now, 1000], function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="metric-send_all">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">send_all(metrics, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>send a list of metrics</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>metrics</dt>
|
|
|
<dd><p>an array of metrics where each element is an object with the following keys</p>
|
|
|
<ul>
|
|
|
<li>metric: the name of the metric</li>
|
|
|
<li>points: a single datapoint or an array of [timestamp, datapoint] (same as <code>dogapi.metric.send</code>)</li>
|
|
|
<li>tags: an array of "tag:value"'s</li>
|
|
|
<li>host: the source hostname to use for the metrics</li>
|
|
|
<li>metric_type: the type of metric to use ("gauge" or "counter") [default: gauge]</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var now = parseInt(new Date().getTime() / 1000);
|
|
|
var metrics = [
|
|
|
{
|
|
|
metric: "my.metric",
|
|
|
points: [now, 1000],
|
|
|
tags: ["tag:value"]
|
|
|
},
|
|
|
{
|
|
|
metric: "another.metric",
|
|
|
points: 1000
|
|
|
}
|
|
|
];
|
|
|
dogapi.metric.send_all(metrics, function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="metric-query">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">query(from, to, query, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>make a metric query</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>from</dt>
|
|
|
<dd><p>POSIX timestamp for start of query</p>
|
|
|
</dd>
|
|
|
<dt>to</dt>
|
|
|
<dd><p>POSIX timestamp for end of query</p>
|
|
|
</dd>
|
|
|
<dt>query</dt>
|
|
|
<dd><p>the string query to perform (e.g. "system.cpu.idle{*}by{host}")</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var now = parseInt(new Date().getTime() / 1000);
|
|
|
var then = now - 3600; // one hour ago
|
|
|
var query = "system.cpu.idle{*}by{host}";
|
|
|
dogapi.metric.query(then, now, query, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="monitor" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">monitor</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#monitor-create">create</a></li>
|
|
|
<li role"presentation"><a href="#monitor-get">get</a></li>
|
|
|
<li role"presentation"><a href="#monitor-getAll">getAll</a></li>
|
|
|
<li role"presentation"><a href="#monitor-update">update</a></li>
|
|
|
<li role"presentation"><a href="#monitor-remove">remove</a></li>
|
|
|
<li role"presentation"><a href="#monitor-mute">mute</a></li>
|
|
|
<li role"presentation"><a href="#monitor-muteAll">muteAll</a></li>
|
|
|
<li role"presentation"><a href="#monitor-unmute">unmute</a></li>
|
|
|
<li role"presentation"><a href="#monitor-unmuteAll">unmuteAll</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="monitor-create">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">create(type, query, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>create a new monitor</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>type</dt>
|
|
|
<dd><p>one of "metric alert" or "service check"</p>
|
|
|
</dd>
|
|
|
<dt>query</dt>
|
|
|
<dd><p>the monitor query to use, you probably want to read datadog's <a href="http://docs.datadoghq.com/api/#monitor-create">monitor create</a> docs</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>name: the name of the monitor</li>
|
|
|
<li>message: the message for the monitor</li>
|
|
|
<li>options: an object, to see available options please see the <a href="http://docs.datadoghq.com/api/#monitor-create">monitor create</a> docs</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-get">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">get(monitorId, groupStates, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get an existing monitor's details</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>monitorId</dt>
|
|
|
<dd><p>the id of the monitor</p>
|
|
|
</dd>
|
|
|
<dt>groupStates</dt>
|
|
|
<dd><p>an array containing any of the following "all", "alert", "warn", or "no data"</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-getAll">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">getAll(options, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get all monitors</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>options</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>group_states: an array containing any of the following "all", "alert", "warn", or "no data"</li>
|
|
|
<li>tags: an array of "tag:value"'s to filter on</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-update">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">update(monitorId, query, properties, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>update a monitor's details</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>monitorId</dt>
|
|
|
<dd><p>the id of the monitor to edit</p>
|
|
|
</dd>
|
|
|
<dt>query</dt>
|
|
|
<dd><p>the query that the monitor should have, see the <a href="http://docs.datadoghq.com/api/#monitor-create">monitor create</a> docs for more info</p>
|
|
|
</dd>
|
|
|
<dt>properties</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>name: the name of the monitor</li>
|
|
|
<li>message: the message for the monitor</li>
|
|
|
<li>options: an object, to see available options please see the <a href="http://docs.datadoghq.com/api/#monitor-create">monitor create</a> docs</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-remove">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">remove(monitorId, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>delete an existing monitor</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>monitorId</dt>
|
|
|
<dd><p>the id of the monitor to remove</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-mute">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">mute(monitorId, options, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>mute an existing monitor</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>monitorId</dt>
|
|
|
<dd><p>the id of the monitor to mute</p>
|
|
|
</dd>
|
|
|
<dt>options</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>scope: the scope to mute (e.g. "role:db")</li>
|
|
|
<li>end: POSIX timestamp indicating when the mute should end</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-muteAll">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">muteAll(callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>mute all monitors</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-unmute">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">unmute(monitorId, scope, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>unmute an existing monitor</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>monitorId</dt>
|
|
|
<dd><p>the id of the monitor to unmute</p>
|
|
|
</dd>
|
|
|
<dt>scope</dt>
|
|
|
<dd><p><em>optional</em>, a scope to apply the unmute to (e.g. "role:db")</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="monitor-unmuteAll">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">unmuteAll(callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>unmute all monitors</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">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);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="serviceCheck" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">serviceCheck</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#serviceCheck-check">check</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="serviceCheck-check">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">check(check, hostName, status, parameters, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>post an update to a service check</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>check</dt>
|
|
|
<dd><p>the check name (e.g. "app.ok")</p>
|
|
|
</dd>
|
|
|
<dt>hostName</dt>
|
|
|
<dd><p>the name of the host submitting the check</p>
|
|
|
</dd>
|
|
|
<dt>status</dt>
|
|
|
<dd><p>one of <code>dogapi.OK</code>, <code>dogapi.WARNING</code>, <code>dogapi.CRITICAL</code> or <code>dogapi.UNKNOWN</code></p>
|
|
|
</dd>
|
|
|
<dt>parameters</dt>
|
|
|
<dd><p><em>optional</em>, an object containing any of the following</p>
|
|
|
<ul>
|
|
|
<li>timestamp: POSIX timestamp for when the check happened</li>
|
|
|
<li>message: string message to accompany the check</li>
|
|
|
<li>tags: an array of "tag:value"'s associated with the check</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript"> var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var check = "app.ok";
|
|
|
var hostName = "some.machine";
|
|
|
dogapi.serviceCheck.check(
|
|
|
check, hostName, dogapi.WARNING, function(err, res){
|
|
|
console.dir(res);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="tag" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">tag</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#tag-getAll">getAll</a></li>
|
|
|
<li role"presentation"><a href="#tag-get">get</a></li>
|
|
|
<li role"presentation"><a href="#tag-create">create</a></li>
|
|
|
<li role"presentation"><a href="#tag-update">update</a></li>
|
|
|
<li role"presentation"><a href="#tag-remove">remove</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="tag-getAll">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">getAll(source, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get all host tags</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>source</dt>
|
|
|
<dd><p><em>optional</em>, only show tags for a particular source [default: null]</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function callback(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.tag.getAll(function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="tag-get">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">get(hostname, options, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get the host tags for a provided host name or host id</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname or host id</p>
|
|
|
</dd>
|
|
|
<dt>options</dt>
|
|
|
<dd><p><em>optional</em>, an object of options for the query allowing the following</p>
|
|
|
<ul>
|
|
|
<li>source: the source of the tags (e.g. chef, puppet, users, etc) [default: null]</li>
|
|
|
<li>by_source: whether or not to group the results by source [default: false]</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function callback(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.tag.get("host.name", function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="tag-create">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">create(hostname, tags, source, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>assign new host tags to the provided host name or host id</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname or host id</p>
|
|
|
</dd>
|
|
|
<dt>tags</dt>
|
|
|
<dd><p>list of <code><tag>:<value></code> tags to assign to the server</p>
|
|
|
</dd>
|
|
|
<dt>source</dt>
|
|
|
<dd><p><em>optional</em>, the source of the tags (e.g. chef, puppet, etc) [default: users]</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function callback(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.tag.create("host.name", ["role:webserver"], function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="tag-update">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">update(hostname, tags, source, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>update the host tags for the provided host name or host id</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname or host id</p>
|
|
|
</dd>
|
|
|
<dt>tags</dt>
|
|
|
<dd><p>list of <code><tag>:<value></code> tags to assign to the server</p>
|
|
|
</dd>
|
|
|
<dt>source</dt>
|
|
|
<dd><p><em>optional</em>, the source of the tags (e.g. chef, puppet, etc) [default: users]</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function callback(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.tag.update("host.name", function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="tag-remove">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">remove(hostname, source, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>delete the host tags for the provided host name or host id</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>hostname</dt>
|
|
|
<dd><p>the hostname or host id</p>
|
|
|
</dd>
|
|
|
<dt>source</dt>
|
|
|
<dd><p><em>optional</em>, the source of the tags (e.g. chef, puppet, etc) [default: users]</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function callback(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.tag.remove("host.name", function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="user" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">user</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#user-invite">invite</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="user-invite">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">invite(emails, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>invite users via e-mail</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>emails</dt>
|
|
|
<dd><p>an array of email addresses to send invites to</p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function(err, res)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
var emails = ["me@domain.com", "you@domain.com"];
|
|
|
dogapi.user.invite(emails, fuction(err, res){
|
|
|
console.dir(res):
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="client" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">client</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#client-client">client</a></li>
|
|
|
<li role"presentation"><a href="#client-request">request</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="client-client">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">client()</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>the constructor for <em>client</em> object</p>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<p>See <a href="#client-request">client.request</a></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="client-request">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">request(method, path, params, callback)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>used to make a raw request to the datadog api</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>method</dt>
|
|
|
<dd><p>http method GET, POST, PUT, DELETE</p>
|
|
|
</dd>
|
|
|
<dt>path</dt>
|
|
|
<dd><p>the api url path e.g. /tags/hosts</p>
|
|
|
</dd>
|
|
|
<dt>params</dt>
|
|
|
<dd><p>an object which allows the keys <code>query</code> or <code>body</code></p>
|
|
|
</dd>
|
|
|
<dt>callback</dt>
|
|
|
<dd><p>function to call on success/failure callback(err, result)</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "api_key",
|
|
|
app_key: "app_key"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.client.request("GET", "/url/path", {}, function(err, results){
|
|
|
console.dir(results);
|
|
|
});
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="dogapi" class="col-sm-12">
|
|
|
<div class="row">
|
|
|
<h2 class="bg-primary" style="text-indent:1rem">dogapi</h2></div>
|
|
|
<ul class="nav nav-pills">
|
|
|
<li role"presentation"><a href="#dogapi-initialize">initialize</a></li>
|
|
|
<li role"presentation"><a href="#dogapi-now">now</a></li>
|
|
|
</ul>
|
|
|
<div class="function row" id="dogapi-initialize">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">initialize(options)</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>configure the dogapi client with your app/api keys</p>
|
|
|
<h4>Parameters:</h4>
|
|
|
<dl>
|
|
|
<dt>options</dt>
|
|
|
<dd><p>An object which allows you to override the default set parameters for interacting
|
|
|
with the datadog api. The available options are.</p>
|
|
|
<ul>
|
|
|
<li>api_key: your api key</li>
|
|
|
<li>app_key: your app key</li>
|
|
|
<li>api_version: the version of the api [default: <code>v1</code>]</li>
|
|
|
<li>api_host: the host to call [default: <code>api.datadoghq.com</code>]</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
var options = {
|
|
|
api_key: "<API_KEY_HERE>",
|
|
|
app_key: "<APP_KEY_HERE>"
|
|
|
};
|
|
|
dogapi.initialize(options);
|
|
|
dogapi.event.create(...);
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="function row" id="dogapi-now">
|
|
|
<h3 class="bg-info" style="text-indent:.5rem;padding:.5rem;margin-top:.5rem">now()</h3>
|
|
|
<div class="col-md-6">
|
|
|
<p>get the current POSIX timestamp</p>
|
|
|
</div>
|
|
|
<div class="col-md-6">
|
|
|
<pre><code class="lang-javascript">var dogapi = require("dogapi");
|
|
|
dogapi.now();
|
|
|
// this is the same as
|
|
|
parseInt(new Date().getTime() / 1000);
|
|
|
</code></pre>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
|
<a href="https://github.com/brettlangdon/node-dogapi"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a></body></html>
|