remove!(telegraf): unused
This commit is contained in:
parent
1041703c1a
commit
f8b9813461
7 changed files with 0 additions and 459 deletions
|
@ -1,27 +0,0 @@
|
||||||
Telegraf
|
|
||||||
=========
|
|
||||||
|
|
||||||
This will setup a [Telegraf](https://docs.influxdata.com/telegraf/) container using their official docker container to monitor the system.
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
You will need to have docker and docker-compose installed or declared as dependencies with their respective roles.
|
|
||||||
|
|
||||||
Role Variables
|
|
||||||
--------------
|
|
||||||
|
|
||||||
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
|
|
||||||
|
|
||||||
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
|
|
||||||
|
|
||||||
Dependencies
|
|
||||||
------------
|
|
||||||
|
|
||||||
- docker
|
|
||||||
- docker-compose
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
GPL-3.0-only
|
|
|
@ -1,116 +0,0 @@
|
||||||
---
|
|
||||||
# Default variables for the telegraf role
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
# Copyright (C) 2020 Saibotk
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# The install locations
|
|
||||||
telegraf_install_location: "/srv/telegraf"
|
|
||||||
telegraf_config_location: "{{ telegraf_install_location }}/conf"
|
|
||||||
|
|
||||||
# The telegraf/dockersocket version to use
|
|
||||||
# renovate: depName=docker.io/library/telegraf
|
|
||||||
telegraf_version: "1.25.3"
|
|
||||||
# renovate: depName=quay.io/sheogorath/docker-socket-proxy
|
|
||||||
telegraf_dockersocketproxy_version: "2.3"
|
|
||||||
# Changing this image may also require changing the UID / GID below,
|
|
||||||
# to set the correct permissions
|
|
||||||
telegraf_image_version: "{{ telegraf_version }}-alpine"
|
|
||||||
|
|
||||||
# Telegraf config user & group id
|
|
||||||
# This is used for the config folder that is mounted to the container
|
|
||||||
telegraf_config_uid: 100
|
|
||||||
telegraf_config_gid: 101
|
|
||||||
|
|
||||||
# The influxdb endpoints, telegraf should send data to
|
|
||||||
telegraf_influxdb_endpoints:
|
|
||||||
- influxdb.example.com
|
|
||||||
|
|
||||||
# The influxdb credentials
|
|
||||||
telegraf_influxdb_username: telegraf
|
|
||||||
telegraf_influxdb_password: "{{ lookup('passwordstore', telegraf_influxdb_endpoints[0] + '/db create=true length=42') }}"
|
|
||||||
|
|
||||||
# The retention policy settings (see https://github.com/influxdata/telegraf/blob/release-1.15/plugins/outputs/influxdb/README.md)
|
|
||||||
telegraf_influxdb_retention_policy: ""
|
|
||||||
telegraf_influxdb_retention_policy_tag: ""
|
|
||||||
|
|
||||||
# Telegraf agent configuration (see https://docs.influxdata.com/telegraf/v1.15/administration/configuration/)
|
|
||||||
telegraf_agent_hostname: "{{ ansible_fqdn }}"
|
|
||||||
telegraf_agent_interval: 10
|
|
||||||
telegraf_agent_debug: false
|
|
||||||
telegraf_agent_round_interval: true
|
|
||||||
telegraf_agent_flush_interval: 10
|
|
||||||
telegraf_agent_flush_jitter: 5
|
|
||||||
telegraf_agent_collection_jitter: 5
|
|
||||||
telegraf_agent_metric_batch_size: 2000
|
|
||||||
telegraf_agent_metric_buffer_limit: 1000000
|
|
||||||
telegraf_agent_omit_hostname: false
|
|
||||||
|
|
||||||
# The telegraf config's [global_tags] section (see https://docs.influxdata.com/telegraf/v1.15/administration/configuration/)
|
|
||||||
telegraf_global_tags: []
|
|
||||||
|
|
||||||
# The telegraf [[outputs.type]] sections (see https://docs.influxdata.com/telegraf/v1.15/administration/configuration/)
|
|
||||||
telegraf_output:
|
|
||||||
- type: influxdb
|
|
||||||
config:
|
|
||||||
- urls = ["https://{{ telegraf_influxdb_endpoints | join('","https://') }}"]
|
|
||||||
- database = "telegraf"
|
|
||||||
- timeout = "5s"
|
|
||||||
- username = "{{ telegraf_influxdb_username }}"
|
|
||||||
- password = "{{ telegraf_influxdb_password }}"
|
|
||||||
- retention_policy = "autogen"
|
|
||||||
- retention_policy_tag = "retention_policy"
|
|
||||||
|
|
||||||
# The telegraf input plugins that are enabled by default (see https://docs.influxdata.com/telegraf/v1.15/plugins/plugin-list/)
|
|
||||||
telegraf_plugins:
|
|
||||||
- plugin: internal
|
|
||||||
- plugin: cpu
|
|
||||||
config:
|
|
||||||
- percpu = true
|
|
||||||
- totalcpu = true
|
|
||||||
- collect_cpu_time = false
|
|
||||||
- report_active = false
|
|
||||||
- plugin: disk
|
|
||||||
config:
|
|
||||||
- ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
|
|
||||||
- plugin: diskio
|
|
||||||
- plugin: kernel
|
|
||||||
- plugin: mem
|
|
||||||
- plugin: processes
|
|
||||||
- plugin: swap
|
|
||||||
- plugin: system
|
|
||||||
- plugin: docker
|
|
||||||
config:
|
|
||||||
- endpoint = "tcp://dockersocket:2375"
|
|
||||||
- container_names = []
|
|
||||||
- timeout = "5s"
|
|
||||||
- total = false
|
|
||||||
- plugin: docker_log
|
|
||||||
config:
|
|
||||||
- endpoint = "tcp://dockersocket:2375"
|
|
||||||
- source_tag = true
|
|
||||||
tags:
|
|
||||||
- retention_policy = "logs"
|
|
||||||
|
|
||||||
# Additional plugins, these will be added to the list of plugins above
|
|
||||||
telegraf_plugins_extra: []
|
|
||||||
|
|
||||||
# The telegraf processor plugins list (see https://docs.influxdata.com/telegraf/v1.15/plugins/plugin-list/)
|
|
||||||
# telegraf_processors = []
|
|
||||||
|
|
||||||
# Extra volumes that should be mounted inside the telegraf container
|
|
||||||
telegraf_extra_volumes: []
|
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
# Handlers for the telegraf role
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Restart telegraf
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
project_src: "{{ telegraf_install_location }}"
|
|
||||||
state: restarted
|
|
||||||
become: true
|
|
|
@ -1,43 +0,0 @@
|
||||||
galaxy_info:
|
|
||||||
author: saibotk
|
|
||||||
description: "Deploys a telegraf container for monitoring."
|
|
||||||
license: GPL-3.0-only
|
|
||||||
min_ansible_version: "2.9"
|
|
||||||
standalone: true
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: EL
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericUNIX
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Fedora
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: opensuse
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericBSD
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: FreeBSD
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Ubuntu
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: SLES
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericLinux
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Debian
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- role: docker
|
|
|
@ -1,78 +0,0 @@
|
||||||
---
|
|
||||||
# Tasks file for the telegraf role
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Update default SELinux contexts
|
|
||||||
community.general.sefcontext:
|
|
||||||
target: "{{ item }}(/.*)?"
|
|
||||||
setype: "container_file_t"
|
|
||||||
state: present
|
|
||||||
with_items:
|
|
||||||
- "{{ telegraf_config_location }}"
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Create install directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
mode: "0700"
|
|
||||||
owner: "root"
|
|
||||||
group: "root"
|
|
||||||
with_items:
|
|
||||||
- "{{ telegraf_install_location }}"
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Create config directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
mode: "0700"
|
|
||||||
owner: "{{ telegraf_config_uid }}"
|
|
||||||
group: "{{ telegraf_config_gid }}"
|
|
||||||
state: directory
|
|
||||||
setype: "container_file_t"
|
|
||||||
with_items:
|
|
||||||
- "{{ telegraf_config_location }}"
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Deploy docker-compose.yml
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "docker-compose.yml"
|
|
||||||
dest: "{{ telegraf_install_location }}/docker-compose.yml"
|
|
||||||
mode: "0600"
|
|
||||||
owner: "root"
|
|
||||||
group: "root"
|
|
||||||
validate: docker compose -f %s config -q
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Deploy telegraf config
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "telegraf.conf"
|
|
||||||
dest: "{{ telegraf_config_location }}/telegraf.conf"
|
|
||||||
mode: "0600"
|
|
||||||
owner: "{{ telegraf_config_uid }}"
|
|
||||||
group: "{{ telegraf_config_gid }}"
|
|
||||||
notify: "Restart telegraf"
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Compose telegraf
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
state: present
|
|
||||||
project_src: "{{ telegraf_install_location }}"
|
|
||||||
pull: always
|
|
||||||
remove_orphans: true
|
|
||||||
become: true
|
|
|
@ -1,67 +0,0 @@
|
||||||
{{ ansible_managed | comment }}
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
version: "2"
|
|
||||||
services:
|
|
||||||
|
|
||||||
telegraf:
|
|
||||||
image: docker.io/library/telegraf:{{ telegraf_image_version }}
|
|
||||||
restart: always
|
|
||||||
mem_limit: 256mb
|
|
||||||
memswap_limit: 384mb
|
|
||||||
read_only: false # TODO: switch to self-made container
|
|
||||||
security_opt:
|
|
||||||
- label:disable
|
|
||||||
environment:
|
|
||||||
HOST_PROC: /rootfs/proc
|
|
||||||
HOST_SYS: /rootfs/sys
|
|
||||||
HOST_ETC: /rootfs/etc
|
|
||||||
volumes:
|
|
||||||
- {{ telegraf_config_location }}:/etc/telegraf/:ro
|
|
||||||
- /sys:/rootfs/sys:ro
|
|
||||||
- /proc:/rootfs/proc:ro
|
|
||||||
- /etc:/rootfs/etc:ro
|
|
||||||
{% for item in telegraf_extra_volumes %}
|
|
||||||
- "{{item}}"
|
|
||||||
{% endfor %}
|
|
||||||
networks:
|
|
||||||
telegraf:
|
|
||||||
|
|
||||||
dockersocket:
|
|
||||||
image: quay.io/sheogorath/docker-socket-proxy:{{ telegraf_dockersocketproxy_version }}
|
|
||||||
mem_limit: 16mb
|
|
||||||
memswap_limit: 32mb
|
|
||||||
security_opt:
|
|
||||||
- "label:disable"
|
|
||||||
read_only: true
|
|
||||||
tmpfs:
|
|
||||||
- /run/:size=32K
|
|
||||||
environment:
|
|
||||||
- "CONTAINERS=1"
|
|
||||||
- "INFO=1"
|
|
||||||
- "NETWORKS=1"
|
|
||||||
- "IMAGES=1"
|
|
||||||
- "LOG_LEVEL=notice"
|
|
||||||
volumes:
|
|
||||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
|
||||||
networks:
|
|
||||||
telegraf:
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
networks:
|
|
||||||
telegraf:
|
|
|
@ -1,104 +0,0 @@
|
||||||
{{ ansible_managed | comment }}
|
|
||||||
# Source: https://github.com/dj-wasabi/ansible-telegraf/blob/master/templates/telegraf.conf.j2
|
|
||||||
|
|
||||||
[global_tags]
|
|
||||||
{% if telegraf_global_tags is defined and telegraf_global_tags is iterable %}
|
|
||||||
{% for item in telegraf_global_tags %}
|
|
||||||
{{ item.tag_name }} = "{{ item.tag_value }}"
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
# Configuration for telegraf agent
|
|
||||||
[agent]
|
|
||||||
interval = "{{ telegraf_agent_interval }}s"
|
|
||||||
debug = {{ telegraf_agent_debug | lower }}
|
|
||||||
hostname = "{{ telegraf_agent_hostname }}"
|
|
||||||
round_interval = {{ telegraf_agent_round_interval | lower }}
|
|
||||||
flush_interval = "{{ telegraf_agent_flush_interval }}s"
|
|
||||||
flush_jitter = "{{ telegraf_agent_flush_jitter }}s"
|
|
||||||
collection_jitter = "{{ telegraf_agent_collection_jitter }}s"
|
|
||||||
metric_batch_size = {{ telegraf_agent_metric_batch_size }}
|
|
||||||
metric_buffer_limit = {{ telegraf_agent_metric_buffer_limit }}
|
|
||||||
omit_hostname = {{ telegraf_agent_omit_hostname | lower }}
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# OUTPUTS #
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
{% if telegraf_output is defined and telegraf_output is iterable %}
|
|
||||||
{% for item in telegraf_output %}
|
|
||||||
[[outputs.{{ item.type }}]]
|
|
||||||
{% for items in item.config %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% if item.tagpass is defined and item.tagpass is iterable %}
|
|
||||||
[outputs.{{ item.type }}.tagpass]
|
|
||||||
{% for items in item.tagpass %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if item.tagdrop is defined and item.tagdrop is iterable %}
|
|
||||||
[outputs.{{ item.type }}.tagdrop]
|
|
||||||
{% for items in item.tagdrop %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# INPUTS #
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
{% if telegraf_plugins is defined and telegraf_plugins is iterable %}
|
|
||||||
{% for item in telegraf_plugins + telegraf_plugins_extra %}
|
|
||||||
[[inputs.{{ item.plugin }}]]
|
|
||||||
{% if item.interval is defined %}
|
|
||||||
interval = "{{ item.interval }}s"
|
|
||||||
{% endif %}
|
|
||||||
{% if item.config is defined and item.config is iterable %}
|
|
||||||
{% for items in item.config %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if item.tags is defined and item.tags is iterable %}
|
|
||||||
[inputs.{{ item.plugin }}.tags]
|
|
||||||
{% for items in item.tags %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if item.tagpass is defined and item.tagpass is iterable %}
|
|
||||||
[inputs.{{ item.plugin }}.tagpass]
|
|
||||||
{% for items in item.tagpass %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if item.tagdrop is defined and item.tagdrop is iterable %}
|
|
||||||
[inputs.{{ item.plugin }}.tagdrop]
|
|
||||||
{% for items in item.tagdrop %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if telegraf_plugins is defined and telegraf_plugins|length == 0 %}
|
|
||||||
# No plugins configured, added a mem plugin so telegraf doesn't stop working.
|
|
||||||
[[inputs.mem]]
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# PROCESSORS #
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
{% if telegraf_processors is defined and telegraf_processors is iterable %}
|
|
||||||
{% for item in telegraf_processors %}
|
|
||||||
[[processors.{{ item.processor }}]]
|
|
||||||
{% if item.config is defined and item.config is iterable %}
|
|
||||||
{% for items in item.config %}
|
|
||||||
{{ items }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
Loading…
Add table
Reference in a new issue