• Centos8 Zabbix5.4配置全过程 温湿度监控


    一、修改LDAP用户

    #插入用户

    INSERT INTO users (username,name,surname,url,autologin,autologout,theme,refresh,rows_per_page,lang,timezone,roleid,passwd,userid) VALUES ('22222000','test','','','0','0','default','30s','50','default','default','3','$2y$10$92nDno4n0Zm7Ej7Jfsz8WukBfgSS/U0QkIuu8WkJPihXBb2A1UrEK','4');

    #插入群组

    insert into users_groups values(6,7,4);

    #修改LDAP认证

     

     二、配置告警推送

    #配置媒介

     

     #添加用户群组

     

    #添加告警用户

     

     #推送脚本,基于python2.7

    cd /usr/lib/zabbix/alertscripts

    vi wechart.py

    #!/usr/bin/python

    import requests
    import sys
    import os
    import logging

    reload(sys)
    sys.setdefaultencoding('utf8')

    valMsg = ''
    valUsr = ''
    valGroupId = ''

    for i in range(1, len(sys.argv)):
    args = sys.argv[i]
    try:
    idx = args.index('=',0)
    if idx > 1:
    key = args[2:idx]
    value = args[idx+1:99999]
    if len(key) == 0:
    pass
    elif key == 'msg':
    valMsg = value
    elif key == 'user':
    valUsr = value
    elif key == 'groupid':
    valGroupId = value.replace(' ','')
    except:
    pass

    url = "https://url/api/QYWeixin/SendTextMessage"
    payload = '{"ChatId": "' + valGroupId + '","Description": "' + valMsg + '"}'
    headers = {
    'Authorization': 'BasicAuth HupBasicAuth',
    'Content-Type': 'text/html'
    }
    response = requests.request("POST", url, headers=headers, data = payload.encode())

     #安装requests模块

    yum install python2.7

    ln -s /usr/bin/python2.7 /usr/bin/python

    yum install requests

    #离线安装requests参照

    https://blog.csdn.net/xyy1028/article/details/106755323

    https://pypi.python.org/pypi/chardet/3.0.4#downloads    --chardet-3.0.4版本

    https://pypi.python.org/pypi/urllib3/1.25.8/#downloads    --urllib3-1.25.8版本

    #测试推送

    三、配置主机群组、模板及主机

    #主机群主

     #模板

     #监控项

     

    #触发器

     

    #添加主机

     

    四、配置触发动作

    #动作

  • 相关阅读:
    数据库的......
    数据库
    XML
    网络编程
    I/O系统---流
    周结

    集合,框架
    Spring入门
    Java Wed
  • 原文地址:https://www.cnblogs.com/sonnyBag/p/16294443.html
Copyright © 2020-2023  润新知