Skip to content

Instantly share code, notes, and snippets.

@plytro
Created July 13, 2020 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plytro/f40eb9a09ad7c86629f4aadfc1bbf247 to your computer and use it in GitHub Desktop.
Save plytro/f40eb9a09ad7c86629f4aadfc1bbf247 to your computer and use it in GitHub Desktop.
# Global tags can be specified here in key="value" format.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
# user = "$USER"
# Configuration for telegraf agent
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
## Override default hostname, if empty use os.Hostname()
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://influx:8086"]
database = "systems"
###############################################################################
[[inputs.cpu]]
percpu = true
totalcpu = true
## If true, collect raw CPU time metrics.
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states.
report_active = false
[[inputs.mem]]
[[inputs.system]]
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"]
# https://github.com/davehouse/ronin_puppet/blob/3b1dc458e0f0afbe81b56e66ea341f70f176d566/modules/telegraf/templates/telegraf.conf.erb#L45-L58
# Fan Speed and CPU/GPU temp, reported to influx as "thermal"
# Example output: `thermal,host=mbp.local cpu=36.85,fan=2161,gpu=35 1594647603000000000`
[[inputs.exec]]
commands = [
"/bin/bash -c \"powermetrics --samplers smc --sample-count 1 -i 1 | grep -E '(Fan|temperature)' | sed -e 's/ die temperature//' -e 's/: /=/' -e 's/ .*$//' | tr '[A-Z]' '[a-z]' | xargs | sed -e 's/ /,/g' -e 's/^/thermal /'\""
]
timeout = "60s"
data_format = "influx"
# Thermal throttling info, reported to influx as "thermal"
# Example output: `thermal,host=mbp.local cpu_available_cpus=8,cpu_scheduler_limit=100,cpu_speed_limit=100 1594647603000000000`
[[inputs.exec]]
commands = [
"/bin/bash -c \"/usr/bin/pmset -g therm | awk $'/=/{printf $1$2$3\\\",\\\"}' | sed -e 's/,$//' -e 's/^/thermal /' | tr '[A-Z]' '[a-z]'\""
]
timeout = "60s"
data_format = "influx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment