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: telegraf-config-dir:
file.directory: file.directory:
- name: /etc/telegraf - name: /etc/telegraf
- user: root
- group: root
- mode: 700
- watch_in: - watch_in:
- service: telegraf-service - service: telegraf-service

View File

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

View File

@ -1,6 +1,5 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "telegraf/map.jinja" import telegraf with context %} {%- from "telegraf/map.jinja" import telegraf with context %}
[global_tags] [global_tags]
[agent] [agent]
interval = "1m" interval = "1m"
@ -14,17 +13,20 @@
hostname = "{{ salt['grains.get']('fqdn') }}" hostname = "{{ salt['grains.get']('fqdn') }}"
omit_hostname = false omit_hostname = false
[[outputs.influxdb]] {% for name, value in telegraf.config.outputs.items() -%}
urls = [{{ telegraf.influxdb_urls|join(",") }}] [[outputs.{{ name }}]]
username = "{{ telegraf.influxdb_username }}" {% if value is not none -%}
password = "{{ telegraf.influxdb_password }}" {% for paramname, paramvalue in value.items() -%}
database = "{{ telegraf.influxdb_database }}" {{ ' '}}{{ 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.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 %}
{%- endif %} {%- endif %}
{% endfor %} {% 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 -%}