DBLOG
» WTF
Toggle navigation
DBLOG
主页
1、用户
2、各种方案
3、备份恢复
4、表空间相关
5、OGG
6、文件管理
7、常见故障分析
8、DG
9、集群相关
About Me
归档
标签
zabbix监控ogg
无
2025-08-29 00:08:03
1
0
0
admin
[TOC] ##监控脚本 ```bash cat oggcheck.sh #!/bin/bash source ~/.bash_profile # 获取所有 OGG 进程信息 all() { source /home/oracle/.bash_profile echo "info all" | /opt/ogg/ggsci | egrep 'EXTRACT|REPLICAT' | sed 's/unknown/00:00:00/g' | awk -F"[ ]+|:" '{print $2,$3,$4*60+$5,$7*60+$8}' > /tmp/ogg.cfg } # 将 /tmp/ogg.cfg 内容写入 /tmp/ogg.his write_to_history() { echo `date` >> /tmp/ogg.his cat /tmp/ogg.cfg >> /tmp/ogg.his echo "Debug: /tmp/ogg.cfg content has been written to /tmp/ogg.his" >> /tmp/ogg.his } # 获取进程名 get_names() { all names=$(awk '{print $2}' /tmp/ogg.cfg) echo '{"data":[' first=true for name in $names; do if $first; then first=false else echo "," fi echo -n "{\"{#NAME}\":\"$name\"}" done echo ']}' } # 获取指定进程的状态 get_status() { process_name=$1 status=$(awk -v process="$process_name" '$2 == process {print $1}' /tmp/ogg.cfg) if [[ -z "$status" ]]; then echo "Debug: Process $process_name not found. Writing to /tmp/ogg.his..." write_to_history echo "UNKNOWN" else echo "$status" fi } # 获取指定进程的延迟 get_lag() { process_name=$1 lag=$(awk -v process="$process_name" '$2 == process {print $4}' /tmp/ogg.cfg) if [[ -z "$lag" ]]; then echo "Debug: Lag for process $process_name not found. Writing to /tmp/ogg.his..." write_to_history echo "0" else echo "$lag" fi } # 获取检查点的延迟 get_time_since_chkpt() { process_name=$1 since=$(awk -v process="$process_name" '$2 == process {print $3}' /tmp/ogg.cfg) if [[ -z "$since" ]]; then echo "Debug: Lag for process $process_name not found. Writing to /tmp/ogg.his..." write_to_history echo "0" else echo "$since" fi } # 主函数 main() { case "$1" in name) get_names ;; status) if [[ -z "$2" ]]; then echo "Usage: $0 status {#NAME}" exit 1 fi get_status "$2" ;; get_lag) if [[ -z "$2" ]]; then echo "Usage: $0 get_lag {#NAME}" exit 1 fi get_lag "$2" ;; getget_time_since_chkptlag) if [[ -z "$2" ]]; then echo "Usage: \$0 get_time_since_chkpt {#NAME}" exit 1 fi get_lag "$2" ;; *) echo "Usage: $0 {name|status {#NAME}|get_lag {#NAME}|getget_time_since_chkptlag {#NAME}" exit 1 ;; esac } # 执行主函数 main "$@" ``` ##zabbix-agent配置 ```bash cat zabbix_agentd.conf |grep Include Include=/etc/zabbix/zabbix_agentd.d/*.conf cat userparameter_ogg.conf UserParameter=ogg.names,/home/oracle/scripts/oggcheck.sh name UserParameter=ogg.status[*],/home/oracle/scripts/oggcheck.sh status $1 UserParameter=ogg.lag[*],/home/oracle/scripts/oggcheck.sh get_lag $1 UserParameter=ogg.since[*],/home/oracle/scripts/oggcheck.sh getget_time_since_chkptlag $1 ``` ##zabbix web端配置 ``` 自动发现清单-获取进程名 键值:ogg.names 监控项原型 应用进程延时 键值:ogg.lag[{#NAME}] 还原点检查时延 键值:ogg.since[{#NAME}] 进程状态 键值:ogg.status[{#NAME}] 再配置触发器类型监控以上监控项原型 ```
上一篇:
sqlldr
下一篇:
关于授权
0
赞
1 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网