Shell monitoring script preparation work sharing _linux shell

Source: Internet
Author: User
Tags prepare ssh

1 Prepare the monitoring machine

Linux system, normal server can, request:
Install SSH client, if you want to send SMS, also need to prepare SMS cat and install Gnokii or Gammu

2 Edit ssh_config configuration file

/etc/ssh/ssh_config configuration file, setting "Gssapiauthentication no"
The monitored Linux Editor/etc/ssh/sshd_config, add Usedns No, and finally reboot sshd

3 using the key to log on to the Linux host

4 to create the SH directory for storing shell scripts

Mkdir-p/root/sh/crontab/log
SH Directory store Shell script
Crontab/log directory to store error messages

5 Preparing the configuration file

Copy Code code as follows:

Cat/root/sh/config

mobiles= "13xxxxxxxxx 18xxxxxxxxx 13xxxxxxxxx"
mails= "Dongnan@jb51.net user2@jb51.net"

esxi_hosts= "192.168.57.91 192.168.57.93"
physical_hosts= "192.168.57.112 192.168.0.1 192.168.57.99"
linux_web_hosts= "192.168.57.82 192.168.57.70 10.0.100.72 10.0.100.73 10.0.100.75 10.0.100.76 10.0.100.77 10.0.100.78"
win_web_hosts= "10.0.100.81 10.0.100.83"
Db_slave_hosts= "10.0.100.82"
allhosts= "$ESXI _hosts $PHYSICAL _hosts $LINUX _web_hosts $WIN _web_hosts $DB _slave_hosts"

Note: This profile is used to define global variables, including IP addresses, mail addresses, phone numbers, and so on.

6 crontab Mission Plan

Copy Code code as follows:

Crontab-l
#ping
*/1 * * * */root/sh/chk_ping.sh >>/root/sh/cron.log 2>&1

#df
* * * * * * */root/sh/chk_df.sh >>/root/sh/cron.log 2>&1

#load
*/1 * * * */root/sh/chk_load.sh >>/root/sh/cron.log 2>&1

#mysql_replicate
*/1 * * * */root/sh/chk_mysql_replicate.sh >>/root/sh/cron.log 2>&1

#web
*/1 * * * */root/sh/chk_web.sh >>/root/sh/cron.log 2>&1

#xxxx
#......................................

Note: Script execution time should be done according to the actual script function, such as CHK_DF Monitoring Server disk space, once per hour;
All monitoring scripts are tested properly under RHEL5/CENTOS5 and other Linux systems are tested on their own.

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.