linux os 監控
##################os cpu mem disk ##############
51 23 * * * df -h >/home/oraprod/sys/disk
51 23 * * * free -m >/home/oraprod/sys/mem
0 9 * * * iostat -xt 300 144 > /home/oraprod/sys/cpudiskam
0 21 * * * iostat -xt 300 144 > /home/oraprod/sys/cpudiskpm
52 23 * * * sh /home/oraprod/check.sh
15 21 * * * sh /home/oraprod/checkcpuam.sh
15 9 * * * sh /home/oraprod/checkcpupm.sh
disk mem監控
[oraprod@ebsdb ~]$ cat /home/oraprod/check.sh
rm -rf /home/oraprod/sys/disk_* /home/oraprod/sys/mem_* /home/oraprod/sys/cpu_* /home/oraprod/sys/disk.sql /home/oraprod/sys/mem.sql /home/oraprod/sys/cpu.sql
cat /home/oraprod/sys/disk|grep -v r|awk '{print $1}' >/home/oraprod/sys/disk1
cat /home/oraprod/sys/disk|grep -v r|awk '{print $2}' >/home/oraprod/sys/disk2
cat /home/oraprod/sys/disk|grep -v r|awk '{print $3}' >/home/oraprod/sys/disk3
cat /home/oraprod/sys/disk|grep -v r|awk '{print $4}' >/home/oraprod/sys/disk4
cat /home/oraprod/sys/disk|grep -v r|awk '{print $5}' >/home/oraprod/sys/disk5
cat /home/oraprod/sys/disk|grep -v r|awk '{print $6}' >/home/oraprod/sys/disk6
cat /home/oraprod/sys/disk2|sed s/^/,\'\/g>/home/oraprod/sys/disk_2
cat /home/oraprod/sys/disk3|sed s/^/,\'\/g>/home/oraprod/sys/disk_3
cat /home/oraprod/sys/disk4|sed s/^/,\'\/g>/home/oraprod/sys/disk_4
cat /home/oraprod/sys/disk5|sed s/^/,\'\/g>/home/oraprod/sys/disk_5
cat /home/oraprod/sys/disk6|sed s/^/,\'\/g>/home/oraprod/sys/disk_6
cat /home/oraprod/sys/disk_2|sed s/$/\'\/g>/home/oraprod/sys/disk_22
cat /home/oraprod/sys/disk_3|sed s/$/\'\/g>/home/oraprod/sys/disk_33
cat /home/oraprod/sys/disk_4|sed s/$/\'\/g>/home/oraprod/sys/disk_44
cat /home/oraprod/sys/disk_5|sed s/$/\'\/g>/home/oraprod/sys/disk_55
cat /home/oraprod/sys/disk_6|sed s/$/\'\/g>/home/oraprod/sys/disk_66
cat /home/oraprod/sys/disk1|sed s/^/insert\ into\ checkdisk\ values\(\'192\.168\.0\.6\',\'/g>/home/oraprod/sys/disk_1
cat /home/oraprod/sys/disk_1|sed s/$/\'\/g>/home/oraprod/sys/disk_11
paste /home/oraprod/sys/disk_11 /home/oraprod/sys/disk_22 >/home/oraprod/sys/disk_21
paste /home/oraprod/sys/disk_21 /home/oraprod/sys/disk_33 >/home/oraprod/sys/disk_31
paste /home/oraprod/sys/disk_31 /home/oraprod/sys/disk_44 >/home/oraprod/sys/disk_41
paste /home/oraprod/sys/disk_41 /home/oraprod/sys/disk_55 >/home/oraprod/sys/disk_51
paste /home/oraprod/sys/disk_51 /home/oraprod/sys/disk_66 >/home/oraprod/sys/disk_61
cat /home/oraprod/sys/disk_61|sed s/$/\)\;/g >>/home/oraprod/sys/disk.sql
cat /home/oraprod/sys/mem|grep -v r|awk '{print $1}' >/home/oraprod/sys/mem1
cat /home/oraprod/sys/mem|grep -v r|awk '{print $2}' >/home/oraprod/sys/mem2
cat /home/oraprod/sys/mem|grep -v r|awk '{print $3}' >/home/oraprod/sys/mem3
cat /home/oraprod/sys/mem|grep -v r|awk '{print $4}' >/home/oraprod/sys/mem4
cat /home/oraprod/sys/mem2|sed s/^/,\/g>/home/oraprod/sys/mem_22
cat /home/oraprod/sys/mem3|sed s/^/,\/g>/home/oraprod/sys/mem_33
cat /home/oraprod/sys/mem4|sed s/^/,\/g>/home/oraprod/sys/mem_44
cat /home/oraprod/sys/mem1|sed s/^/insert\ into\ checkmem\ values\(\'192\.168\.0\.6\',\'/g>/home/oraprod/sys/mem_1
cat /home/oraprod/sys/mem_1|sed s/$/\'\/g>/home/oraprod/sys/mem_11
paste /home/oraprod/sys/mem_11 /home/oraprod/sys/mem_22 >/home/oraprod/sys/mem_21
paste /home/oraprod/sys/mem_21 /home/oraprod/sys/mem_33 >/home/oraprod/sys/mem_31
paste /home/oraprod/sys/mem_31 /home/oraprod/sys/mem_44 >/home/oraprod/sys/mem_41
cat /home/oraprod/sys/mem_41|sed s/$/\)\;/g >>/home/oraprod/sys/mem.sql
#echo 'exit' >>/home/oraprod/sys/mem.sql
echo 'exit' >>/home/oraprod/sys/disk.sql
#export ORACLE_HOME="/ebs10/oracle/oraprod/db/tech_st/11.1.0"
#$ORACLE_HOME/bin/sqlplusoscheck/checkdb@test@/home/oraprod/sys/cpu.sql
sqlplus oscheck/checkdb@checkdb <@/home/oraprod/sys/mem.sql
#sqlplus oscheck/checkdb@checkdb <@/home/oraprod/sys/disk.sql
cpu監控 分上午下午
[oraprod@ebsdb ~]$ cat /home/oraprod/checkcpuam.sh
sysdir="/home/oraprod/sys/"
rm -rf /home/oraprod/sys/cpuam_* /home/oraprod/sys/cpuam3 /home/oraprod/sys/cpuam4 /home/oraprod/sys/cpuam5 /home/oraprod/sys/cpuam6 /home/oraprod/sys/cpuam7 /home/oraprod/sys/cpuam.sql
cp /home/oraprod/sys/cpudiskam /home/oraprod/sys/cpudiskam.bak
i=1
cn=5
cat $sysdir/cpudiskam.bak|while read line
do
if [ "$i" -eq "$cn" ];
then
echo $line|awk '{print $1}' >>$sysdir/cpuam3
echo $line|awk '{print $2}' >>$sysdir/cpuam4
echo $line|awk '{print $3}' >>$sysdir/cpuam5
echo $line|awk '{print $4}' >>$sysdir/cpuam6
echo $line|awk '{print $6}' >>$sysdir/cpuam7
cn=$(($cn + 16))
fi
i=$(($i+1))
done
cat /home/oraprod/sys/cpuam3|sed s/^/,\/g>/home/oraprod/sys/cpuam_33
cat /home/oraprod/sys/cpuam4|sed s/^/,\/g>/home/oraprod/sys/cpuam_44
cat /home/oraprod/sys/cpuam5|sed s/^/,\/g>/home/oraprod/sys/cpuam_55
cat /home/oraprod/sys/cpuam6|sed s/^/,\/g>/home/oraprod/sys/cpuam_66
cat /home/oraprod/sys/cpuam7|sed s/^/,\/g>/home/oraprod/sys/cpuam_77
cat /home/oraprod/sys/tam|sed s/^/insert\ into\ checkcpu\ values\(\'192\.168\.0\.25\',\/g>/home/oraprod/sys/cpuam_11
### cat /home/oraprod/sys/cpudiskam 需要空的144行
cat /home/oraprod/sys/cpudiskam|grep Time|awk '{print $2}'|sed s/^/\'/g|sed s/$/\'/g >/home/oraprod/sys/cpuam_time
paste /home/oraprod/sys/cpuam_11 /home/oraprod/sys/cpuam_time > /home/oraprod/sys/cpuam_time_21
paste /home/oraprod/sys/cpuam_11 /home/oraprod/sys/cpuam_33 >/home/oraprod/sys/cpuam_31
paste /home/oraprod/sys/cpuam_31 /home/oraprod/sys/cpuam_44 >/home/oraprod/sys/cpuam_41
paste /home/oraprod/sys/cpuam_41 /home/oraprod/sys/cpuam_55 >/home/oraprod/sys/cpuam_51
paste /home/oraprod/sys/cpuam_51 /home/oraprod/sys/cpuam_66 >/home/oraprod/sys/cpuam_61
paste /home/oraprod/sys/cpuam_61 /home/oraprod/sys/cpuam_77 >/home/oraprod/sys/cpuam_71
cat /home/oraprod/sys/cpuam_71|sed s/$/\)\;/g >>/home/oraprod/sys/cpuam.sql
echo 'commit;' >>/home/oraprod/sys/cpuam.sql
echo 'exit' >>/home/oraprod/sys/cpuam.sql
#home/oraprodort ORACLE_HOME="/u01/app/oracle/product/10.2.0/"
sqlplus oscheck/checkdb@checkdb @/home/oraprod/sys/cpuam.sql
[oraprod@ebsdb ~]$ cat /home/oraprod/checkcpupm.sh
sysdir="/home/oraprod/sys/"
rm -rf /home/oraprod/sys/cpupm_* /home/oraprod/sys/cpupm3 /home/oraprod/sys/cpupm4 /home/oraprod/sys/cpupm5 /home/oraprod/sys/cpupm6 /home/oraprod/sys/cpupm7 /home/oraprod/sys/cpupm.sql
cp /home/oraprod/sys/cpudiskpm /home/oraprod/sys/cpudiskpm.bak
i=1
cn=5
cat $sysdir/cpudiskpm.bak|while read line
do
if [ "$i" -eq "$cn" ];
then
echo $line|awk '{print $1}' >>$sysdir/cpupm3
echo $line|awk '{print $2}' >>$sysdir/cpupm4
echo $line|awk '{print $3}' >>$sysdir/cpupm5
echo $line|awk '{print $4}' >>$sysdir/cpupm6
echo $line|awk '{print $6}' >>$sysdir/cpupm7
cn=$(($cn + 16))
fi
i=$(($i+1))
done
cat /home/oraprod/sys/cpupm3|sed s/^/,\/g>/home/oraprod/sys/cpupm_33
cat /home/oraprod/sys/cpupm4|sed s/^/,\/g>/home/oraprod/sys/cpupm_44
cat /home/oraprod/sys/cpupm5|sed s/^/,\/g>/home/oraprod/sys/cpupm_55
cat /home/oraprod/sys/cpupm6|sed s/^/,\/g>/home/oraprod/sys/cpupm_66
cat /home/oraprod/sys/cpupm7|sed s/^/,\/g>/home/oraprod/sys/cpupm_77
cat /home/oraprod/sys/tpm|sed s/^/insert\ into\ checkcpu\ values\(\'192\.168\.0\.25\',\/g>/home/oraprod/sys/cpupm_11
cat /home/oraprod/sys/cpudiskpm|grep Time|awk '{print $2}'|sed s/^/\'/g|sed s/$/\'/g >/home/oraprod/sys/cpupm_time
paste /home/oraprod/sys/cpupm_11 /home/oraprod/sys/cpupm_time > /home/oraprod/sys/cpupm_time_21
paste /home/oraprod/sys/cpupm_time_21 /home/oraprod/sys/cpupm_33 >/home/oraprod/sys/cpupm_31
paste /home/oraprod/sys/cpupm_31 /home/oraprod/sys/cpupm_44 >/home/oraprod/sys/cpupm_41
paste /home/oraprod/sys/cpupm_41 /home/oraprod/sys/cpupm_55 >/home/oraprod/sys/cpupm_51
paste /home/oraprod/sys/cpupm_51 /home/oraprod/sys/cpupm_66 >/home/oraprod/sys/cpupm_61
paste /home/oraprod/sys/cpupm_61 /home/oraprod/sys/cpupm_77 >/home/oraprod/sys/cpupm_71
cat /home/oraprod/sys/cpupm_71|sed s/$/\)\;/g >>/home/oraprod/sys/cpupm.sql
echo 'commit;' >>/home/oraprod/sys/cpupm.sql
echo 'exit' >>/home/oraprod/sys/cpupm.sql
#home/oraprodort ORACLE_HOME="/u01/app/oracle/product/10.2.0/"
sqlplus oscheck/checkdb@checkdb @/home/oraprod/sys/cpupm.sql
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15187685/viewspace-761130/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux 監控Linux
- Linux atop監控Linux
- linux監控工具auditLinux
- linux效能監控命令Linux
- Linux和UNIX監控Linux
- Linux 效能監控工具Linux
- 天兔(Lepus)監控作業系統(OS)安裝配置作業系統
- ORACLE及OS相關監控指令碼 For AIX6.1Oracle指令碼AI
- Linux 流量監控工具 iftopLinux
- linux監控平臺搭建Linux
- Linux 伺服器監控Linux伺服器
- Linux監控命令全解Linux
- Linux nmon 監控工具使用Linux
- linux 系統監控工具Linux
- Unix/Linux 常用監控命令Linux
- linux 流量監控工具-iftopLinux
- Linux 系統監控指南Linux
- nagios監控linux主機監控記憶體指令碼iOSLinux記憶體指令碼
- itm6對os400監控歷史資料收集
- Linux程式管理與效能監控Linux
- linux系統 物理硬碟監控Linux硬碟
- 監控linux系統資源Linux
- Linux系統監控神器--CollectlLinux
- Nrpe 監控Linux系統Linux
- 監控linux系統的shellLinux
- LINUX主機監控指令碼Linux指令碼
- Linux系統監控命令薦Linux
- linux監控CPU命令-mpstatLinux
- linux效能監控利器20個Linux
- linux I/O 瓶頸監控Linux
- linux 下監控磁碟空間Linux
- linux監控,單行指令碼Linux指令碼
- 容器生態圈專案一覽:引擎、編排、OS、Registry、監控
- 黑盒監控、日誌監控
- linux安裝Arthas監控java程式LinuxJava
- Linux伺服器---流量監控ntopLinux伺服器
- Linux伺服器---流量監控webalizerLinux伺服器Web
- Linux伺服器---流量監控MRTGLinux伺服器