Parcourir la source

Added check cnmon shell.

Qiuyang il y a 10 mois
Parent
commit
4ab4e9fb16
1 fichiers modifiés avec 26 ajouts et 0 suppressions
  1. 26 0
      check_tacks/check_cnmon.sh

+ 26 - 0
check_tacks/check_cnmon.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+Cluster=`cnmon info | grep "Cluster 0"`
+info=${Cluster}
+b=${info//[A-Za-z :]/}
+temp=${b:1}
+echo "temp:$temp℃"
+
+use_rate=`cnmon | sed -n '8p' | awk -F '[ %]+' '{print $10}'`
+echo "cn use rate:$use_rate%"
+
+if [ $temp -gt 85 ]
+then
+    ehco "Temperature is too high, Portal algorithm service"
+    docker stop gsd_cnstream_1
+    exit 1
+else
+    if [ $use_rate -eq 0 ]
+    then 
+        echo "CNMON service stops, restart."
+        cd /opt/GSD
+        docker-compose restart
+        exit 1
+    else
+        exit 0
+    fi
+fi