欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kafka lag 监控脚本

程序员文章站 2022-05-21 12:58:30
...
 
shell脚本获取lag值
 
[root@tingyun-kafka-01 zabbix]# cat kafka-lag.sh
#!/bin/sh
#power by gaoyh@tingyun.com
zookeeper_server=192.168.110.12:2181,192.168.110.13:2181,192.168.110.14:2181,192.168.110.15:2181,192.168.110.16:2181
GROUP=$1
TOPIC=$2
cd /opt/kafka/bin/ && ./kafka-consumer-offset-checker.sh --zookeeper $zookeeper_server --topic $TOPIC --group $GROUP | grep -v 'will be dropped in releases'  | awk 'NR>1{a+=$6}END{print a}'
 
zabbix 客户端被动模式 从server端拉去客户端数据
 
[root@tingyun-kafka-01 zabbix]# cat /etc/zabbix/zabbix_agentd.
zabbix_agentd.conf  zabbix_agentd.d/   
[root@tingyun-kafka-01 zabbix]# cat /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
# For all the following commands HOME should be set to the directory that has .my.cnf file with password information.
# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
# Key syntax is mysql.status[variable].
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
# Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data].
# Key syntax is mysql.size[<database>,<table>,<type>].
# Database may be a database name or "all". Default is "all".
# Table may be a table name or "all". Default is "all".
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both".
# Database is mandatory if a table is specified. Type may be specified always.
# Returns value in bytes.
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
#tingyun kafka lag
UserParameter=q-newlens-mobile-errors-persist,/opt/zabbix/kafka-lag.sh q-newlens-mobile-errors-persist mobileErrors  2>/dev/null
UserParameter=q-newlens-mobile-interaction-traces-wrappedmessages,/opt/zabbix/kafka-lag.sh q-newlens-mobile-interaction-traces-wrappedmessages mobileInteractionTracesWrappedMessages  2>/dev/null
UserParameter=q-newlens-mobile-actions-wrappedmessages,/opt/zabbix/kafka-lag.sh q-newlens-mobile-actions-wrappedmessages mobileActionsWrappedMessages  2>/dev/null
UserParameter=q-newlens-mobile-actions-wrappedmessages-alarm,/opt/zabbix/kafka-lag.sh q-newlens-mobile-actions-wrappedmessages-alarm mobileActionsWrappedMessages  2>/dev/null
UserParameter=q-newlens-mobile-crash-alarm,/opt/zabbix/kafka-lag.sh q-newlens-mobile-crash-alarm crashMessage   2>/dev/null
UserParameter=q-newlens-report-user-traces-persist,/opt/zabbix/kafka-lag.sh q-newlens-report-user-traces-persist mobileReportUsers  2>/dev/null
UserParameter=q-newlens-mobile-errors-wrappedmessages,/opt/zabbix/kafka-lag.sh q-newlens-mobile-errors-wrappedmessages mobileErrorsWrappedMessages   2>/dev/null
UserParameter=q-newlens-mobile-interaction-traces-persist,/opt/zabbix/kafka-lag.sh q-newlens-mobile-interaction-traces-persist mobileInteractionTraces   2>/dev/null
UserParameter=q-newlens-report-users-wrappedmessages,/opt/zabbix/kafka-lag.sh q-newlens-report-users-wrappedmessages mobileReportUsersWrappedMessages   2>/dev/null
UserParameter=q-newlens-appserver-metrics-persist,/opt/zabbix/kafka-lag.sh q-newlens-appserver-metrics-persist mobileActions  2>/dev/null
kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
 
 
 
kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
 
 
 

kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
 
 
 
 

kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
 
 
 
 
 
 

kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
 
 
 
 

kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
  • kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
  • 大小: 42.6 KB
  • kafka lag 监控脚本
            
    
    博客分类: kafka kafka 
  • 大小: 44.1 KB
相关标签: kafka