datadog-generic-monitors
Advanced tools
Comparing version 0.0.3 to 0.0.4
# Changelog | ||
## [0.0.2] - 2019-04-16 | ||
## [0.0.4] - 2019-04-18 | ||
### Added | ||
- More sophisticated way to add alert recipients. | ||
## [0.0.3] - 2019-04-16 | ||
### Fixed | ||
@@ -6,0 +12,0 @@ |
@@ -7,4 +7,4 @@ // Generated by dts-bundle v0.7.3 | ||
getAllMonitors(): Promise<IMonitorResponse[]>; | ||
createMonitor(config: IMonitorConfig): Promise<IMonitorResponse>; | ||
createMonitors(configs: IMonitorConfig[]): Promise<IMonitorResponse[]>; | ||
createMonitor(config: IMonitorConfigAndAlertRecipients): Promise<IMonitorResponse>; | ||
createMonitors(configs: IMonitorConfigAndAlertRecipients[]): Promise<IMonitorResponse[]>; | ||
deleteMonitorById(monitorId: number): Promise<IDeleteMonitorResponse>; | ||
@@ -24,9 +24,5 @@ deleteAllMonitors(): Promise<IDeleteMonitorResponse[]>; | ||
export interface IMonitorConfig { | ||
type: MonitorType; | ||
query: string; | ||
name: string; | ||
message: string; | ||
options?: IMonitorOptions; | ||
tags?: string[]; | ||
export interface IMonitorConfigAndAlertRecipients { | ||
monitorConfig: IMonitorConfig; | ||
alertRecipients?: string[]; | ||
} | ||
@@ -54,2 +50,11 @@ | ||
export interface IMonitorConfig { | ||
type: MonitorType; | ||
query: string; | ||
name: string; | ||
message: string; | ||
options?: IMonitorOptions; | ||
tags?: string[]; | ||
} | ||
export declare enum MonitorType { | ||
@@ -56,0 +61,0 @@ Anomaly = "query alert", |
@@ -156,3 +156,3 @@ import request from 'request'; | ||
DatadogGenericMonitors.prototype.createMonitor = function (config) { | ||
var body = JSON.stringify(config); | ||
var body = JSON.stringify(this.addAlertRecipientsToMonitorConfig(config)); | ||
return this.rest.post(this.url, body); | ||
@@ -183,2 +183,13 @@ }; | ||
}; | ||
DatadogGenericMonitors.prototype.addAlertRecipientsToMonitorConfig = function (_a) { | ||
var monitorConfig = _a.monitorConfig, alertRecipients = _a.alertRecipients; | ||
var monitorConfigWithAlertRecipients = __assign({}, monitorConfig); | ||
if (alertRecipients && alertRecipients.length > 0) { | ||
monitorConfigWithAlertRecipients.message = monitorConfigWithAlertRecipients.message + "\n\n"; | ||
} | ||
alertRecipients.forEach(function (alertRecipient) { | ||
return monitorConfigWithAlertRecipients.message = monitorConfigWithAlertRecipients.message + " @" + alertRecipient; | ||
}); | ||
return monitorConfigWithAlertRecipients; | ||
}; | ||
return DatadogGenericMonitors; | ||
@@ -244,3 +255,3 @@ }()); | ||
// tslint:disable-next-line: max-line-length | ||
message: "{{#is_alert}}##Alert{{/is_alert}} \n{{#is_warning}}##Warning{{/is_warning}} \n\nKey space hit rate for Redis service `" + databaseConfig.name + "` is {{comparator}} {{threshold}} .\n\n", | ||
message: "{{#is_alert}}##Alert{{/is_alert}} \n{{#is_warning}}##Warning{{/is_warning}} \n\nKey space hit rate for Redis service `" + databaseConfig.name + "` is {{comparator}} {{threshold}}.", | ||
options: { | ||
@@ -247,0 +258,0 @@ include_tags: true, |
@@ -162,3 +162,3 @@ 'use strict'; | ||
DatadogGenericMonitors.prototype.createMonitor = function (config) { | ||
var body = JSON.stringify(config); | ||
var body = JSON.stringify(this.addAlertRecipientsToMonitorConfig(config)); | ||
return this.rest.post(this.url, body); | ||
@@ -189,2 +189,13 @@ }; | ||
}; | ||
DatadogGenericMonitors.prototype.addAlertRecipientsToMonitorConfig = function (_a) { | ||
var monitorConfig = _a.monitorConfig, alertRecipients = _a.alertRecipients; | ||
var monitorConfigWithAlertRecipients = __assign({}, monitorConfig); | ||
if (alertRecipients && alertRecipients.length > 0) { | ||
monitorConfigWithAlertRecipients.message = monitorConfigWithAlertRecipients.message + "\n\n"; | ||
} | ||
alertRecipients.forEach(function (alertRecipient) { | ||
return monitorConfigWithAlertRecipients.message = monitorConfigWithAlertRecipients.message + " @" + alertRecipient; | ||
}); | ||
return monitorConfigWithAlertRecipients; | ||
}; | ||
return DatadogGenericMonitors; | ||
@@ -250,3 +261,3 @@ }()); | ||
// tslint:disable-next-line: max-line-length | ||
message: "{{#is_alert}}##Alert{{/is_alert}} \n{{#is_warning}}##Warning{{/is_warning}} \n\nKey space hit rate for Redis service `" + databaseConfig.name + "` is {{comparator}} {{threshold}} .\n\n", | ||
message: "{{#is_alert}}##Alert{{/is_alert}} \n{{#is_warning}}##Warning{{/is_warning}} \n\nKey space hit rate for Redis service `" + databaseConfig.name + "` is {{comparator}} {{threshold}}.", | ||
options: { | ||
@@ -253,0 +264,0 @@ include_tags: true, |
{ | ||
"name": "datadog-generic-monitors", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Create Datadog monitors configuration", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38083
5
731