58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
---
|
|
- name: Install prometheus-snmp-exporter
|
|
apt:
|
|
name:
|
|
- prometheus-snmp-exporter
|
|
- snmp-mibs-downloader
|
|
|
|
- name: Create local MIB directory
|
|
file:
|
|
path: /usr/local/share/snmp/mibs
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: u=rwx,g=rx,o=rx
|
|
|
|
- name: Install MIBs
|
|
copy:
|
|
src: "mibs/{{ item }}"
|
|
dest: "/usr/local/share/snmp/mibs/{{ item }}"
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
loop:
|
|
- FOUNDRY-SN-AGENT-MIB.txt
|
|
- FOUNDRY-SN-ROOT-MIB.txt
|
|
- FOUNDRY-SN-SWITCH-GROUP-MIB.txt
|
|
- XUPS-MIB.txt
|
|
- EATON-OIDS.txt
|
|
- EATON-EMP-MIB.txt
|
|
- LLDP-MIB.txt
|
|
|
|
- name: Configure prometheus-snmp-exporter generator
|
|
template:
|
|
src: generator.yml.j2
|
|
dest: /etc/prometheus/generator.yml
|
|
owner: prometheus
|
|
group: prometheus
|
|
mode: u=rw,g=,o=
|
|
vars:
|
|
prometheus_snmp__config:
|
|
modules: "{{ prometheus_snmp__modules }}"
|
|
register: generator
|
|
|
|
- name: Generate snmp.yml
|
|
command:
|
|
cmd: prometheus-snmp-generator generate
|
|
chdir: /etc/prometheus
|
|
environment:
|
|
MIBDIRS: "{{ prometheus_snmp__mib_dirs | join(':') }}"
|
|
when: generator.changed
|
|
notify:
|
|
- Restart prometheus-snmp-exporter
|
|
|
|
- name: Enable prometheus-snmp-exporter
|
|
systemd:
|
|
name: prometheus-snmp-exporter.service
|
|
enabled: true
|
|
...
|