Skip to content

Commit

Permalink
Merge pull request #20 from Rosa-Luxemburgstiftung-Berlin/checkmk_hea…
Browse files Browse the repository at this point in the history
…lth_checks

implemented health check for checkmk
  • Loading branch information
zerwes authored Jun 9, 2024
2 parents 9dd6627 + 44c24f9 commit 02b0dfe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ openproject_required_packages:

openproject_hold_package: false

# main version
openproject_main_version: 14

# you can set this to something like openproject=13.3.1-1709106543.9f5d5716.bookworm
Expand Down Expand Up @@ -94,5 +95,7 @@ openproject_update_installerdat: {}
# openproject_update_installerdat:
# 'openproject/admin_email': [email protected]

# install the health check for ckeckmk
openproject_use_checkmk_check: false

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 smartindent nu ft=yaml
7 changes: 7 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
notify: openproject restart
with_items: "{{ openproject_configset }}"

- name: install health check for checkmk
ansible.builtin.template:
src: checkmk_health_checks.j2
dest: /usr/lib/check_mk_agent/local/openproject_health_check
mode: '0755'
when: openproject_use_checkmk_check | bool

- name: ensure backup will be performed before upgrade
ansible.builtin.set_fact:
openproject_backup_now: true
Expand Down
12 changes: 12 additions & 0 deletions templates/checkmk_health_checks.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash

declare -r OPJ_HOST="{{ ansible_fqdn }}"

curl -s -w "\n" https://${OPJ_HOST}/health_checks/all 2>&1 | sed '1d' | while read checkline; do
CHECKNAME=${checkline%%: *}
STATUSTXT=${checkline#*: }
STATUS=${STATUSTXT%% *}
ECODE=0
[ "$STATUS" != "PASSED" ] && ECODE=1
echo "$ECODE health_check_$CHECKNAME - $STATUSTXT"
done

0 comments on commit 02b0dfe

Please sign in to comment.