Step 1:- Add below lines:
# visudo
Comment below line:
#Defaults requiretty
Add below line
zabbix ALL=(ALL) NOPASSWD: ALL
Step 2:- Create sh files
#vi /etc/zabbix/appliedlogs.sh
sqlplus -s / as sysdba << EOF
set echo off
set heading off
SELECT to_char(SEQUENCE#) FROM V\$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V\$LOG_HISTORY GROUP BY THREAD#) AND THREAD#=1;
exit;
EOF
# vi /etc/zabbix/receivedlogs.sh
sqlplus -s / as sysdba << EOF
set echo off
set heading off
SELECT to_char(SEQUENCE#) FROM V\$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V\$ARCHIVED_LOG GROUP BY THREAD#) AND THREAD#=1;
exit;
EOF
# vi /etc/zabbix/drloggap.sh
sqlplus -s / as sysdba << EOF
set echo off
set heading off
SELECT to_char((ARCH.SEQUENCE# - APPL.SEQUENCE#)) FROM (SELECT THREAD# ,SEQUENCE# FROM V\$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V\$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, (SELECT THREAD# ,SEQUENCE# FROM V\$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V\$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;
exit;
EOF
Step 3:-
# chmod 755 /etc/zabbix/drloggap.sh /etc/zabbix/receivedlogs.sh /etc/zabbix/appliedlogs.sh
Step 4:- Add zabbix user parameters in /etc/zabbix/zabbix_agentd.conf file
# vi /etc/zabbix/zabbix_agentd.conf
UserParameter=appliedlogs,sudo su - oracle -c /etc/zabbix/appliedlogs.sh | grep -v '^$'
UserParameter=receivedlogs,sudo su - oracle -c /etc/zabbix/receivedlogs.sh | grep -v '^$'
UserParameter=drloggap,sudo su - oracle -c /etc/zabbix/drloggap.sh | grep -v '^$'
Increase Timeout=29 in zabbix agent config and proxy.
Step 5:- Restart zabbix agent
Step 6:- Apply below templet:
Template Oracle ODBC DR
Comments
Post a Comment