kudu状态监控脚本

zabbix监控kudu主节点、从节点数量、表分布平衡情况的脚本:

#!/bin/bash
#Script to fetch kudu statuses for monitoring systems
#Author Hari 
    HOST=`curl -s http://10.11.12.13:8051/masters|grep -A 1 "LEADER"|awk "NR==2"|awk '{print $11}'|sed 's/\"\;//g'`
    PORT=`curl -s http://10.11.12.13:8051/masters|grep -A 1 "LEADER"|awk "NR==2"|awk '{print $13}'`
	function ping {
        /sbin/pidof kudu-master | wc -l
    }
    function live_master {
        /usr/bin/curl "http://$HOST:$PORT/masters" 2>/dev/null| grep 'rpc_addresses' -c
    }
    function dead_master {
        /usr/bin/curl "http://$HOST:$PORT/masters" 2>/dev/null| grep 'Unavailable' -c
    }
    function live_tablet_servers {
        /usr/bin/curl -s "http://$HOST:$PORT/tablet-servers" 2>/dev/null| awk "NR==72" | sed "s/[^0-9^]//g"
    }
    function dead_tablet_servers {
        /usr/bin/curl -s "http://$HOST:$PORT/tablet-servers" 2>/dev/null| awk "NR==73" | sed "s/[^0-9^]//g"
    }
	function tablename_replica_skew {
		tablename_tid=`curl -s http://$HOST:$PORT/tables|grep -A 1 "schemaname.tablename"|awk "NR==2"|awk -F '"' '{print $2}'`
		curl -s http://$HOST:$PORT$tablename_tid|grep -A 4 "Skew"|awk "NR==7"|sed "s/[^0-9^]//g"
	}    	
    $1

你可能感兴趣的:(kudu状态监控脚本)