Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OGG maintenance optimization script (24)-OGG status monitoring system-background script

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This simple monitoring system is implemented by html.

There is no database in the background, only html files collected and uploaded from various machines

It is sorted out and sorted into various directories by timed shell scripts, and then called by web pages through apache.

The specific update frequency depends on the timing task running frequency of each data synchronization server.

OGG process status collation script

This script is used to organize the files collected by the process information upload script and merge them into html files

Pcsindex.sh

#! / bin/bashcd / root/gg/ggscript/pcsindexls-lrt / root/gg/gginfo/*.gginfo | awk'{print $9}'> tempsed'/ ^ $/ d 'temp > tempccat tempc | sort-n > temprm-f tempcecho "The data was collected by RenYi

"> / var/www/virtual/index2.htmlecho"

"> > / var/www/virtual/index2.htmlecho"

"> / var/www/virtual/index2.htmli=1num= `sed-n'$= 'temp`cd / root/gg/gginfowhile [" $I "- le" $num "] do filename= `sed-n $itemp` / root/gg/ggscript/pcsindex/ temp`cat $filename > > / var/www/virtual/index2.html ((itemp`)); done

OGG error log collation script

This script is used to organize the error log information collected by the error log upload script.

Gglog.sh

#! / bin/bashcd / root/gg/ggscript/gglogls-lrt / root/gg/gglog/*.gglog | awk'{print $9}'> / root/gg/ggscript/gglog/tempsed'/ ^ $/ d 'temp > tempccat tempc | sort-n > temprm-f tempci=1num= `sed-n' $= 'temp`cd / root/gg/gglogwhile ["$I"-le "$num"] do filename= `sed-n $itemp' / root/gg/ggscript/gglog/ temp`file=$ {filename%.*} File=$ {file##*/} cat $filename > / var/www/virtual/gglog/$file.html ((iTunes +)) Done

Lgglog.sh

#! / bin/bashcd / root/gg/ggscript/gglogls-lrt / var/www/virtual/gglog/* | awk'{print $9}'> / root/gg/ggscript/gglog/temp2sed'/ ^ $/ d 'temp2 > tempccat tempc | sort-n > temp2rm-f tempci=1i=1num= `sed-n' $= 'temp2`cd / var/www/virtual/gglogwhile ["$I"-le "$num"] do filename= `sed-n $itemp' / root/gg/ggscript/gglog/ temp2`file=$ {filename%.*} File=$ {file##*/} cat $filename > / var/www/virtual/lgglog/$file.html ((iTunes +)) Done

Additional log error message collation script

This script is used to sort additional log error information collected by the script from different machines and send it to different directories.

Ggchk.sh

#! / bin/bashcd / root/gg/ggscript/ggchkls-lrt / root/gg/ggtbchk/*.tbcheck | awk'{print $9}'> / root/gg/ggscript/ggchk/tempsed'/ ^ $/ d 'temp > tempccat tempc | sort-n > temprm-f tempci=1num= `sed-n' $= 'temp `cd / root/gg/ggtbchkwhile ["$I"-le "$num"] do filename= `sed-n $itemp` / root/gg/ggscript/ggchk/ temp`file=$ {filename%.*} File=$ {file##*/} cat $filename > / var/www/virtual/ggchk/$file.html ((iTunes +)) Done

Write error log collation script

Used to sort out the exception logs collected by the write process exception log collection script

Ggdsc.sh

#! / bin/bashcd / root/gg/ggscript/ggdscls-lrt / root/gg/ggdcs/*.dcsinfo | awk'{print $9}'> / root/gg/ggscript/ggdsc/tempsed'/ ^ $/ d 'temp > tempccat tempc | sort-n > temprm-f tempci=1num= `sed-n' $= 'temp`c d / root/gg/ggdcswhile ["$I"-le "$num"] do filename= `sed-n $itemp' / root/gg/ggscript/ggdsc/ temp`file=$ {filename%.*} File=$ {file##*/} cat $filename > / var/www/virtual/ggdsc/$file.html ((iTunes +)) Done

Error count script

It is used to count errors and exception information in each system log and generate data such as ERROR or the number of errors on the page.

Count.sh

#! / bin/bashcd / root/gg/ggscript/ggcount#gginfols-lrt / var/www/virtual/gginfo/*.html | awk'{print $9}'> / root/gg/ggscript/ggcount/tempsed'/ ^ $/ d 'temp > tempccat tempc | sort-n > temprm-f tempci=1num= 's ed-n' $= 'temp`cd / root/gg/ggscript/ggcountwhile ["$I"-le "$num"] do filename= `sed-n $itemp` / 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 "ALERT" > / var/www/virtual/txt/gginfo/$file.html else echo "NORMAL" > / var/www/virtual/txt/gginfo/$file.html fi ((iTunes +)); done

Crontab scheduled task configuration

# 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.sh1 0 1 * * sh / root/gg/ggscript/gglog/lgglog.sh*/10 * sh / root/gg/ggscript/ggchk/ggchk.sh

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report