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,26 +5,23 @@ 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"
params:
percpu: true percpu: true
totalcpu: true totalcpu: true
collect_cpu_time: false collect_cpu_time: false
report_active: false report_active: false
disk: disk:
name: "disk"
params:
ignore_fs: ignore_fs:
- '"tmpfs"' - '"tmpfs"'
- '"devtmpfs"' - '"devtmpfs"'
@ -34,10 +31,7 @@ telegraf:
- '"aufs"' - '"aufs"'
- '"squashfs"' - '"squashfs"'
diskio: diskio:
name: "diskio"
httpjson: httpjson:
name: "httpjson"
params:
name: "ipinfo" name: "ipinfo"
interval: "15m" interval: "15m"
servers: servers:
@ -47,40 +41,22 @@ telegraf:
tag_keys: tag_keys:
- '"ip"' - '"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"
params:
urls: urls:
- '"http://localhost/status"' - '"http://localhost/status"'
response_timeout: "5s" response_timeout: "5s"
ntpq: ntpq:
name: "ntpq"
params:
dns_lookup: true 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"
params:
server: "udp://:6514" 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 -%}