Add telegraf to router

This commit is contained in:
Przemek Grondek 2023-07-21 09:21:57 +02:00
parent 6065471faa
commit f4861fc0a6
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,21 @@
[agent]
hostname = "router"
interval = "1m"
debug = false
quiet = false
logtarget = "stderr"
[[outputs.prometheus_client]]
listen = ":9273"
[[inputs.cpu]]
percpu = false
report_active = true
[[inputs.system]]
[[inputs.mem]]
[[inputs.net]]
[[inputs.exec]]
command = "sh /usr/lib/telegraf/edgeos.sh --interfaces"
data_format = "influx"
[[inputs.exec]]
command = "sh /usr/lib/telegraf/edgeos.sh --firmware"
data_format = "influx"
interval = "24h"

View File

@ -0,0 +1,31 @@
---
- name: Download telegraf
get_url:
url: https://github.com/x70b1/telegraf-edgeos/releases/download/v{{ telegraf.release }}/telegraf_{{ telegraf.release }}+{{ telegraf.flavour }}_{{ telegraf.arch }}.deb
dest: /tmp/telegraf.deb
- name: Install telegraf
shell:
cmd: dpkg -i /tmp/telegraf.deb
- name: create directory for configuration
file:
path: "/etc/telegraf"
state: directory
mode: 0755
- name: copy configuration
copy:
src: "telegraf.conf"
dest: "/etc/telegraf/telegraf.conf"
- name: start and enable telegraf
systemd:
name: docker
state: started
enabled: true
- name: Remove telegraf.deb file
file:
path: /tmp/telegraf.deb
state: absent

View File

@ -0,0 +1,3 @@
---
- import_tasks: install_telegraf.yml
become: yes

View File

@ -0,0 +1,5 @@
---
telegraf:
release: 1.26.2-1
flavour: prometheus
arch: mipsel