John Wheeler
2 min readApr 22, 2021

--

Thanks for the feedback Mike. I probably could have done a better job of providing a fully canonical config. I mention that I added the config in telegraf from a previous post here. My full config for telegraf is as follows

$ cat /etc/telegraf/telegraf.conf
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "3s"
flush_interval = "10s"
flush_jitter = "0s"
# logfile = "/var/log/telegraf.log"
precision = ""
# debug = true
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://192.168.1.30:8086"]
database = "rpi_monitoring"
username = "rpi"
password = "thesearenotthedroidsyouarelookingfor"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.mem]]
[[inputs.swap]]
[[inputs.file]]
files = ["/sys/class/thermal/thermal_zone0/temp"]
name_override = "cpu_temperature"
data_format = "value"
data_type = "integer"
[[inputs.exec]]
commands = [ "/opt/vc/bin/vcgencmd measure_temp" ]
name_override = "gpu_temperature"
data_format = "grok"
grok_patterns = ["%{NUMBER:value:float}"]
[[inputs.net]]
interfaces = ["eth0"]
[[inputs.netstat]]
[[inputs.ping]]
urls = ["www.google.com"] # required
count = 4
interface = "eth0"
name_override = "google_ping"
[[inputs.dns_query]]
servers = ["8.8.8.8"]
domains = ["."]
record_type = "A"
timeout = 10
name_override = "google_dns"
[[inputs.kernel]]
[[inputs.system]]
[[inputs.processes]]
[[inputs.diskio]]

The start script on raspberry pi looks for configs in the /etc/telegraf/telegraf.d directory. I chose to use this for the pi-hole stuff.

The I have the piholestats config for telegraf here

$ cat /etc/telegraf/telegraf.d/telegraf.piholestats.conf 
[[inputs.exec]]
commands = ["/usr/local/bin/piholestats"]
precision = "1ms"
name_override = "piholestats"
data_format = "csv"
timeout = "5s"
csv_header_row_count=0
csv_column_names = ["timestamp","type","status","domain","client","forward","id"]
csv_delimiter = "|"
csv_tag_columns = ["domain","client","forward","type","status"]
csv_timestamp_column = "timestamp"
csv_timestamp_format = "unix_ms"

You must have the first file setup above or at a minimum the [[outputs.influxdb]] section. Let me know if that helps.

--

--

John Wheeler
John Wheeler

Written by John Wheeler

Security professional, Mac enthusiast, writing code when I have to.

Responses (1)