-
Notifications
You must be signed in to change notification settings - Fork 5
/
junos_exporter.yml
84 lines (75 loc) · 2.5 KB
/
junos_exporter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- hosts: homelab
vars:
application: junos_exporter
docker_network: "{{ networks.user }}"
handlers:
- name: Restart
community.docker.docker_container:
name: "{{ application }}"
restart: true
comparisons:
'*': ignore
tasks:
- name: Create config folder
ansible.builtin.file:
path: "{{ config_directory }}"
state: directory
owner: "{{ common_user }}"
group: "{{ common_group }}"
mode: "0771"
- name: Create config file
ansible.builtin.copy:
dest: "{{ config_directory }}/config.yaml"
mode: "755"
content: |
---
configs:
default:
username: root
password: {{ _junos_password }}
enabled_collectors:
- interface
- environment
- route_engine
global:
timeout: 30
vars:
_junos_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
38363231613461666435356230623234663332616635393931663234333832356437353662376663
6238356637633766653733386331326537306530303666660a646631373137666432333265386637
63636165653834653535333334633665393862656635366632343966323461646230363631336463
3362633061663032620a316134633637616466363065323635636133393432653730393064323962
6134
notify: Restart
- name: Create container
ansible.builtin.include_role:
name: docker_container
vars:
image: tynany/junos_exporter:v1.4.0
volumes:
- "{{ config_directory }}/config.yaml:/config.yaml"
- name: Create scrape config for Prometheus
ansible.builtin.copy:
content: |
scrape_configs:
- job_name: junos
scrape_interval: 120s
scrape_timeout: 30s
static_configs:
- targets:
- switch.{{ common_local_tld }}
params:
config: ['default']
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: {{ application }}.{{ docker_network.name }}:9347
dest: "{{ prometheus_scrape_directory }}/{{ application }}.yml"
owner: "65534" # nobody user
group: "{{ common_group }}"
mode: "0755"