|
|
13 years ago | |
|---|---|---|
| lib | 13 years ago | |
| .gitignore | 13 years ago | |
| README.md | 13 years ago | |
| package.json | 13 years ago | |
Datadog API Node.JS Client modeled after Datadog/dogapi python client.
Official API Documentation: http://docs.datadoghq.com/api/
From NPM:
[sudo] npm install dogapi
From source:
git clone git://github.com/brettlangdon/node-dogapi.git
cd ./node-dogapi
npm install
dogapi implements all available functions in the official datadog api, http://docs.datadoghq.com/api/.
dogapi.stream(start, end, [[filter], callback])
dogapi.get_event(event_id, callback)
dogapi.add_event(event, callback)
dogapi.add_comment(comment, [callback])
dogapi.update_comment(comment_id, comment, callback)
dogapi.delete_comment(comment_id, callback)
dogapi.add_alert(alert, [callback])
dogapi.update_alert(alert_id, alert, [callback])
dogapi.get_alert(alert_id, [callback])
dogapi.delete_alert(alert_id, [callback])
dogapi.get_all_alerts([callback])
dogapi.mute_alerts([callback])
dogapi.unmute_alerts([callback])
dogapi.get_dashboard(dash_id, [callback])
dogapi.get_all_dashboards([callback])
dogapi.create_dashboard(dashboard, [callback])
dogapi.update_dashboard(dash_id, dashboard, [callback])
dash_iddogapi.delete_dashboard(dash_id, [callback])
dogapi.search(query, [callback])
metrics or hostsdogapi.add_metric(metric, [callback])
dogapi.add_metrics(metrics, [callback])
dogapi.all_tags([[source], callback])
dogapi.host_tags(host, [[source], callback])
hostdogapi.host_tags_by_source(host, [[source], callback])
dogapi.add_tags(host, tags, [[source], callback])
hostdogapi.update_tags(host, tags, [[source], callback])
hostdogapi.detach_tags(host, [[source], callback])
hostExample: get all events since this time yesterday:
var dogapi = require('dogapi');
var options = {
api_key: 'YOUR_KEY_HERE',
app_key: 'YOUR KEY_HERE',
};
var api = new dogapi(options);
var end = parseInt(new Date().getTime() / 1000);
var start = end - 86400;
api.stream(start, end, function(error, result, status_code){
if(error){
console.log('Error: ', error);
console.log('Status Code: ', status_code);
return;
}
result['events'].forEach(function(event){
console.log(event['id'] + ': ' + event['title']);
});
});