中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Zabbix3.4通過shell腳本監控redis集群

發布時間:2020-07-04 15:40:29 來源:網絡 閱讀:622 作者:xuad88 欄目:系統運維

為了避免單點故障,生產環境中redis升級為集群模式,需要對redis集群進行監控,一旦有節點出現故障便觸發報警。Redis有自帶的redis-cli客戶端,通過cluster info命令能查詢到集群的運行情況,我們可以寫個shell腳本,通過zabbix來調用這個腳本實現集群的監控。

一、cluster info命令的使用

命令格式:

redis-cli -h [hostname] -p [port] -a [password] cluster info

1、查詢集群運行情況(其中一個master節點即可)

/data/redis/bin/redis-cli -h xxx.xxx.xxx.xxx -a 'password' -p 7001 cluster info

Zabbix3.4通過shell腳本監控redis集群
2、查詢集群運行狀態,1為正常,0為故障

/data/redis/bin/redis-cli -h xxx.xxx.xxx.xxx -a 'password' -p 7001 cluster info | grep "cluster_state"

Zabbix3.4通過shell腳本監控redis集群

/data/redis/bin/redis-cli -h xxx.xxx.xxx.xxx -a 'password' -p 7001 cluster info | grep -w "cluster_state" | awk -F':' '{print $2}'|grep -c "ok"

Zabbix3.4通過shell腳本監控redis集群
3、查詢集群已知節點數量

/data/redis/bin/redis-cli -h xxx.xxx.xxx.xxx -a 'password' -p 7001 cluster info | grep -w "cluster_known_nodes" | awk -F':' '{print $2}'

Zabbix3.4通過shell腳本監控redis集群

二、創建監控腳本

vim /etc/zabbix/zabbix_agentd.d/redis_cluster.sh
#!/bin/bash
REDISCLI="/data/redis/bin/redis-cli"
HOST="xxx.xxx.xxx.xxx"
PORT=7001
PASS="password"

