|
|
|
|
@ -11,6 +11,7 @@ package datadog
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"strconv"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ThresholdCount struct {
|
|
|
|
|
@ -19,18 +20,34 @@ type ThresholdCount struct {
|
|
|
|
|
Warning json.Number `json:"warning,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type NoDataTimeframe int
|
|
|
|
|
|
|
|
|
|
func (tf *NoDataTimeframe) UnmarshalJSON(data []byte) error {
|
|
|
|
|
s := string(data)
|
|
|
|
|
if s == "false" {
|
|
|
|
|
*tf = 0
|
|
|
|
|
} else {
|
|
|
|
|
i, err := strconv.ParseInt(s, 10, 32)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
*tf = NoDataTimeframe(i)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Options struct {
|
|
|
|
|
NoDataTimeframe int `json:"no_data_timeframe,omitempty"`
|
|
|
|
|
NotifyAudit bool `json:"notify_audit,omitempty"`
|
|
|
|
|
NotifyNoData bool `json:"notify_no_data,omitempty"`
|
|
|
|
|
RenotifyInterval int `json:"renotify_interval,omitempty"`
|
|
|
|
|
Silenced map[string]int `json:"silenced,omitempty"`
|
|
|
|
|
TimeoutH int `json:"timeout_h,omitempty"`
|
|
|
|
|
EscalationMessage string `json:"escalation_message,omitempty"`
|
|
|
|
|
Thresholds ThresholdCount `json:"thresholds,omitempty"`
|
|
|
|
|
IncludeTags bool `json:"include_tags,omitempty"`
|
|
|
|
|
RequireFullWindow bool `json:"require_full_window,omitempty"`
|
|
|
|
|
Locked bool `json:"locked,omitempty"`
|
|
|
|
|
NoDataTimeframe NoDataTimeframe `json:"no_data_timeframe,omitempty"`
|
|
|
|
|
NotifyAudit bool `json:"notify_audit,omitempty"`
|
|
|
|
|
NotifyNoData bool `json:"notify_no_data,omitempty"`
|
|
|
|
|
RenotifyInterval int `json:"renotify_interval,omitempty"`
|
|
|
|
|
Silenced map[string]int `json:"silenced,omitempty"`
|
|
|
|
|
TimeoutH int `json:"timeout_h,omitempty"`
|
|
|
|
|
EscalationMessage string `json:"escalation_message,omitempty"`
|
|
|
|
|
Thresholds ThresholdCount `json:"thresholds,omitempty"`
|
|
|
|
|
IncludeTags bool `json:"include_tags,omitempty"`
|
|
|
|
|
RequireFullWindow bool `json:"require_full_window,omitempty"`
|
|
|
|
|
Locked bool `json:"locked,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Monitor allows watching a metric or check that you care about,
|
|
|
|
|
|