采用link方式解决zabbix对于备份监控和ORACLE日志监控由于路径不统一的问题

#对于备份监控和ORACLE日志监控由于路径不统一,我们可以采用link的方式如:
#ln -s 原路径 新路径(/zabbix/logs)
#新路径统一放在/zabbix/logs下具体看模板指定。

#脚本:

###############CREATE LINK FOR ORACLE ALERT LOG##################
#! /bin/sh

#Created by Jason
BIN=/zabbix/bin
LOGS=/zabbix/logs
mkdir -p $BIN
mkdir -p $LOGS
touch /zabbix/bin/background_dump_dest.sql
echo "set lin 100" > $BIN/background_dump_dest.sql
echo "select VALUE from v$parameter where name='background_dump_dest';" >> $BIN/background_dump_dest.sql
echo "exit" >> $BIN/background_dump_dest.sql

ORACLE_VERSION=`su - oracle -c "sqlplus / as sysdba @$BIN/background_dump_dest.sql" |grep -e "Disconnected from Oracle Database " | sed 's/^.*Database//g' | sed 's/Enterprise.*$//g' | sed s/[[:space:]]//g`

if [ $ORACLE_VERSION == 11g ];then
ALERT_DIR=`su - oracle -c "sqlplus / as sysdba @$BIN/background_dump_dest.sql" |grep trace`
else
ALERT_DIR=`su - oracle -c "sqlplus / as sysdba @$BIN/background_dump_dest.sql" |grep bdump`
fi

ALERT_NAME=`ls $ALERT_DIR |grep alert`
ln -s $ALERT_DIR/$ALERT_NAME $LOGS/alert_oracle.log
ALERTLOG_TARGET=`ls $LOGS | grep alert_oracle`
echo ===The link is located $LOGS/$ALERTLOG_TARGET===
#################CREATE LINK FOR BACKUP LOG######################

LOGS=/zabbix/logs
mkdir -p $LOGS
BACKUPLOG_COUNT=`find / -name hot_database_*.sh.out | wc -l`

if [ $BACKUPLOG_COUNT -gt 1 ];then
echo "===!!!There are greater than 2 backup logs,Please check it!!!==="
else
BACKUPLOG_SOURCE=`find / -name hot_database_*.sh.out`
ln -s $BACKUPLOG_SOURCE $LOGS/hot_database_backup.sh.out
BACKUPLOG_TARGET=`ls $LOGS |grep hot_database_backup`
echo ===The link is located $LOGS/$BACKUPLOG_TARGET===
fi

原文地址:https://www.cnblogs.com/datalife/p/7079520.html