File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,30 +16,32 @@ spec:
1616 image : quay.io/deis/telegraf:v2-beta
1717 imagePullPolicy : Always
1818 env :
19+ - name : POD_NAMESPACE
20+ valueFrom :
21+ fieldRef :
22+ fieldPath : metadata.namespace
1923 - name : " INFLUXDB_URLS"
20- value : http://$(DEIS_MONITOR_INFLUXDB_SERVICE_HOST):$(DEIS_MONITOR_INFLUXDB_PORT_8086_TCP_PORT)
21- - name : " KUBERNETES_DOCKER_ENDPOINT"
22- value : " unix:///var/run/docker.sock"
23- # - name: "HOST_PROC"
24- # value: "/rootfs/proc"
25- # - name: "HOST_SYS"
26- # value: "/rootfs/sys"
24+ value : http://$(DEIS_MONITOR_INFLUXDB_SERVICE_HOST):$(DEIS_MONITOR_INFLUXDB_SERVICE_PORT_TRANSPORT)
25+ - name : " HOST_PROC"
26+ value : " /rootfs/proc"
27+ - name : " HOST_SYS"
28+ value : " /rootfs/sys"
2729 volumeMounts :
2830 - mountPath : /var/run/docker.sock
2931 name : docker-socket
30- # - name: sysro
31- # mountPath: /rootfs/sys
32- # readOnly: true
33- # - name: procro
34- # mountPath: /rootfs/proc
35- # readOnly: true
32+ - name : sysro
33+ mountPath : /rootfs/sys
34+ readOnly : true
35+ - name : procro
36+ mountPath : /rootfs/proc
37+ readOnly : true
3638 volumes :
3739 - name : docker-socket
3840 hostPath :
3941 path : /var/run/docker.sock
40- # - name: sysro
41- # hostPath:
42- # path: /sys
43- # - name: procro
44- # hostPath:
45- # path: /proc
42+ - name : sysro
43+ hostPath :
44+ path : /sys
45+ - name : procro
46+ hostPath :
47+ path : /proc
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ MAINTAINER Jonathan Chauncey "<jchauncey@deis.com>"
33
44ENV TELEGRAF_VERSION "0.10.0_linux_amd64"
55
6- RUN apk --update add bash
6+ RUN apk --update add bash curl
77
88# The download links for the zip of telegraf are broken.
99# So for now Im building this locally and copying it into the build context.
Original file line number Diff line number Diff line change 1111 flush_jitter = " {{ default " 0s" .AGENT_FLUSH_JITTER }}"
1212 debug = {{ default " false" .AGENT_DEBUG }}
1313 quiet = {{ default " false" .AGENT_QUIET }}
14- {{ if .AGENT_HOSTNAME }} hostname = {{ .AGENT_HOSTNAME }} {{ end }}
14+ {{ if .AGENT_HOSTNAME }}hostname = " {{ .AGENT_HOSTNAME }}" {{ end }}
1515
1616# Set output configuration
1717{{ if .AMON_INSTANCE }}
135135 container_names = [{{ if .DOCKER_CONTAINER_NAMES }}{{ .DOCKER_CONTAINER_NAMES }}{{ end }}]
136136{{ end }}
137137
138- {{ if .KUBERNETES_SERVICE_HOST}}
139- [[inputs.kubernetes]]
140- docker_endpoint = " {{ .KUBERNETES_DOCKER_ENDPOINT }}"
141- container_names = [{{ if .KUBERNETES_CONTAINER_NAMES }}{{ .KUBERNETES_CONTAINER_NAMES }}{{ end }}]
142- {{ end }}
143-
144138{{ if .ELASTIC_SEARCH_SERVERS }}
145139[[inputs.elasticsearch]]
146140 servers = [{{ .ELASTIC_SEARCH_SERVERS }}]
200194 {{ if .POSTGRESQL_DATABASES }} databases = [{{ .POSTGRESQL_DATABASES }}] {{ end }}
201195{{ end }}
202196
197+ {{ if .PROMETHEUS_URLS }}
198+ [[inputs.prometheus]]
199+ urls = [{{ .PROMETHEUS_URLS }}]
200+ bearer_token = " {{ .PROMETHEUS_BEARER_TOKEN }}"
201+ {{ end }}
202+
203203{{ if .RABBITMQ_URL }}
204204[[inputs.rabbitmq]]
205205 url = " {{ .RABBITMQ_URL }}"
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ export PROMETHEUS_BEARER_TOKEN=/var/run/secrets/kubernetes.io/serviceaccount/token
3+ export TOKEN=$( cat $PROMETHEUS_BEARER_TOKEN )
4+ export POD_API_URL=https://$KUBERNETES_SERVICE_HOST :$KUBERNETES_SERVICE_PORT /api/v1/namespaces/$POD_NAMESPACE /pods/$HOSTNAME
5+ export NODE_NAME=$( curl -s $POD_API_URL --header " Authorization: Bearer $TOKEN " --insecure | grep nodeName | cut -c 18- | tr -d ' "' )
6+ export AGENT_HOSTNAME=$NODE_NAME
7+ echo " Setting Agent Hostname to: $AGENT_HOSTNAME "
8+ export PROMETHEUS_URLS=" \" https://$KUBERNETES_SERVICE_HOST :$KUBERNETES_SERVICE_PORT /api/v1/proxy/nodes/$NODE_NAME /metrics\" , \" https://$KUBERNETES_SERVICE_HOST :$KUBERNETES_SERVICE_PORT /metrics\" "
9+ echo " Setting PROMETHEUS_URLS to: $PROMETHEUS_URLS "
10+
211echo " Building config.toml!"
312./envtpl -in config.toml.tpl >> config.toml
413echo " Finished building toml..."
You can’t perform that action at this time.
0 commit comments