mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-22 20:03:04 +00:00
enhancement: add service debug role to catch and display service errors
Signed-off-by: Christian Krause <christian.krause@idiv.de>
This commit is contained in:
parent
9c6c96e188
commit
efd9292dc8
3 changed files with 39 additions and 0 deletions
|
@ -41,3 +41,9 @@
|
||||||
enabled: true
|
enabled: true
|
||||||
tags:
|
tags:
|
||||||
- blackbox_exporter_run
|
- blackbox_exporter_run
|
||||||
|
|
||||||
|
- name: Display service errors
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: service_debug
|
||||||
|
vars:
|
||||||
|
__service_name: blackbox_exporter
|
||||||
|
|
27
roles/service_debug/tasks/main.yml
Normal file
27
roles/service_debug/tasks/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: 'Run `systemctl status {{ __service_name }}`'
|
||||||
|
ansible.builtin.command: 'systemctl status {{ __service_name }}.service'
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
register: __service_status
|
||||||
|
|
||||||
|
- name: 'Show `systemctl status` output for {{ __service_name }}'
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: __service_status.stdout_lines
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: 'Run `journalctl -x -u {{ __service_name }}`'
|
||||||
|
ansible.builtin.command: 'journalctl -x -u {{ __service_name }}.service'
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
register: __service_journal
|
||||||
|
|
||||||
|
- name: 'Show `journalctl -x` output for {{ __service_name }}'
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: __service_journal.stdout_lines
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
...
|
|
@ -61,3 +61,9 @@
|
||||||
- not ansible_check_mode
|
- not ansible_check_mode
|
||||||
tags:
|
tags:
|
||||||
- smokeping_prober_run
|
- smokeping_prober_run
|
||||||
|
|
||||||
|
- name: Display service errors
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: service_debug
|
||||||
|
vars:
|
||||||
|
__service_name: smokeping_prober
|
||||||
|
|
Loading…
Reference in a new issue