-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitoring.yml
More file actions
36 lines (30 loc) · 920 Bytes
/
monitoring.yml
File metadata and controls
36 lines (30 loc) · 920 Bytes
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
---
# Monitoring Setup Example
#
# Author: Assaf Feuerstein
#
# Quick example to install Prometheus Node Exporter.
#
# Usage:
# ansible-playbook monitoring.yml -i hosts.ini
# ansible-playbook monitoring.yml -i hosts.ini -e "node_exporter_port=9200"
- name: Setup Prometheus Node Exporter
hosts: all
remote_user: "{{ ansible_user | default('admin') }}"
gather_facts: yes
become: yes
vars:
node_exporter_version: "1.8.2"
node_exporter_port: 9100
roles:
- role: prometheus-node-exporter
post_tasks:
- name: Check Node Exporter is running
uri:
url: "http://localhost:{{ node_exporter_port }}/metrics"
return_content: no
register: exporter_check
ignore_errors: true
- name: Display status
debug:
msg: "Node Exporter is {{ 'running' if exporter_check.status == 200 else 'not responding' }} on port {{ node_exporter_port }}"