Operations Monitoring Scripts

Source: Internet
Author: User

1. Turn off Firewall service iptables stop

2.SSH Configuration

(1) Generate key ssh-keygen-t RSA on the Monitor machine

(2) Create a folder on the monitored machine mkdir/root/.ssh/

(3) Copy files from the control machine to the controlled end scp/root/.ssh/id_rsa.pub 192.168.1.2:root/.ssh/authorized_keys

3. Scripting on the server

(1) Script abc.sh on the control machine is as follows

#/bin/bash

Fsmax=6

Remote_user=root

remote_ip= (192.168.1.1 192.168.1.2)

Ip_num=0

While ["$ip _num"-lt "${#remote_ip [@]}"]

Do

SSH [email protected]${remote_ip[$ip _num]} df-h >/tmp/disk_tmp

Disksize= ' grep ' \/$ '/tmp/disk_tmp | awk ' {print $4} ' | Cut-d%-f1 '

If [$disksize-gt $FSMAX]

Then

grep ' \/$ '/tmp/disk_tmp >/tmp/maildisk

echo ${remote_ip[$ip _num]} >>/tmp/maildisk

Mail-s "Diskcheck_alert" Root </tmp/maildisk

Fi

ip_num= ' expr $ip _num + 1 '

Done


(2) chmod a+x abc.sh

(3)./abc.sh

(4) Add a task plan CRONTAB-E

*/10 * * * */abc.sh

4. View message Records

Tail/var/spool/mail/root


Operations Monitoring Scripts

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.