-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
752fee0
commit aa3a5cd
Showing
12 changed files
with
101 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
--- | ||
# Use the latest node_exporter release | ||
node_exporter_version: 'latest' | ||
# Use the latest frr_exporter release | ||
frr_exporter_version: 'latest' | ||
|
||
# Alternatively, set a specific version | ||
# See available releases: https://github.com/prometheus/node_exporter/releases/ | ||
# node_exporter_version: '0.18.1' | ||
# See available releases: https://github.com/tynany/frr_exporter/releases/ | ||
# frr_exporter_version: '1.1.3' | ||
|
||
node_exporter_arch: 'amd64' | ||
node_exporter_download_url: https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}.tar.gz | ||
frr_exporter_arch: 'amd64' | ||
frr_exporter_download_url: https://github.com/tynany/frr_exporter/releases/download/v{{ frr_exporter_version }}/frr_exporter-{{ frr_exporter_version }}.linux-{{ frr_exporter_arch }}.tar.gz | ||
|
||
node_exporter_bin_path: /usr/local/bin/node_exporter | ||
frr_exporter_bin_path: /usr/local/bin/frr_exporter | ||
|
||
# Set node_exporter_host to localhost if you wish to expose node_exporter on localhost only. | ||
node_exporter_host: '' | ||
node_exporter_port: 9100 | ||
node_exporter_options: '' | ||
# Set frr_exporter_host to localhost if you wish to expose frr_exporter on localhost only. | ||
frr_exporter_host: '' | ||
frr_exporter_port: 9432 | ||
frr_exporter_options: '' | ||
|
||
node_exporter_state: started | ||
node_exporter_enabled: true | ||
node_exporter_restart: on-failure | ||
frr_exporter_state: started | ||
frr_exporter_enabled: true | ||
frr_exporter_restart: on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- name: restart node_exporter | ||
- name: restart frr_exporter | ||
service: | ||
name: node_exporter | ||
name: frr_exporter | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
changed_when: false | ||
|
||
roles: | ||
- role: geerlingguy.node_exporter | ||
- role: vgrid.frr_exporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,71 @@ | ||
--- | ||
- name: Check current node_exporter version. | ||
command: "{{ node_exporter_bin_path }} --version" | ||
- name: Check current frr_exporter version. | ||
command: "{{ frr_exporter_bin_path }} --version" | ||
failed_when: false | ||
changed_when: false | ||
register: node_exporter_version_check | ||
register: frr_exporter_version_check | ||
|
||
- name: Configure latest version | ||
include_tasks: config-version.yaml | ||
when: > | ||
node_exporter_version is match("latest") | ||
or node_exporter_version is not defined | ||
frr_exporter_version is match("latest") | ||
or frr_exporter_version is not defined | ||
- name: Download and unarchive node_exporter into temporary location. | ||
- name: Download and unarchive frr_exporter into temporary location. | ||
unarchive: | ||
src: "{{ node_exporter_download_url }}" | ||
src: "{{ frr_exporter_download_url }}" | ||
dest: /tmp | ||
remote_src: true | ||
mode: 0755 | ||
when: > | ||
node_exporter_version_check.stdout is not defined | ||
or node_exporter_version not in node_exporter_version_check.stdout | ||
register: node_exporter_download_check | ||
frr_exporter_version_check.stdout is not defined | ||
or frr_exporter_version not in frr_exporter_version_check.stdout | ||
register: frr_exporter_download_check | ||
|
||
- name: Move node_exporter binary into place. | ||
- name: Move frr_exporter binary into place. | ||
copy: | ||
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}/node_exporter" | ||
dest: "{{ node_exporter_bin_path }}" | ||
src: "/tmp/frr_exporter-{{ frr_exporter_version }}.linux-{{ frr_exporter_arch }}/frr_exporter" | ||
dest: "{{ frr_exporter_bin_path }}" | ||
mode: 0755 | ||
remote_src: true | ||
notify: restart node_exporter | ||
notify: restart frr_exporter | ||
when: > | ||
node_exporter_download_check is changed | ||
or node_exporter_version_check.stdout | length == 0 | ||
frr_exporter_download_check is changed | ||
or frr_exporter_version_check.stdout | length == 0 | ||
- name: Create node_exporter user. | ||
- name: Create frr_exporter user. | ||
user: | ||
name: node_exporter | ||
name: frr_exporter | ||
shell: /sbin/nologin | ||
state: present | ||
|
||
- name: Copy the node_exporter systemd unit file. | ||
- name: Add frr_exporter user to frr group | ||
user: | ||
name: frr_exporter | ||
groups: frrvty | ||
|
||
- name: Copy the frr_exporter systemd unit file. | ||
template: | ||
src: node_exporter.service.j2 | ||
dest: /etc/systemd/system/node_exporter.service | ||
src: frr_exporter.service.j2 | ||
dest: /etc/systemd/system/frr_exporter.service | ||
mode: 0644 | ||
register: node_exporter_service | ||
register: frr_exporter_service | ||
|
||
- name: Reload systemd daemon if unit file is changed. | ||
systemd: | ||
daemon_reload: true | ||
notify: restart node_exporter | ||
when: node_exporter_service is changed | ||
notify: restart frr_exporter | ||
when: frr_exporter_service is changed | ||
|
||
- name: Ensure node_exporter is running and enabled at boot. | ||
- name: Ensure frr_exporter is running and enabled at boot. | ||
service: | ||
name: node_exporter | ||
state: "{{ node_exporter_state }}" | ||
enabled: "{{ node_exporter_enabled }}" | ||
name: frr_exporter | ||
state: "{{ frr_exporter_state }}" | ||
enabled: "{{ frr_exporter_enabled }}" | ||
|
||
- name: Verify node_exporter is responding to requests. | ||
- name: Verify frr_exporter is responding to requests. | ||
uri: | ||
url: "http://{% if node_exporter_host !='' %}{{ node_exporter_host }}{% else %}localhost{% endif %}:{{ node_exporter_port }}/" | ||
url: "http://{% if frr_exporter_host !='' %}{{ frr_exporter_host }}{% else %}localhost{% endif %}:{{ frr_exporter_port }}/" | ||
return_content: true | ||
register: metrics_output | ||
failed_when: "'Metrics' not in metrics_output.content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=FrrExporter | ||
|
||
[Service] | ||
TimeoutStartSec=0 | ||
User=frr_exporter | ||
ExecStart={{ frr_exporter_bin_path }} --web.listen-address={{ frr_exporter_host }}:{{ frr_exporter_port }} {{ frr_exporter_options }} | ||
Restart={{ frr_exporter_restart }} | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file was deleted.
Oops, something went wrong.