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}'
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.
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}'
# 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'
# 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
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
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
相关推荐
1. **全面监控**:它能够监控 Kafka 的关键指标,如 Broker 的状态、Topic 的分区分布、Consumer 的消费进度(offset 和 lag)以及 Owner 信息。 2. **直观界面**:Kafka-Eagle 提供了一个友好的 Web UI,使得管理...
如果上述工具无法满足需求,可以通过编写脚本或使用SDK(如Java、Python)直接与Kafka API交互,定制适合自己业务场景的监控方案。 总结,对Linux系统下的Kafka进行监控是确保其高效、稳定运行的重要环节。通过监控...
10. **故障排查**:当Kafka集群出现异常时,Kafka-Eagle的监控数据可以帮助快速定位问题,例如,通过查看消费者的lag情况判断是否消费延迟,或通过broker的CPU、内存使用情况判断是否存在资源瓶颈。 总的来说,...
* 了解如何使用 Shell 或 Python 调度脚本来监控和管理 Kafka 集群。 * 了解如何使用 Kafka 的配置文件来调整 Kafka 集群的性能和可靠性。 Kafka 管理工具监控偏移量消费 Offset 是一个复杂的任务,需要具备专业的...
KafkaTool是一款高效且用户友好的Kafka管理工具,专为Apache Kafka用户设计,提供了一系列实用功能,便于管理和监控Kafka集群。在本文中,我们将深入探讨KafkaTool的特性和使用方法,以及如何在Windows 64位系统上...
接下来,你可以通过执行启动脚本来运行Kafka-Manager,通常会有一个类似于`start-kafka-manager.sh`的脚本。记得根据实际的Kafka集群配置来调整Kafka-Manager的配置文件,例如设置Zookeeper地址和端口。 Kafka-...
- **Consumer Group监控**:监控消费者组的消费进度,查看滞后(Lag)情况。 - **操作日志**:记录对Kafka集群的所有操作,便于追踪和审计。 使用Kafka Manager可以帮助我们更好地管理和优化Kafka集群,确保系统的...
Kafka Manager是一款强大的开源工具,专为Apache Kafka设计,用于简化Kafka集群的管理和监控。在本文中,我们将深入探讨Kafka Manager的功能、安装过程以及如何有效地利用它来优化您的Kafka环境。 1. **Kafka ...
只需执行启动脚本`./kafka-manager`(假设你是在Unix/Linux环境中),Kafka Manager服务就会在本地运行。对于Windows用户,可以找到对应的.bat启动文件。确保你的环境配置正确,包括Zookeeper和Kafka集群的地址。 ...
3. **消费组管理**:监控消费组的状态,查看每个消费组的offset和lag情况。 4. **性能监控**:提供实时的性能指标,如消息生产与消费速率、broker和topic的磁盘使用情况等。 5. **配置调整**:允许在线调整Kafka集群...
2. 累积与滞后:消费者组内的每个消费者都有自己的消费位置,滞后(Lag)表示未被消费的消息数量,监控滞后情况有助于发现性能问题。 3. 消息保留策略:Kafka可以设置消息保留时间或空间大小,超出范围的消息将被...
2. **解压与启动**:将下载的"kafka-manager-2.0.0.2"压缩包解压到指定目录,然后执行启动脚本,如`./bin/kafka-manager`。 3. **访问Web界面**:Kafka-Manager启动后,通过浏览器访问默认的HTTP端口(通常是9000)...
6. **监控指标**:了解如何解读Kafka的关键指标,如每秒处理的消息数(Msgs/Sec)、分区滞后(Lag)和消费速率,对于有效使用Kafka-Dashboard进行性能优化至关重要。 通过学习和使用Kafka-Dashboard,你可以提升对...
### 使用Python3调用wxPy模块监控Linux日志并定时发送消息给群组或好友 #### 一、背景介绍 在运维与开发工作中,实时监控系统日志是至关重要的环节。这不仅能帮助我们及时发现系统异常,还能为后续的问题排查提供...