ansible-role-server/templates/telegraf.conf.j2

86 lines
2.7 KiB
Plaintext
Raw Normal View History

[agent]
interval = "{{ telegraf_interval }}"
hostname = ""
[[outputs.influxdb]]
urls = ["{{ telegraf_server_url }}"]
database = "servers"
skip_database_creation = true
## Name of existing retention policy to write to.
retention_policy = ""
## Write timeout (for the InfluxDB client), formatted as a string.
timeout = "5s"
username = "{{ telegraf_server_user }}"
password = "{{ telegraf_server_passwd }}"
# Read metrics about cpu usage
[[inputs.cpu]]
percpu = false
totalcpu = true
collect_cpu_time = false ## If true, collect raw CPU time metrics
report_active = true ## If true, compute and report the sum of all non-idle CPU states.
fieldpass = ["usage_user", "usage_system", "usage_iowait", "usage_irq", "usage_active"]
# Read metrics about memory usage
[[inputs.mem]]
#fieldpass = ["total", "used_percent"]
# Read metrics about disk usage by mount point
[[inputs.disk]]
# By default, telegraf gather stats for all mountpoints.
mount_points = ["/", "/mnt/volume-nbg1-1"]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"]
fieldpass = ["total", "free", "used_percent"]
# Read metrics about disk IO by device
[[inputs.diskio]]
## By default, telegraf will gather stats for all devices including partitions.
## Setting devices will restrict the stats to the specified devices.
devices = ["sd[a-d]", "mmcblk[0-1]", "ada[0-9]", "nvd[0-9]", "ploop*"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
fieldpass = ["read_bytes", "write_bytes", "io_time", "weighted_io_time", "iops_in_progress"]
# Read metrics about system load & uptime
[[inputs.system]]
# default config, pass all fields
# Get TCP connection state and UDP socket counts using lsof
[[inputs.netstat]]
fieldpass = ["tcp_established", "tcp_listen", "udp_socket"]
# Gather metrics about network interface and protocol usage (Linux only)
[[inputs.net]]
interfaces = ["eth*", "enp0s[0-1]", "venet*"]
ignore_protocol_stats = true
fieldpass = ["bytes_sent", "bytes_recv"]
{% if telegraf_docker|default(false)|bool %}
{% include telegraf_docker_file %}
{% endif %}
{% include telegraf_unifi_file %}
{% include telegraf_airmax_file %}
# # Monitor sensors, requires lm-sensors package
# [[inputs.sensors]]
# ## Remove numbers from field names.
# ## If true, a field name like 'temp1_input' will be changed to 'temp_input'.
# # remove_numbers = true
{% if ansible_lsb.id is defined and ansible_lsb.id == "Raspbian" %}
# On Raspbian, get CPU temperature (in millicelsius)
[[inputs.exec]]
commands = ["cat /sys/class/thermal/thermal_zone0/temp"]
data_format = "value"
data_type = "integer"
name_override = "cpu_temp"
{% endif %}