• 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

  • 相关阅读:
    【华为手机】如何关闭/卸载下滑出现的智慧搜索
    Day20 | 每天五道题
    springboot上传word/doc/docx文档(含图片)与HTML富文本导入/导出互相转换解析!超级硬核qaq
    GitHub配置账号Pull Request更新代码分支
    java毕业设计气候分析平台源码+lw文档+mybatis+系统+mysql数据库+调试
    mybatis plus遇到invalid bound statement(not found)报错
    澳洲谷揽GRANAR谷物分析仪维修GR-1800蛋白检测仪
    前端Ui框架bootstrap-vue地址
    Win11一键重装系统后如何使用自带的故障检测修复功能
    ubuntu 22.04 minikube 部署 应用测试
  • 原文地址:https://blog.csdn.net/u010533742/article/details/126926459