姓名:刘浩然。 2020年大目标Python

监控glusterfs

监控集群状态

[4ajr@elk1 scripts]$ cat glusterfs_peer_status.sh 

#!/bin/bash

peer_status=`sudo gluster peer status |  grep State | uniq`

if [ "State: Peer in Cluster (Connected)" = "$peer_status" ]

  then

    echo "1"

  else

    echo "0"

fi

 

UserParameter=status_gluster,bash /soft/zabbix_agent/scripts/glusterfs_peer_status.sh

监控端口

[4ajr@elk1 scripts]$ cat glusterfs_port_listen.sh

#!/bin/bash

port=`ss -ant | grep LISTEN | grep 49153 | awk '{print $4}' | awk -F : '{print $2}'`

if [ $port -eq 49153 ]

    then

  echo 1

else

  echo 0

fi

UserParameter=port_gluster,bash /soft/zabbix_agent/scripts/glusterfs_port_listen.sh

 

posted @ 2019-02-03 10:11  pluto2charon  阅读(1019)  评论(0编辑  收藏  举报