updated telegraf state

This commit is contained in:
Paul 2021-08-18 07:10:35 +02:00
parent 19cf4d8523
commit b05a9a0ad4
3 changed files with 49 additions and 68 deletions

View File

@ -3,6 +3,9 @@
telegraf-config-dir:
file.directory:
- name: /etc/telegraf
- user: root
- group: root
- mode: 700
- watch_in:
- service: telegraf-service

View File

@ -5,82 +5,58 @@ telegraf:
install_dir: /usr/local/apps
mirror: https://dl.influxdata.com/telegraf/releases
version: 1.13.3
influxdb_urls:
- '"http://localhost:8086"'
influxdb_username: username
influxdb_password: password
influxdb_database: telegraf
os: linux
arch: amd64
config:
outputs:
influxdb:
urls:
- '"http://localhost:8086"'
username: username
password: password
database: telegraf
inputs:
cpu:
name: "cpu"
params:
percpu: true
totalcpu: true
collect_cpu_time: false
report_active: false
percpu: true
totalcpu: true
collect_cpu_time: false
report_active: false
disk:
name: "disk"
params:
ignore_fs:
- '"tmpfs"'
- '"devtmpfs"'
- '"devfs"'
- '"iso9660"'
- '"overlay"'
- '"aufs"'
- '"squashfs"'
ignore_fs:
- '"tmpfs"'
- '"devtmpfs"'
- '"devfs"'
- '"iso9660"'
- '"overlay"'
- '"aufs"'
- '"squashfs"'
diskio:
name: "diskio"
httpjson:
name: "httpjson"
params:
name: "ipinfo"
interval: "15m"
servers:
- '"https://ipinfo.io"'
response_timeout: "5s"
method: "GET"
tag_keys:
- '"ip"'
name: "ipinfo"
interval: "15m"
servers:
- '"https://ipinfo.io"'
response_timeout: "5s"
method: "GET"
tag_keys:
- '"ip"'
kernel:
name: "kernel"
kernel_vmstat:
name: "kernel_vmstat"
mem:
name: "mem"
net:
name: "net"
netstat:
name: "netstat"
nginx:
name: "nginx"
params:
urls:
- '"http://localhost/status"'
response_timeout: "5s"
urls:
- '"http://localhost/status"'
response_timeout: "5s"
ntpq:
name: "ntpq"
params:
dns_lookup: true
dns_lookup: true
postfix:
name: "postfix"
processes:
name: "processes"
swap:
name: "swap"
sensors:
name: "sensors"
smart:
name: "smart"
system:
name: "system"
systemd_units:
name: "systemd_units"
syslog:
name: "syslog"
params:
server: "udp://:6514"
server: "udp://:6514"

View File

@ -1,6 +1,5 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "telegraf/map.jinja" import telegraf with context %}
[global_tags]
[agent]
interval = "1m"
@ -14,17 +13,20 @@
hostname = "{{ salt['grains.get']('fqdn') }}"
omit_hostname = false
[[outputs.influxdb]]
urls = [{{ telegraf.influxdb_urls|join(",") }}]
username = "{{ telegraf.influxdb_username }}"
password = "{{ telegraf.influxdb_password }}"
database = "{{ telegraf.influxdb_database }}"
{% for name, value in telegraf.config.inputs.items() %}
[[inputs.{{ name }}]]
{%- if value['params'] is defined %}
{%- for paramname, paramvalue in value['params'].items() %}
{{ paramname }} = {% if paramvalue is sameas True or paramvalue is sameas False %}{{ paramvalue|string|lower }}{% elif paramvalue is iterable and paramvalue is not string %}[{{ paramvalue|join(",") }}]{% else %}"{{ paramvalue }}"{% endif %}
{%- endfor %}
{% for name, value in telegraf.config.outputs.items() -%}
[[outputs.{{ name }}]]
{% if value is not none -%}
{% for paramname, paramvalue in value.items() -%}
{{ ' '}}{{ paramname }} = {% if paramvalue is sameas True or paramvalue is sameas False %}{{ paramvalue|string|lower }}{% elif paramvalue is iterable and paramvalue is not string %}[{{ paramvalue|join(",") }}]{% else %}"{{ paramvalue }}"{% endif %}
{% endfor %}
{%- endif %}
{% endfor %}
{% for name, value in telegraf.config.inputs.items() -%}
[[inputs.{{ name }}]]
{% if value is not none -%}
{% for paramname, paramvalue in value.items() -%}
{{ ' ' }}{{ paramname }} = {% if paramvalue is sameas True or paramvalue is sameas False %}{{ paramvalue|string|lower }}{% elif paramvalue is iterable and paramvalue is not string %}[{{ paramvalue|join(",") }}]{% else %}"{{ paramvalue }}"{% endif %}
{% endfor %}
{%- endif %}
{% endfor -%}