Help with Nagios and Oracle script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
gmilitel
Posts: 1
Joined: Wed Dec 11, 2013 8:04 am

Help with Nagios and Oracle script

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Help with Nagios and Oracle script

Post 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).
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked