From f25a80ff53cb1aa881eb6e08f40c9033e2ea4d20 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:26 -0400 Subject: [PATCH] Add additional CMK checks --- roles/pvc/tasks/pvc/main.yml | 6 ++++++ roles/pvc/tasks/zookeeper/main.yml | 6 ++++++ roles/pvc/templates/zookeeper/zk_status.j2 | 13 +++++++++++++ 3 files changed, 25 insertions(+) create mode 100755 roles/pvc/templates/zookeeper/zk_status.j2 diff --git a/roles/pvc/tasks/pvc/main.yml b/roles/pvc/tasks/pvc/main.yml index 52ed79f..f645fd4 100644 --- a/roles/pvc/tasks/pvc/main.yml +++ b/roles/pvc/tasks/pvc/main.yml @@ -45,6 +45,12 @@ no_log: True when: pvc_api_enable_ssl and not pvc_api_ssl_key_path +- name: install check_mk agent check + template: + src: pvc/pvc_status.j2 + dest: /usr/lib/check_mk_agent/plugins/pvc_status + mode: 0755 + - include: pvc/bootstrap.yml run_once: yes when: bootstrap is defined and bootstrap and is_coordinator diff --git a/roles/pvc/tasks/zookeeper/main.yml b/roles/pvc/tasks/zookeeper/main.yml index bd13a9e..96c5a65 100644 --- a/roles/pvc/tasks/zookeeper/main.yml +++ b/roles/pvc/tasks/zookeeper/main.yml @@ -24,6 +24,12 @@ dest: /etc/cron.daily/zookeeper-vacuum mode: 0755 +- name: install check_mk agent check + template: + src: zookeeper/zk_status.j2 + dest: /usr/lib/check_mk_agent/plugins/zk_status + mode: 0755 + - name: install systemd unit file template: src: zookeeper/zookeeper.service.j2 diff --git a/roles/pvc/templates/zookeeper/zk_status.j2 b/roles/pvc/templates/zookeeper/zk_status.j2 new file mode 100755 index 0000000..72c3cf9 --- /dev/null +++ b/roles/pvc/templates/zookeeper/zk_status.j2 @@ -0,0 +1,13 @@ +#!/bin/bash + +# Zookeeper cluster status check for Check_MK +# {{ ansible_managed }} + +echo "<<>>" +zk_stat=$( /usr/share/zookeeper/bin/zkCli.sh -server $(hostname -s):2181 -q get /primary_node 2>/dev/null ) +zk_retcode=$? +if [[ ${zk_retcode} -eq 0 ]]; then + echo "Connection succeeded" +else + echo "Connection failed" +fi