diff --git a/stable/telegraf/.helmignore b/stable/telegraf/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/telegraf/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/telegraf/Chart.yaml b/stable/telegraf/Chart.yaml new file mode 100755 index 0000000000..076710cffb --- /dev/null +++ b/stable/telegraf/Chart.yaml @@ -0,0 +1,13 @@ +name: telegraf +version: 0.1.0 +description: Chart for Telegraf Kubernetes deployments +keywords: +- telegraf +- collector +- timeseries +- influxdata +home: https://www.influxdata.com/time-series-platform/telegraf/ +maintainers: +- name: Jack Zampolin + email: jack@influxdb.com +engine: gotpl \ No newline at end of file diff --git a/stable/telegraf/README.md b/stable/telegraf/README.md new file mode 100644 index 0000000000..9b7c72f9cf --- /dev/null +++ b/stable/telegraf/README.md @@ -0,0 +1,174 @@ +# Telegraf + +[Telegraf](https://github.com/influxdata/telegraf) is a plugin-driven server agent written by the folks over at [InfluxData](https://influxdata.com) for collecting & reporting metrics. + +## TL;DR + +```console +$ helm install stable/telegraf +``` + +## Introduction + +This chart bootstraps a `telegraf` deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/telegraf +``` + +The command deploys Telegraf on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The default configuration parameters are listed in `values.yaml`. To change the defaults, specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set single.enabled=false \ + stable/telegraf +``` + +The above command prevents the single telegraf instance from deploying. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml stable/telegraf +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Telegraf Configuration + +This chart deploys the following by default: + +- `telegraf` (`telegraf-ds`) running in a daemonset with the following plugins enabled + * [`cpu`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`disk`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`docker`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker) + * [`diskio`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`kernel`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`kubernetes`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/kubernetes) + * [`mem`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`processes`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`swap`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`system`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + +- A single `telegraf` deployment (`telegraf-s`) with an associated service running the following plugins: + * [`prometheus`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus) + * [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb) + * [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) + + +### Supported Outputs + +The following telegraf output plugins are supported for both the daemonset and the single instance. To enable them uncomment them in `.Values.{{ "daemonset" | "single" }}.outputs`: + +- [`amqp`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/amqp) +- [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb) +- [`kafka`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/kafka) +- [`mqtt`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/mqtt) +- [`nats`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nats) +- [`nsq`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nsq) + +### Service Plugins - Single Instance + +The single telegraf also supports all service plugins. To enable them uncomment the named plugin in `.Values.single.inputs` section. The associated service exposes the ports if it is enabled: + +- [`tcp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tcp_listener) +- [`udp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/udp_listener) +- [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) +- [`http_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener) + +### Supported Inputs - Single Instance + +To enable additional input plugins uncomment them in the `.Values.single.inputs` section. The input plugins supported by the single telegraf instance are as follows: + +- [`aerospike`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/aerospike) +- [`apache`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/apache) +- [`cassandra`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cassandra) +- [`cloudwatch`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cloudwatch) +- [`consul`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/consul) +- [`couchbase`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchbase) +- [`couchdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchdb) +- [`disque`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/disque) +- [`dns_query`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dns_query) +- [`dovecot`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dovecot) +- [`elasticsearch`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/elasticsearch) +- [`graylog`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/graylog) +- [`haproxy`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/haproxy) +- [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb) +- [`lustre2`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/lustre2) +- [`mailchimp`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mailchimp) +- [`memcached`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/memcached) +- [`mesos`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mesos) +- [`mongodb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mongodb) +- [`mysql`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mysql) +- [`net_response`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/net_response) +- [`nginx`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nginx) +- [`nsq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nsq) +- [`phpfpm`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/phpfpm) +- [`ping`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ping) +- [`postgresql`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/postgresql) +- [`prometheus`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus) +- [`rabbitmq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rabbitmq) +- [`raindrops`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/raindrops) +- [`redis`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/redis) +- [`rethinkdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rethinkdb) +- [`riak`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/riak) +- [`sqlserver`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sqlserver) +- [`twemproxy`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/twemproxy) +- [`zookeeper`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zookeeper) +- [`http_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener) +- [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) +- [`tcp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tcp_listener) +- [`udp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/udp_listener) +- [`webhooks`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks) + +### Future work: + +There are a couple of additional plugins that could/should possibly be supported but are not yet: +- `telegraf-s` + - [`smnp`](https://github.com/influxdata/telegraf/tree/master/plugins/smnp) +- `telegraf-ds` + - [`jolokia`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/jolokia) + - [`bcache`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/bcache) + - [`cgroup`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cgroup) + - [`conntrack`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/conntrack) + - [`exec`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/exec) + - [`filestat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/filestat) + - [`hddtemp`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/hddtemp) + - [`ipmi_sensor`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ipmi_sensor) + - [`iptables`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/iptables) + - [`leofs`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/leofs) + - [`logparser`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/logparser) + - [`nstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nstat) + - [`ntpq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ntpq) + - [`passenger`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/passenger) + - [`powerdns`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/powerdns) + - [`procstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/procstat) + - [`puppetagent`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/puppetagent) + - [`sysstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sysstat) + - [`varnish`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/varnish) + - [`win_perf_counters`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters) + - [`zfs`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zfs) diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt new file mode 100644 index 0000000000..d98cf612e4 --- /dev/null +++ b/stable/telegraf/templates/NOTES.txt @@ -0,0 +1,25 @@ +To open a shell session in the container running Telegraf run the following: + +- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh + +To tail the logs for a Telegraf pod in the Daemonset run the following: + +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }}-ds -o jsonpath='{ .items[0].metadata.name }') + +{{- if eq .Values.single.service.type "LoadBalancer" }} + +To watch for the LoadBalancer IP run the following + +- kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} +{{- end }} + +{{- if empty .Values.single.config.outputs.influxdb.urls }} +{{- if empty .Values.daemonset.config.outputs.influxdb.urls }} + +Need to set an InfluxDB url for either single or daemonset to deploy this instance: + +.Values.daemonset.config.outputs.influxdb.urls +.Values.single.config.outputs.influxdb.urls + +{{- end }} +{{- end }} \ No newline at end of file diff --git a/stable/telegraf/templates/_helpers.tpl b/stable/telegraf/templates/_helpers.tpl new file mode 100644 index 0000000000..46f2741621 --- /dev/null +++ b/stable/telegraf/templates/_helpers.tpl @@ -0,0 +1,164 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- end -}} + +{{/* + CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file. + - global_tags section + - agent section +*/}} + +{{- define "global_tags" -}} +{{- if . -}} +[global_tags] + {{- range $key, $val := . }} + {{ $key }} = {{ $val | quote }} + {{- end }} +{{- end }} +{{- end -}} + +{{- define "agent" -}} +[agent] +{{- range $key, $value := . -}} + {{- $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 }} +{{- end }} +{{- end -}} + +{{- define "outputs" -}} +{{- range $output, $config := . }} + [[outputs.{{ $output }}]] + {{- if $config }} + {{- 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 {}" }} + {{ $key }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $value }} + {{- $i := int64 $b }} + {{- if eq $i $numOut }} + {{ $val | quote }} + {{- else }} + {{ $val | quote }}, + {{- end }} + {{- end }} + ] + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end -}} + +{{- define "inputs" -}} +{{- range $input, $config := . -}} + [[inputs.{{- $input }}]] + {{- if $config -}} + {{- 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 {}" }} + {{ $key }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $value }} + {{- $i := int64 $b }} + {{- $tp := typeOf $val }} + {{- if eq $i $numOut }} + {{- if eq $tp "string" }} + {{ $val | quote }} + {{- end }} + {{- if eq $tp "float64" }} + {{ $val | int64 }} + {{- end }} + {{- else }} + {{- if eq $tp "string" }} + {{ $val | quote }}, + {{- end}} + {{- if eq $tp "float64" }} + {{ $val | int64 }}, + {{- end }} + {{- end }} + {{- end }} + ] + {{- end }} + {{- if eq $tp "map[string]interface {}" }} + [[inputs.{{ $input }}.{{ $key }}]] + {{- range $k, $v := $value }} + {{- $tps := typeOf $v }} + {{- if eq $tps "string" }} + {{ $k }} = {{ $v }} + {{- end }} + {{- if eq $tps "[]interface {}"}} + {{ $k }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $v }} + {{- $i := int64 $b }} + {{- if eq $i $numOut }} + {{ $val | quote }} + {{- else }} + {{ $val | quote }}, + {{- end }} + {{- end }} + ] + {{- end }} + {{- 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 -}} \ No newline at end of file diff --git a/stable/telegraf/templates/configmap-s.yaml b/stable/telegraf/templates/configmap-s.yaml new file mode 100644 index 0000000000..9cd61540ba --- /dev/null +++ b/stable/telegraf/templates/configmap-s.yaml @@ -0,0 +1,19 @@ +{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} +{{- if .Values.single.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-s + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + telegraf.conf: |+ + {{ template "global_tags" .Values.single.config.global_tags }} + {{ template "agent" .Values.single.config.agent }} + {{ template "outputs" .Values.single.config.outputs }} + {{ template "inputs" .Values.single.config.inputs -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/conifgmap-ds.yaml b/stable/telegraf/templates/conifgmap-ds.yaml new file mode 100644 index 0000000000..1c7efff333 --- /dev/null +++ b/stable/telegraf/templates/conifgmap-ds.yaml @@ -0,0 +1,19 @@ +{{- if gt (len .Values.daemonset.config.outputs.influxdb.urls) 0 }} +{{- if .Values.daemonset.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-ds + labels: + app: {{ template "fullname" . }}-ds + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + telegraf.conf: |+ + {{ template "global_tags" .Values.daemonset.config.global_tags }} + {{ template "agent" .Values.daemonset.config.agent }} + {{ template "outputs" .Values.daemonset.config.outputs }} + {{ template "inputs" .Values.daemonset.config.inputs -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/daemonset.yaml b/stable/telegraf/templates/daemonset.yaml new file mode 100644 index 0000000000..2cac86e94e --- /dev/null +++ b/stable/telegraf/templates/daemonset.yaml @@ -0,0 +1,64 @@ +{{- if gt (len .Values.daemonset.config.outputs.influxdb.urls) 0 }} +{{- if .Values.daemonset.enabled -}} +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: {{ template "fullname" . }}-ds + labels: + app: {{ template "fullname" . }}-ds + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" +spec: + template: + metadata: + labels: + app: {{ template "fullname" . }}-ds + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }} + resources: +{{ toYaml .Values.daemonset.resources | indent 10 }} + env: + - name: HOSTNAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: "HOST_PROC" + value: "/rootfs/proc" + - name: "HOST_SYS" + value: "/rootfs/sys" + volumeMounts: + - name: sysro + mountPath: /rootfs/sys + readOnly: true + - name: procro + mountPath: /rootfs/proc + readOnly: true + - name: docker-socket + mountPath: /var/run/docker.sock + # readOnly: true + - name: varrunutmpro + mountPath: /var/run/utmp + readOnly: true + - name: config + mountPath: /etc/telegraf + volumes: + - name: sysro + hostPath: + path: /sys + - name: docker-socket + hostPath: + path: /var/run/docker.sock + - name: procro + hostPath: + path: /proc + - name: varrunutmpro + hostPath: + path: /var/run/utmp + - name: config + configMap: + name: {{ template "fullname" . }}-ds +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/deployment.yaml b/stable/telegraf/templates/deployment.yaml new file mode 100644 index 0000000000..01f488e487 --- /dev/null +++ b/stable/telegraf/templates/deployment.yaml @@ -0,0 +1,32 @@ +{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} +{{- if .Values.single.enabled -}} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }}-s + labels: + app: {{ template "fullname" . }}-s + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }}-s + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }} + resources: +{{ toYaml .Values.single.resources | indent 10 }} + volumeMounts: + - name: config + mountPath: /etc/telegraf + volumes: + - name: config + configMap: + name: {{ template "fullname" . }}-s +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/service.yaml b/stable/telegraf/templates/service.yaml new file mode 100644 index 0000000000..dad0685032 --- /dev/null +++ b/stable/telegraf/templates/service.yaml @@ -0,0 +1,42 @@ +{{- if .Values.single.enabled -}} +{{- if .Values.single.service.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }}-s + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + type: {{ .Values.single.service.type }} + ports: + {{- range $key, $value := .Values.single.config.inputs }} + {{- if eq $key "http_listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "http-listener" + {{- end }} + {{- if eq $key "statsd" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "statsd" + {{- end }} + {{- if eq $key "tcp-listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "tcp_listener" + {{- end }} + {{- if eq $key "udp-listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "udp_listener" + {{- end }} + {{- if eq $key "webhooks" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "webhooks" + {{- end }} + {{- end }} + selector: + app: {{ template "fullname" . }}-s +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml new file mode 100644 index 0000000000..8e94bef65d --- /dev/null +++ b/stable/telegraf/values.yaml @@ -0,0 +1,495 @@ +## Default values.yaml for Telegraf +## This is a YAML-formatted file. +## ref: https://hub.docker.com/r/library/telegraf/tags/ +image: + repo: "telegraf" + tag: "1.1.0-alpine" + pullPolicy: IfNotPresent + +## Configure the telegraf daemonset here. +## Resource limits and outputs can be set seperately +daemonset: + enabled: true + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + requests: + memory: 256Mi + cpu: 0.1 + limits: + memory: 2Gi + cpu: 1 + ## Exposed telegraf configuration + ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ + config: +## global_tags: +## dc: "us-east-1" +## user: "$USER" + agent: + interval: "10s" + round_interval: true + metric_batch_size: 1000 + metric_buffer_limit: 10000 + collection_jitter: "0s" + flush_interval: "10s" + flush_jitter: "0s" + precision: "" + debug: false + quiet: false + logfile: "" + hostname: "$HOSTNAME" + omit_hostname: false + outputs: + influxdb: + urls: [] + # - "http://influxdb-influxdb.tick:8086" + database: "telegraf" +## retention_policy: "" +## write_consistency: "any" +## timeout: "5s" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## user_agent: "telegraf" +## udp_payload: 512 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## amqp: +## url: "amqp://localhost:5672/influxdb" +## exchange: "telegraf" +## auth_method: "PLAIN" +## routing_tag: "host" +## retention_policy: "default" +## database: "telegraf" +## precision: "s" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## kafka: +## brokers: +## - "localhost:9092" +## topic: "telegraf" +## routing_tag: "host" +## compression_codec: 0 +## required_acks: -1 +## max_retry: 3 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## mqtt: +## servers: +## - "localhost:1883" +## topic_prefix: "telegraf" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nats: +## servers: +## - "nats://localhost:4222" +## username: "" +## password: "" +## subject: "telegraf" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nsq: +## server: "localhost:4150" +## topic: "telegraf" +## data_format: "influx" + inputs: + cpu: + percpu: true + totalcpu: true + collect_cpu_time: false + disk: + ignore_fs: + - "tmpfs" + - "devtmpfs" + diskio: + docker: + endpoint: "unix:///var/run/docker.sock" + container_names: [] + kernel: + mem: + processes: + swap: + system: + kubernetes: + url: "http://$HOSTNAME:10255" + bearer_token: "/var/run/secrets/kubernetes.io/serviceaccount/token" + insecure_skip_verify: true + +## Configure the telegraf single instance here. +## Resource limits and outputs can be set seperately +single: + enabled: true + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + requests: + memory: 256Mi + cpu: 0.1 + limits: + memory: 2Gi + cpu: 1 + ## Configure the service for this telegraf instance. If you are running + ## Any of the service plugins you will need this enabled + ## Service Plugins: http_listener, statsd, tcp_listener, udp_listener + ## ref: http://kubernetes.io/docs/user-guide/services/ + service: + enabled: true + type: ClusterIP + + ## Exposed telegraf configuration + ## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml` + ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ + + config: +## global_tags: +## dc: "us-east-1" +## user: "$USER" + agent: + interval: "10s" + round_interval: true + metric_batch_size: 1000 + metric_buffer_limit: 10000 + collection_jitter: "0s" + flush_interval: "10s" + flush_jitter: "0s" + precision: "" + debug: false + quiet: false + logfile: "" + hostname: "telegraf-polling-service" + omit_hostname: false + outputs: + influxdb: + urls: [] + # - "http://influxdb-influxdb.tick:8086" + database: "telegraf" +## retention_policy: "" +## write_consistency: "any" +## timeout: "5s" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## user_agent: "telegraf" +## udp_payload: 512 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## amqp: +## url: "amqp://localhost:5672/influxdb" +## exchange: "telegraf" +## auth_method: "PLAIN" +## routing_tag: "host" +## retention_policy: "default" +## database: "telegraf" +## precision: "s" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## kafka: +## brokers: +## - "localhost:9092" +## topic: "telegraf" +## routing_tag: "host" +## compression_codec: 0 +## required_acks: -1 +## max_retry: 3 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## mqtt: +## servers: +## - "localhost:1883" +## topic_prefix: "telegraf" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nats: +## servers: +## - "nats://localhost:4222" +## username: "" +## password: "" +## subject: "telegraf" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nsq: +## server: "localhost:4150" +## topic: "telegraf" +## data_format: "influx" + inputs: + cpu: + percpu: false + totalcpu: true + system: +## aerospike: +## servers: +## - "localhost:3000" +## apache: +## urls: +## - "http://localhost/server-status?auto" +## cassandra: +## context: "/jolokia/read" +## servers: +## - "myuser:mypassword@10.10.10.1:8778" +## - "10.10.10.2:8778" +## - ":8778" +## metrics : +## - "/java.lang:type=Memory/HeapMemoryUsage" +## - "/org.apache.cassandra.metrics:type=Table,keyspace=*,scope=*,name=ReadLatency" +## cloudwatch: +## region: "us-east-1" +## access_key: "" +## secret_key: "" +## token: "" +## role_arn: "" +## profile: "" +## shared_credential_file: "" +## period: "5m" +## delay: "5m" +## interval: "5m" +## cache_ttl: "10m" +## namespace: "AWS/ELB" +## ratelimit: 10 +## metrics: +## names: +## - "Latency" +## - "RequestCount" +## dimensions: +## name: "LoadBalancerName" +## value: "p-example" +## consul: +## address: "localhost" +## scheme: "http" +## token: "" +## username: "" +## password: "" +## datacentre: "" +## couchbase: +## servers: +## - "http://localhost:8091" +## couchdb: +## hosts: +## - "http://localhost:8086/_stats" +## disque: +## servers: +## - "localhost" +## dns_query: +## servers: +## - "8.8.8.8" +## domains: +## - "." +## record_type: "A" +## port: 53 +## timeout: 2 +## dovecot: +## servers: +## - "localhost:24242" +## type: "global" +## filters: +## - "" +## elasticsearch: +## servers: +## - "http://localhost:9200" +## http_timeout: "5s" +## local: true +## cluster_health: false +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## graylog: +## servers: +## - "http://[graylog-server-ip]:12900/system/metrics/multiple" +## metrics: +## - "jvm.cl.loaded" +## - "jvm.memory.pools.Metaspace.committed" +## username: "" +## password: "" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## haproxy: +## servers: +## - "http://myhaproxy.com:1936/haproxy?stats" + influxdb: + urls: + - "http://influxdb-influxdb.tick:8086/debug/vars" + timeout: "5s" +## lustre2: +## ost_procfiles: +## - "/proc/fs/lustre/obdfilter/*/stats" +## - "/proc/fs/lustre/osd-ldiskfs/*/stats" +## - "/proc/fs/lustre/obdfilter/*/job_stats" +## mds_procfiles: +## - "/proc/fs/lustre/mdt/*/md_stats" +## - "/proc/fs/lustre/mdt/*/job_stats" +## mailchimp: +## api_key: "" +## days_old: 0 +## campaign_id: "" +## memcached: +## servers: +## - "localhost:11211" +## unix_sockets: +## - "/var/run/memcached.sock" +## mesos: +## timeout: 100 +## masters: +## - "localhost:5050" +## master_collections: +## - "resources" +## - "master" +## - "system" +## - "agents" +## - "frameworks" +## - "tasks" +## - "messages" +## - "evqueue" +## - "registrar" +## slaves: +## - +## slave_collections: +## - "resources" +## - "agent" +## - "system" +## - "executors" +## - "tasks" +## - "messages" +## mongodb: +## servers: +## - "mongodb://user:password@127.0.0.1:27017" +## gather_perdb_stats: false +## mysql: +## servers: +## - "tcp(127.0.0.1:3306)?tls=false" +## perf_events_statements_digest_text_limit : 120 +## perf_events_statements_limit: 250 +## perf_events_statements_time_limit : 86400 +## table_schema_databases: [] +## gather_table_schema: false +## gather_process_list: true +## gather_info_schema_auto_inc: true +## gather_slave_status: true +## gather_binary_logs: false +## gather_table_io_waits: false +## gather_table_lock_waits: false +## gather_index_io_waits: false +## gather_event_waits: false +## gather_file_events_stats: false +## gather_perf_events_statements: false +## interval_slow: "30m" +## net_response: +## protocol: "tcp" +## address: "github.com:80" +## timeout: "1s" +## send: "ssh" +## expect: "ssh" +## read_timeout: "1s" +## nginx: +## urls: +## - "http://nginx.nginx-ingress/nginx_status" +## nsq: +## endpoints: +## - "http://localhost:4151" +## phpfpm: +## urls: +## - "http://localhost/status" +## ping: +## urls: +## - "www.google.com" +## count: 1 +## ping_interval: 1.0 +## timeout: 1.0 +## interface: "" +## postgresql: +## address: "postgres://user:password@localhost?sslmode=disable" +## ignored_databases: +## - "postgres" +## databases: +## - "app_production" +## - "testing" + prometheus: + urls: + - "https://kubernetes.default:443/metrics" + name_prefix: "prom_" + bearer_token: "/var/run/secrets/kubernetes.io/serviceaccount/token" + insecure_skip_verify: true +## ssl_ca: /path/to/cafile +## ssl_cert: /path/to/certfile +## ssl_key: /path/to/keyfile +## rabbitmq: +## url: "http://localhost:15672" +## name: "rmq-server-1" +## username: "guest" +## password: "guest" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## nodes: +## - "rabbit@node1" +## - "rabbit@node2" +## raindrops: +## urls: +## - "http://localhost:8080/_raindrops" +## redis: +## servers: +## - "tcp://localhost:6379" +## rethinkdb: +## servers: +## - "127.0.0.1:28015" +## riak: +## servers: +## - "http://localhost:8098" +## sqlserver: +## servers: +## - "Server=192.168.1.10;Port=1433;User Id=;Password=;app name=telegraf;log=1;" +## twemproxy: +## addr: "localhost:22222" +## pools: +## - "redis_pool" +## - "mc_pool" +## zookeeper: +## servers: +## - "localhost:2181" +## http_listener: +## service_address: ":8186" +## read_timeout: "10s" +## write_timeout: "10s" +## max_body_size: 0 +## max_line_size: 0 + statsd: + service_address: ":8125" + percentiles: + - 50 + - 95 + - 99 + metric_separator: "_" + allowed_pending_messages: 10000 + percentile_limit: 1000 \ No newline at end of file