check_oracle_health

Posted on July 3rd, 2009 by admin

This page is not yet available in english

 

52 Responses to “check_oracle_health”

  1. Marco Says:
    October 7th, 2009 at 12:58

    Hallo,

    ich teste gerade Ihr Tool. Ich bin sehr begeistert davon, denn es nimmt mir viel Abreit ab. Leider habe ich ein kleines Problem mit dem mode sql ./check_oracle_health –connect ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.102.103)(PORT=1521))(CONNECT_DATA=(SID=XYZ)))’ –user nagios –password oradbmon09 –mode sql –name ’select count(*) from v$session’ –name2 sessions –warning 100 –critical 150 ERgebnis: WARNING – sessions: 21 | ’sessions’=21;20;30

    In Nagios eingebunden bekomme ich als Status Information nur OK – sessions: Hier müßte eigentlich ja auch die Warning kommen.

    Skript:

    define command{ command_name check_oracle_per_sql command_line $USER1$/check_oracle_health –connect ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$HOSTADDRESS$)(PORT=1521))(CONNECT_DATA=(SID=$ARG3$)))’ –user $ARG1$ –password $ARG2$ –mode sql –name ’select count(*) from v\$session’ –name2 sessions –warning 5 –critical 10 }

    define service{ use local-service host_name test2_ch service_description Count Open Sessions2 check_command check_oracle_per_sql!nagios!abc!xyz }

    Performance Daten werden auch nicht geschrieben.

    Der Mode Tablespace funktioniert bei mir.

    Gruß Marco

    [Reply]

  2. lausser Says:
    October 8th, 2009 at 10:24

    Hallo, das liegt daran, dass Nagios empfindlich auf das Dollarzeichen in seinen Konfigdateien reagiert. Mit –name ’select count(*) from v$$session’ in der Command-Definition sollte es funktionieren. Eine Alternative wäre, SQL-Statements, die Sonderzeichen beinhalten, vorher zu encodieren. Das geht zwar auf Kosten der Lesbarkeit, dafür muss man sich aber keine Gedanken mehr bzgl. einfache/doppelte Hochkommata, Escapen etc. machen.

    echo 'select count(*) from v$session' | check_oracle_health --mode encode select%20count%28%2A%29%20from%20v%24session

    command_line $USER1$/check_oracle_health ..... --name select%20count%28%2A%29%20from%20v%24session ....

    Gerhard

    [Reply]

  3. Marco Says:
    October 9th, 2009 at 8:50

    Wunderbar es funktionert.

    Eine Frage habe ich noch. Kann es sein, dass für einige Abfragen keine Performancedaten geschrieben werden? z.B. für sga-shared-pool-reloads ?

    Marco

    [Reply]

    lausser Reply:

    Das kann ich nicht nachvollziehen. $ check_oracle_health --user nagios --password $ORAPW --connect NAPRAX --mode sga-shared-pool-reloads OK - SGA shared pool reload ratio 0.85% | sga_shared_pool_reload_ratio=0.85%;1;10 $ check_oracle_health -V check_oracle_health (1.6.3) Verwendest du die neueste Version? Gerhard

    [Reply]

  4. Marco Says:
    October 9th, 2009 at 9:29

    Wenn ich keine Schwellwerte mitgebe, dann schreibt er nichts. Gebe ich welche an, dann werden auch Performancedaten geschrieben.

    [Reply]

  5. Marco Says:
    October 9th, 2009 at 12:25

    Ich habe die gleiche Version. Bei mir war es so, dass er keine Performance-Daten nach “/usr/local/nagios/share/perfdata” geschrieben hat. Nachdem ich die Schwellwerte angegeben habe, ging es. Lag vielleich an mir.

    Eine Frage habe ich nun doch schon wieder: Ich möchte mir “sga-data-buffer-hit-ratio” ausgeben lassen. Ergebnis: CRITICAL – SGA data buffer hit ratio 43.73% | sga_data_buffer_hit_ratio=43.73%;98:;95: Unter SQLPLUS kommt folgendes raus: SELECT ROUND((1-(phy.value / (cur.value + con.value)))*100,2) “Cache Hit Ratio” FROM v$sysstat cur, v$sysstat con, v$sysstat phy WHERE cur.name = ‘db block gets’ AND con.name = ‘consistent gets’ AND phy.name = ‘physical reads’;

    Cache Hit Ratio

          86.36
    

    Interpretier ich etwas falsch?

    [Reply]

    lausser Reply:

    “db block gets” und die anderen Werte werden stur hochgezählt. Mit deinem SQL-Statement errechnest du die Hitratio über die gesamte Laufzeit der Instanz. Der Wert wird irgendwann sehr ungenau bzw. ändert sich nur sehr langsam. Bei check_oracle_health werden die Deltas dieser Zähler (zwischen dem aktuellen und dem letzten Lauf des Plugins) zur Berechnung verwendet. So bekommst du immer einen aktuellen Wert. (Den Mittelwert im check_interval).

    [Reply]

  6. Marco Says:
    October 15th, 2009 at 15:04

    Ich habe schon wieder eine Frage: Kann ich mit “tablespace-usage” auch einige Tablespace excluden? Ich möchte alle TBS’s außer z.B. sysaux, system überwachen. Geht das?

    [Reply]

    lausser Reply:

    Der Parameter –regexp sorgt dafür, dass der Parameter –name (mit dem man normalerweise einen Tablespace gezielt abfragt) als regulärer Ausdruck interpretiert wird. Wenn du also –name so formulierst, dass der Pattern alle Namen matcht ausser SYSTEM und SYSAUX, dann werden die beiden nicht angezeigt.

    … –name=’^(?!(SYSTEM|SYSAUX))’ –regexp

    Gerhard

    [Reply]

  7. Manuel Says:
    October 18th, 2009 at 3:22

    HAllo aus Spanien , Wo kann ich check_oracle_health download ?’

    DAnke

    [Reply]

    lausser Reply:

    Ungefähr 80cm nach oben scrollen bis zur Überschrift “Download”.

    [Reply]

  8. guzik Says:
    October 28th, 2009 at 11:35

    Hi, I’ve got a problem with check_oracle_health plugin. Status information in my Nagios: **ePN /usr/lib64/nagios/plugins/check_oracle_health: “Can’t exec “/usr/sbin/p1.pl”: Permission denied at (eval 1) line 5254,”. Few of check working fine, rest has got a problem. From console there is no problem to execute script. What can I do to correct check services?

    [Reply]

    lausser Reply:

    Hi, please add one line in the first 10 lines of the plugin:

    # nagios: -epn
    This prevents Nagios from executing check_oracle_health with the embedded Perl interpreter. I will add this to the next release of the plugin as the default. Gerhard

    [Reply]

  9. Steffen Poulsen Says:
    November 9th, 2009 at 17:29

    I tried to run check_oracle_health at an install using perl, version 5.005_03 – and it barked at me:

    Use of reserved word “our” is deprecated at check_oracle_health.pl line 9. Bareword “our” not allowed while “strict subs” in use at check_oracle_health.pl line 9. Unquoted string “our” may clash with future reserved word at check_oracle_health.pl line 9. Array found where operator expected at check_oracle_health.pl line 9, at end of line (Do you need to predeclare our?) syntax error at check_oracle_health.pl line 9, near “our @ISA ” Global symbol “@ISA” requires explicit package name at check_oracle_health.pl line 9. BEGIN not safe after errors–compilation aborted at check_oracle_health.pl line 80.

    We are very fond of your plugin and would like to use it at this install also – is there per incidence a drag-and-drop replacement for the “our @ISA”-construct that would allow the check to run at this old install also?

    Best regards, Steffen Poulsen

    [Reply]

    lausser Reply:

    I think, this would require a major rewrite of the plugin. Can’t you run it on the Nagios server and check the database with a remote connection? Gerhard

    [Reply]

  10. SweetBiene91 Says:
    November 11th, 2009 at 0:57

    hey ho bin so einsam jemand lust zu chattn oder so

    [Reply]

    lausser Reply:

    Versuch’s mal hiermit: irc server : irc.irclink.net port : 6667 channel : #nagios

    [Reply]

  11. Manfred Says:
    November 12th, 2009 at 18:17

    Gibt es eine Option (z.B. quiet) welche nur die Werte ausgeben läßt, welche ein warning oder critical ausgeben? Bei über 30 Tablespaces (bei –mode=tablespace-free) ist es fast unmöglich den zu finden, welcher das Warning ausgelöst hat. Ausserdem wird die Ausgabe in Nagios sehr unübersichtlich und viel zu lange. Ich habe schon im Source versucht, ein “if” einzubauen um die Ausgabe zu unterdrücken, bin damit aber gescheitert – da dann die Warnings selbst ausbleiben. Z.B. der orignal Nagios check der Filesysteme gibt auch nur die aus, welche warning oder critical sind.

    [Reply]

    lausser Reply:

    Ich würde in dem Fall empfehlen, check_multi zu verwenden. Das hat ausserdem den Vorteil, dass Schwellwerte im check_multi-Konfigfile geändert werden können, ohne dass man Nagios neu starten muss. Wenn man die Tablespacenamen als Label angibt, so erhält man eine knappe Ausgabe 30 plugins checked, 1 critical (TBS_1), 1 warning (TBS_25), 0 unknown, 28 ok

    [Reply]

  12. fsom Says:
    November 20th, 2009 at 15:54

    Tolles Script! Funktioniert soweit alles, nur bei mode=sql komme ich nicht weiter (v1.6.3): ./check_oracle_health –connect=DB –user=xxxxxx –password=yyyyyy –mode=sql –name=”select count(*) from v$session where status = ‘ACTIVE’”

    Use of uninitialized value in numeric gt (>) at /usr/lib/nagios/plugins/check_oracle_health line 3615. Use of uninitialized value in numeric gt (>) at /usr/lib/nagios/plugins/check_oracle_health line 3616. OK – select count(*) from v where status = ‘active’:

    ich bekomme nichts von dem SQL Befehl zurück. Mache ich etwas falsch ? danke, fsom

    [Reply]

    lausser Reply:

    Du musst das Dollarzeichen entwerten. Dein Statement: from v$session where… Ausgabe: from v where… Für die Shell sieht $session wie eine Variable aus und da diese nicht existiert, macht sie einen Leerstring draus. Schreib stattdessen …from v\$session…. Wenn das SQL-Statement komplizierter ist und viele solcher Sonderzeichen enthält, kann man es auch encodieren. Dazu rufst du check_oracle_health mit dem Parameter “–mode encode” auf. Es liest dann von der Standardeingabe. Du tippst dein Statement (ohne auf Entwertung von Sonderzeichen achten zu müssen und schliesst es mit RETURN ab.

    $ check_oracle_health --mode encode
    select count(*) from v$session where status = 'ACTIVE'
    select%20count%28%2A%29%20from%20v%24session%20where%20status%20%3D%20%27ACTIVE%27
    
    Als Ausgabe erhältst du das Statement in encodierter Form, das du nun bei –name angeben kannst, ohne auf Dollar- oder irgendwelche Anführungszeichen achten zu müssen.

    [Reply]

  13. Bas de Klerk Says:
    November 28th, 2009 at 17:55

    Hi,

    thx for your greate plugin. Saves me a lot of time!

    One small problem I’m having in version 1.6.3 is that the sga-data-bufer-hit-ratio sometimes drops to 0%… no clue why but sometimes it does. If I calculate it by hand using statement below the values are fine. If you need any add. info please let me know. For now I’ve made a workaround using mod=sql

    Regards Bas

    SELECT ((P1.value + P2.value – P3.value) / (P1.value + P2.value))*100 ratio FROM v$sysstat P1, v$sysstat P2, v$sysstat P3 WHERE P1.name = ‘db block gets’ AND P2.name = ‘consistent gets’ AND P3.name = ‘physical reads’;

    [Reply]

  14. lausser Says:
    November 28th, 2009 at 20:48

    I use the deltas (the difference to the counter value when check_oracle_health was run last time) for the calculation. E.g. the “physical reads” i use for the calculation is “value of physical reads now – value of physical reads approx. 5 minutes ago.” This way the hitrate reflects the current state of the buffer cache. In your formula you use the counters which increased since the database was started, so it’s an average hitrate over the whole lifetime. But isn’t it more interesting to get the current hitrate? When you get 0% sometimes, it actually means a hitrate of 0% (at least during the last check_interval).This is some kind of a “negative spike”. But i understand the problem. I will introduce a parameter “–lookback” which takes a number of minutes as argument. This way, you can for example measure the hitrate during the last 30 minutes, which is pretty up to date, but gives you much smoother results.

    [Reply]

  15. Andreas Says:
    December 12th, 2009 at 8:44

    Hallo, bei mir funktionieren nur run 50% der Abfragen: z.B. TNSPING, CON.-TIME, CON.-USERS, invalid-objects . Aber bei einigen Abfragen z.B. sga-data-buffer-hit-ratio erhalte ich in Nagios folgende Fehlermeldung: **ePN /usr/lib/nagios/plugins/check_oracle_health: printf() on closed filehandle STATE at (eval 1) line 3841,. “-epn” habe ich schon eingebaut. auf der Kommandozeile funktioniert die Abfrage aber. Danke!

    [Reply]

    lausser Reply:

    Kann es sein, dass du check_oracle_health auf der Kommandozeile als root ausgeführt hast? Das Plugin merkt sich nämlich Zwischenergebnisse im Verzeichnis /var/tmp/check_oracle_health, welches automatisch angelegt wird. Falls das Verzeichnis root gehört, kann ein check_oracle_health-Prozess, der unter der Nagios-Kennung läuft, da nicht mehr hineinschreiben. Die Fehlermeldung weist darauf hin. Ein “chown -R nagios:nagios /var/tmp/check_oracle_health” sollte das Problem lösen.

    [Reply]

    Andreas Reply:

    @lausser, Super! Genau daran hat’s gelegen. Vielen Dank!

    [Reply]

  16. Erlon Says:
    December 14th, 2009 at 14:41

    Where I find the download link?

    [Reply]

    lausser Reply:

    Scroll up until you see the topic “Download”

    [Reply]

  17. Erlon Says:
    December 14th, 2009 at 16:54

    But does not exist the Topic Download!

    [Reply]

  18. Erlon Says:
    December 14th, 2009 at 20:41

    Ok, I can see now. I didn’t see before because, i was seeing the page in english, and in english this link dont exists.

    [Reply]

  19. Don Seiler Says:
    January 8th, 2010 at 1:14

    Are there plans for ASM checks, such as disk group free space (v$asm_diskgroup.usable_file_mb)?

    [Reply]

    lausser Reply:

    No, i actually have no plans (mostly because i’m too occupied with other things). But if you look in the contribs subdirectory, you’ll find a description how you can extend check_oracle_health with your own custom modes. You simply put the code (mostly the sql stements) in a separate file which is sourced at runtime. Perhaps you want to play around with this and post the result. If it works, i will gladly add it to the core plugin.

    [Reply]

    Don Seiler Reply:

    @lausser, I’d love to do this if I have some time later. Thanks.

    [Reply]

  20. Millet JC Says:
    January 13th, 2010 at 11:29

    Hello All

    I’ve a small compilation error on a Solaris system. I’m not expert but think that it’s linked to my environment :

    ./configure work with success.

    make give me this error :

    Making all in plugins-scripts make: Fatal error: Don’t know how to make target Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/DictionaryCache.pm' Current working directory /tmp/check_oracle_health-1.6.3/plugins-scripts *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=echo all-recursive | sed s/-recursive//; \ list='plugins-scripts t'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for targetall-recursive’

    [Reply]

    Millet JC Reply:

    @Millet JC, Making all in plugins-scripts make: Fatal error: Don’t know how to make target Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/DictionaryCache.pm' Current working directory /tmp/check_oracle_health-1.6.3/plugins-scripts *** Error code 1 The following command caused the error: failcom='exit 1'; \ for f in x $MAKEFLAGS; do \ case $f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=echo all-recursive | sed s/-recursive//; \ list='plugins-scripts t'; for subdir in $list; do \ echo "Making $target in $subdir"; \ if test "$subdir" = "."; then \ dot_seen=yes; \ local_target="$target-am"; \ else \ local_target="$target"; \ fi; \ (cd $subdir && make $local_target) \ || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \ make "$target-am" || exit 1; \ fi; test -z "$fail" make: Fatal error: Command failed for targetall-recursive’

    [Reply]

    lausser Reply:

    Looks like your tar-command does not support filenames which exceed 100 characters (i think SuSE has such a tar). Instead of the tar.gz please download the shar.gz and unpack it with [sourcecode]cat check_oracle_health-xxx.shar.gz | gzip -d | sh[/sourcecode]

    [Reply]

  21. Rascal Says:
    January 25th, 2010 at 20:44

    Hallo, ich bin kein Datenbänker, sondern nur “Überwacher”, daher meine Frage: Gibt es eine Möglichkeit den Datenbank-Connect durch das Plugin zu erhalten? Durch den ständigen Auf- und Abbau der Verbindung, schwellen die Logdateien auf der DB an? Oder muss da was an der Datenbank-Config gemacht werden?

    [Reply]

  22. lausser Says:
    January 26th, 2010 at 13:13

    Mit http://sqlrelay.sourceforge.net/ kann man einen Proxy laufen lassen, der die Verbindung aufrecht hält. Dadurch entfallen dann die Login-Meldungen in der Logdatei.

    check_oracle_health --method sqlrelay --connect <proxy-ip>:<proxy-port> --username <proxy-user> --password <proxy-password> ...

    [Reply]

  23. Frank Says:
    February 15th, 2010 at 18:15

    Hallo, auf Kommandozeile funktioniert die Abfrage als User nagios. Im Nagios selber kommt die Fehlermeldung: ePN failed to compile /usr/lib/nagios/plugins/check_oracle_health “Missing right curly or square bracket at (eval 18) line 4193, at end of line syntax error at (eval 18) line 4200, at EOF at /usr/lib/nagios/p1.pl line 155″

    Die Zeile “# nagios: -epn” steht im Skript bereits drin.

    Kann es daran liegen dass Nagios noch v.2.9 ist? Gibt es einen Weg das unter dieser Version zum laufen zu bringen?

    [Reply]

    lausser Reply:

    Die selektive Abschaltung mit -epn gibt es erst ab der Version 3. Leider, bleibt also nur ein Upgrade auf 3.x oder der komplette Verzicht auf ePN.

    [Reply]

  24. John Tomawski Says:
    February 16th, 2010 at 23:30

    Be sure to set the –environment flag when required. The flag can be used to set things such as TNS_ADMIN, etc.

    Hopefully this comment saves someone 2 hours… sigh

    ex. –environment TNS_ADMIN=’/usr/lib/oracle/bleh’

    [Reply]

  25. Aldo Says:
    February 19th, 2010 at 12:52

    when running the following command:

    ./check_oracle_health –connect REMOTE –username $ORAUSER –password $ORAPWD –mode tablespace-usage –tablespace USERS

    I get the following error message.

    Use of uninitialized value in split at /usr/lib/nagios/plugins/check_oracle_health line 3924. bumm Can’t call method “execute” on an undefined value at /usr/lib/nagios/plugins/check_oracle_health line 4230.

    Can’t use an undefined value as an ARRAY reference at /usr/lib/nagios/plugins/check_oracle_health line 4242.

    and now I’m clue less what todo? can you assist me on this one

    thanks in advance

    [Reply]

    lausser Reply:

    Did you give the necessary privileges to your ORAUSER?

    CREATE user nagios IDENTIFIED BY oradbmon; 
    GRANT CREATE session TO nagios;
    GRANT SELECT any dictionary TO nagios;
    GRANT SELECT ON V_$SYSSTAT TO nagios;
    GRANT SELECT ON V_$INSTANCE TO nagios;
    GRANT SELECT ON V_$LOG TO nagios;
    GRANT SELECT ON SYS.DBA_DATA_FILES TO nagios;
    GRANT SELECT ON SYS.DBA_FREE_SPACE TO nagios;
    You also can create an empty file /tmp/check_oracle_health.trace with the touch-command. As long as this file exists, check_oracle_health will write debugging messages into it. You should see the sql statements sent to the database server and the responses. Maybe this gives you an idea what’s wrong.

    [Reply]

    Aldo Reply:

    @lausser, Hi Lausser, it works fantastic now! This is a great plugin.

    [Reply]

  26. Hans-Jürgen Says:
    February 22nd, 2010 at 11:03

    Hallo,

    wir benutzen check_oracle_health seit längerem und sind sehr zufrieden damit. Vielen Dank dafür. Für die Tablespaces, bei denen auto-extent eingeschaltet ist, möchten wir die Überwachung von tablespace-usage auf tablespace-can-allocate-next ändern. Wird dabei sowohl überprüft, ob noch genügend Platz ist als auch ob MAX_EXTENT bereits erreicht ist?

    [Reply]

    lausser Reply:

    Hallo, max_extent wird meines Wissens nach nicht angeschaut. Wenn man mit touch /tmp/check_oracle_health.trace eine leere Datei anlegt (beschreibbar vom Nagios-User), dann werden dort die angesetzten SQL-Statements und deren Resultate reinprotokolliert.

    [Reply]

  27. angry_admin Says:
    February 24th, 2010 at 13:49

    http://ideas.nagios.org/a/dtd/22035-3955

    [Reply]

  28. Rik Says:
    February 26th, 2010 at 16:21

    Thanks you Gerhard for an excellent plugin. Here is a tiny correction on the documentation on this page. –method accepts two arguments: dbi (not tns) or sqlplus. Or am I misinterpreting things?

    [Reply]

    lausser Reply:

    Thanks! “tns” was how i named it in a very early phase. Later it was replaced by the less misleading “dbi”.

    [Reply]

  29. Thomas Says:
    March 4th, 2010 at 11:57

    Hallo,

    hört sich ja alles sehr schön an. Ich würde es ja auch gerne mal ausprobieren, aber ich finde leider nirgends einen Download Link (auch nicht mittlerweile 1,20 m weiter oben). Habe ich etwas übersehen?

    Danke, Thomas

    [Reply]

    lausser Reply:

    du bist vermutlich auf der englischen Seite gelandet, die es nicht gibt (bei der allerdings die Kommentare angezeigt werden) Der Download-Link ist auf dieser Seite: http://labs.consol.de/lang/de/nagios/check_oracle_health/

    [Reply]

  30. Thomas Says:
    March 4th, 2010 at 17:27

    Hallo,

    habe leider Schwierigkeiten, den Oracle-Instant-Client zu installieren. Weiß vielleicht jemand eine Seite, die sich mit dem Thema beschäftigt?

    Vielen Dank, Thomas

    [Reply]

Leave a Reply