How can I use shell scripts and enterprise WeChat to implement real-time alarm functions ?, Shell Information

Source: Internet
Author: User

How can I implement real-time alarm functions through shell scripts and enterprises ?, Shell Information

At work, we will have some applications running on the server online, so these applications have problems. For example, after the memory and CPU exceed the threshold, we must first know and handle these problems as soon as possible, try to make the user feel the exceptions of the application.

Some companies have O & M personnel. Congratulations, O & M should have a monitoring system, so developers can concentrate on business logic. However, some companies may not, the application status needs to be monitored by our developers.

For monitoring, there are emails, Zabbix, and enterprise emails. I do not hesitate to choose, which is simple and convenient. Someone in my mailbox sends spam every day, directly shielded, zabbix (same as z? Bix) is an enterprise-level open-source solution that provides distributed system monitoring and network monitoring functions based on the WEB interface. It is too heavy.

The following describes how to implement alarm

Registered enterprise number

I thought that the enterprise number needed enterprise-related information and so on. I didn't expect anything. I only needed a number. I suggest you register one here ~ Registration address

Create an application after registration. After filling in some basic information, the application can be created successfully. Some interfaces are as follows:

Shell script

I was going to write it in python. I thought about it later. No! Writing in any language is inferior to using shell, because linux itself supports shell and does not need to install any environment. This is the most important thing!

First, I analyzed the enterprise's API documentation.

Official documentation

Online debugging

Note the following for the API:

Access_token has an expiration time of 2 hours. Do not frequently obtain the token and save it once.

I am not sure about shell. It took about three hours to complete it. It seems that I will learn more about shell programming in the future.

Note:

For how to process json in shell, refer to the curl parameter in the blog shell. Use the if else shell to write data to a file.

The final effect is as follows:

Here, the process of sending alarm information via shell is broken through. As for how to monitor the application status and server status, I will implement it later.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.