Linux inspection report

Source: Internet
Author: User
Tags log log egrep

#! /Bin/bash
Echo-e resin cluster inspection "\ n">/opt/xunjian/xunjian.txt
Echo-e wap cluster "\ n">/opt/xunjian/xunjian.txt
A = 'cat/opt/xunjian/wap.txt'
T = 'cat/opt/xunjian/touch.txt'
W = 'cat/opt/xunjian/webkit.txt'
B = 'date + % Y-% m-% d-% H: % m'
F = $ (date + % d' \ '\ % H: % M | awk-F ""' {OFS = "" }{$ NF = ""; print }')
For I in $
Do
C = 'ssh $ I "w | grep-op '(? <= Load average:) \ d ...(? = ,)'"'
D = 'ssh $ I "df-h | grep-w/| awk '{print $4 }'"'
Total = 'ssh $ I "free-m | grep-w Mem" | awk '{print $2 }''
Userd = 'ssh $ I "free-m | grep-w Mem" | awk '{print $3 }''
Mem = 'echo "scale = 2; $ userd/$ total" | bc'
Mount = 'ssh $ I "mount | grep-w 192.168.0.70 | wc-l "'
Resin = 'ssh $ I "ps-ef | grep resin | grep-v grep | wc-l "'
Rooterror = 'ssh $ I "grep $ f/www/youyuan.com. 1/logs/root-error.log | egrep '(500error | 500 error)' | wc-l "'
If [$ mount-lt 5]; then
Hangshu = error
Else
Hangshu = good
Fi
If [$ resin-lt 2]; then
Jincheng = error
Else
Jincheng = good
Fi
Echo-e $ I "\ t" yanchao "\ t" $ B "\ t" $ c "\ t" $ d "\ t" $ mem "\ t" $ hangshu "\ t" $ jincheng "\ t" $ rooterror "\ n">/opt/xunjian/xunjian.txt

Done
Echo-e touch cluster "\ n">/opt/xunjian/xunjian.txt
For tt in $ t
Do
C = 'ssh $ tt "w | grep-op '(? <= Load average:) \ d ...(? = ,)'"'
D = 'ssh $ tt "df-h | grep-w/| awk '{print $4 }'"'
Total = 'ssh $ tt "free-m | grep-w Mem" | awk '{print $2 }''
Userd = 'ssh $ tt "free-m | grep-w Mem" | awk '{print $3 }''
Mem = 'echo "scale = 2; $ userd/$ total" | bc'
Mount = 'ssh $ tt "mount | grep-w 192.168.0.70 | wc-l "'
Resin = 'ssh $ tt "ps-ef | grep resin | grep-v grep | wc-l "'
Rooterror = 'ssh $ tt "grep $ f/www/youyuan.com. 1/logs/root-error.log | egrep '(500error | 500 error)' | wc-l "'
If [$ mount-lt 5]; then
Hangshu = error
Else
Hangshu = good
Fi
If [$ resin-lt 2]; then
Jincheng = error
Else
Jincheng = good
Fi
Echo-e $ tt "\ t" yanchao "\ t" $ B "\ t" $ c "\ t" $ d "\ t" $ mem "\ t" $ hangshu "\ t" $ jincheng "\ t" $ rooterror "\ n">/opt/xunjian/xunjian.txt

Done
Echo-e webkit cluster "\ n">/opt/xunjian/xunjian.txt
For ww in $ w
Do
C = 'ssh $ ww "w | grep-op '(? <= Load average:) \ d ...(? = ,)'"'
D = 'ssh $ ww "df-h | grep-w/| awk '{print $4 }'"'
Total = 'ssh $ ww "free-m | grep-w Mem" | awk '{print $2 }''
Userd = 'ssh $ ww "free-m | grep-w Mem" | awk '{print $3 }''
Mem = 'echo "scale = 2; $ userd/$ total" | bc'
Mount = 'ssh $ ww "mount | grep-w 192.168.0.70 | wc-l "'
Resin = 'ssh $ ww "ps-ef | grep resin | grep-v grep | wc-l "'
Rooterror = 'ssh $ ww "grep $ f/www/youyuan.com. 1/logs/root-error.log | egrep '(500error | 500 error)' | wc-l "'
If [$ mount-lt 5]; then
Hangshu = error
Else
Hangshu = good
Fi
If [$ resin-lt 2]; then
Jincheng = error
Else
Jincheng = good
Fi
Echo-e $ ww "\ t" yanchao "\ t" $ B "\ t" $ c "\ t" $ d "\ t" $ mem "\ t" $ hangshu "\ t" $ jincheng "\ t" $ rooterror "\ n">/opt/xunjian/xunjian.txt

Done



Result

Resin cluster Inspection

Server ip inspection personnel inspection Date load disk space I/O usage memory usage image mounting is normal resin process is normal root-error.log log 500 Error

Wap Cluster

192.168.0.132 yanchao 2013-09-22-0.27/dev/sda1 531G 35G 470G 7%/. 59 good 4

192.168.0.41 yanchao 2013-09-22-0.09/dev/sda3 381G 39G 324G 11%/. 72 good 1

192.168.0.43 yanchao 2013-09-22-0.21/dev/sda3 381G 81G 281G 23%/. 64 good 7

192.168.0.42 yanchao 2013-09-22-0.29/dev/sda3 381G 44G 318G 13%/. 58 good 4

192.168.0.51 yanchao 2013-09-22-0.57/dev/sda3 381G 34G 329G 10%/. 60 good 5

192.168.0.126 yanchao 2013-09-22-0.13/dev/sda1 531G 13G 491G 3%/. 37 good 0

192.168.0.127 yanchao 2013-09-22-0.00/dev/sda1 531G 11G 494G 3%/. 41 good 0

Touch Cluster

192.168.0.211 yanchao 2013-09-22-0.08/dev/sda1 531G 18G 486G 4%/. 50 good 0

192.168.0.44 yanchao 2013-09-22-0.26/dev/sda3 381G 66G 296G 19%/. 65 good 0

192.168.0.130 yanchao 2013-09-22-0.09/dev/sda1 531G 22G 483G 5%/. 66 good 0

192.168.0.131 yanchao 2013-09-22-0.05/dev/sda1 531G 17G 487G 4%/. 48 good 0

Webkit Cluster

192.168.0.23 yanchao 2013-09-22-1.45 1.6 T 1011G 505G 67%/. 55 good 1

192.168.0.53 yanchao 2013-09-22-0.04/dev/sda3 366G 46G 302G 13%/. 82 good 0

192.168.0.123 yanchao 2013-09-22-0.00/dev/sda1 531G 31G 474G 7%/. 54 good 1

192.168.0.128 yanchao 2013-09-22-0.01/dev/sda1 531G 24G 480G 5%/. 51 good 0

This article is from the "batch CT Batch Data Synchronization" blog, please be sure to keep this source http://4249964.blog.51cto.com/4239964/1300178

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.