-
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
Showing
4 changed files
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- hosts: all | ||
roles: | ||
- ping_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
ping_exporter_download_url: https://raw.githubusercontent.com/frankiexyz/ping-exporter/master/ping-exporter.py | ||
ping_exporter_checksum: sha256:0e70e1cdd6c82155b11a71486bde6657b733f3479ffaf428ea4a6a0760ca5aec |
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,44 @@ | ||
--- | ||
- block: | ||
- name: Download ping_exporter into /opt | ||
get_url: | ||
url: "{{ ping_exporter_download_url }}" | ||
dest: /opt | ||
mode: '0755' | ||
checksum: "{{ ping_exporter_checksum }}" | ||
|
||
- name: Install fping | ||
package: | ||
name: fping | ||
state: latest | ||
|
||
- name: Create ping_exporter user | ||
user: | ||
name: ping_exporter | ||
shell: /sbin/nologin | ||
state: present | ||
|
||
- name: Copy the ping_exporter systemd unit file | ||
template: | ||
src: ping_exporter.service.j2 | ||
dest: /etc/systemd/system/ping_exporter.service | ||
mode: 0644 | ||
|
||
- name: Reload systemd daemon if unit file is changed. | ||
systemd: | ||
daemon_reload: true | ||
|
||
- name: Ensure ping_exporter is running and enabled | ||
service: | ||
name: ping_exporter | ||
enabled: yes | ||
state: restarted | ||
|
||
- name: Verify node_exporter is responding to requests. | ||
uri: | ||
url: http://127.0.0.1:8085/?target=127.0.0.1" | ||
return_content: true | ||
register: metrics_output | ||
failed_when: "'ping_min' not in metrics_output.content" | ||
|
||
become: true |
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,10 @@ | ||
[Unit] | ||
Description=Ping Exporter for Prometheus (Created By Frankie) | ||
After=multi-user.target | ||
|
||
[Service] | ||
Type=idle | ||
ExecStart=/usr/bin/python /opt/ping-exporter.py | ||
|
||
[Install] | ||
WantedBy=multi-user.target |