1. check_old_gc_es_76.sh
    2. #!/bin/bash
    3. for i in `seq 1 4`;
    4. do
    5. es_pid=`ps -ef |grep es-${i} |grep -v grep|awk '{print $2}'`
    6. if [ -z ${es_pid} ];then
    7. echo "Can't find es-${i} process and it will be started!"
    8. else
    9. echo "es-${i} jstat gcutil:"
    10. su - elastic -c "/app/es-1/jdk/bin/jstat -gcutil ${es_pid}"
    11. fi
    12. done
    1. [root@cnsz17pl2550 state_es]# cat check_old_gc_es_76.sls
    2. shell_test:
    3. cmd.script:
    4. - source: salt://state_es/check_old_gc_es_76.sh
    5. - user: root
    1. salt -S 10.117.93.4 state.sls state_es.check_old_gc_es_76

    image.png
    image.png
    image.png