service_check.sh
#! /bin/bash list="nginx redis java rabbit kafka ssh" for i in $list; do wci=`ps -ef | grep "$i" | grep -v grep | wc -l` if [ $wci -gt 0 ]; then echo $i $wci >> service_check.out; fi done
cpu_mem_disk.sh
#!/bin/bash #CHECK CPU cpu_total=`cat /proc/cpuinfo | grep processor |wc -l` echo "cup_total:$cpu_total" #CHECK MEMORY mem_total=`free -m | sed -n '2p' | awk '{print $2}'` echo "mem_total:$mem_total" #CHECK DISK # disk_total=`df -l | awk '{print $2}' | sed -e 1d | awk '{sum += $1} END {print sum/1024/1024"GB"}' ` disk_total=`df -l | awk '{print $2}' | sed -e 1d | awk '{sum += $1} END {print sum/1024/1024}' ` echo "disk_total:$disk_total"