From 61f9988a970f18efa7af0edde38e130a233e0ee7 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 28 Oct 2024 17:24:41 +0100
Subject: [PATCH] update check script

---
 check_gitlab_tokens | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/check_gitlab_tokens b/check_gitlab_tokens
index 9b4ca1f..58fdd8c 100755
--- a/check_gitlab_tokens
+++ b/check_gitlab_tokens
@@ -21,9 +21,6 @@ export self_APPVERSION=0.1
 GITLAB_API='https://gitlab.example.com/api/v4'
 GITLAB_TOKEN='glpat-12345678'
 
-GITLAB_API='https://git-repo.iml.unibe.ch/api/v4'
-GITLAB_TOKEN='glpat-4Lh6j_aJv7b6zVsRxyXF'
-
 GITLAB_CONFIG=/etc/icinga2/gitlab.cfg
 REST_CLIENT="$( dirname $0 )/../inc/rest-api-client.sh"
 
@@ -33,8 +30,8 @@ typeset -i iTokensFound
 NL="
 "
 
-typeset -i iWarnLimit=300
-typeset -i iCriticalLimit=200
+typeset -i iWarnLimit=30
+typeset -i iCriticalLimit=10
 
 typeset -i iCountWarn=0
 typeset -i iCountCritical=0
@@ -218,7 +215,12 @@ do
         fi
     fi
 
-    output+="$sExpire $sStatus $sName $myusername${NL}" 
+    # url of owning group (is that useful?)
+    sType=$( cut -f 1 -d "_" <<< "$myusername" )s
+    sId2=$( cut -f 2 -d "_" <<< "$myusername" )
+    myurl="$GITLAB_API/$sType/$sId2"
+
+    output+="$sExpire $sStatus $sName $myusername $myurl${NL}" 
 
 done 
 
-- 
GitLab