• zabbix-agent2监控redis、mongodb


    使用zabbix-agent2对redis和mongodb进行监控

    一、redis
    zabbix-agent2.conf中添加

    Plugins.Redis.Sessions.redis.Uri=tcp://192.168.11.16:6379       #redis_smartgate 为被监控的实例名,在zabbix服务器端会用到
    Plugins.Redis.Sessions.redis.Password=xxxxxxxxxxxxxxxxx     #redis_smartgate的密码
    
    • 1
    • 2

    在主机配置中添加宏
    {$REDIS.CONN.URI} = redis #redis_smartgate与zabbix-agent2.conf中的配对

    二、mongodb
    2.1 在mongo数据库中添加监控专用的帐号

    use admin
    db.auth("admin", "qwer@.asd")
    db.createUser({  "user": "monitor",  "pwd": "monitor@#2O22",  "roles": [    { role: "readAnyDatabase", db: "admin" },    { role: "clusterMonitor", db: "admin" }  ] })
    
    • 1
    • 2
    • 3

    2.2 在zabbix-agent2中添加配置
    Plugins.Mongo.Sessions.mongo.Uri=tcp://127.0.0.1:27017
    Plugins.Mongo.Sessions.mongo.User=monitor
    Plugins.Mongo.Sessions.mongo.Password=monitor@#2O22

    2.3 在主机配置中添加宏
    {$MONGODB.CONNSTRING} = mongo #redis_smartgate与zabbix-agent2.conf中的配对

    三、mysql
    3.1、在被监控的数据库主机上,新建数据库用户,并赋予权限:
    mysql> CREATE USER ‘monitor’@‘%’ IDENTIFIED BY ‘monitor@#2O22’;
    mysql> GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON . TO ‘monitor’@‘%’;
    mysql> flush privileges;

    3.2 配置

    Plugins.Mysql.CallTimeout=30
    Plugins.Mysql.Sessions.mysql.Uri=unix:/data/mysql/mysql.sock
    Plugins.Mysql.Sessions.mysql.User=monitor
    Plugins.Mysql.Sessions.mysql.Password=monitor@#2O22
    
    • 1
    • 2
    • 3
    • 4

    在主机配置中添加宏
    {$MYSQL_DSN} = mysql #redis_smartgate与zabbix-agent2.conf中的配对

    zabbix_agent2.conf

    PidFile=/data/zabbix_agent2/zabbix_agent2.pid
    LogFile=/data/zabbix_agent2/log/zabbix_agent2.log
    LogFileSize=0
    Server=192.168.11.100,127.0.0.1
    ServerActive=192.168.11.100:10051,127.0.0.1:10051
    Hostname=192.168.11.100
    Include=/data/zabbix_agent2/zabbix_agent2.d/*.conf
    ControlSocket=/tmp/agent.sock
    TLSConnect=psk
    TLSAccept=psk
    TLSPSKIdentity=PSK 001
    TLSPSKFile=/data/zabbix_agent2/zabbix_agent2.d/.zabbix.psk
    
    #mongo
    Plugins.Mongo.Sessions.mongo.Uri=tcp://127.0.0.1:27017
    Plugins.Mongo.Sessions.mongo.User=monitor
    Plugins.Mongo.Sessions.mongo.Password=Monitor#2O22
    
    #redis
    Plugins.Redis.Sessions.redis.Uri=tcp://127.0.0.1:6379
    Plugins.Redis.Sessions.redis.Password=xxxxxxxxxxxxxxxxx
    
    #mysql
    Plugins.Mysql.CallTimeout=30
    #Plugins.Mysql.Sessions.mysql.Uri=unix:/data/mysql/mysql.sock
    Plugins.Mysql.Sessions.mysql.Uri=tcp://127.0.0.1:3306
    Plugins.Mysql.Sessions.mysql.User=monitor
    Plugins.Mysql.Sessions.mysql.Password=Monitor#2O22
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    mongodb zabbix-agent2插件
    https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix-agent2-plugins/1/rhel/7/x86_64/

    mongodb for zabbix
    ID: 14669

  • 相关阅读:
    React Native 项目配置 Flow (windows环境)
    Linux中修改环境变量的几种方法比较分析
    2.00001《Postgresql内幕探索》走读 之 查询优化
    Prometheus系列第三篇一协议设计
    你就想这样一辈子躺平,还是改变这个世界?
    杨氏矩阵/杨图x杨表(知识点总结)
    [动态规划] (十四) 简单多状态 LeetCode LCR 091.粉刷房子
    1137. 第N个泰波那契数- 力扣
    Debezium系列之:详细整理总结Kafka Connect Configs
    《架构设计2.0大型分布式系统架构方法论与实践》三高笔记
  • 原文地址:https://blog.csdn.net/u010533742/article/details/126926459