-
Notifications
You must be signed in to change notification settings - Fork 0
/
telegraf.toml.tmpl
50 lines (39 loc) · 1.03 KB
/
telegraf.toml.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{{ $module := .Module -}}
# MIB {{.Module}} converted at {{ now }}
{{ if .Enums -}}
[[processors.enum]]
order = 10
namepass = ["snmp_trap"]
tagpass = { mib = ["{{.Module}}"] }
{{- range .Enums }}
# Translate {{.Module}}::{{.Name}} (.{{.Oid}})
[[processors.enum.mapping]]
## Name of the field to map
field = "{{.Name}}"
## Table of mappings
[processors.enum.mapping.value_mappings]
{{- range $value, $name := .Values }}
{{$value}} = "{{$name}}"
{{- end }}
{{- end }}
{{ end -}}
{{- if .Fields }}
[[processors.converter]]
order = 20
namepass = ["snmp_trap"]
tagpass = { mib = ["{{.Module}}"] }
[processors.converter.fields]
tag = ["{{ join .Fields "\", \"" }}"]
{{ end -}}
{{- range .Traps }}
# Prepare message for {{$module}}::{{.Name}} (.{{.Oid}})
[[processors.template]]
order = 30
namepass = ["snmp_trap"]
tagpass = { trap = ["{{$module}}::{{.Name}}"] }
tag = "message"
template = '''{{.Description}}
{{- range .Fields }}
{{.}}:{{ "{{" }} .Tag "{{.}}" {{ "}}" }}
{{- end }}'''
{{ end }}