Zabbix简单监控es实践

监控图展示

创建监控 ES 脚本

# zabbix agent 创建 scripts 目录并安装jq命令
$ mkdir /etc/zabbix/scripts
$ yum install -y jq

# 创建elk监控脚本
$ touch es_monitoring.sh && chmod +x es_monitoring.sh
$ vim es_monitoring.sh

#!/usr/bin/env bash

case $1 in
    active_primary_shards)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    active_shards)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    cluster_name)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    number_of_data_nodes)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    initializing_shards)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    number_of_nodes)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    relocating_shards)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    status)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    timed_out)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    unassigned_shards)
        result=`curl --user elastic:password -s -XGET 192.168.0.1:9200/_cluster/health | jq .$1`
        echo $result
        ;;
    *)
        echo "Usage:$0(active_primary_shards|active_shards|cluster_name|number_of_data_nodes|initializing_shards|number_of_nodes|relocating_shards|status|timed_out|unassigned_shards)"
        ;;
esac

创建 zabbix-agent es 监控配置

# 创建es监控配置
$ vim /etc/zabbix/zabbix_agentd.d/es_monitoring.conf

UserParameter=es_monitoring[*],/etc/zabbix/scripts/es_monitoring.sh $1

# 重启 zabbix-agent 服务
$ systemctl restart zabbix-agent

zabbix-server 添加监控 es 模板

上面是 Zabbix 监控 ES 模板,具体模板配置公众号后台回复 zabbix-es 获取。

热门文章推荐

最后

  • 后台回复 【列表】,可获取本公众号所有文章列表

  • 欢迎您加我微信【ypxiaozhan01】,拉您进技术群,一起交流学习

  • 欢迎您关注【YP小站】,学习互联网最流行的技术,做个专业的技术人


  【文章让您有收获,????  或者 在看 支持我吧】
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值