if [[ $# == 1 ]];then
    case $1 in
        cluster_state)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_state" | awk -F':' '{print $2}' | grep -c "ok"`
            echo $result
        ;;
        cluster_slots_assigned)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_slots_assigned" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_slots_ok)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_slots_ok" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_slots_pfail)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_slots_pfail" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_slots_fail)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_slots_fail" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_known_nodes)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_known_nodes" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_size)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_size" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_current_epoch)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_current_epoch" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_my_epoch)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_my_epoch" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_ping_sent)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_ping_sent" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_pong_sent)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_pong_sent" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_sent)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_sent" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_ping_received)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_ping_received" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_pong_received)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_pong_received" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_meet_received)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_meet_received" | awk -F':' '{print $2}'`
            echo $result
        ;;
        cluster_stats_messages_received)
            result=`$REDISCLI -h $HOST -a $PASS -p $PORT cluster info 2>/dev/null | grep -w "cluster_stats_messages_received" | awk -F':' '{print $2}'`
            echo $result
        ;;
        *)
            echo -e "\033[33mUsage: $0 {cluster_state|cluster_slots_assigned|cluster_slots_ok|cluster_slots_pfail|cluster_slots_fail|cluster_known_nodes|cluster size|cluster current epoch|cluster my epoch|cluster_stats_messages_ping_sent|cluster_stats_messages_pong_sent|cluster_stats_messages_sent|cluster_stats_messages_ping_received|cluster_stats_messages_pong_received|cluster_stats_messages_meet_received|cluster_stats_messages_received}\033[0m"
        ;;
    esac
fi

2、賦予腳本可執行權限

chmod +x /etc/zabbix/zabbix_agentd.d/redis_cluster.sh

3、腳本測試
查看redis集群節點數量

/etc/zabbix/zabbix_agentd.d/redis_cluster.sh cluster_known_nodes

Zabbix3.4通過shell腳本監控redis集群

三、創建redis集群監控配置文件

1、編寫redis監控配置文件

vim /etc/zabbix/zabbix_agentd.d/redis.conf
UserParameter=Redis.Cluster[*],/etc/zabbix/zabbix_agentd.d/redis_cluster.sh $1

2、重啟zabbix-agent

systemctl restart zabbix-agent

3、在zabbix server端測試

zabbix_get -s xxx.xxx.xxx.xxx -p 10050 -k "Redis.Cluster[cluster_slots_ok]"

Zabbix3.4通過shell腳本監控redis集群

四、創建并導入監控模板

1、創建監控模板文件
注:此模板報警閥值設置為cluster current epoch < 6、cluster known nodes < 6和clusterstate不是ok
redis_cluster_templates.xml文件內容如下

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>3.4</version>
    <date>2019-12-06T05:43:56Z</date>
    <groups>
        <group>
            <name>Templates</name>
        </group>
    </groups>
    <templates>
        <template>
            <template>Template Redis Cluster</template>
            <name>Template Redis Cluster</name>
            <description>redis集群監控模板</description>
            <groups>
                <group>
                    <name>Templates</name>
                </group>
            </groups>
            <applications>
                <application>
                    <name>Redis cluster node</name>
                </application>
                <application>
                    <name>Redis cluster slots</name>
                </application>
                <application>
                    <name>Redis cluster stats messages</name>
                </application>
            </applications>
            <items>
                <item>
                    <name>cluster_current_epoch</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_current_epoch]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster node</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_known_nodes</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_known_nodes]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster node</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_my_epoch</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_my_epoch]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster node</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_size</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_size]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster node</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_slots_assigned</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_slots_assigned]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster slots</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_slots_fail</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_slots_fail]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster slots</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_slots_ok</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_slots_ok]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster slots</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_slots_pfail</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_slots_pfail]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster slots</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_state</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_state]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications/>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_meet_received</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_meet_received]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_ping_received</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_ping_received]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_ping_sent</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_ping_sent]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_pong_received</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_pong_received]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_pong_sent</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_pong_sent]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_received</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_received]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
                <item>
                    <name>cluster_stats_messages_sent</name>
                    <type>0</type>
                    <snmp_community/>
                    <snmp_oid/>
                    <key>Redis.Cluster[cluster_stats_messages_sent]</key>
                    <delay>30s</delay>
                    <history>90d</history>
                    <trends>365d</trends>
                    <status>0</status>
                    <value_type>3</value_type>
                    <allowed_hosts/>
                    <units/>
                    <snmpv3_contextname/>
                    <snmpv3_securityname/>
                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
                    <snmpv3_authpassphrase/>
                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
                    <snmpv3_privpassphrase/>
                    <params/>
                    <ipmi_sensor/>
                    <authtype>0</authtype>
                    <username/>
                    <password/>
                    <publickey/>
                    <privatekey/>
                    <port/>
                    <description/>
                    <inventory_link>0</inventory_link>
                    <applications>
                        <application>
                            <name>Redis cluster stats messages</name>
                        </application>
                    </applications>
                    <valuemap/>
                    <logtimefmt/>
                    <preprocessing/>
                    <jmx_endpoint/>
                    <master_item/>
                </item>
            </items>
            <discovery_rules/>
            <httptests/>
            <macros/>
            <templates/>
            <screens/>
        </template>
    </templates>
    <triggers>
        <trigger>
            <expression>{Template Redis Cluster:Redis.Cluster[cluster_current_epoch].last()}&lt;6</expression>
            <recovery_mode>0</recovery_mode>
            <recovery_expression/>
            <name>cluster current epoch &lt; 6</name>
            <correlation_mode>0</correlation_mode>
            <correlation_tag/>
            <url/>
            <status>0</status>
            <priority>3</priority>
            <description/>
            <type>0</type>
            <manual_close>1</manual_close>
            <dependencies/>
            <tags/>
        </trigger>
        <trigger>
            <expression>{Template Redis Cluster:Redis.Cluster[cluster_known_nodes].last()}&lt;6</expression>
            <recovery_mode>0</recovery_mode>
            <recovery_expression/>
            <name>cluster known nodes &lt; 6</name>
            <correlation_mode>0</correlation_mode>
            <correlation_tag/>
            <url/>
            <status>0</status>
            <priority>3</priority>
            <description/>
            <type>0</type>
            <manual_close>1</manual_close>
            <dependencies/>
            <tags/>
        </trigger>
        <trigger>
            <expression>{Template Redis Cluster:Redis.Cluster[cluster_state].last()}=0</expression>
            <recovery_mode>0</recovery_mode>
            <recovery_expression/>
            <name>Redis Cluster is down</name>
            <correlation_mode>0</correlation_mode>
            <correlation_tag/>
            <url/>
            <status>0</status>
            <priority>4</priority>
            <description/>
            <type>0</type>
            <manual_close>1</manual_close>
            <dependencies/>
            <tags/>
        </trigger>
    </triggers>
    <graphs>
        <graph>
            <name>Redis cluster node</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>1A7C11</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_current_epoch]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>F63100</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_known_nodes]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>2774A4</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_my_epoch]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>3</sortorder>
                    <drawtype>0</drawtype>
                    <color>A54F10</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_size]</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Redis cluster slots</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>1A7C11</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_slots_assigned]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>F63100</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_slots_fail]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>2774A4</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_slots_ok]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>3</sortorder>
                    <drawtype>0</drawtype>
                    <color>A54F10</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_slots_pfail]</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
        <graph>
            <name>Redis cluster stats messages</name>
            <width>900</width>
            <height>200</height>
            <yaxismin>0.0000</yaxismin>
            <yaxismax>100.0000</yaxismax>
            <show_work_period>1</show_work_period>
            <show_triggers>1</show_triggers>
            <type>0</type>
            <show_legend>1</show_legend>
            <show_3d>0</show_3d>
            <percent_left>0.0000</percent_left>
            <percent_right>0.0000</percent_right>
            <ymin_type_1>0</ymin_type_1>
            <ymax_type_1>0</ymax_type_1>
            <ymin_item_1>0</ymin_item_1>
            <ymax_item_1>0</ymax_item_1>
            <graph_items>
                <graph_item>
                    <sortorder>0</sortorder>
                    <drawtype>0</drawtype>
                    <color>1A7C11</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_meet_received]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>1</sortorder>
                    <drawtype>0</drawtype>
                    <color>F63100</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_ping_received]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>2</sortorder>
                    <drawtype>0</drawtype>
                    <color>2774A4</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_ping_sent]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>3</sortorder>
                    <drawtype>0</drawtype>
                    <color>A54F10</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_pong_received]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>4</sortorder>
                    <drawtype>0</drawtype>
                    <color>FC6EA3</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_pong_sent]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>5</sortorder>
                    <drawtype>0</drawtype>
                    <color>6C59DC</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_received]</key>
                    </item>
                </graph_item>
                <graph_item>
                    <sortorder>6</sortorder>
                    <drawtype>0</drawtype>
                    <color>AC8C14</color>
                    <yaxisside>0</yaxisside>
                    <calc_fnc>7</calc_fnc>
                    <type>0</type>
                    <item>
                        <host>Template Redis Cluster</host>
                        <key>Redis.Cluster[cluster_stats_messages_sent]</key>
                    </item>
                </graph_item>
            </graph_items>
        </graph>
    </graphs>
</zabbix_export>

2、導入監控模板
配置—模板—導入
Zabbix3.4通過shell腳本監控redis集群
點擊“選擇文件”,找到redis_cluster_templates.xml文件,將其導入
Zabbix3.4通過shell腳本監控redis集群

五、給主機添加監控模板

Zabbix3.4通過shell腳本監控redis集群
Zabbix3.4通過shell腳本監控redis集群

六、監控效果圖

Zabbix3.4通過shell腳本監控redis集群
Zabbix3.4通過shell腳本監控redis集群
Zabbix3.4通過shell腳本監控redis集群

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

陇川县| 那曲县| 邓州市| 乌什县| 黄梅县| 阳城县| 武汉市| 宁南县| 扎赉特旗| 辉南县| 辽阳市| 蚌埠市| 云霄县| 集贤县| 祥云县| 商城县| 石家庄市| 庄浪县| 南平市| 渭南市| 太和县| 当雄县| 庄河市| 潮安县| 福泉市| 东乌珠穆沁旗| 利川市| 华坪县| 安国市| 长治市| 赞皇县| 行唐县| 达拉特旗| 汉源县| 惠州市| 治县。| 永春县| 航空| 沙雅县| 资阳市| 宿州市|