appagile-telegraf

# Deploy Telegraf on AppAgile

Version: appagile-telegraf, Telegraf Version 1.2.1-1

This deployment supports the ephemeral storage model.
A config file needs to be added through an S2I build process.

 

[%hardbreaks]
== Prerequisites
=== Templates

[cols=”4,10″,options=”header”]
|===

|Name |Description

|*appagile-telegraf-is-template*
|Template to create an image stream pointing to the builder image.

|*appagile-telegraf-template*
|Template to build the Telegraf Docker image via S2I and create an ephemeral Telegraf instance
|===

Add templates to be used later. These Templates can be found at https://gitlabappadev.tsi-af.de/OSE3/appagile-telegraf/tree/master/ose-artefacts. Put them into namespace openshift, so that they can be accessed from every project.
—-
$ oc create -f ose-artefacts/telegraf-is_template.json -n openshift
$ oc create -f ose-artefacts/telegraf-template.json -n openshift
—-

 

== Setting up the builder image image stream.
—-
oc process appagile-telegraf-is-template -v DOCKER_IMAGE_REPOSITORY=vmapgmucrep01.appacd.tsi-af.de:5000/public/appagile-telegraf | oc create -f –
—-

 

== Building and Deploying Telegraf with ephemeral storage.
—-
oc process appagile-telegraf-template -v SOURCE_REPOSITORY_URL=https://github.com/rasp15/telegraf_conf.git,IMAGE_STREAM_NAMESPACE=openshift,IMAGE_STREAM_NAME=appagile-telegraf:latest,INFLUXDB_URL=http://influxdb,INFLUXDB_PORT=8086 | oc create -f –
—-
– The repository at the `SOURCE_REPOSITORY_URL` should provide a `telegraf.conf` config file at its root. If the environment variables `$INFLUXDB_URL` and `$INFLUXDB_PORT` are used within this file, they will be substituted with the respective values on container startup.
– Provide the `IMAGE_STREAM_NAMESPACE` in which the image stream was placed in the previous step.
– Provide the `IMAGE_STREAM_NAMESPACE` if it was changed from the standard “appagile-telegraf:latest”.
– If a Telegraf config file with the respective variables is used, provide values for `INFLUXDB_URL` (http://) and `INFLUXDB_PORT` (8086 by default).

 

If the build did not start automatically, it can be manually started using the following command:
—-
oc start-build telegraf
—-

 

== Connecting Telegraf to InfluxDB
In the “OUTPUT PLUGINS” section of your `telegraf.conf` provide a line like the following to point to your InfluxDB instance.
—-
urls = [“$INFLUXDB_URL:$INFLUXDB_PORT”]
—-
If values for these environment variables are provided as described above, they will be substituted here.
Alternatively, the URL and port can simply be hard-wired in the `telegraf.conf`.
Note also the name of the database defined in the same section. It is required when connecting other tools like link:https://gitlabappadev.tsi-af.de/OSE3/appagile-grafana[Grafana] to the database. The database will be created if not existing yet and is