Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
influxdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
influxdb
Commits
cf607dc6
Unverified
Commit
cf607dc6
authored
Sep 01, 2023
by
Paulo Dias
Committed by
GitHub
Sep 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Inputs Loop in Telegraf-DS like in Telegraf (#557)
parent
65564b14
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
23 deletions
+138
-23
Chart.yaml
charts/telegraf-ds/Chart.yaml
+1
-1
_helpers.tpl
charts/telegraf-ds/templates/_helpers.tpl
+110
-0
configmap.yaml
charts/telegraf-ds/templates/configmap.yaml
+1
-22
values.yaml
charts/telegraf-ds/values.yaml
+26
-0
No files found.
charts/telegraf-ds/Chart.yaml
View file @
cf607dc6
apiVersion
:
v1
apiVersion
:
v1
name
:
telegraf-ds
name
:
telegraf-ds
version
:
1.1.1
4
version
:
1.1.1
5
appVersion
:
1.27.4
appVersion
:
1.27.4
deprecated
:
false
deprecated
:
false
description
:
Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
description
:
Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
...
...
charts/telegraf-ds/templates/_helpers.tpl
View file @
cf607dc6
...
@@ -394,6 +394,116 @@ app.kubernetes.io/instance: {{ .Release.Name }}
...
@@ -394,6 +394,116 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
{{- define "inputs" -}}
{{- range $inputIdx, $configObject := . -}}
{{- range $input, $config := . -}}
[[inputs.{{- $input }}]]
{{- if $config -}}
{{- $tp := typeOf $config -}}
{{- if eq $tp "map[string]interface {}" -}}
{{- range $key, $value := $config -}}
{{- $tp := typeOf $value -}}
{{- if eq $tp "string" }}
{{ $key }} = {{ $value | quote }}
{{- end }}
{{- if eq $tp "float64" }}
{{ $key }} = {{ $value | int64 }}
{{- end }}
{{- if eq $tp "int" }}
{{ $key }} = {{ $value | int64 }}
{{- end }}
{{- if eq $tp "bool" }}
{{ $key }} = {{ $value }}
{{- end }}
{{- if eq $tp "[]interface {}" }}
{{- if eq (index $value 0 | typeOf) "map[string]interface {}" -}}
{{- range $b, $val := $value }}
[[inputs.{{- $input }}.{{- $key }}]]
{{- range $k, $v := $val }}
{{- $tps := typeOf $v }}
{{- if eq $tps "string" }}
{{ $k }} = {{ $v | quote }}
{{- end }}
{{- if eq $tps "float64" }}
{{ $k }} = {{ $v | int64 }}
{{- end }}
{{- if eq $tps "bool" }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{ $key }} = [
{{- $numOut := len $value }}
{{- $numOut := sub $numOut 1 }}
{{- range $b, $val := $value }}
{{- $i := int64 $b }}
{{- $tp := typeOf $val }}
{{- if eq $tp "string" }}
{{ $val | quote }}
{{- end }}
{{- if eq $tp "float64" }}
{{- if eq $key "percentiles" }}
{{- $xval := float64 (int64 $val) }}
{{- if eq $val $xval }}
{{ $val | int64 }}.0
{{- else }}
{{ $val | float64 }}
{{- end }}
{{- else }}
{{ $val | int64 }}
{{- end }}
{{- end }}
{{- if ne $i $numOut -}}
,
{{- end -}}
{{- end }}
]
{{- end }}
{{- end }}
{{- end }}
{{- range $key, $value := $config -}}
{{- $tp := typeOf $value -}}
{{- if eq $tp "map[string]interface {}" }}
[inputs.{{ $input }}.{{ $key }}]
{{- range $k, $v := $value }}
{{- $tps := typeOf $v }}
{{- if eq $tps "string" }}
{{ $k }} = {{ $v | quote }}
{{- end }}
{{- if eq $tps "[]interface {}"}}
{{ $k }} = [
{{- $numOut := len $v }}
{{- $numOut := sub $numOut 1 }}
{{- range $b, $val := $v }}
{{- $i := int64 $b }}
{{- if eq $i $numOut }}
{{ $val | quote }}
{{- else }}
{{ $val | quote }},
{{- end }}
{{- end }}
]
{{- end }}
{{- end }}
{{- range $k, $v := $value }}
{{- $tps := typeOf $v }}
{{- if eq $tps "map[string]interface {}"}}
[inputs.{{ $input }}.{{ $key }}.{{ $k }}]
{{- range $foo, $bar := $v }}
{{ $foo }} = {{ $bar | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{ end }}
{{- end }}
{{- end -}}
{
{
/*
{
{
/*
Create
the
name
of
the
service
account
to
use
Create
the
name
of
the
service
account
to
use
*/
}
}
*/
}
}
...
...
charts/telegraf-ds/templates/configmap.yaml
View file @
cf607dc6
...
@@ -16,31 +16,10 @@ data:
...
@@ -16,31 +16,10 @@ data:
{{ template "aggregators" .Values.config.aggregators }}
{{ template "aggregators" .Values.config.aggregators }}
{{ template "outputs" .Values.config.outputs }}
{{ template "outputs" .Values.config.outputs }}
{{ template "monitor_self" .Values.config.monitor_self }}
{{ template "monitor_self" .Values.config.monitor_self }}
{{ template "inputs" .Values.config.inputs }}
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.net]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
{{- if .Values.config.docker_endpoint }}
{{- if .Values.config.docker_endpoint }}
[[inputs.docker]]
[[inputs.docker]]
endpoint = {{ .Values.config.docker_endpoint | quote }}
endpoint = {{ .Values.config.docker_endpoint | quote }}
{{- end }}
{{- end }}
[[inputs.kubernetes]]
url = "https://$HOSTIP:10250"
bearer_token = "/var/run/secrets/kubernetes.io/serviceaccount/token"
insecure_skip_verify = true
{{
- end
}}
{{
- end
}}
charts/telegraf-ds/values.yaml
View file @
cf607dc6
...
@@ -133,6 +133,32 @@ config:
...
@@ -133,6 +133,32 @@ config:
logfile
:
"
"
logfile
:
"
"
hostname
:
"
$HOSTNAME"
hostname
:
"
$HOSTNAME"
omit_hostname
:
false
omit_hostname
:
false
inputs
:
-
diskio
:
{}
-
kernel
:
{}
-
mem
:
{}
-
net
:
{}
-
processes
:
{}
-
swap
:
{}
-
system
:
{}
-
cpu
:
percpu
:
true
totalcpu
:
true
collect_cpu_time
:
false
report_active
:
false
-
disk
:
ignore_fs
:
-
tmpfs
-
devtmpfs
-
devfs
-
iso9660
-
overlay
-
aufs
-
squashfs
-
kubernetes
:
url
:
"
https://$HOSTIP:10250"
bearer_token
:
"
/var/run/secrets/kubernetes.io/serviceaccount/token"
insecure_skip_verify
:
true
outputs
:
outputs
:
-
influxdb
:
-
influxdb
:
urls
:
urls
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment