Skip to content

Commit

Permalink
Fix screenboard template
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 committed Feb 26, 2019
1 parent 694725d commit f9cb3e8
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 204 deletions.
5 changes: 2 additions & 3 deletions screenboards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ func Example() {
// type = "query_value"
// x = "1"
// y = "1"
// title = "true"
// title_text = "Test title"
// title = "Test title"
// title_align = "right"
// title_size = "16"
// height = "5"
// width = "5"
// title_align = "right"
// time {
// live_span = "1d"
// }
Expand Down
54 changes: 40 additions & 14 deletions tmpl/monitor.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "datadog_monitor" "{{ .Id }}" {
name = "{{ .Name }}"
type = "{{ .Type }}"
{{ if .Tags }}
{{- if .Tags }}
tags = [{{range .Tags}}"{{.}}",{{end}}]
{{- end }}
message = <<EOT
Expand All @@ -12,23 +12,49 @@ EOT
query = {{ .Query | escapeCharacters }}

{{- with .Options }}
{{ if .NotifyNoData }}notify_no_data = {{ .NotifyNoData }}{{- end }}
{{ if .RenotifyInterval }}renotify_interval = {{ .RenotifyInterval }} {{- end }}
{{ if .NotifyAudit }}notify_audit = {{ .NotifyAudit }}{{- end }}
{{ if .TimeoutH }}timeout_h = {{ .TimeoutH }}{{- end }}
{{ if .IncludeTags }}include_tags = {{ .IncludeTags }}{{- end }}
{{ if .RequireFullWindow }}require_full_window = {{ .RequireFullWindow }}{{- end }}
{{ if .NewHostDelay }}new_host_delay = {{ .NewHostDelay }}{{- end }}
{{ if .EvaluationDelay }}evaluation_delay = {{ .EvaluationDelay }}{{- end }}
{{- if .NotifyNoData }}
notify_no_data = {{ .NotifyNoData }}
{{- end }}
{{- if .RenotifyInterval }}
renotify_interval = {{ .RenotifyInterval }}
{{- end }}
{{- if .NotifyAudit }}
notify_audit = {{ .NotifyAudit }}
{{- end }}
{{- if .TimeoutH }}
timeout_h = {{ .TimeoutH }}
{{- end }}
{{- if .IncludeTags }}
include_tags = {{ .IncludeTags }}
{{- end }}
{{- if .RequireFullWindow }}
require_full_window = {{ .RequireFullWindow }}
{{- end }}
{{- if .NewHostDelay }}
new_host_delay = {{ .NewHostDelay }}
{{- end }}
{{- if .EvaluationDelay }}
evaluation_delay = {{ .EvaluationDelay }}
{{- end }}

{{- if .Thresholds }}
{{- with .Thresholds }}
thresholds {
{{ if .Ok }}ok = {{ .Ok }}{{- end }}
{{ if .Warning }}warning = {{ .Warning }}{{- end }}
{{ if .WarningRecovery }}warning_recovery = {{ .WarningRecovery }}{{- end }}
{{ if .Critical }}critical = {{ .Critical }}{{- end }}
{{ if .CriticalRecovery }}critical_recovery = {{ .CriticalRecovery }}{{- end }}
{{- if .Ok }}
ok = {{ .Ok }}
{{- end }}
{{- if .Warning }}
warning = {{ .Warning }}
{{- end }}
{{- if .WarningRecovery }}
warning_recovery = {{ .WarningRecovery }}
{{- end }}
{{- if .Critical }}
critical = {{ .Critical }}
{{- end }}
{{- if .CriticalRecovery }}
critical_recovery = {{ .CriticalRecovery }}
{{- end }}
}
{{- end }}
{{- end }}
Expand Down
Loading

0 comments on commit f9cb3e8

Please sign in to comment.