Add telegraf to router
This commit is contained in:
parent
6065471faa
commit
f4861fc0a6
21
roles/router-telegraf/files/telegraf.conf
Normal file
21
roles/router-telegraf/files/telegraf.conf
Normal 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"
|
31
roles/router-telegraf/tasks/install_telegraf.yml
Normal file
31
roles/router-telegraf/tasks/install_telegraf.yml
Normal 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
|
3
roles/router-telegraf/tasks/main.yml
Normal file
3
roles/router-telegraf/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: install_telegraf.yml
|
||||||
|
become: yes
|
5
roles/router-telegraf/vars/main.yml
Normal file
5
roles/router-telegraf/vars/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
telegraf:
|
||||||
|
release: 1.26.2-1
|
||||||
|
flavour: prometheus
|
||||||
|
arch: mipsel
|
Loading…
Reference in New Issue
Block a user