Move telegraf to host
This makes metric collection for SMART much simpler. I'll still be using the prometheus node exporter for actual system metrics, though.
This commit is contained in:
parent
aa3da3cf10
commit
6b95b75fc2
11 changed files with 17 additions and 46 deletions
|
@ -2,6 +2,7 @@ collections:
|
|||
- ansible.posix
|
||||
- community.general
|
||||
- community.docker
|
||||
- amazon.aws # Dependency of rossmcdonald.telegraf
|
||||
|
||||
roles:
|
||||
- src: geerlingguy.docker
|
||||
|
@ -10,3 +11,4 @@ roles:
|
|||
- src: https://github.com/IronicBadger/ansible-role-proxmox-nag-removal
|
||||
name: proxmox-nag-removal
|
||||
- src: chmduquesne.iptables_persistent
|
||||
- src: rossmcdonald.telegraf
|
||||
|
|
|
@ -15,3 +15,6 @@ pve_hosts:
|
|||
internal_ip: 10.23.1.99
|
||||
deluge:
|
||||
internal_ip: 10.23.1.52
|
||||
pve:
|
||||
internal_ip: 10.23.1.1
|
||||
ip: 192.168.2.200
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
expose_ssh: true
|
||||
|
||||
private_ip: "{{ pve_hosts.pve.ip }}"
|
||||
protected_ip: "{{ pve_hosts.pve.internal_ip }}"
|
||||
|
||||
zpools_to_scrub:
|
||||
- tank
|
||||
- rpool
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
- pve
|
||||
- zfs
|
||||
- pve_nebula_route
|
||||
- telegraf
|
||||
|
||||
- hosts: forrest
|
||||
roles:
|
||||
|
|
|
@ -7,7 +7,7 @@ scrape_configs:
|
|||
|
||||
static_configs:
|
||||
- targets:
|
||||
- telegraf:9273
|
||||
- 10.23.1.1:9273
|
||||
- job_name: traefik
|
||||
metric_relabel_configs:
|
||||
- source_labels: [__name__]
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
version: "2.3"
|
||||
|
||||
services:
|
||||
telegraf:
|
||||
image: telegraf:alpine
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- default
|
||||
- prometheus
|
||||
volumes:
|
||||
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
|
||||
networks:
|
||||
prometheus:
|
||||
external: true
|
|
@ -6,6 +6,3 @@
|
|||
|
||||
- name: Prometheus
|
||||
include: prometheus.yml
|
||||
|
||||
- name: Telegraf
|
||||
include: telegraf.yml
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
- name: Create telegraf install directory
|
||||
file:
|
||||
path: /opt/telegraf
|
||||
state: directory
|
||||
owner: "{{ docker_user.name }}"
|
||||
mode: "{{ docker_compose_directory_mask }}"
|
||||
become: true
|
||||
|
||||
- name: Install telegraf config
|
||||
template:
|
||||
src: files/telegraf/telegraf.conf
|
||||
dest: /opt/telegraf/telegraf.conf
|
||||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
notify: restart telegraf
|
||||
become: true
|
||||
|
||||
- name: Install telegraf compose file
|
||||
template:
|
||||
src: files/telegraf/docker-compose.yml
|
||||
dest: /opt/telegraf/docker-compose.yml
|
||||
mode: "{{ docker_compose_file_mask }}"
|
||||
owner: "{{ docker_user.name }}"
|
||||
validate: docker-compose -f %s config
|
||||
notify: restart telegraf
|
||||
become: true
|
|
@ -85,7 +85,7 @@
|
|||
###############################################################################
|
||||
|
||||
[[outputs.prometheus_client]]
|
||||
listen = ":9273"
|
||||
listen = "{{ protected_ip }}:9273"
|
||||
metric_version = 2
|
||||
|
||||
|
4
ansible/roles/telegraf/tasks/main.yml
Normal file
4
ansible/roles/telegraf/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: Install and configure telegraf
|
||||
import_role:
|
||||
name: rossmcdonald.telegraf
|
||||
become: true
|
2
ansible/roles/telegraf/vars/main.yml
Normal file
2
ansible/roles/telegraf/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
telegraf_configuration_template: files/telegraf.conf
|
||||
telegraf_aws_tags: false
|
Loading…
Reference in a new issue