check_cnmon.sh 533 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. Cluster=`cnmon info | grep "Cluster 0"`
  3. info=${Cluster}
  4. b=${info//[A-Za-z :]/}
  5. temp=${b:1}
  6. echo "temp:$temp℃"
  7. use_rate=`cnmon | sed -n '8p' | awk -F '[ %]+' '{print $10}'`
  8. echo "cn use rate:$use_rate%"
  9. if [ $temp -gt 85 ]
  10. then
  11. ehco "Temperature is too high, Portal algorithm service"
  12. docker stop gsd_cnstream_1
  13. exit 1
  14. else
  15. if [ $use_rate -eq 0 ]
  16. then
  17. echo "CNMON service stops, restart."
  18. cd /opt/GSD
  19. docker-compose restart
  20. exit 1
  21. else
  22. exit 0
  23. fi
  24. fi