From 4832376de6d2864a51edf7b35860842afd5ddcba Mon Sep 17 00:00:00 2001 From: Dennis Ahrens <dennis.ahrens@hs-hannover.de> Date: Mon, 17 Aug 2020 13:12:37 +0200 Subject: [PATCH] monitor remaining luh_ids as well --- checkmk/custom-files/local/monitor_hshinfo | 8 ++++++++ checkmk/custom-files/local/remaining_library_ids | 5 ----- checkmk/debian/monitor_hshinfo.sls | 7 +++++++ checkmk/debian/remaining_library_ids.sls | 7 ------- 4 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 checkmk/custom-files/local/monitor_hshinfo delete mode 100644 checkmk/custom-files/local/remaining_library_ids create mode 100644 checkmk/debian/monitor_hshinfo.sls delete mode 100644 checkmk/debian/remaining_library_ids.sls diff --git a/checkmk/custom-files/local/monitor_hshinfo b/checkmk/custom-files/local/monitor_hshinfo new file mode 100644 index 0000000..d14ff85 --- /dev/null +++ b/checkmk/custom-files/local/monitor_hshinfo @@ -0,0 +1,8 @@ +#!/bin/bash + +REMAINING_LIBRARY_IDS=$(sudo -u postgres -- psql -qtAX -d hshinfo -c "select (maximum_value::bigint - (SELECT last_value FROM hshinfo.seq_raw_library_id)) from information_schema.sequences where sequence_schema = 'hshinfo' and sequence_name = 'seq_raw_library_id';") + +REMAINING_LUH_IDS=$(sudo -u postgres -- psql -qtAX -d hshinfo -c "select count(*) from hshinfo.username_luh where allocated = false;") + +echo "P watch_lib_ids remaining_library_ids=$REMAINING_LIBRARY_IDS;400:;200: hshinfo.seq_raw_library_ids" +echo "P watch_luh_ids remaining_luh_ids=$REMAINING_LUH_IDS;1000:;100: hshinfo.usernames_luh with allocated = false" \ No newline at end of file diff --git a/checkmk/custom-files/local/remaining_library_ids b/checkmk/custom-files/local/remaining_library_ids deleted file mode 100644 index dbf9955..0000000 --- a/checkmk/custom-files/local/remaining_library_ids +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -REMAINING=$(sudo -u postgres -- psql -qtAX -d hshinfo -c "select (maximum_value::bigint - (SELECT last_value FROM hshinfo.seq_raw_library_id)) from information_schema.sequences where sequence_schema = 'hshinfo' and sequence_name = 'seq_raw_library_id';") - -echo "P watch_lib_ids remaining_library_ids=$REMAINING;400:;200: hshinfo.seq_raw_library_ids" diff --git a/checkmk/debian/monitor_hshinfo.sls b/checkmk/debian/monitor_hshinfo.sls new file mode 100644 index 0000000..ab753e9 --- /dev/null +++ b/checkmk/debian/monitor_hshinfo.sls @@ -0,0 +1,7 @@ +hsh_checkmk_monitor_hshinfo_local: + file.managed: + - name: /usr/lib/check_mk_agent/local/monitor_hshinfo + - source: salt://checkmk/custom-files/local/monitor_hshinfo + - mode: 755 + - user: root + - group: root \ No newline at end of file diff --git a/checkmk/debian/remaining_library_ids.sls b/checkmk/debian/remaining_library_ids.sls deleted file mode 100644 index 6fe076a..0000000 --- a/checkmk/debian/remaining_library_ids.sls +++ /dev/null @@ -1,7 +0,0 @@ -hsh_checkmk_library_ids_local: - file.managed: - - name: /usr/lib/check_mk_agent/local/remaining_library_ids - - source: salt://checkmk/custom-files/local/remaining_library_ids - - mode: 755 - - user: root - - group: root \ No newline at end of file -- GitLab