telegraf: add support for UBNT NanoStation

This commit is contained in:
Jannik Beyerstedt 2020-05-22 13:18:45 +02:00
parent df5f0a6fc6
commit 3720b6bf73
9 changed files with 1748 additions and 2 deletions

View file

@ -23,3 +23,15 @@
state: latest
update_cache: yes
cache_valid_time: 3600
# Install SNMP utilities for telegraf monitoring
- name: telegraf - Install SNMP utilities
become: yes
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- snmp
- snmp-mibs-downloader
when: telegraf_ubnt_ns_ips is defined

View file

@ -9,11 +9,34 @@
- "telegraf-{{ ansible_distribution }}.yml"
- "telegraf-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
# Install SNMP MIBs
- name: telegraf - Install SNMP MIBs
become: yes
block:
- name: SNMP - Download and install Ubiquiti MIB
copy:
src: "{{ role_path }}/files/UBNT-MIB.txt"
dest: /usr/share/snmp/mibs/UBNT-MIB
- name: SNMP - Download and install Ubiquiti MIB
copy:
src: "{{ role_path }}/files/UBNT-AirMAX-MIB.txt"
dest: /usr/share/snmp/mibs/UBNT-AirMAX-MIB
- name: SNMP - Download and install UniFi MIB
copy:
src: "{{ role_path }}/files/UBNT-UniFi-MIB.txt"
dest: /usr/share/snmp/mibs/UBNT-UniFi-MIB
- name: SNMP - Setup snmp.conf
lineinfile:
name: /etc/snmp/snmp.conf
line: mibs +ALL
create: yes
when: telegraf_ubnt_ns_ips is defined
# Configure
- name: telegraf - Copy telegraf config
become: yes
template:
src: "{{ role_path }}/templates/telegraf.conf"
src: "{{ role_path }}/templates/telegraf.conf.j2"
dest: /etc/telegraf/telegraf.conf
notify:
- Enable and restart telegraf