Linux Server monitoring mobile phone alarm

Source: Internet
Author: User

DoDo original, reprinted please indicate the source

SA is necessary for server monitoring. However, if many servers are managed, it is impossible to monitor the server online 24 hours a day.

The main content of this article is implementation. If an exception occurs on the server, the server will be sent directly to the Administrator's mobile phone via text message. SA can immediately know that the server has encountered an exception, in this way, the fastest time can be processed.

The principle is very simple, China Mobile provides a mailbox such as 139.com, if there is an email arrives, will also send the mail title to the Administrator corresponding mobile phone, mailbox name is your mobile phone number @ 139.com, For example: 13036110648@139.com, when this mailbox receives the mail, it will send the mail arrival information to the mobile phone 13036110648 at the same time, the mail registration addressHttp://mail.139.com/

Before you implement the following functions, register your email address (this function is now provided free of charge by mobile phone)

The following functions are implemented:

 

Monitor User Logon

We know that users usually load logon scripts when logging on ~ /. Bashrc, we can add the following in this script:

# Echo at now + 1 minutes-f/data/checklogin. sh>/dev/null 2> & 1> ~ /. Bashrc

Then the user will execute/data/checklogin in 1 minute after logging on. sh script (why do I need to send a text message after one minute, because if I log in, I don't need to send a text message and give myself time to use atrm to cancel the task schedule). The script content is as follows:

# Cat/data/checklogin. sh

#! /Bin/sh

Echo "'Who">/data/login. log

Mail-s "'who '"13036110648@139.com</Data/login. log

# Chmod a + x/data/checklogin. sh

# Touch/data/login. log

# Chmod a + w/data/login. log

After this is done, the current logged-on user information will be sent to the Administrator's mobile phone number by text message every time this user logs on.

Of course, you can monitor all user logins, so you should modify the/etc/bashrc logon script.

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.