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.