Page 1 of 1

Help with Nagios and Oracle script

Posted: Mon Dec 23, 2013 9:27 am
by gmilitel
Hi, Im new to nagios and my contractor has nagios reporting on several oracle databases, as I'm a dba i have the below query to show Oracle database events, they want to notify each event in nagios with a value higher than...

SELECT event,cnt
FROM (
SELECT COUNT(*) as cnt, event
FROM v$session_wait
WHERE event NOT IN (
'pipe get', 'PL/SQL lock timer', 'SQL*Net more data from client',
'queue messages', 'SQL*Net message from client', 'pmon timer',
'rdbms ipc message', 'SQL*Net message to client', 'smon timer',
'wakeup time manager', 'virtual circuit status',
'wait for unread message on broadcast channel', 'jobq slave wait'
)
AND event NOT LIKE 'Streams%AQ%'
GROUP BY event
) a
WHERE (CASE WHEN event = 'db file scattered read' AND cnt >= &1 THEN 1
WHEN event = 'db file sequential read' AND cnt >= &2 THEN 1
WHEN event = 'buffer busy waits' AND cnt >= &3 THEN 1
WHEN event = 'latch free%' AND cnt >= &4 THEN 1
WHEN event = 'library cache%' AND cnt >= &5 THEN 1
WHEN event = 'enqueue' AND cnt >= &6 THEN 1
WHEN event = 'read by other session' AND cnt >= &7 THEN 1
WHEN event = 'log file sync' AND cnt >= &8 THEN 1
WHEN event = 'SQL*Net message from dblink' AND cnt >= &9 THEN 1
ELSE 0 END) = 1
;

Of course every cnt >=& is a variable for nagios to report on every event.

Regards.

Re: Help with Nagios and Oracle script

Posted: Mon Dec 23, 2013 1:14 pm
by abrist
You may be able to use the sql mode of the check_oracle_health plugin to run your query. Otherwise, you will need to write a custom plugin script (and probably have to use the oracle sdk as you would with check_oracle_health).