阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Zabbix 3.4监控Zookeeper3.4(附脚本模板)

263次阅读
没有评论

共计 13702 个字符,预计需要花费 35 分钟才能阅读完成。

zabbix3.4 监控 zookeeper

zookeeper 监控要点系统监控 这个监控 linux 系统以及修改 linux 服务器参数即可
内存使用量 ZooKeeper 应当完全运行在内存中,不能使用到 SWAP。Java Heap 大小不能超过可用内存。
Swap 使用量 使用 Swap 会降低 ZooKeeper 的性能,设置 vm.swappiness = 0
网络带宽占用 如果发现 ZooKeeper 性能降低关注下网络带宽占用情况和丢包情况,通常情况下 ZooKeeper 是 20% 写入 80% 读入
磁盘使用量 ZooKeeper 数据目录使用情况需要注意
磁盘 I /O ZooKeeper 的磁盘写入是异步的,所以不会存在很大的 I / O 请求,如果 ZooKeeper 和其他 I / O 密集型服务公用应该关注下磁盘 I / O 情况

ZooKeeper 监控
zk_avg/min/max_latency 响应一个客户端请求的时间,建议这个时间大于 10 个 Tick 就报警 平均延迟 / 最小延迟 / 最大延迟
zk_outstanding_requests 排队请求的数量,当 ZooKeeper 超过了它的处理能力时,这个值会增大,建议设置报警阀值为 10 堆积请求数
zk_packets_received 接收到客户端请求的包数量 收包数
zk_packets_sent 发送给客户单的包数量,主要是响应和通知 发包数
zk_max_file_descriptor_count 最大允许打开的文件数,由 ulimit 控制 最大文件描述符数量
zk_open_file_descriptor_count 打开文件数量,当这个值大于允许值得 85% 时报警 打开的文件描述符数量
Mode 运行的角色,如果没有加入集群就是 standalone, 加入集群式 follower 或者 leader
zk_followers leader 角色才会有这个输出, 集合中 follower 的个数。正常的值应该是集合成员的数量减 1 follower 数量
zk_pending_syncs leader 角色才会有这个输出,pending syncs 的数量 准备同步数
zk_znode_count znodes 的数量 znode 数量
zk_watch_count watches 的数量 watch 数量
Java Heap Size ZooKeeper Java 进程的

监控脚本

[root@lanzhu-linux-nginx-cn summer]# cat check_zookeeper.sh
#!/bin/bash

function imok {
        echo ruok|nc 127.0.0.1 2181 | wc -l
}

function  zk_min_latency {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 4” 2>/dev/null
}

function  zk_avg_latency {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 2” 2>/dev/null
}

function  zk_max_latency {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 3” 2>/dev/null
}

function  zk_outstanding_requests {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 8” 2>/dev/null
}

function  zk_packets_received {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 5” 2>/dev/null
}

function  zk_packets_sent {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 6” 2>/dev/null
}

function  zk_znode_count {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 10” 2>/dev/null
}

function  zk_watch_count {
        echo mntr | nc 127.0.0.1 2181 | grep “$1” |awk ‘{print $2}’| awk “NR == 11” 2>/dev/null
}

#excute function
$1

zabbix_agentd.conf 配置文件添加

UserParameter=zookeeper.status[*],/alidata/summer/check_zookeeper.sh $1

zabbix-web 端添加 zookeeper 模板见附件

<?xml version=”1.0″ encoding=”UTF-8″?>
<zabbix_export>
<version>3.4</version>
<date>2018-09-28T08:08:15Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template App zookeeper</template>
<name>Template App zookeeper</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>zookeeper</name>
</application>
</applications>
<items>
<item>
<name>zookeeper status running</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[imok]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_avg_latency</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_avg_latency]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_max_latency</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_max_latency]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_min_latency</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_min_latency]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_outstanding_requests</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_outstanding_requests]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_packets_received</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_packets_received]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zk_packets_sent</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_packets_sent]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zk_watch_count</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_watch_count]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
<item>
<name>zookeeper status zk_znode_count</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>zookeeper.status[zk_znode_count]</key>
<delay>60</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>zookeeper</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<master_item/>
</item>
</items>
<discovery_rules/>
<httptests/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template App zookeeper:zookeeper.status[imok].last()}<>0</expression>
<recovery_mode>1</recovery_mode>
<recovery_expression>{Template App zookeeper:zookeeper.status[imok].diff()}=0</recovery_expression>
<name>php_39.108.161.17_zookeeper is down</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
</triggers>
<graphs>
<graph>
<name>zookeeper request time</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>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_avg_latency]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>F63100</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_max_latency]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>0</drawtype>
<color>2774A4</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_min_latency]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>zookeeper server status</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>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_packets_sent]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>F63100</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_watch_count]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>0</drawtype>
<color>2774A4</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_outstanding_requests]</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<drawtype>0</drawtype>
<color>A54F10</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_packets_received]</key>
</item>
</graph_item>
<graph_item>
<sortorder>4</sortorder>
<drawtype>0</drawtype>
<color>FC6EA3</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[zk_znode_count]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>zookeeper status</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>1</drawtype>
<color>1A7C11</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template App zookeeper</host>
<key>zookeeper.status[imok]</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计13702字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中