File tree Expand file tree Collapse file tree 6 files changed +87
-0
lines changed Expand file tree Collapse file tree 6 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 2222- ` node_exporter_checksum ` - The checksum for the version of node exporter
2323- ` alertmanager_version ` - Which version of alertmanager to download
2424- ` alertmanager_checksum ` - The checksum for the version of alertmanager
25+ - ` redis_exporter_version ` - Which version of redis_exporter to download
26+ - ` redis_exporter_checksum ` - The checksum for the version of redis_exporter
2527- ` grafana_ini_file ` - The file to use for ` grafana.ini `
2628 - Default: ` grafana.ini `
2729- ` prometheus_config_file ` - The file to use for ` prometheus.yml `
@@ -71,6 +73,14 @@ Node exporter only:
7173 - { role: prometheus, action: "node_exporter" }
7274` ` `
7375
76+ Redis exporter:
77+
78+ ` ` ` yaml
79+ - hosts : servers
80+ roles :
81+ - { role: prometheus, action: "redis_exporter" }
82+ ` ` `
83+
7484## License
7585
7686MIT
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ node_exporter_checksum: 7ffb3773abb71dd2b2119c5f6a7a0dbca0cff34b24b2ced9e01d9897
88alertmanager_version : 0.10.0
99alertmanager_checksum : ef09b9c9795a7148fd74bb1dcecdd00a4fa25da05a4d2b8517e6ceb5f124e1a8
1010
11+ redis_exporter_version : 0.14
12+ redis_exporter_checksum : ba80d6902a7020ca94156741cb1d6e44480d19bfa753315d5e6b0f099921bce0
13+
1114grafana_ini_file : grafana.ini
1215prometheus_config_file : prometheus.yml
1316prometheus_alert_file : alertmanager.yml
Original file line number Diff line number Diff line change 2727 name : node_exporter
2828 state : restarted
2929 become : true
30+
31+ - name : restart redis_exporter
32+ service :
33+ name : redis_exporter
34+ state : restarted
35+ become : true
Original file line number Diff line number Diff line change 99
1010- import_tasks : node_exporter.yml
1111 when : action == "full" or action == "node_exporter"
12+
13+ - import_tasks : redis_exporter.yml
14+ when : action == "redis_exporter"
Original file line number Diff line number Diff line change 1+ - name : " Create the prometheus user"
2+ user :
3+ name : prometheus
4+ comment : " Prometheus"
5+ become : true
6+
7+ - name : " Create version folder"
8+ file :
9+ path : " /home/prometheus/redis_exporter/{{ redis_exporter_version }}"
10+ state : directory
11+ mode : 0700
12+ become : yes
13+ become_user : prometheus
14+
15+ - name : " Download the redis_exporter file"
16+ get_url :
17+ url : " https://github.com/oliver006/redis_exporter/releases/download/v{{ redis_exporter_version }}/redis_exporter-v{{ redis_exporter_version }}.linux-amd64.tar.gz"
18+ dest : " /home/prometheus/redis_exporter/{{ redis_exporter_version }}/redis_exporter.tar.gz"
19+ mode : 0400
20+ checksum : " sha256:{{ redis_exporter_checksum }}"
21+ become : yes
22+ become_user : prometheus
23+
24+ - name : stat final file
25+ stat : path="/home/prometheus/redis_exporter/{{ redis_exporter_version }}/redis_exporter"
26+ register : redis_exporter_stat
27+ become : yes
28+ become_user : prometheus
29+
30+ - name : " Extract archive"
31+ unarchive :
32+ src : " /home/prometheus/redis_exporter/{{ redis_exporter_version }}/redis_exporter.tar.gz"
33+ dest : " /home/prometheus/redis_exporter/{{ redis_exporter_version }}/"
34+ remote_src : yes
35+ when : redis_exporter_stat.stat.exists == False
36+ become : yes
37+ become_user : prometheus
38+
39+ - name : Template out the service file
40+ template :
41+ src : redis_exporter.service.j2
42+ dest : /etc/systemd/system/redis_exporter.service
43+ mode : 0644
44+ become : yes
45+ notify :
46+ - reload systemd
47+ - restart redis_exporter
48+
49+ - name : Enable redis exporter
50+ systemd :
51+ enabled : yes
52+ name : redis_exporter
53+ become : yes
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description=Prometheus Redis Exporter
3+ After=network-online.target
4+
5+ [Service]
6+ User=prometheus
7+ Restart=on-failure
8+ WorkingDirectory=/home/prometheus/redis_exporter/{{ redis_exporter_version }}
9+ ExecStart=/home/prometheus/redis_exporter/{{ redis_exporter_version }}/redis_exporter
10+
11+ [Install]
12+ WantedBy=multi-user.target
You can’t perform that action at this time.
0 commit comments