In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Preface
Zabbix is an enterprise-level open source solution based on WEB interface that provides distributed system monitoring and network monitoring capabilities.
Zabbix can monitor various network parameters to ensure the safe operation of the server system, and provides a flexible notification mechanism to enable system administrators to quickly locate / solve various problems.
Zabbix consists of two parts, zabbix server and optional component zabbix agent.
Zabbix server can provide remote server / network status monitoring, data collection and other functions through SNMP,zabbix agent,ping, port monitoring and other methods. It can run on platforms such as Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X.
Advantages of Zabbix:
1 supports distributed monitoring
(2) it has its own drawing function, which can obtain numerical data and generate graphs automatically.
3 Web configuration mode, easy to operate and use. It is very fast to add monitoring items or machines.
When there is an alarm, no matter in any interface, a small window will pop up to give an alarm, and there will be an alarm sound prompt at the same time, at the same time, you can quickly check the monitoring items.
5 it comes with rich built-in functions, and it also supports the call of scripts and nagios scripts.
6 when there is a problem, you can automatically execute the command remotely (you need to set the execution permission on agent)
Disadvantages of Zabbix:
1 it is not convenient to modify in batches, it can be assisted by database.
2 after in-depth, there are very few Chinese materials, most of the questions need to see the official documents and forums.
(3) lack of data summary function, if you can't view the average value of a set of servers, you can consider secondary development.
4 compared with cacti, zabbix has poorer drawing function and more complex traffic acquisition.
Wechat alarm first register a WeCom in order to achieve Wechat alarm. Registered address: https://work.weixin.qq.com/.
Apply for WeCom account
1)。 Several important information needs to be recorded after the application is completed, which can be used in the zabbix server monitoring script.
Login page-my Enterprise-Enterprise ID:
2)。 Create an application
Log in to the web page-Application Management-Application-create Application
Record and get AgentId and Secret
AgentId:xxxxx
Secret:xxxxx
3)。 Add address Book
Log in to the page-address book-add members
You can not receive the information until you add it. Zabbix server side configuration
1)。 Installation dependency
Python is used as the monitoring script here, and python dependencies need to be installed on the zabbix sever server. Yum install-y python-requests
2)。 Configure python script
Create a wechat.py on the default monitoring script directory on the zabbix sever server.
Cd / usr/lib/zabbix/alertscripts
Vim wechat.py
#! / usr/bin/env python#-*- coding: utf-8-*-# author: Yuimport requestsimport sysimport osimport jsonimport logging# config for loglogging.basicConfig (level = logging.DEBUG, format ='% (asctime) s,% (filename) s,% (levelname) s,% (message) slots, datefmt ='% a,% d% b% Y% HGV% MVA% slots, filename = os.path.join ('/ usr/lib/zabbix/alertscripts') 'weixin.log') Filemode ='a') # Company IDcorpid='xxxxxxx'# secretappsecret='xxxxxxxx'# AgentIdagentid=xxxxxxx#Accesstokentoken_url=' https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=' + corpid +'& corpsecret=' + appsecretreq=requests.get (token_url) accesstoken=req.json () ['access_token'] # Message sendmsgsend_url=' https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + accesstokentouser=sys.argv [1] subject=sys.argv [2 ] # toparty='3 | 4 | 5 | 6'message=sys.argv [3] params= {"touser": touser # "toparty": toparty, "msgtype": "text", "agentid": agentid, "text": {"content": message}, "safe": 0} req=requests.post (msgsend_url, data=json.dumps (params)) logging.info ('sendto:' + touser +' ; subject:' + subject +';; message:' + message)
Remember to give weight to the file
Chown zabbix.zabbix weixin
Chmod 755 weixin
3)。 test
Run the weixin.py script
/ usr/lib/zabbix/alertscripts/weixin.py name "title test"hello"
Name: recipient account (log in to WeCom website-address Book-Open a recipient-account)
Title test: title
Hello: specific content to be sent
If there is no error, the recipient will be able to receive this message on the mobile APP WeCom, as shown below:
Wechat alarm is enabled on Zabbix Server Web.
1)。 Add alarm media
Manage-> alarm Media Type-> create Media Type
Add three script parameters: {ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE}
The script name must be the same as the script name configured with / usr/lib/zabbix/alertscripts on zabbix server.
2)。 Create users and add alarm media
Manage-> users
Note: the recipient fills in the account of the member of WeCom's address book. Here we intend to use the official account of Wechat to receive the alarm notification information.
3)。 Create trigger action
Configure-> Action-> Action
Create email sending action and configure trigger condition: trigger warning degree is greater than or equal to warning
Configure-> Action-> Action
Default title:
Fault {TRIGGER.STATUS}, server name: {HOSTNAME1} occurred: {TRIGGER.NAME} failure!
Message content:
Alarm host: {HOSTNAME} alarm host IP address: {HOST.IP} alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY} alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} problem details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID}
Configure-> Action-> restore
Default title:
Restore {TRIGGER.STATUS}, server name: {HOSTNAME1}: {TRIGGER.NAME} has been restored!
Message content:
Alarm host: {HOSTNAME} alarm host IP address: {HOST.IP} alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY} alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1} problem details: {ITEM.NAME}: {ITEM.VALUE} current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID}
4)。 Simulated test Wechat to receive alarm notice
Shut down the zabbix agent service of a new monitored host and wait 5 minutes to check and receive the Wechat alarm.
5)。 Accept message settings using normal Wechat
Directly use Wechat scan code to follow the micro-workbench, you can receive enterprise notifications and use enterprise applications in Wechat.
Method: log in to WeCom management page-my enterprise-micro-workbench-QR code invited to follow
You can collect it after paying attention.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.