OGG維護優化腳本(二十四)-OGG狀態監控系統--後臺腳本
阿新 • • 發佈:2017-06-19
oracle ogg goldengate
這個簡易監控系統具體是由html實現的
後臺沒有數據庫,只有從各臺機器收集並上傳過來的html文件
通過定時shell腳本整理並分類到各個目錄,然後通過apache被網頁調用
具體更新頻率取決於各數據同步服務器的定時任務運行頻率
OGG進程狀態整理腳本
這個腳本用於整理進程信息上傳腳本 收集到的文件,將其合並為html文件
pcsindex.sh
#!/bin/bash cd /root/gg/ggscript/pcsindex ls -lrt /root/gg/gginfo/*.gginfo|awk ‘{print $9}‘ > temp sed ‘/^$/d‘ temp > tempc cat tempc|sort -n > temp rm -f tempc echo "The data was collected by RenYi<br> " > /var/www/virtual/index2.html echo "<br>" >> /var/www/virtual/index2.html echo "<br>" >> /var/www/virtual/index2.html i=1 num=`sed -n ‘$=‘ temp` cd /root/gg/gginfo while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/pcsindex/temp` cat $filename >> /var/www/virtual/index2.html ((i++)); done
OGG 錯誤日誌整理腳本
該腳本用於整理 錯誤日誌上傳腳本 收集到的錯誤日誌信息
gglog.sh
#!/bin/bash cd /root/gg/ggscript/gglog ls -lrt /root/gg/gglog/*.gglog|awk ‘{print $9}‘ > /root/gg/ggscript/gglog/temp sed ‘/^$/d‘ temp > tempc cat tempc|sort -n > temp rm -f tempc i=1 num=`sed -n ‘$=‘ temp` cd /root/gg/gglog while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/gglog/temp` file=${filename%.*} file=${file##*/} cat $filename > /var/www/virtual/gglog/$file.html ((i++)); done
lgglog.sh
#!/bin/bash cd /root/gg/ggscript/gglog ls -lrt /var/www/virtual/gglog/* |awk ‘{print $9}‘ > /root/gg/ggscript/gglog/temp2 sed ‘/^$/d‘ temp2 > tempc cat tempc|sort -n > temp2 rm -f tempc i=1 i=1 num=`sed -n ‘$=‘ temp2` cd /var/www/virtual/gglog while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/gglog/temp2` file=${filename%.*} file=${file##*/} cat $filename > /var/www/virtual/lgglog/$file.html ((i++)); done
附加日誌錯誤信息整理腳本
該腳本用於整理分類 附加日誌錯誤信息收集腳本從不同機器收集來的附加日誌信息,並發送到不同的目錄
ggchk.sh
#!/bin/bash cd /root/gg/ggscript/ggchk ls -lrt /root/gg/ggtbchk/*.tbcheck|awk ‘{print $9}‘ > /root/gg/ggscript/ggchk/temp sed ‘/^$/d‘ temp > tempc cat tempc|sort -n > temp rm -f tempc i=1 num=`sed -n ‘$=‘ temp` cd /root/gg/ggtbchk while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/ggchk/temp` file=${filename%.*} file=${file##*/} cat $filename > /var/www/virtual/ggchk/$file.html ((i++)); done
寫入錯誤日誌整理腳本
用於整理寫入進程異常日誌收集腳本 收集到的異常日誌
ggdsc.sh
#!/bin/bash cd /root/gg/ggscript/ggdsc ls -lrt /root/gg/ggdcs/*.dcsinfo|awk ‘{print $9}‘ > /root/gg/ggscript/ggdsc/temp sed ‘/^$/d‘ temp > tempc cat tempc|sort -n > temp rm -f tempc i=1 num=`sed -n ‘$=‘ temp` cd /root/gg/ggdcs while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/ggdsc/temp` file=${filename%.*} file=${file##*/} cat $filename > /var/www/virtual/ggdsc/$file.html ((i++)); done
錯誤數量統計腳本
用於統計各個系統日誌中錯誤以及異常信息,生成頁面上的ERROR 或者錯誤數量等數據
count.sh
#!/bin/bash cd /root/gg/ggscript/ggcount #gginfo ls -lrt /var/www/virtual/gginfo/*.html|awk ‘{print $9}‘ > /root/gg/ggscript/ggcount/temp sed ‘/^$/d‘ temp > tempc cat tempc|sort -n > temp rm -f tempc i=1 num=`sed -n ‘$=‘ temp` cd /root/gg/ggscript/ggcount while [ "$i" -le "$num" ] do filename=`sed -n $i‘p‘ /root/gg/ggscript/ggcount/temp` file=${filename%.*} file=${file##*/} filename=${filename##*/} nux=`grep -oi "red" /var/www/virtual/gginfo/$filename |wc -l` if [ $nux -gt 0 ];then echo "<font size=2 color=red>ALERT</font>" > /var/www/virtual/txt/gginfo/$file.html else echo "<font size=2 color=blue>NORMAL</font>" > /var/www/virtual/txt/gginfo/$file.html fi ((i++)); done
crontab 計劃任務配置
#GGscript */7 * * * * sh/root/gg/ggscript/pcsindex/pcsindex.sh > /root/gg/ggscript/pcsindex.log */6 * * * * sh /root/gg/ggscript/gglog/gglog.sh */15 * * * * sh /root/gg/ggscript/ggdsc/ggdsc.sh */8 * * * * sh /root/gg/ggscript/gginfo/gginfo.sh */5 * * * * sh /root/gg/ggscript/ggcount/count.sh 1 0 1 * * sh /root/gg/ggscript/gglog/lgglog.sh */10 * * * * sh /root/gg/ggscript/ggchk/ggchk.sh
本文出自 “netsman” 博客,請務必保留此出處http://netsman.blog.51cto.com/5750076/1939948
OGG維護優化腳本(二十四)-OGG狀態監控系統--後臺腳本