Skip to content

Commit

Permalink
examples: automate host metrics otel receiver
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Apr 26, 2022
1 parent be6c499 commit 59990a6
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/hostmetricsreceiver/config/grafana-datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# config file version
apiVersion: 1

datasources:
- name: InfluxDB
type: influxdb
access: proxy
url: http://influxdb:8086
secureJsonData:
token: 1d223ca15b2e42e1b1659662ef455b93
jsonData:
version: Flux
organization: opi
defaultBucket: opi
tlsSkipVerify: true
7 changes: 7 additions & 0 deletions examples/hostmetricsreceiver/config/grafana.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[auth]
disable_login_form = true

[auth.anonymous]
enabled = true
org_name = Main Org.
org_role = Admin
58 changes: 58 additions & 0 deletions examples/hostmetricsreceiver/config/otel-collector-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
receivers:
tcplog:
listen_address: "0.0.0.0:54525"
hostmetrics:
collection_interval: 1m
scrapers:
cpu:
load:
memory:
disk:
filesystem:
network:
paging:
processes:

processors:
batch:
send_batch_size: 50
timeout: 5s

exporters:
influxdb:
endpoint: http://influxdb:8086
timeout: 500ms
org: opi
bucket: opi
token: 1d223ca15b2e42e1b1659662ef455b93
metrics_schema: telegraf-prometheus-v1

sending_queue:
enabled: true
num_consumers: 3
queue_size: 10

retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 3s
max_elapsed_time: 10s

extensions:
health_check:
pprof:
endpoint: :1888
zpages:
endpoint: :55679

service:
extensions: [pprof, zpages, health_check]
pipelines:
metrics:
receivers: [hostmetrics]
processors: [batch]
exporters: [influxdb]
logs:
receivers: [tcplog]
processors: [batch]
exporters: [influxdb]
54 changes: 54 additions & 0 deletions examples/hostmetricsreceiver/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: "3.9"

services:

otel-collector:
image: otel/opentelemetry-collector-contrib:0.48.0
command:
- "--config=/etc/otel-collector-config.yml"
volumes:
- ./config/otel-collector-config.yml:/etc/otel-collector-config.yml
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "55670:55679" # zpages extension
- "54525:54525" # tcp log receiver
depends_on:
- influxdb
networks:
- opi

grafana:
image: grafana/grafana:8.4.6
volumes:
- ./config/grafana.ini:/etc/grafana/grafana.ini
- ./config/grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasource.yaml
ports:
- "3000:3000"
networks:
- opi

influxdb:
image: influxdb:2.2.0-alpine
ports:
- "8086:8086"
volumes:
- influxdb-storage:/var/lib/influxdb
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=opi
- DOCKER_INFLUXDB_INIT_PASSWORD=opi123456789
- DOCKER_INFLUXDB_INIT_ORG=opi
- DOCKER_INFLUXDB_INIT_BUCKET=opi
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=1d223ca15b2e42e1b1659662ef455b93
networks:
- opi

volumes:
influxdb-storage:

networks:
opi:

0 comments on commit 59990a6

Please sign in to comment.