From 6ced21dc506a817c5d8e9abff1b501d2408952a9 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 11 May 2021 16:01:16 +0200
Subject: [PATCH] added centos8 support

---
 check_packages2install | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/check_packages2install b/check_packages2install
index ee2b07d..8a4fbaa 100755
--- a/check_packages2install
+++ b/check_packages2install
@@ -15,6 +15,7 @@
 # 2019-04-29  v1.2  ah     yum: supress error channel output (task #2959)
 # 2020-03-05  v1.3  <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
 # 2020-03-11  v1.4  <axel.hahn@iml.unibe.ch> add -c -w limits; added perfdata (yum)
+# 2021-05-11  v1.4  <axel.hahn@iml.unibe.ch> added centos8 support
 # ======================================================================
 
 
@@ -75,7 +76,7 @@ function checkApt(){
 # check updates with yum and exit script
 function checkYum(){
 
-  summary=`ph.execIfReady "/usr/bin/yum --security  check-update 2>/dev/null | fgrep 'for security'" `
+  summary=`ph.execIfReady "/usr/bin/yum --security  check-update 2>&1 | fgrep 'security'" `
 
   # example outputs:
   # I   No packages needed for security; 223 packages available
@@ -87,12 +88,13 @@ function checkYum(){
   ph.setStatusByLimit ${iPkg2Update} ${iWarnLimit} ${iCriticalLimit}
 
   # step II: security packages switch to "critical"
+  #          remark: a warn level does not exist
   if [ ${iPkgSecurity} -ne 0 ]; then
     ph.setStatus "critical"
   fi
 
   ph.perfadd "updates-available" "${iPkg2Update}"  ${iWarnLimit} ${iCriticalLimit}
-  ph.perfadd "updates-security"  "${iPkgSecurity}" ""            1
+  ph.perfadd "updates-security"  "${iPkgSecurity}" 1             1
 
   ph.status "$summary"
   echo "[yum]"
-- 
GitLab