In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to use zabbix to monitor the background log of oracle. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
How to use zabbix to monitor the oracle background log, when the oracle background log appears "ORA-" or "Error", the information will be alerted as soon as possible.
Zabbix agent end
All of the following operations are performed with root
Create a hard link for the oracle background log
There is insufficient permission to directly use zabbix to read oracle backend log reports, so the permission problem is bypassed by creating hard links.
Cd / tmp
Ln / u01/app/oracle/diag/rdbms/orcltest/orcltest/trace/alert_orcltest.log alert_orcltest.log
Chmod 644 alert_orcltest.log
Create a directory
Mkdir-p / etc/zabbix/scripts
Create script
Vi / etc/zabbix/scripts/alert.sh
#! / bin/bashget_sum_rows () {rows= `wc-l $1 | awk'{print $1} '`echo $rows} runfile=/tmp/tmp_alertrows.txt# initializes the runfile file if test-e $runfile Then sleep 0.01else get_sum_rows $1 > / tmp/tmp_alertrows.txtfi# filter ORA- and Errorprevrows= `cat / tmp/tmp_ alertrows.txt` prevrows=$ (($prevrows+1)) tail-n + $prevrows $1 | egrep "^ ORA- | ^ Error" # after each execution of the script, the total number of rows of the alert log updated get_sum_rows $1 > / tmp/tmp_alertrows.txt
Chmod 755 / etc/zabbix/scripts/alert.sh
Create an agent conf file
Vi / etc/zabbix/zabbix_agentd.d/userparameter_alert.conf
-
UserParameter=ora.alert. [*] / etc/zabbix/scripts/alert.sh $1
-
Restart the zabbix agent service
Service zabbix-agent restart
Zabbix server side test monitoring item
Zabbix_get-s 10.40.16.120-k 'ora.alert.[ / tmp/alert_orcltest.log]'
Under normal circumstances, blank lines are returned. If other errors are returned, check the problem according to the error prompt.
test
Simulate a deadlock in the database, then quietly wait for the zabbix alarm
The work is done, in fact, the process is quite simple, monitoring other types of database background logs can be handled in this way. However, this method is not applicable to the large log file, otherwise the execution time of the script will take a long time and lead to timeout. The background log should be archived regularly so that the background log is not too large. After archiving the background log, manually delete / tmp/tmp_alertrows.txt and / tmp/alert_orcltest.log, and re-make a hard link to the background log.
However, there is a problem, that is, if the alert log is too large, it will cause slow zabbix monitoring and even timeout, so archive the alert log on a regular basis. I wrote a script to archive alert log, refer to below.
one
two
three
four
five
six
seven
eight
nine
ten
eleven
[root@node2 trace] # cat / usr/local/shell/alert_clear.sh
#! / bin/bash
Set-u
Set-e
Set-o pipefail
Alertlog_path=/opt/oracle/diag/rdbms/orcldg/orcl/trace/
Date1=$ (date +% Y%m%d_%H%M%S)
Su-oracle-c "cp-a ${alertlog_path} alert_orcl.log ${alertlog_path} alert_orcl.log_$ {date1}"
Su-oracle-c "echo > ${alertlog_path} alert_orcl.log"
Echo > / tmp/tmp_alertrows.txt
Find ${alertlog_path}-name "alert_orcl.log_*"-mtime + 30 | xargs rm-rf
one
two
three
[root@node2 trace] # crontab-l
# Archive alert logs
50 00 * / usr/local/shell/alert_clear.sh
After reading the above, do you have any further understanding of how to use zabbix to monitor the background log of oracle? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.