Windows use BAT to implement the database data to the file within one month

2023-02-16  

zabbix installation for referenceZABBIX4.0 Source Code Installation, corporate WeChat alarm needs to go in three steps, the first step to apply for the public account of the enterprise, the second step to write the alarm script, the third step is to configure the ZABBIX-Web interface

enterWeChat public platform, select the company’s WeChat, fill in the registration according to the requirements. After the registration is completed, log in to the company’s WeChat, click to apply to the applet, create an application在这里插入图片描述

Circles are filled in. Here you can choose the department or the designated personnel.在这里插入图片描述

After the creation is completed, it will be transferred to the application management interface. Agentid and Secret need to be recorded. In addition, it is necessary to record the company ID. Click my company. At the bottom, there is an enterprise ID.
在这里插入图片描述
在这里插入图片描述

The company’s WeChat has been completed above, and then scripts on the zabbix-server side

[[email protected] alertscripts]#  pwd
/opt/zabbix-4.1/share/zabbix/alertscript 
[[email protected]Alertscripts]# Cat Weichat.py 
  #!/usr/bin/env python 
  #-*-coding: UTF-8-*- 
  #date: 2018-04-20 
  #Comment: zabbix access to WeChat alarm script 
    
     Import Requests 
     import sys 
     Import OS 
     import json 
     Import logging 
    
     #Logging.basicconfig (level = logging.debug, format = ' %(asctime) s, %(filename) s, %(levelName) s, (Message) s', datefmt =' %a, %d %b %b % Y%H:%S ', FILENAME = OS.Path.Join ('/Data/Zabbix ',' We 
     Ixin.log '), Filemode =' A ') 
     Corpid = 'xx' #c c 
     appsecret = 'xx' #Secret 
     agentid =[email protected] alertscripts]# chmod +x weichat.py 
    [[email protected] alertscripts]# ./weichat.py wechatname Test "This is test message"

Click Management —–> Alarm Media Type ——> Create Media Types ——> Type Select the script, and then fill in the script name (consistent with the name of the server script), three The parameters must be filled, namely users, events, and warning content
{ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE}
在这里插入图片描述

Management —–> User —–> Alarm Media (the recipient is a department user, or you can set the department ID (unbet, it should be possible)
在这里插入图片描述

Configuration —–> Action, set the trigger conditions
在这里插入图片描述

source

Related Posts

computer journal SCI, EI included, core journal catalog

Android set up a local area network server li

hive programming (2) [Basic operation]

javaweb Learning Notes (18.5) Bootstrap Case Dark Horse Tourism Network

Windows use BAT to implement the database data to the file within one month

Random Posts

Case statement

Compilation principle exercises (including answers) -Begis analysis -Harbin Institute of Technology Chen Yan supporting version of Hasp

WeChat Mini Program prompt update version

JSP in JSON implementation three -level union BLESS

vim color scheme and random color matching