mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-05 01:53:44 +01:00
check_oracle_health plugin added
This commit is contained in:
parent
581b2a77f3
commit
b341201cf4
@ -0,0 +1 @@
|
||||
Gerhard Lausser <gerhard.lausser@consol.de>
|
340
check_oracle_health/src/check_oracle_health-1.6.9/COPYING
Normal file
340
check_oracle_health/src/check_oracle_health-1.6.9/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
206
check_oracle_health/src/check_oracle_health-1.6.9/ChangeLog
Normal file
206
check_oracle_health/src/check_oracle_health-1.6.9/ChangeLog
Normal file
@ -0,0 +1,206 @@
|
||||
###############################################
|
||||
# Changelog of the check_oracle_health plugin #
|
||||
###############################################
|
||||
|
||||
1.6.9 - 2011-06-16
|
||||
- sites in an OMD (http://omdistro.org) environment have now private statefile directories
|
||||
- add mode session-usage, process-usage, rman-backup-problems, corrupted-blocks (Thanks Ovidiu Marcu)
|
||||
-add mode datafiles-created (Thanks Ovidiu Marcu)
|
||||
|
||||
1.6.8.1 - 2011-01-08
|
||||
- Workaround for the windows version which cleans up leftover spool files which cannot be deleted.
|
||||
|
||||
1.6.8 - 2010-01.03
|
||||
- massive speedup in modes seg-top10-* (Thanks Michael Nieberg http://kenntwas.de)
|
||||
- bugfix in --mode sql (numeric vs. regexp result) (Thanks Michel Meelker)
|
||||
|
||||
1.6.7 - 2010-12-18
|
||||
- mode sql can now have a non-numerical output which is compared to a string/regexp
|
||||
- new mode report can be used to output only the bad news (short,long,html)
|
||||
|
||||
1.6.6.2 2010-11-11
|
||||
- better error message with method sqlplus when db is down
|
||||
|
||||
1.6.6.1 2010-10-01
|
||||
- --dbthresholds can have an argument
|
||||
- workaround for an oracle-bug in shared-pool-free (Thanks Yannik)
|
||||
|
||||
1.6.6 2010-08-12
|
||||
- new parameter --dbthresholds. thresholds can now also be deposited in the table check_oracle_health_thresholds
|
||||
- bugfix in connection-time. dbuser was uninitialized in rare cases
|
||||
|
||||
1.6.5 2010-08-09
|
||||
- plugin can now run on windows
|
||||
- --with-mymodules-dyn-dir on the commandline overrides the configure-option of the same name
|
||||
- added mode flash-recovery-area-[usage|free]
|
||||
|
||||
1.6.4
|
||||
- added checking of dba_registry to mode invalid-objects. Thanks Ovidiu Marcu
|
||||
- speedup of tablespace-remaining-time. Thanks Steffen Poulsen
|
||||
- switch-interval detects redo log timestamps in the future and reports critical- method sqlplus now works with "(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP"-like connectstrings
|
||||
- new parameter --ident to show instance and database names in the output
|
||||
- bugfix in tablespace-usage (temp tbs with multiple datafiles). Thanks Philipp Lemke
|
||||
|
||||
1.6.3 2009-09-09
|
||||
- optimized tablespace-can-allocate-next
|
||||
- added more tracing.
|
||||
- fixed a bug which caused invalid statefile names. Thanks Franky van Liedekerke
|
||||
- fixed a bug in tablespace-usage for Oracle 8.1.x
|
||||
- switch-interval now tries to predict the next interval to avoid false alerts. Thanks Naquada.
|
||||
- passwords do no longer show up in error messages. Thanks Jens Seiffert.
|
||||
- fixed a bug in mode sql (numbers of the form .5 were rejected). Thanks Shane Jordan.
|
||||
- fixed a bug in sga-latches-hitratio (thresholds were ignored). Thanks Yannik Charton.
|
||||
- login parameter --user is now --username (--user still works)
|
||||
|
||||
1.6.2 2009-04-04
|
||||
- fixed a bug in tablespace-usage and german localization
|
||||
- fixed a bug with --method sqlplus and tablespacenames. Thanks "contact_name"
|
||||
- fixed a bug in tablespace-usage/free with non-autoextensible TEMP-tablespaces. Thanks Daniel Graef.
|
||||
|
||||
1.6.1 2009-03-27
|
||||
- NAGIOS__HOSTMYSQL_HOST is now possible
|
||||
- added detection for offline/damaged tablespaces to --mode=tablespace-usage|free. Thanks Daniel Graef.
|
||||
|
||||
1.6 2009-03-12
|
||||
- support for DBD::SQLRelay (use it. it spares your database
|
||||
the extra load caused by permanent logins)
|
||||
- added support for mode=sql and an array of results. Thanks Juergen Lesny from Matrix.
|
||||
- added support for login as "sys". Thanks Joerg Horchler.
|
||||
- fixed a bug where warning/critical=0 was ignored. Thanks Danijel Tasov.
|
||||
|
||||
1.5.1 2008-12-10
|
||||
- the plugin can be used with the embedded perl interpreter.
|
||||
- fixed some typos. Thanks Oliver Riesen.
|
||||
|
||||
1.5.0.1 2008-10-16
|
||||
- fixed a bug with , instead of . in decimal numbers. Thanks Birk Bohne.
|
||||
- mode=sql numerical results are round up to two decimal places.
|
||||
- fixed a bug in sga-shared-pool-free. You'll see more free space now. Thanks Birk Bohne.
|
||||
|
||||
1.5.0 2008-10-15
|
||||
- added authentication with password store
|
||||
- added authentication as sysdba
|
||||
- new parameter --units for mode=sql
|
||||
- new parameter tablespace-free which allows thresholds in combination with --units
|
||||
- mode=switch-interval now separates redologs of rac nodes. Thanks Harald Zahn.
|
||||
- it is now possible to integrate self-written code
|
||||
|
||||
1.4.2.1 2008-09-19
|
||||
- bugfix in tablespace-usage. resized datafiles caused usage 100%
|
||||
|
||||
1.4.2 2008-09-16
|
||||
- new mode --regexp which extends --name
|
||||
- bugfix in datafile-io-balance and case sensitive tbs (Thanks Wiltmut Gerdes)
|
||||
|
||||
1.4.1 2008-09-07
|
||||
- new mode tablespace-can-allocate-next
|
||||
- bugfix to handle locked accounts
|
||||
- rewrote seg-top10... sql to avoid overloading
|
||||
- bugfix in timeout
|
||||
- bugfix in mode sql and zero return value. (Thanks Viktor Kaefer)
|
||||
- new mode encode
|
||||
- undo tablespace usage takes into account expired extents
|
||||
|
||||
1.4.0.1 2008-07-07
|
||||
- bugfix when --name=0
|
||||
- bugfix in --method=sqlplus
|
||||
- bugfix in thresholds of invalid-objects (Thanks Konrad Barck)
|
||||
|
||||
1.4 2008-07-03
|
||||
- statesdir is now /var/tmp/check_oracle_health by default (autom. migration if it was /tmp)
|
||||
- bugfix in latch-contention
|
||||
- bugfix in sysstats (thresholds were ignored)
|
||||
- bugfix in roll-extends and roll-wraps
|
||||
- performance enhancements
|
||||
- tablespace-usage can be output as a bargraph (Thanks Allan Peda)
|
||||
|
||||
1.3.1.2 2008-07-02
|
||||
- fixed a bug in disconnect. there were leftover sessions.
|
||||
|
||||
1.3.1.1 2008-07-01
|
||||
- fixed a bug in method=sqlplus and os$user
|
||||
- objects in the recyclebin are no longer treated as invalid
|
||||
- better performance data for pga-in-memory-sort-ratio
|
||||
- fixed a bug in tablespace-usage and temp tbs (Thanks Franky van Liedekerke)
|
||||
|
||||
1.3.1 2008-06-26
|
||||
- typos removed, code cleanup
|
||||
- fixed a bug in connected-users thresholds (Thanks Frank Brehm)
|
||||
|
||||
1.3 2008-06-23
|
||||
- --method=sqlplus using sqlplus instead of DBD::Oracle is possible but NOT supported
|
||||
- !! NOT !! supported. If you use it and it don't work, then don't whine about it
|
||||
- tablespace-usage now takes autoextent into account (Thanks Wiltmut Gerdes)
|
||||
- data-buffer/library/dictionary-cache-hitratio is now more accurate
|
||||
- --method=sqlplus does not work for you? I'm not listening, lalalalala
|
||||
|
||||
1.2.7.1 2008-06-20
|
||||
- fixed a bug in windows datafile handling
|
||||
|
||||
1.2.7 2008-06-20
|
||||
- removed unrecoverable datafiles from invalid-objects
|
||||
- added mode sql
|
||||
- bugfixes in top10-x and pga-in-memory-sort-ratio
|
||||
|
||||
1.2.6.1 2008-06-16
|
||||
- added sysstat-rate and list-sysstats
|
||||
|
||||
1.2.6 2008-06-14
|
||||
- added event-waiting
|
||||
- added event-waits
|
||||
- added list-events
|
||||
|
||||
1.2.5.1 2008-06-11
|
||||
- added an abstraction layer so that perl-dbi may be replaced
|
||||
|
||||
1.2.5 2008-06-03
|
||||
- added latch-contention
|
||||
- added enqueue-contention
|
||||
- added enqueue-waiting
|
||||
- added connected-users
|
||||
- added roll-avgactivesize (forget it)
|
||||
- added --list-latches --list-enqueues
|
||||
|
||||
1.2.4.2 2008-05-27
|
||||
- windows pathnames of datafiles are now handled correctly
|
||||
|
||||
1.2.4.1 2008-05-27
|
||||
- added --list-tablespaces --list-datafiles
|
||||
|
||||
1.2.4 2008-05-27
|
||||
- added datafile-io-traffic
|
||||
- added redo-io-traffic
|
||||
- better handling of temp tablespaces
|
||||
|
||||
1.2.3.1 2008-05-25
|
||||
- stale-statistics now works for < 10.x
|
||||
|
||||
1.2.3 2008-05-25
|
||||
- added roll-block-contention
|
||||
- added roll-hit-ratio
|
||||
- fixed a bug in switch-interval
|
||||
|
||||
1.2.2.1 - 2008-05-23
|
||||
- disabled modes which require minimum 10.x
|
||||
|
||||
1.2.2 - 2008-05-21
|
||||
- fixed a bug in --environment
|
||||
|
||||
1.2.1 - 2008-05-19
|
||||
- support for externally authenticated users
|
||||
- new parameters --runas and --environment
|
||||
- sga-buffer-cache-hit-ratio now shows percent (Thanks Maik Ihde)
|
||||
- fixed a bug in tablespace-remaining-time
|
||||
|
||||
1.2 - 2008-05-06
|
||||
- stale-statistics
|
||||
- connection timeout handling
|
||||
|
||||
1.1 - 2008-05-02
|
||||
----------------
|
||||
- tablespace-remaining-time predicts when a tablespace will be full
|
||||
- tablespace-io-balance uses standard deviation
|
||||
|
||||
1.0 - 2008-04-16
|
||||
----------------
|
||||
- Initial release
|
233
check_oracle_health/src/check_oracle_health-1.6.9/INSTALL
Normal file
233
check_oracle_health/src/check_oracle_health-1.6.9/INSTALL
Normal file
@ -0,0 +1,233 @@
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2008 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
Joerg
|
||||
=====
|
||||
|
||||
Na, hast du alles brav durchgelesen?
|
@ -0,0 +1,13 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# find . \( -type d -and -name .svn -and -prune \) -or -type f -exec fromdos -v {} \;
|
||||
|
||||
SUBDIRS = plugins-scripts t
|
||||
EXTRA_DIST = contrib
|
||||
|
||||
dist-hook:
|
||||
rm -f t/var/tmp/*
|
||||
rm -f t/var/adm/*
|
||||
find $(distdir) -depth -name .svn -exec rm -rf {} \;
|
||||
find $(distdir) -type f -exec dos2unix -v {} \;
|
||||
make
|
575
check_oracle_health/src/check_oracle_health-1.6.9/Makefile.in
Normal file
575
check_oracle_health/src/check_oracle_health-1.6.9/Makefile.in
Normal file
@ -0,0 +1,575 @@
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# find . \( -type d -and -name .svn -and -prune \) -or -type f -exec fromdos -v {} \;
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS TODO config.guess config.sub install-sh \
|
||||
missing
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno configure.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-exec-recursive install-info-recursive \
|
||||
install-recursive installcheck-recursive installdirs-recursive \
|
||||
pdf-recursive ps-recursive uninstall-info-recursive \
|
||||
uninstall-recursive
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d $(distdir) \
|
||||
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr $(distdir); }; }
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
INSTALL = @INSTALL@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CAT = @CAT@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
GREP = @GREP@
|
||||
GZIP = @GZIP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_OPTS = @INSTALL_OPTS@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MYMODULES_DIR = @MYMODULES_DIR@
|
||||
MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
RELEASE = @RELEASE@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
STATEFILES_DIR = @STATEFILES_DIR@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_nagios_group = @with_nagios_group@
|
||||
with_nagios_user = @with_nagios_user@
|
||||
SUBDIRS = plugins-scripts t
|
||||
EXTRA_DIST = contrib
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
|
||||
cd $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; 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) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
$(mkdir_p) $(distdir)/plugins-scripts
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(mkdir_p) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
distdir=`$(am__cd) $(distdir) && pwd`; \
|
||||
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$top_distdir" \
|
||||
distdir="$$distdir/$$subdir" \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-find $(distdir) -type d ! -perm -755 -exec chmod a+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& cd $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
|
||||
distuninstallcheck:
|
||||
@cd $(distuninstallcheck_dir) \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
|
||||
check-am clean clean-generic clean-recursive ctags \
|
||||
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
|
||||
dist-shar dist-tarZ dist-zip distcheck distclean \
|
||||
distclean-generic distclean-recursive distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-recursive \
|
||||
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
|
||||
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
|
||||
dist-hook:
|
||||
rm -f t/var/tmp/*
|
||||
rm -f t/var/adm/*
|
||||
find $(distdir) -depth -name .svn -exec rm -rf {} \;
|
||||
find $(distdir) -type f -exec dos2unix -v {} \;
|
||||
make
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
142
check_oracle_health/src/check_oracle_health-1.6.9/README
Normal file
142
check_oracle_health/src/check_oracle_health-1.6.9/README
Normal file
@ -0,0 +1,142 @@
|
||||
check_oracle_health Nagios Plugin README
|
||||
---------------------
|
||||
|
||||
This plugin is used to monitor a variety of oracle database metrics.
|
||||
|
||||
* For instructions on installing this plugin for use with Nagios,
|
||||
see below. In addition, generic instructions for the GNU toolchain
|
||||
can be found in the INSTALL file.
|
||||
|
||||
* For major changes between releases, read the CHANGES file.
|
||||
|
||||
* For information on detailed changes that have been made,
|
||||
read the Changelog file.
|
||||
|
||||
* This plugin is self documenting. All plugins that comply with
|
||||
the basic guidelines for development will provide detailed help when
|
||||
invoked with the '-h' or '--help' options.
|
||||
|
||||
You can check for the latest plugin at:
|
||||
http://www.consol.com/opensource/nagios/check-oracle-health
|
||||
|
||||
The documentation in this README covers only the most common features.
|
||||
To view the full documentation and examples, go to
|
||||
http://www.consol.com/opensource/nagios/check-oracle-health or
|
||||
http://www.consol.de/opensource/nagios/check-oracle-health
|
||||
|
||||
Send mail to gerhard.lausser@consol.de for assistance.
|
||||
Please include the OS type/version and the Perl DBI/DBD version
|
||||
that you are using.
|
||||
Also, run the plugin with the '-vvv' option and provide the resulting
|
||||
version information. Of course, there may be additional diagnostic information
|
||||
required as well. Use good judgment.
|
||||
|
||||
For patch submissions and bug reports, please send me a mail. You can also find
|
||||
me at http://www.nagios-portal.de
|
||||
|
||||
|
||||
|
||||
|
||||
How to "compile" the check_oracle_health script.
|
||||
--------------------------------------------------------
|
||||
|
||||
1) Run the configure script to initialize variables and create a Makefile, etc.
|
||||
|
||||
./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-perl=PATH_TO_PERL --with-statefiles-dir=STATE_PATH
|
||||
|
||||
a) Replace BASEDIRECTORY with the path of the directory under which Nagios
|
||||
is installed (default is '/usr/local/nagios')
|
||||
b) Replace SOMEUSER with the name of a user on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
c) Replace SOMEGRP with the name of a group on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
d) Replace PATH_TO_PERL with the path where a perl binary can be found.
|
||||
Besides the system wide perl you might have installed a private perl
|
||||
just for the nagios plugins (default is the perl in your path).
|
||||
e) Replace STATE_PATH with the directory where you want the script to
|
||||
write state files which transport information from one run to the next.
|
||||
(default is /tmp)
|
||||
|
||||
Simply running ./configure will be sufficient to create a check_oracle_health
|
||||
script which you can customize later.
|
||||
|
||||
|
||||
2) "Compile" the plugin with the following command:
|
||||
|
||||
make
|
||||
|
||||
This will produce a "check_oracle_health" script. You will also find
|
||||
a "check_oracle_health.pl" which you better ignore. It is the base for
|
||||
the compilation filled with placeholders. These will be replaced during
|
||||
the make process.
|
||||
|
||||
|
||||
3) Install the compiled plugin script with the following command:
|
||||
|
||||
make install
|
||||
|
||||
The installation procedure will attempt to place the plugin in a
|
||||
'libexec/' subdirectory in the base directory you specified with
|
||||
the --prefix argument to the configure script.
|
||||
|
||||
|
||||
4) Verify that your configuration files for Nagios contains
|
||||
the correct paths to the new plugin.
|
||||
|
||||
|
||||
Command line parameters
|
||||
-----------------------
|
||||
|
||||
--connect=<the oracle connect string>
|
||||
This is what you would also use with tnsping and sqlplus.
|
||||
|
||||
--user=<username>
|
||||
This is the user which reads the system tables.
|
||||
|
||||
--password=<secret>
|
||||
This is the user's password.
|
||||
|
||||
--mode=<operation mode>
|
||||
This parameter tells the plugin what it should check.
|
||||
The list of known modes may grow frequently. Please look at
|
||||
http://www.consol.com/opensource/nagios/check-oracle-health for a list
|
||||
of features.
|
||||
|
||||
--tablespace=<tablespace name>
|
||||
Tablespace-related modes check all tablespaces in one run by default.
|
||||
If only a single tablespace should be checked, use this parameter.
|
||||
|
||||
--warning=<warning threshold>
|
||||
If the metric is out of this range, the plugin returns a warning.
|
||||
|
||||
--critical=<critical threshold>
|
||||
If the metric is out of this range, the plugin returns a critical.
|
||||
|
||||
|
||||
|
||||
How to prepare the database for monitoring
|
||||
--------------------------------------
|
||||
|
||||
create user nagios identified by 'whatever';
|
||||
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;
|
||||
|
||||
on 8.x the user must be granted the SELECT_CATALOG_ROLE
|
||||
grant select_catalog_role to nagios;
|
||||
instead of "grant select any dictionary..."
|
||||
|
||||
If you monitor the oracle 7.x database at the local computer museum:
|
||||
grant select on V_$SYSSTAT to nagios;
|
||||
grant select on sys.dba_tablespaces to nagios;
|
||||
grant select on sys.dba_free_space to nagios;
|
||||
grant select on sys.dba_data_files to nagios;
|
||||
|
||||
|
||||
--------------------------------------
|
||||
That's it. If you have any problems or questions, feel free to send mail
|
||||
to gerhard.lausser@consol.de
|
26
check_oracle_health/src/check_oracle_health-1.6.9/TODO
Normal file
26
check_oracle_health/src/check_oracle_health-1.6.9/TODO
Normal file
@ -0,0 +1,26 @@
|
||||
a lot
|
||||
|
||||
maybe add some ORA- to the examples
|
||||
ORA-60X alle Internal Errors
|
||||
SEGV, SIGBUS alle System Access Violations
|
||||
Ora-4020 Deadlock on library object
|
||||
ORA-8103 Object no longer exists
|
||||
ORA-1410 invalid ROWID
|
||||
ORA-1578 Data block corrupted
|
||||
ORA-29740 Node eviction
|
||||
ORA-255 Database is not mounted
|
||||
ORA-376 File cannot be read at this time
|
||||
ORA-4030 Out of memory
|
||||
ORA-4031 Unable to allocate more bytes of shared memory
|
||||
ORA-355 The change numbers are out of order
|
||||
ORA356 Inconsistent lengths in change description
|
||||
ORA-353 Log corruption
|
||||
ORA-7445 Operating System exception
|
||||
Checkpoint not complete
|
||||
|
||||
|
||||
! Lesny proposal for multiple sql results
|
||||
|
||||
|
||||
flash recovery area free
|
||||
http://www.muniqsoft.de/tipps/monatstipps/Tipp0308.pdf
|
@ -0,0 +1,78 @@
|
||||
dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
|
||||
dnl
|
||||
dnl Provides a test to determine the correct way to call gethostbyname_r
|
||||
dnl
|
||||
dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required
|
||||
dnl
|
||||
dnl e.g. 6 arguments (linux)
|
||||
dnl e.g. 5 arguments (solaris)
|
||||
dnl e.g. 3 arguments (osf/1)
|
||||
dnl
|
||||
dnl @version $Id: acinclude.m4,v 1.5 2004/02/18 14:56:34 kdebisschop Exp $
|
||||
dnl @author Brian Stafford <brian@stafford.uklinux.net>
|
||||
dnl
|
||||
dnl based on version by Caolan McNamara <caolan@skynet.ie>
|
||||
dnl based on David Arnold's autoconf suggestion in the threads faq
|
||||
dnl
|
||||
AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R],
|
||||
[AC_CACHE_CHECK(number of arguments to gethostbyname_r,
|
||||
acx_which_gethostbyname_r, [
|
||||
AC_TRY_COMPILE([
|
||||
# include <netdb.h>
|
||||
], [
|
||||
|
||||
char *name;
|
||||
struct hostent *he;
|
||||
struct hostent_data data;
|
||||
(void) gethostbyname_r(name, he, &data);
|
||||
|
||||
],acx_which_gethostbyname_r=3,
|
||||
[
|
||||
dnl acx_which_gethostbyname_r=0
|
||||
AC_TRY_COMPILE([
|
||||
# include <netdb.h>
|
||||
], [
|
||||
char *name;
|
||||
struct hostent *he, *res;
|
||||
char *buffer = NULL;
|
||||
int buflen = 2048;
|
||||
int h_errnop;
|
||||
(void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
|
||||
],acx_which_gethostbyname_r=6,
|
||||
|
||||
[
|
||||
dnl acx_which_gethostbyname_r=0
|
||||
AC_TRY_COMPILE([
|
||||
# include <netdb.h>
|
||||
], [
|
||||
char *name;
|
||||
struct hostent *he;
|
||||
char *buffer = NULL;
|
||||
int buflen = 2048;
|
||||
int h_errnop;
|
||||
(void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
|
||||
],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0)
|
||||
|
||||
]
|
||||
|
||||
)
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
if test $acx_which_gethostbyname_r -gt 0 ; then
|
||||
AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r,
|
||||
[Number of parameters to gethostbyname_r or 0 if not available])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION)
|
||||
AC_DEFUN([ACX_HELP_STRING],
|
||||
[ $1 builtin([substr],[ ],len($1))[$2]])
|
||||
|
||||
|
||||
dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE])
|
||||
AC_DEFUN([ACX_FEATURE],
|
||||
[echo "builtin([substr],[ ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"])
|
||||
|
559
check_oracle_health/src/check_oracle_health-1.6.9/aclocal.m4
vendored
Normal file
559
check_oracle_health/src/check_oracle_health-1.6.9/aclocal.m4
vendored
Normal file
@ -0,0 +1,559 @@
|
||||
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.9.6])])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 12
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.58])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
||||
#
|
||||
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
||||
# created by `make install' are always world readable, even if the
|
||||
# installer happens to have an overly restrictive umask (e.g. 077).
|
||||
# This was a mistake. There are at least two reasons why we must not
|
||||
# use `-m 0755':
|
||||
# - it causes special bits like SGID to be ignored,
|
||||
# - it may be too restrictive (some setups expect 775 directories).
|
||||
#
|
||||
# Do not use -m 0755 and let people choose whatever they expect by
|
||||
# setting umask.
|
||||
#
|
||||
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
||||
# Some implementations (such as Solaris 8's) are not thread-safe: if a
|
||||
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
||||
# concurrently, both version can detect that a/ is missing, but only
|
||||
# one can create it and the other will error out. Consequently we
|
||||
# restrict ourselves to GNU make (using the --version option ensures
|
||||
# this.)
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# We used to keeping the `.' as first argument, in order to
|
||||
# allow $(mkdir_p) to be used without argument. As in
|
||||
# $(mkdir_p) $(somedir)
|
||||
# where $(somedir) is conditionally defined. However this is wrong
|
||||
# for two reasons:
|
||||
# 1. if the package is installed by a user who cannot write `.'
|
||||
# make install will fail,
|
||||
# 2. the above comment should most certainly read
|
||||
# $(mkdir_p) $(DESTDIR)$(somedir)
|
||||
# so it does not work when $(somedir) is undefined and
|
||||
# $(DESTDIR) is not.
|
||||
# To support the latter case, we have to write
|
||||
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
|
||||
# so the `.' trick is pointless.
|
||||
mkdir_p='mkdir -p --'
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
for d in ./-p ./--version;
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
||||
if test -f "$ac_aux_dir/mkinstalldirs"; then
|
||||
mkdir_p='$(mkinstalldirs)'
|
||||
else
|
||||
mkdir_p='$(install_sh) -d'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([mkdir_p])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_RUN_LOG(COMMAND)
|
||||
# -------------------
|
||||
# Run COMMAND, save the exit status in ac_status, and log it.
|
||||
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
|
||||
AC_DEFUN([AM_RUN_LOG],
|
||||
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
|
||||
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
|
||||
(exit $ac_status); }])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([acinclude.m4])
|
1432
check_oracle_health/src/check_oracle_health-1.6.9/config.guess
vendored
Executable file
1432
check_oracle_health/src/check_oracle_health-1.6.9/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1534
check_oracle_health/src/check_oracle_health-1.6.9/config.sub
vendored
Executable file
1534
check_oracle_health/src/check_oracle_health-1.6.9/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
3296
check_oracle_health/src/check_oracle_health-1.6.9/configure
vendored
Executable file
3296
check_oracle_health/src/check_oracle_health-1.6.9/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
101
check_oracle_health/src/check_oracle_health-1.6.9/configure.in
Normal file
101
check_oracle_health/src/check_oracle_health-1.6.9/configure.in
Normal file
@ -0,0 +1,101 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION ($Revision: 1.150 $)
|
||||
AC_PREREQ(2.58)
|
||||
AC_INIT(check_oracle_health,1.6.9)
|
||||
AM_INIT_AUTOMAKE([1.9 tar-pax])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
RELEASE=1
|
||||
AC_SUBST(RELEASE)
|
||||
|
||||
AC_PREFIX_DEFAULT(/usr/local/nagios)
|
||||
|
||||
dnl Figure out how to invoke "install" and what install options to use.
|
||||
AC_PROG_INSTALL
|
||||
AC_SUBST(INSTALL)
|
||||
|
||||
dnl AC_PROG_CC
|
||||
dnl AC_PROG_CPP
|
||||
dnl AC_PROG_GCC_TRADITIONAL
|
||||
dnl AC_PROG_RANLIB
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
WARRANTY="This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
|
||||
AC_SUBST(WARRANTY)
|
||||
|
||||
SUPPORT="Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
|
||||
AC_SUBST(SUPPORT)
|
||||
|
||||
AC_ARG_WITH(nagios_user,
|
||||
ACX_HELP_STRING([--with-nagios-user=USER],
|
||||
[set user name to run nagios]),
|
||||
with_nagios_user=$withval,
|
||||
with_nagios_user=nagios)
|
||||
AC_ARG_WITH(nagios_group,
|
||||
ACX_HELP_STRING([--with-nagios-group=GROUP],
|
||||
[set group name to run nagios]),
|
||||
with_nagios_group=$withval,
|
||||
with_nagios_group=nagios)
|
||||
AC_SUBST(with_nagios_user)
|
||||
AC_SUBST(with_nagios_group)
|
||||
INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
|
||||
AC_SUBST(INSTALL_OPTS)
|
||||
|
||||
AC_ARG_WITH(statefiles_dir,
|
||||
ACX_HELP_STRING([--with-statefiles-dir=PATH],
|
||||
[sets directory for the state files (default=/var/tmp/check_oracle_health)]),
|
||||
with_statefiles_dir=$withval,
|
||||
with_statefiles_dir=/var/tmp/check_oracle_health)
|
||||
AC_SUBST(STATEFILES_DIR, $with_statefiles_dir)
|
||||
echo variable with_statefiles_dir is $with_statefiles_dir
|
||||
|
||||
AC_ARG_WITH(mymodules_dir,
|
||||
ACX_HELP_STRING([--with-mymodules-dir=PATH],
|
||||
[sets directory for own extensions which will be included during the build process (default=/usr/local/nagios/libexec)]),
|
||||
with_mymodules_dir=$withval,
|
||||
with_mymodules_dir=/usr/local/nagios/libexec)
|
||||
AC_SUBST(MYMODULES_DIR, $with_mymodules_dir)
|
||||
echo variable with_mymodules_dir is $with_mymodules_dir
|
||||
|
||||
AC_ARG_WITH(mymodules_dyn_dir,
|
||||
ACX_HELP_STRING([--with-mymodules-dyn-dir=PATH],
|
||||
[sets directory for own extensions which will be included at runtime (default=/usr/local/nagios/libexec)]),
|
||||
with_mymodules_dyn_dir=$withval,
|
||||
with_mymodules_dyn_dir=/usr/local/nagios/libexec)
|
||||
AC_SUBST(MYMODULES_DYN_DIR, $with_mymodules_dyn_dir)
|
||||
echo variable with_mymodules_dyn_dir is $with_mymodules_dyn_dir
|
||||
|
||||
EXTRAS=
|
||||
dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PATH_PROG(SH,sh)
|
||||
AC_PATH_PROG(PERL,perl)
|
||||
AC_PATH_PROG(GZIP,gzip)
|
||||
AC_PATH_PROGS(AWK,gawk nawk /usr/xpg4/bin/awk awk)
|
||||
AC_PATH_PROG(GREP,grep)
|
||||
AC_PATH_PROG(ECHO,echo)
|
||||
AC_PATH_PROG(SED,sed)
|
||||
AC_PATH_PROG(CAT,cat)
|
||||
|
||||
dnl allow them to override the path of perl
|
||||
AC_ARG_WITH(perl,
|
||||
ACX_HELP_STRING([--with-perl=PATH],
|
||||
[sets path to perl executable]),
|
||||
with_perl=$withval,with_perl=$PERL)
|
||||
AC_SUBST(PERL, $with_perl)
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
plugins-scripts/Makefile
|
||||
plugins-scripts/subst
|
||||
t/Makefile
|
||||
)
|
||||
|
||||
ACX_FEATURE([with],[perl])
|
||||
ACX_FEATURE([with],[statefiles-dir])
|
||||
ACX_FEATURE([with],[nagios-user])
|
||||
ACX_FEATURE([with],[nagios-group])
|
||||
ACX_FEATURE([with],[mymodules-dir])
|
||||
ACX_FEATURE([with],[mymodules-dyn-dir])
|
@ -0,0 +1,68 @@
|
||||
package MyQueue;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server);
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->{running} = 0;
|
||||
$self->{waiting} = 0;
|
||||
$self->{held} = 20;
|
||||
$self->{cancelled} = 0;
|
||||
$self->{length} = 100;
|
||||
if ($params{mode} =~ /my::queue::status/) {
|
||||
($self->{running}, $self->{waiting}, $self->{held}, $self->{cancelled}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM queues WHERE
|
||||
status IN ('running', 'waiting', 'held', 'cancelled')
|
||||
GROUP BY status
|
||||
});
|
||||
} elsif ($params{mode} =~ /my::queue::length/) {
|
||||
$self->{length} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM queues
|
||||
});
|
||||
} elsif ($params{mode} =~ /my::queue::througput/) {
|
||||
$self->{processed_items} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT processed FROM queue_status
|
||||
});
|
||||
$self->valdiff(\%params, qw(processed_items));
|
||||
# this automatically creates
|
||||
# $self->{delta_timestamp}
|
||||
# the time in seconds since the last run of check_oracle_health
|
||||
# $self->{delta_processed_items}
|
||||
# the difference between processed_items now and
|
||||
# processed_items when check_oracle_health was run last time
|
||||
$self->{throughput} = $self->{delta_processed_items} / $self->{delta_timestamp};
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /my::queue::status/) {
|
||||
if ($self->{held} > 10 || $self->{cancelled} > 10) {
|
||||
$self->add_nagios_critical("more than 10 queues are held or cancelled");
|
||||
} elsif ($self->{waiting} > 20 && $self->{running} < 3) {
|
||||
$self->add_nagios_warning("more than 20 queues are waiting and less than 3 queues are running");
|
||||
} else {
|
||||
$self->add_nagios_ok("queues are running normal");
|
||||
}
|
||||
$self->add_perfdata(sprintf "held=%d cancelled=%d waiting=%d running=%d",
|
||||
$self->{running}, $self->{waiting}, $self->{held}, $self->{cancelled});
|
||||
} elsif ($params{mode} =~ /my::queue::length/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{length}, 100, 500),
|
||||
sprintf "queue length is %d", $self->{length});
|
||||
$self->add_perfdata(sprintf "queuelen=%d;%d;%d",
|
||||
$self->{length}, $self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /my::queue::througput/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{throughput}, "50:", "10:"),
|
||||
sprintf "queue throughput is %d", $self->{throughput});
|
||||
$self->add_perfdata(sprintf "throughput=%.2f;%d;%d",
|
||||
$self->{throughput}, $self->{warningrange}, $self->{criticalrange});
|
||||
} else {
|
||||
$self->add_nagios_unknown("unknown mode");
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
# you will find instructions how to write extensions here
|
||||
|
||||
Self-written code is addressed by using a mode which starts with my-
|
||||
--mode=my-thing-does ?
|
||||
|
||||
check_oracle_health will then look for a package named MyThing.
|
||||
|
||||
So you first have to write a Module which describes MyThing. Such a thing iinherits from DBD::Oracle::Server and needs two methods: init and nagios.
|
||||
|
||||
Start with a file called CheckOracleHealthExt1.pm and skeleton code:
|
||||
|
||||
###################################################
|
||||
package MyThing;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server);
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
}
|
||||
###################################################
|
||||
|
||||
When you call check_oracle_health with --mode=my-thing-does, it will
|
||||
- create a DBD::Oracle::Server object
|
||||
$obj = DBD::Oracle::Server->new()
|
||||
- connect to the database
|
||||
$obj->connect()
|
||||
- re-bless the object
|
||||
bless $obj, "MyThing"
|
||||
- call $obj->init()
|
||||
- if that was ok, call $obj->nagios()
|
||||
|
||||
|
||||
So you need to write code which
|
||||
- initializes the parameters you want to check
|
||||
- calculates the nagios result from these parameters
|
||||
|
||||
For your convenience there are some predefined methods and variables:
|
||||
|
||||
Variable $self
|
||||
$self is a hash-based object of type My::Thing
|
||||
You can pass metrics from the init() method to the nagios() method by
|
||||
adding attributes to the hash.
|
||||
One important predefined attribute is $self->{handle} which points to
|
||||
a database Connection object. You surely will use this.
|
||||
|
||||
Variable %params
|
||||
$params{mode} contains the string you passed to the
|
||||
--mode command line parameter, only with the "-" replaced by "::".
|
||||
In the above example it will be "my::thing::does".
|
||||
Because you can have only one init() method for your MyThing object but
|
||||
more than one related modes (my-thing-does, my-thing-length, my-thing-rate)
|
||||
you use $params{mode} for branching in your code. (see the example file)
|
||||
|
||||
Method add_nagios
|
||||
$self->add_nagios(1, "i warn you");
|
||||
This method can be called several times. The messages will be concatenated.
|
||||
The first parameter is one of 0..3 and sets the nagios level. The worst level
|
||||
among several calls to add_nagios will determine the plugin's exit code.
|
||||
|
||||
Method add_nagios_[ok|warning|critical|unknown]
|
||||
$self->add_nagios_critical("i warned you!!! now it's too late");
|
||||
$self->add_nagios_ok("everything is ok. i am the exit message");
|
||||
These methods are wrappers for add_nagios which make your code more readable.
|
||||
|
||||
Method add_perfdata
|
||||
$self->add_perfdata("metric1=0 metric2=100");
|
||||
$self->add_perfdata("metric3=0);
|
||||
$self->add_perfdata(sprintf "metric_xy=%d", $self->{xy});
|
||||
You can call add_perfdata as often as you like.
|
||||
The strings will be concatenated.
|
||||
|
||||
Method valdiff
|
||||
$self->valdiff(\%params, qw(metric1 metric2));
|
||||
Use this if you want to know how a metric has changed since the last run
|
||||
of check_oracle_health.
|
||||
Provided you have attributes metric1 and metric2 this method will create
|
||||
new attributes for your $self object.
|
||||
$self->{delta_metric1} which is the difference between the value of
|
||||
$self->{metric1} during the current run and $self->{metric1} during the
|
||||
last run.
|
||||
$self->{delta_timestamp} which is the number of seconds which passed
|
||||
since the last run of check_oracle_health.
|
||||
If you have ever-growing values, you can simply calculate the rate:
|
||||
$self->{metric1_per_second} = $self->{delta_metric1} / $self->{delta_timestamp}
|
||||
The valdiff method will automatically save the current value to a state file
|
||||
and read the past value from this file.
|
||||
If you used the --name parameter which appears as $params{name} in your code
|
||||
then you probably need to separate the saved values from each other. Otherwise
|
||||
name1 would read the same saved value as name2. They would overwrite the
|
||||
saved values. Use $params{differentiator} to use different state files.
|
||||
$params{differenciator} = lc $self->{name};
|
||||
$self->valdiff(\%params, qw(gets misses));
|
||||
|
||||
Method fetchrow_array
|
||||
my($column1, $column2) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT col1, col2 FROM table1 where col1 = 'val1'
|
||||
});
|
||||
$self->{connected_users} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM v$session WHERE type = 'USER'
|
||||
});
|
||||
This method is used like the Perl DBI method fetchrow_array.
|
||||
|
||||
|
||||
Method fetchall_array
|
||||
my @results = $self->{handle}->fetchall_array(q{
|
||||
SELECT col1, col2, col3 FROM table1
|
||||
});
|
||||
foreach (@results) {
|
||||
my($column1, $column2, $column3) = @{$_};
|
||||
...
|
||||
}
|
||||
This method is used like the Perl DBI method fetchall_array.
|
||||
|
||||
|
||||
|
||||
|
||||
Now you have written your first extension to check_oracle_health. Maybe you
|
||||
just modified the example file contrib/CheckOracleHealthExt1.pm
|
||||
There are two methods how to import your own code into check_oracle_health:
|
||||
|
||||
- the static method
|
||||
with ./configure --with-mymodules-dir=<dir> parameter you build a plugin which
|
||||
contains both my code and your code in a single file. When you call "make"
|
||||
every file in <dir> which matches CheckOracleHealthExt*.pm is appended
|
||||
to the final plugin check_oracle_health.
|
||||
|
||||
- the dynamic method
|
||||
with ./configure --with-mymodules-dyn-dir=<dir> you build a plugin which will
|
||||
search at runtime the <dir> for files matching CheckOracleHealthExt*.pm and
|
||||
import them. This way you can have different extensions on different hosts.
|
||||
You also can modify your extension without having to rebuild the plugin.
|
||||
On the other hand you have to distribute your extensions along with the plugin.
|
||||
|
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
#
|
||||
# Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# $Id: check_oracle_health_connection-time.php 523 2008-09-26 17:10:20Z pitchfork $
|
||||
#
|
||||
|
||||
foreach ($DS as $i) {
|
||||
if(preg_match('/^connection_time/', $NAME[$i])) {
|
||||
$ds_name[1] = "Connection Time";
|
||||
$opt[1] = "--vertical-label \"Connection Time\" --title \"Connection Time $hostname / $servicedesc\" ";
|
||||
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
|
||||
$def[1] .= "AREA:var1#F2F2F2:\"\" " ;
|
||||
$def[1] .= "LINE1:var1#F30000:\"Connection Time\" " ;
|
||||
$def[1] .= "GPRINT:var1:LAST:\"%3.2lf LAST \" ";
|
||||
$def[1] .= "GPRINT:var1:MAX:\"%3.2lf MAX \" ";
|
||||
$def[1] .= "GPRINT:var1:AVERAGE:\"%3.2lf AVERAGE \" ";
|
||||
}
|
||||
if(preg_match('/^tbs_.*_usage_pct/', $NAME[$i])) {
|
||||
# if exists array tbss && > 0 -> next
|
||||
if(isset($tbss)) continue;
|
||||
# hash bauen mit tablespace als key
|
||||
$tbss = array();
|
||||
$dsnr = array();
|
||||
$units = array();
|
||||
foreach ($DS as $t) {
|
||||
if(preg_match('/^tbs_(.*)_usage_pct/', $NAME[$t], $match)) {
|
||||
$tbss[] = $match[1];
|
||||
}
|
||||
$dsnr[] = $DS[$t];
|
||||
$units[] = $UNIT[$t];
|
||||
$warn[] = $WARN[$t];
|
||||
$crit[] = $CRIT[$t];
|
||||
}
|
||||
foreach ($tbss as $key => $tbs) {
|
||||
$ds_usage_pct = $dsnr[$key * 3];
|
||||
$ds_used = $dsnr[$key * 3 + 1];
|
||||
$ds_alloc = $dsnr[$key * 3 + 2];
|
||||
$unit_usage_pct = $units[$key * 3];
|
||||
$unit_used = $units[$key * 3 + 1];
|
||||
$unit_alloc = $units[$key * 3 + 2];
|
||||
#$warn_usage_pct = $warn[$key * 3];
|
||||
#$warn_used = $warn[$key * 3 + 1];
|
||||
#$warn_alloc = $warn[$key * 3 + 2];
|
||||
#$crit_usage_pct = $crit[$key * 3];
|
||||
#$crit_used = $crit[$key * 3 + 1];
|
||||
#$crit_alloc = $crit[$key * 3 + 2];
|
||||
$graph1 = $key * 2 + 1;
|
||||
$graph2 = $key * 2 + 2;
|
||||
$opt[$graph1] = "--vertical-label \"TBS usage %\" -u102 -l0 --title \"Tablespace $tbs usage $servicedesc\" ";
|
||||
$ds_name[$graph1] = "TBS usage %";
|
||||
$def[$graph1] = "DEF:var1=$rrdfile:".$ds_usage_pct.":AVERAGE " ;
|
||||
$def[$graph1] .= "AREA:var1#F2F2F2:\"\" " ;
|
||||
$def[$graph1] .= "LINE1:var1#FF6600:\"used %\" " ;
|
||||
$def[$graph1] .= "GPRINT:var1:LAST:\"%3.2lf %% LAST \" ";
|
||||
$def[$graph1] .= "GPRINT:var1:MAX:\"%3.2lf %% MAX \" ";
|
||||
$def[$graph1] .= "GPRINT:var1:AVERAGE:\"%3.2lf %% AVERAGE \" ";
|
||||
if ($warn_usage_pct != "") {
|
||||
$def[$graph1] .= "HRULE:$warn_usage_pct#FFFF00 ";
|
||||
}
|
||||
if ($crit_usage_pct != "") {
|
||||
$def[$graph1] .= "HRULE:$crit_usage_pct#FF0000 ";
|
||||
}
|
||||
$opt[$graph2] = " -X 0 --vertical-label \"TBS usage $unit_used\" --title \"Tablespace $tbs usage $servicedesc\" ";
|
||||
$ds_name[$graph2] = "TBS usage ".$unit_used;
|
||||
$def[$graph2] = "DEF:var1=$rrdfile:$ds_used:AVERAGE " ;
|
||||
$def[$graph2] .= "DEF:var2=$rrdfile:$ds_alloc:AVERAGE " ;
|
||||
$def[$graph2] .= "AREA:var2#F2F2F2:\"\" " ;
|
||||
$def[$graph2] .= "AREA:var1#C3C3C3:\"\" " ;
|
||||
$def[$graph2] .= "LINE1:var2#F30000:\"alloc ".$unit_alloc."\" " ;
|
||||
$def[$graph2] .= "GPRINT:var2:LAST:\"%6.2lf ".$unit_alloc." LAST \" ";
|
||||
$def[$graph2] .= "GPRINT:var2:MAX:\"%6.2lf ".$unit_alloc." MAX \" ";
|
||||
$def[$graph2] .= "GPRINT:var2:AVERAGE:\"%6.2lf ".$unit_alloc." AVERAGE \\n\" ";
|
||||
$def[$graph2] .= "LINE1:var1#FF6600:\"used ".$unit_used."\" " ;
|
||||
$def[$graph2] .= "GPRINT:var1:LAST:\"%6.2lf ".$unit_used." LAST \" ";
|
||||
$def[$graph2] .= "GPRINT:var1:MAX:\"%6.2lf ".$unit_used." MAX \" ";
|
||||
$def[$graph2] .= "GPRINT:var1:AVERAGE:\"%6.2lf ".$unit_used." AVERAGE \\n\" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# <?php
|
||||
# #
|
||||
# # Copyright (c) 2006-2008 Joerg Linge (http://www.pnp4nagios.org)
|
||||
# # Default Template used if no other template is found.
|
||||
# # Don`t delete this file !
|
||||
# # $Id: default.php 367 2008-01-23 18:10:31Z pitchfork $
|
||||
# #
|
||||
# #
|
||||
# # Define some colors ..
|
||||
# #
|
||||
# define("_WARNRULE", '#FFFF00');
|
||||
# define("_CRITRULE", '#FF0000');
|
||||
# define("_AREA", '#EACC00');
|
||||
# define("_LINE", '#000000');
|
||||
# #
|
||||
# # Inital Logic ...
|
||||
# #
|
||||
#
|
||||
# foreach ($DS as $i) {
|
||||
#
|
||||
# $warning = "";
|
||||
# $minimum = "";
|
||||
# $critical = "";
|
||||
# $warning = "";
|
||||
# $vlabel = "";
|
||||
#
|
||||
# if ($WARN[$i] != "") {
|
||||
# $warning = $WARN[$i];
|
||||
# }
|
||||
# if ($CRIT[$i] != "") {
|
||||
# $critical = $CRIT[$i];
|
||||
# }
|
||||
# if ($MIN[$i] != "") {
|
||||
# $lower = " --lower=" . $MIN[$i];
|
||||
# $minimum = $MIN[$i];
|
||||
# }
|
||||
# if ($CRIT[$i] != "") {
|
||||
# $upper = " --upper=" . $MAX[$i];
|
||||
# $maximum = $MAX[$i];
|
||||
# }
|
||||
# if ($UNIT[$i] == "%%") {
|
||||
# $vlabel = "%";
|
||||
# }
|
||||
# else {
|
||||
# $vlabel = $UNIT[$i];
|
||||
# }
|
||||
#
|
||||
# $opt[$i] = '--vertical-label "' . $vlabel . '" --title "' . $hostname . ' / ' . $servicedesc . '"' . $lower;
|
||||
#
|
||||
# $def[$i] = "DEF:var1=$rrdfile:$DS[$i]:AVERAGE ";
|
||||
# $def[$i] .= "AREA:var1" . _AREA . ":\"$NAME[$i] \" ";
|
||||
# $def[$i] .= "LINE1:var1" . _LINE . ":\"\" ";
|
||||
# $def[$i] .= "GPRINT:var1:LAST:\"%3.4lf %s$UNIT[$i] LAST \" ";
|
||||
# $def[$i] .= "GPRINT:var1:MAX:\"%3.4lf %s$UNIT[$i] MAX \" ";
|
||||
# $def[$i] .= "GPRINT:var1:AVERAGE:\"%3.4lf %s$UNIT[$i] AVERAGE \\n\" ";
|
||||
# if ($warning != "") {
|
||||
# $def[$i] .= "HRULE:" . $warning . _WARNRULE . ':"Warning on ' . $warning . '\n" ';
|
||||
# }
|
||||
# if ($critical != "") {
|
||||
# $def[$i] .= "HRULE:" . $critical . _CRITRULE . ':"Critical on ' . $critical . '\n" ';
|
||||
# }
|
||||
# $def[$i] .= 'COMMENT:"Default Template\r" ';
|
||||
# $def[$i] .= 'COMMENT:"Check Command ' . $TEMPLATE[$i] . '\r" ';
|
||||
# }
|
||||
# ?>
|
||||
|
||||
?>
|
295
check_oracle_health/src/check_oracle_health-1.6.9/install-sh
Executable file
295
check_oracle_health/src/check_oracle_health-1.6.9/install-sh
Executable file
@ -0,0 +1,295 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2003-09-24.23
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=
|
||||
transform_arg=
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
|
||||
usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
|
||||
or: $0 -d DIR1 DIR2...
|
||||
|
||||
In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
|
||||
In the second, create the directory path DIR.
|
||||
|
||||
Options:
|
||||
-b=TRANSFORMBASENAME
|
||||
-c copy source (using $cpprog) instead of moving (using $mvprog).
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrp installed files to GROUP.
|
||||
-m MODE $chmod installed files to MODE.
|
||||
-o USER $chown installed files to USER.
|
||||
-s strip installed files (using $stripprog).
|
||||
-t=TRANSFORM
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c) instcmd=$cpprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit 0;;
|
||||
|
||||
*) if test -z "$src"; then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$src"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
|
||||
if test -d "$dst"; then
|
||||
instcmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=
|
||||
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
test -d "$pathcomp" || $mkdirprog "$pathcomp"
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
$doit $instcmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
else
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
if test -z "$transformarg"; then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
dstfile=`basename "$dst" $transformbasename \
|
||||
| sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename.
|
||||
test -z "$dstfile" && dstfile=`basename "$dst"`
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
$doit $instcmd "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
# Now remove or move aside any old file at destination location. We
|
||||
# try this two ways since rm can't unlink itself on some systems and
|
||||
# the destination file might be busy for other reasons. In this case,
|
||||
# the final cleanup might fail but the new file should still install
|
||||
# successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
fi &&
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
360
check_oracle_health/src/check_oracle_health-1.6.9/missing
Executable file
360
check_oracle_health/src/check_oracle_health-1.6.9/missing
Executable file
@ -0,0 +1,360 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2003-09-02.23
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
@ -0,0 +1,66 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUFFIXES = .pl .pm .sh
|
||||
|
||||
VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t
|
||||
|
||||
libexec_SCRIPTS=check_oracle_health
|
||||
MY_MODULES=
|
||||
EXTRA_MODULES=\
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/DataBuffer.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/DictionaryCache.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/LibraryCache.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/RollbackSegments.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/RedoLogBuffer.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/Latch.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/PGA.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Event.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Enqueue.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Sysstat.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/FlashRecoveryArea.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace/Datafile.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace/Segment.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace.pm \
|
||||
Nagios/DBD/Oracle/Server/Database.pm \
|
||||
Nagios/DBD/Oracle/Server.pm \
|
||||
Nagios/Extraopts.pm
|
||||
EXTRA_DIST=check_oracle_health.pl $(EXTRA_MODULES)
|
||||
|
||||
CLEANFILES=$(libexec_SCRIPTS)
|
||||
|
||||
AM_INSTALL_PROGRAM_FLAGS=@INSTALL_OPTS@
|
||||
|
||||
.pm :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
.pl :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
.sh :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
$(libexec_SCRIPTS) : $(EXTRA_DIST)
|
||||
$(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@
|
||||
#since 1.5.1 $(ECHO) "# nagios: -epn" >> $@
|
||||
$(ECHO) >> $@
|
||||
$(ECHO) "my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );" >> $@
|
||||
$(ECHO) "my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );" >> $@
|
||||
for m in ${EXTRA_MODULES}; do \
|
||||
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
|
||||
done
|
||||
if [ -d "${MYMODULES_DIR}" ]; then \
|
||||
for m in ${MYMODULES_DIR}/CheckOracleHealthExt*.pm; do \
|
||||
if [ -f $$m ]; then \
|
||||
$(ECHO) found $$m; \
|
||||
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
|
||||
fi \
|
||||
done \
|
||||
fi
|
||||
$(CAT) check_oracle_health.pl | $(GREP) -v "^use Nagios" | $(GREP) -v "^my %ERROR" | $(AWK) -f ./subst >> $@
|
||||
chmod +x $@
|
@ -0,0 +1,373 @@
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = plugins-scripts
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/subst.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES = subst
|
||||
am__installdirs = "$(DESTDIR)$(libexecdir)"
|
||||
libexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
SCRIPTS = $(libexec_SCRIPTS)
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t
|
||||
INSTALL = @INSTALL@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CAT = @CAT@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
GREP = @GREP@
|
||||
GZIP = @GZIP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_OPTS = @INSTALL_OPTS@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MYMODULES_DIR = @MYMODULES_DIR@
|
||||
MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
RELEASE = @RELEASE@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
STATEFILES_DIR = @STATEFILES_DIR@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_nagios_group = @with_nagios_group@
|
||||
with_nagios_user = @with_nagios_user@
|
||||
SUFFIXES = .pl .pm .sh
|
||||
libexec_SCRIPTS = check_oracle_health
|
||||
MY_MODULES =
|
||||
EXTRA_MODULES = \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/DataBuffer.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/DictionaryCache.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/LibraryCache.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/RollbackSegments.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/RedoLogBuffer.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA/Latch.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/SGA.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/PGA.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Event.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Enqueue.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance/Sysstat.pm \
|
||||
Nagios/DBD/Oracle/Server/Instance.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/FlashRecoveryArea.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace/Datafile.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace/Segment.pm \
|
||||
Nagios/DBD/Oracle/Server/Database/Tablespace.pm \
|
||||
Nagios/DBD/Oracle/Server/Database.pm \
|
||||
Nagios/DBD/Oracle/Server.pm \
|
||||
Nagios/Extraopts.pm
|
||||
|
||||
EXTRA_DIST = check_oracle_health.pl $(EXTRA_MODULES)
|
||||
CLEANFILES = $(libexec_SCRIPTS)
|
||||
AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .pl .pm .sh
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins-scripts/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu plugins-scripts/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
subst: $(top_builddir)/config.status $(srcdir)/subst.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
install-libexecSCRIPTS: $(libexec_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)"
|
||||
@list='$(libexec_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f $$d$$p; then \
|
||||
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
|
||||
echo " $(libexecSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \
|
||||
$(libexecSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(libexecdir)/$$f"; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libexecSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(libexec_SCRIPTS)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
|
||||
echo " rm -f '$(DESTDIR)$(libexecdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(libexecdir)/$$f"; \
|
||||
done
|
||||
uninstall-info-am:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(mkdir_p) $(distdir)/Nagios $(distdir)/Nagios/DBD/Oracle $(distdir)/Nagios/DBD/Oracle/Server $(distdir)/Nagios/DBD/Oracle/Server/Database $(distdir)/Nagios/DBD/Oracle/Server/Database/Tablespace $(distdir)/Nagios/DBD/Oracle/Server/Instance $(distdir)/Nagios/DBD/Oracle/Server/Instance/SGA $(distdir)/Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libexecdir)"; do \
|
||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-libexecSCRIPTS
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-libexecSCRIPTS
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am \
|
||||
install-libexecSCRIPTS install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-libexecSCRIPTS
|
||||
|
||||
|
||||
.pm :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
.pl :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
.sh :
|
||||
$(AWK) -f ./subst $< > $@
|
||||
chmod +x $@
|
||||
|
||||
$(libexec_SCRIPTS) : $(EXTRA_DIST)
|
||||
$(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@
|
||||
#since 1.5.1 $(ECHO) "# nagios: -epn" >> $@
|
||||
$(ECHO) >> $@
|
||||
$(ECHO) "my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );" >> $@
|
||||
$(ECHO) "my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );" >> $@
|
||||
for m in ${EXTRA_MODULES}; do \
|
||||
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
|
||||
done
|
||||
if [ -d "${MYMODULES_DIR}" ]; then \
|
||||
for m in ${MYMODULES_DIR}/CheckOracleHealthExt*.pm; do \
|
||||
if [ -f $$m ]; then \
|
||||
$(ECHO) found $$m; \
|
||||
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
|
||||
fi \
|
||||
done \
|
||||
fi
|
||||
$(CAT) check_oracle_health.pl | $(GREP) -v "^use Nagios" | $(GREP) -v "^my %ERROR" | $(AWK) -f ./subst >> $@
|
||||
chmod +x $@
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,250 @@
|
||||
package DBD::Oracle::Server::Database;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
invalidobjects => {
|
||||
invalid_objects => undef,
|
||||
invalid_indexes => undef,
|
||||
invalid_ind_partitions => undef,
|
||||
invalid_registry_components => undef,
|
||||
},
|
||||
staleobjects => undef,
|
||||
corruptedblocks => undef,
|
||||
tablespaces => [],
|
||||
num_datafiles => undef,
|
||||
num_datafiles_max => undef,
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::database::tablespace/) {
|
||||
DBD::Oracle::Server::Database::Tablespace::init_tablespaces(%params);
|
||||
if (my @tablespaces =
|
||||
DBD::Oracle::Server::Database::Tablespace::return_tablespaces()) {
|
||||
$self->{tablespaces} = \@tablespaces;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire tablespace info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::flash_recovery_area/) {
|
||||
DBD::Oracle::Server::Database::FlashRecoveryArea::init_flash_recovery_areas(%params);
|
||||
if (my @flash_recovery_areas =
|
||||
DBD::Oracle::Server::Database::FlashRecoveryArea::return_flash_recovery_areas()) {
|
||||
$self->{flash_recovery_areas} = \@flash_recovery_areas;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire flash recovery area info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::invalidobjects/) {
|
||||
$self->init_invalid_objects(%params);
|
||||
} elsif ($params{mode} =~ /server::database::stalestats/) {
|
||||
$self->init_stale_objects(%params);
|
||||
} elsif ($params{mode} =~ /server::database::blockcorruption/) {
|
||||
$self->init_corrupted_blocks(%params);
|
||||
} elsif ($params{mode} =~ /server::database::datafilesexisting/) {
|
||||
$self->{num_datafiles_max} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT value FROM v$system_parameter WHERE name = 'db_files'
|
||||
});
|
||||
$self->{num_datafiles} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM sys.dba_data_files
|
||||
});
|
||||
if (! defined $self->{num_datafiles_max} ||
|
||||
! defined $self->{num_datafiles}) {
|
||||
$self->add_nagios_critical("unable to get number of datafiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub init_invalid_objects {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
my $invalid_objects = undef;
|
||||
my $invalid_indexes = undef;
|
||||
my $invalid_ind_partitions = undef;
|
||||
my $unrecoverable_datafiles = undef;
|
||||
$self->{invalidobjects}->{invalid_objects} =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*)
|
||||
FROM dba_objects
|
||||
WHERE status = 'INVALID' AND object_name NOT LIKE 'BIN$%'
|
||||
});
|
||||
# should be only N/A or VALID
|
||||
$self->{invalidobjects}->{invalid_indexes} =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(DISTINCT STATUS)
|
||||
FROM dba_indexes
|
||||
WHERE status <> 'VALID' AND status <> 'N/A'
|
||||
});
|
||||
# should be only USABLE
|
||||
$self->{invalidobjects}->{invalid_ind_partitions} =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(DISTINCT STATUS)
|
||||
FROM dba_ind_partitions
|
||||
WHERE status <> 'USABLE'
|
||||
});
|
||||
# should be only VALID
|
||||
$self->{invalidobjects}->{invalid_registry_components} =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(DISTINCT STATUS)
|
||||
FROM dba_registry
|
||||
WHERE status <> 'VALID'
|
||||
});
|
||||
if (! defined $self->{invalidobjects}->{invalid_objects} ||
|
||||
! defined $self->{invalidobjects}->{invalid_indexes} ||
|
||||
! defined $self->{invalidobjects}->{invalid_registry_components} ||
|
||||
! defined $self->{invalidobjects}->{invalid_ind_partitions}) {
|
||||
$self->add_nagios_critical("unable to get invalid objects");
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_stale_objects {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if ($self->version_is_minimum("10.x")) {
|
||||
$self->{staleobjects} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM sys.dba_tab_statistics WHERE stale_stats = 'YES'
|
||||
});
|
||||
} else {
|
||||
# oracle9 + sqlplus nix gut
|
||||
$self->{handle}->func( 10000, 'dbms_output_enable' );
|
||||
$self->{handle}->execute(q{
|
||||
DECLARE
|
||||
l_objList dbms_stats.objectTab;
|
||||
BEGIN
|
||||
DBMS_OUTPUT.ENABLE (1000000);
|
||||
dbms_stats.gather_database_stats(
|
||||
options => 'LIST STALE',
|
||||
objlist => l_objList );
|
||||
dbms_output.put_line( l_objList.COUNT);
|
||||
-- FOR i IN 1 .. l_objList.COUNT
|
||||
-- LOOP
|
||||
-- dbms_output.put_line( l_objList(i).objType );
|
||||
-- dbms_output.put_line( l_objList(i).objName );
|
||||
-- END LOOP;
|
||||
END;
|
||||
});
|
||||
$self->{staleobjects} = $self->{handle}->func( 'dbms_output_get' );
|
||||
}
|
||||
if (! defined $self->{staleobjects}) {
|
||||
$self->add_nagios_critical("unable to get stale objects");
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_corrupted_blocks {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->{corruptedblocks} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM v$database_block_corruption
|
||||
});
|
||||
if (! defined $self->{corruptedblocks}) {
|
||||
$self->add_nagios_critical("unable to get corrupted blocks");
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::database::tablespace::listtablespaces/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{tablespaces}}) {
|
||||
printf "%s\n", $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::database::tablespace/) {
|
||||
foreach (@{$self->{tablespaces}}) {
|
||||
# sind hier noch nach pctused sortiert
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::listflash_recovery_areas/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{flash_recovery_areas}}) {
|
||||
printf "%s\n", $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::database::flash_recovery_area/) {
|
||||
foreach (@{$self->{flash_recovery_areas}}) {
|
||||
# sind hier noch nach pctused sortiert
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::invalidobjects/) {
|
||||
my @message = ();
|
||||
push(@message, sprintf "%d invalid objects",
|
||||
$self->{invalidobjects}->{invalid_objects}) if
|
||||
$self->{invalidobjects}->{invalid_objects};
|
||||
push(@message, sprintf "%d invalid indexes",
|
||||
$self->{invalidobjects}->{invalid_indexes}) if
|
||||
$self->{invalidobjects}->{invalid_indexes};
|
||||
push(@message, sprintf "%d invalid index partitions",
|
||||
$self->{invalidobjects}->{invalid_ind_partitions}) if
|
||||
$self->{invalidobjects}->{invalid_ind_partitions};
|
||||
push(@message, sprintf "%d invalid registry components",
|
||||
$self->{invalidobjects}->{invalid_registry_components}) if
|
||||
$self->{invalidobjects}->{invalid_registry_components};
|
||||
if (scalar(@message)) {
|
||||
$self->add_nagios($self->check_thresholds(
|
||||
$self->{invalidobjects}->{invalid_objects} +
|
||||
$self->{invalidobjects}->{invalid_indexes} +
|
||||
$self->{invalidobjects}->{invalid_registry_components} +
|
||||
$self->{invalidobjects}->{invalid_ind_partitions}, 0.1, 0.1),
|
||||
join(", ", @message));
|
||||
} else {
|
||||
$self->add_nagios_ok("no invalid objects found");
|
||||
}
|
||||
foreach (sort keys %{$self->{invalidobjects}}) {
|
||||
$self->add_perfdata(sprintf "%s=%d", $_, $self->{invalidobjects}->{$_});
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::stalestats/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{staleobjects}, "10", "100"),
|
||||
sprintf "%d objects with stale statistics", $self->{staleobjects});
|
||||
$self->add_perfdata(sprintf "stale_stats_objects=%d;%s;%s",
|
||||
$self->{staleobjects},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::database::blockcorruption/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{corruptedblocks}, "1", "10"),
|
||||
sprintf "%d database blocks are corrupted", $self->{corruptedblocks});
|
||||
$self->add_perfdata(sprintf "corrupted_blocks=%d;%s;%s",
|
||||
$self->{corruptedblocks},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::database::datafilesexisting/) {
|
||||
my $datafile_usage = $self->{num_datafiles} /
|
||||
$self->{num_datafiles_max} * 100;
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($datafile_usage, "80", "90"),
|
||||
sprintf "you have %.2f%% of max possible datafiles (%d of %d max)",
|
||||
$datafile_usage, $self->{num_datafiles}, $self->{num_datafiles_max});
|
||||
$self->add_perfdata(sprintf "datafiles_pct=%.2f%%;%s;%s",
|
||||
$datafile_usage,
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "datafiles_num=%d;%s;%s;0;%d",
|
||||
$self->{num_datafiles},
|
||||
$self->{num_datafiles_max} / 100 * $self->{warningrange},
|
||||
$self->{num_datafiles_max} / 100 * $self->{criticalrange},
|
||||
$self->{num_datafiles_max});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,192 @@
|
||||
package DBD::Oracle::Server::Database::FlashRecoveryArea;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Database);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @flash_recovery_areas = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_flash_recovery_area {
|
||||
push(@flash_recovery_areas, shift);
|
||||
}
|
||||
|
||||
sub return_flash_recovery_areas {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @flash_recovery_areas;
|
||||
}
|
||||
|
||||
sub init_flash_recovery_areas {
|
||||
# as far as i understand it, there is only one flra.
|
||||
# we use an array here anyway, because the tablespace code can be reused
|
||||
my %params = @_;
|
||||
my $num_flash_recovery_areas = 0;
|
||||
if (($params{mode} =~ /server::database::flash_recovery_area::usage/) ||
|
||||
($params{mode} =~ /server::database::flash_recovery_area::free/) ||
|
||||
($params{mode} =~ /server::database::flash_recovery_area::listflash_recovery_areas/)) {
|
||||
my @flash_recovery_arearesult = ();
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("10.x")) {
|
||||
@flash_recovery_arearesult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
name, space_limit, space_used, space_reclaimable, number_of_files
|
||||
FROM
|
||||
v$recovery_file_dest
|
||||
});
|
||||
} else {
|
||||
# no flash before 10.x
|
||||
}
|
||||
foreach (@flash_recovery_arearesult) {
|
||||
my ($name, $space_limit, $space_used, $space_reclaimable,
|
||||
$number_of_files) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{space_limit} = $space_limit;
|
||||
$thisparams{space_used} = $space_used;
|
||||
$thisparams{space_reclaimable} = $space_reclaimable;
|
||||
$thisparams{number_of_files} = lc $number_of_files;
|
||||
my $flash_recovery_area = DBD::Oracle::Server::Database::FlashRecoveryArea->new(
|
||||
%thisparams);
|
||||
add_flash_recovery_area($flash_recovery_area);
|
||||
$num_flash_recovery_areas++;
|
||||
}
|
||||
if (! $num_flash_recovery_areas) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
verbose => $params{verbose},
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
space_limit => $params{space_limit},
|
||||
space_used => $params{space_used},
|
||||
space_reclaimable => $params{space_reclaimable},
|
||||
number_of_files => $params{number_of_files},
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::database::flash_recovery_area::(usage|free)/) {
|
||||
$self->{percent_used} =
|
||||
($self->{space_used} - $self->{space_reclaimable}) / $self->{space_limit} * 100;
|
||||
$self->{percent_free} = 100 - $self->{percent_used};
|
||||
$self->{bytes_used} = $self->{space_used} - $self->{space_reclaimable};
|
||||
$self->{bytes_free} = $self->{space_limit} - $self->{space_used};
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::database::flash_recovery_area::usage/) {
|
||||
$self->check_thresholds($self->{percent_used}, "90", "98");
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{percent_used}, "90", "98"),
|
||||
sprintf("flra (%s) usage is %.2f%%",
|
||||
$self->{name}, $self->{percent_used}));
|
||||
$self->add_perfdata(sprintf "\'flra_usage_pct\'=%.2f%%;%d;%d",
|
||||
$self->{percent_used},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "\'flra_usage\'=%dMB;%d;%d;%d;%d",
|
||||
($self->{space_used} - $self->{space_reclaimable}) / 1048576,
|
||||
$self->{warningrange} * $self->{space_limit} / 100 / 1048576,
|
||||
$self->{criticalrange} * $self->{space_limit} / 100 / 1048576,
|
||||
0, $self->{space_limit} / 1048576);
|
||||
} elsif ($params{mode} =~ /server::database::flash_recovery_area::free/) {
|
||||
if (($self->{warningrange} && $self->{warningrange} !~ /^\d+:/) ||
|
||||
($self->{criticalrange} && $self->{criticalrange} !~ /^\d+:/)) {
|
||||
$self->add_nagios_unknown("you want an alert if free space is _above_ a threshold????");
|
||||
return;
|
||||
}
|
||||
if (! $params{units}) {
|
||||
$params{units} = "%";
|
||||
}
|
||||
$self->{warning_bytes} = 0;
|
||||
$self->{critical_bytes} = 0;
|
||||
if ($params{units} eq "%") {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{percent_free}, "5:", "2:"),
|
||||
sprintf("flra %s has %.2f%% free space left",
|
||||
$self->{name}, $self->{percent_free})
|
||||
);
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->add_perfdata(sprintf "\'flra_free_pct\'=%.2f%%;%d:;%d:",
|
||||
$self->{percent_free},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "\'flra_free\'=%dMB;%.2f:;%.2f:;0;%.2f",
|
||||
$self->{bytes_free} / 1048576,
|
||||
$self->{warningrange} * $self->{space_limit} / 100 / 1048576,
|
||||
$self->{criticalrange} * $self->{space_limit} / 100 / 1048576,
|
||||
$self->{space_limit} / 1048576);
|
||||
} else {
|
||||
my $factor = 1024 * 1024; # default MB
|
||||
if ($params{units} eq "GB") {
|
||||
$factor = 1024 * 1024 * 1024;
|
||||
} elsif ($params{units} eq "MB") {
|
||||
$factor = 1024 * 1024;
|
||||
} elsif ($params{units} eq "KB") {
|
||||
$factor = 1024;
|
||||
}
|
||||
$self->{warningrange} ||= "5:";
|
||||
$self->{criticalrange} ||= "2:";
|
||||
my $saved_warningrange = $self->{warningrange};
|
||||
my $saved_criticalrange = $self->{criticalrange};
|
||||
# : entfernen weil gerechnet werden muss
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->{warningrange} = $self->{warningrange} ?
|
||||
$self->{warningrange} * $factor : 5 * $factor;
|
||||
$self->{criticalrange} = $self->{criticalrange} ?
|
||||
$self->{criticalrange} * $factor : 2 * $factor;
|
||||
$self->{percent_warning} = 100 * $self->{warningrange} / $self->{space_limit};
|
||||
$self->{percent_critical} = 100 * $self->{criticalrange} / $self->{space_limit};
|
||||
$self->{warningrange} .= ':';
|
||||
$self->{criticalrange} .= ':';
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{bytes_free}, "5242880:", "1048576:"),
|
||||
sprintf("flra (%s) has %.2f%s free space left", $self->{name},
|
||||
$self->{bytes_free} / $factor, $params{units})
|
||||
);
|
||||
$self->{warningrange} = $saved_warningrange;
|
||||
$self->{criticalrange} = $saved_criticalrange;
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->add_perfdata(sprintf "\'flra_free_pct\'=%.2f%%;%.2f:;%.2f:",
|
||||
$self->{percent_free}, $self->{percent_warning},
|
||||
$self->{percent_critical});
|
||||
$self->add_perfdata(sprintf "\'flra_free\'=%.2f%s;%.2f:;%.2f:;0;%.2f",
|
||||
$self->{bytes_free} / $factor, $params{units},
|
||||
$self->{warningrange},
|
||||
$self->{criticalrange},
|
||||
$self->{space_limit} / $factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,833 @@
|
||||
package DBD::Oracle::Server::Database::Tablespace;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Database);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @tablespaces = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_tablespace {
|
||||
push(@tablespaces, shift);
|
||||
}
|
||||
|
||||
sub return_tablespaces {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @tablespaces;
|
||||
}
|
||||
|
||||
sub init_tablespaces {
|
||||
my %params = @_;
|
||||
my $num_tablespaces = 0;
|
||||
if (($params{mode} =~ /server::database::tablespace::usage/) ||
|
||||
($params{mode} =~ /server::database::tablespace::free/) ||
|
||||
($params{mode} =~ /server::database::tablespace::remainingfreetime/) ||
|
||||
($params{mode} =~ /server::database::tablespace::listtablespaces/)) {
|
||||
my @tablespaceresult = ();
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("9.x")) {
|
||||
@tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
a.tablespace_name "Tablespace",
|
||||
b.status "Status",
|
||||
b.contents "Type",
|
||||
b.extent_management "Extent Mgmt",
|
||||
a.bytes bytes,
|
||||
a.maxbytes bytes_max,
|
||||
c.bytes_free + NVL(d.bytes_expired,0) bytes_free
|
||||
FROM
|
||||
(
|
||||
-- belegter und maximal verfuegbarer platz pro datafile
|
||||
-- nach tablespacenamen zusammengefasst
|
||||
-- => bytes
|
||||
-- => maxbytes
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes,
|
||||
SUM(DECODE(a.autoextensible, 'YES', a.maxbytes, 'NO', a.bytes)) maxbytes
|
||||
FROM
|
||||
dba_data_files a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) a,
|
||||
sys.dba_tablespaces b,
|
||||
(
|
||||
-- freier platz pro tablespace
|
||||
-- => bytes_free
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes_free
|
||||
FROM
|
||||
dba_free_space a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) c,
|
||||
(
|
||||
-- freier platz durch expired extents
|
||||
-- speziell fuer undo tablespaces
|
||||
-- => bytes_expired
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes_expired
|
||||
FROM
|
||||
dba_undo_extents a
|
||||
WHERE
|
||||
status = 'EXPIRED'
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) d
|
||||
WHERE
|
||||
a.tablespace_name = c.tablespace_name (+)
|
||||
AND a.tablespace_name = b.tablespace_name
|
||||
AND a.tablespace_name = d.tablespace_name (+)
|
||||
UNION ALL
|
||||
SELECT
|
||||
d.tablespace_name "Tablespace",
|
||||
b.status "Status",
|
||||
b.contents "Type",
|
||||
b.extent_management "Extent Mgmt",
|
||||
sum(a.bytes_free + a.bytes_used) bytes, -- allocated
|
||||
SUM(DECODE(d.autoextensible, 'YES', d.maxbytes, 'NO', d.bytes)) bytes_max,
|
||||
SUM(a.bytes_free + a.bytes_used - NVL(c.bytes_used, 0)) bytes_free
|
||||
FROM
|
||||
sys.v_$TEMP_SPACE_HEADER a,
|
||||
sys.dba_tablespaces b,
|
||||
sys.v_$Temp_extent_pool c,
|
||||
dba_temp_files d
|
||||
WHERE
|
||||
c.file_id(+) = a.file_id
|
||||
and c.tablespace_name(+) = a.tablespace_name
|
||||
and d.file_id = a.file_id
|
||||
and d.tablespace_name = a.tablespace_name
|
||||
and b.tablespace_name = a.tablespace_name
|
||||
GROUP BY
|
||||
b.status,
|
||||
b.contents,
|
||||
b.extent_management,
|
||||
d.tablespace_name
|
||||
ORDER BY
|
||||
1
|
||||
});
|
||||
} elsif (DBD::Oracle::Server::return_first_server()->version_is_minimum("8.x")) {
|
||||
@tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
a.tablespace_name "Tablespace",
|
||||
b.status "Status",
|
||||
b.contents "Type",
|
||||
b.extent_management "Extent Mgmt",
|
||||
a.bytes bytes,
|
||||
a.maxbytes bytes_max,
|
||||
c.bytes_free bytes_free
|
||||
FROM
|
||||
(
|
||||
-- belegter und maximal verfuegbarer platz pro datafile
|
||||
-- nach tablespacenamen zusammengefasst
|
||||
-- => bytes
|
||||
-- => maxbytes
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes,
|
||||
SUM(DECODE(a.autoextensible, 'YES', a.maxbytes, 'NO', a.bytes)) maxbytes
|
||||
FROM
|
||||
dba_data_files a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) a,
|
||||
sys.dba_tablespaces b,
|
||||
(
|
||||
-- freier platz pro tablespace
|
||||
-- => bytes_free
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes_free
|
||||
FROM
|
||||
dba_free_space a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) c
|
||||
WHERE
|
||||
a.tablespace_name = c.tablespace_name (+)
|
||||
AND a.tablespace_name = b.tablespace_name
|
||||
UNION ALL
|
||||
SELECT
|
||||
a.tablespace_name "Tablespace",
|
||||
b.status "Status",
|
||||
b.contents "Type",
|
||||
b.extent_management "Extent Mgmt",
|
||||
sum(a.bytes_free + a.bytes_used) bytes, -- allocated
|
||||
d.maxbytes bytes_max,
|
||||
SUM(a.bytes_free + a.bytes_used - NVL(c.bytes_used, 0)) bytes_free
|
||||
FROM
|
||||
sys.v_$TEMP_SPACE_HEADER a,
|
||||
sys.dba_tablespaces b,
|
||||
sys.v_$Temp_extent_pool c,
|
||||
dba_temp_files d
|
||||
WHERE
|
||||
c.file_id(+) = a.file_id
|
||||
and c.tablespace_name(+) = a.tablespace_name
|
||||
and d.file_id = a.file_id
|
||||
and d.tablespace_name = a.tablespace_name
|
||||
and b.tablespace_name = a.tablespace_name
|
||||
GROUP BY
|
||||
a.tablespace_name,
|
||||
b.status,
|
||||
b.contents,
|
||||
b.extent_management,
|
||||
d.maxbytes
|
||||
ORDER BY
|
||||
1
|
||||
});
|
||||
} else {
|
||||
@tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
a.tablespace_name "Tablespace",
|
||||
b.status "Status",
|
||||
b.contents "Type",
|
||||
'DICTIONARY' "Extent Mgmt",
|
||||
a.bytes bytes,
|
||||
a.maxbytes bytes_max,
|
||||
c.bytes_free bytes_free
|
||||
FROM
|
||||
(
|
||||
-- belegter und maximal verfuegbarer platz pro datafile
|
||||
-- nach tablespacenamen zusammengefasst
|
||||
-- => bytes
|
||||
-- => maxbytes
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes,
|
||||
SUM(a.bytes) maxbytes
|
||||
FROM
|
||||
dba_data_files a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) a,
|
||||
sys.dba_tablespaces b,
|
||||
(
|
||||
-- freier platz pro tablespace
|
||||
-- => bytes_free
|
||||
SELECT
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes) bytes_free
|
||||
FROM
|
||||
dba_free_space a
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
) c
|
||||
WHERE
|
||||
a.tablespace_name = c.tablespace_name (+)
|
||||
AND a.tablespace_name = b.tablespace_name
|
||||
});
|
||||
}
|
||||
foreach (@tablespaceresult) {
|
||||
my ($name, $status, $type, $extentmgmt, $bytes, $bytes_max, $bytes_free) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
# host_filesys_pctAvailable
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{bytes} = $bytes;
|
||||
$thisparams{bytes_max} = $bytes_max;
|
||||
$thisparams{bytes_free} = $bytes_free;
|
||||
$thisparams{status} = lc $status;
|
||||
$thisparams{type} = lc $type;
|
||||
$thisparams{extent_management} = lc $extentmgmt;
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
$num_tablespaces++;
|
||||
}
|
||||
if (! $num_tablespaces) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::fragmentation/) {
|
||||
my @tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
tablespace_name,
|
||||
COUNT(*) free_chunks,
|
||||
DECODE(
|
||||
ROUND((max(bytes) / 1024000),2),
|
||||
NULL,0,
|
||||
ROUND((MAX(bytes) / 1024000),2)) largest_chunk,
|
||||
NVL(ROUND(SQRT(MAX(blocks)/SUM(blocks))*(100/SQRT(SQRT(COUNT(blocks)) )),2),
|
||||
0) fragmentation_index
|
||||
FROM
|
||||
sys.dba_free_space
|
||||
GROUP BY
|
||||
tablespace_name
|
||||
ORDER BY
|
||||
2 DESC, 1
|
||||
});
|
||||
foreach (@tablespaceresult) {
|
||||
my ($name, $free_chunks, $largest_chunk, $fragmentation_index) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{fsfi} = $fragmentation_index;
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
$num_tablespaces++;
|
||||
}
|
||||
if (! $num_tablespaces) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::segment::top10/) {
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = "dummy_segment";
|
||||
$thisparams{segments} = [];
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
} elsif ($params{mode} =~
|
||||
/server::database::tablespace::segment::extendspace/) {
|
||||
my @tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
tablespace_name, extent_management, allocation_type
|
||||
FROM
|
||||
dba_tablespaces
|
||||
});
|
||||
foreach (@tablespaceresult) {
|
||||
my ($name, $extent_management, $allocation_type) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{extent_management} = $extent_management;
|
||||
$thisparams{allocation_type} = $allocation_type;
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
$num_tablespaces++;
|
||||
}
|
||||
if (! $num_tablespaces) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile/) {
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = "dummy_for_datafiles";
|
||||
$thisparams{datafiles} = [];
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::iobalance/) {
|
||||
my @tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT tablespace_name FROM dba_tablespaces
|
||||
});
|
||||
foreach (@tablespaceresult) {
|
||||
my ($name) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
my $tablespace = DBD::Oracle::Server::Database::Tablespace->new(
|
||||
%thisparams);
|
||||
add_tablespace($tablespace);
|
||||
$num_tablespaces++;
|
||||
}
|
||||
if (! $num_tablespaces) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
verbose => $params{verbose},
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
bytes => $params{bytes},
|
||||
bytes_max => $params{bytes_max},
|
||||
bytes_free => $params{bytes_free} || 0,
|
||||
extent_management => $params{extent_management},
|
||||
type => $params{type},
|
||||
status => $params{status},
|
||||
fsfi => $params{fsfi},
|
||||
segments => [],
|
||||
datafiles => [],
|
||||
io_total => 0,
|
||||
usage_history => [],
|
||||
allocation_type => $params{allocation_type},
|
||||
largest_free_extent => $params{largest_free_extent},
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
$self->set_local_db_thresholds(%params);
|
||||
if ($params{mode} =~ /server::database::tablespace::(usage|free)/) {
|
||||
if (! defined $self->{bytes_max}) {
|
||||
$self->{bytes} = 0;
|
||||
$self->{bytes_max} = 0;
|
||||
$self->{bytes_free} = 0;
|
||||
$self->{percent_used} = 0;
|
||||
$self->{real_bytes_max} = $self->{bytes};
|
||||
$self->{real_bytes_free} = $self->{bytes_free};
|
||||
$self->{percent_as_bar} = '____________________';
|
||||
} else {
|
||||
# (total - free) / total * 100 = % used
|
||||
# (used + free - free) / ( used + free)
|
||||
if ($self->{bytes_max} == 0) {
|
||||
$self->{percent_used} =
|
||||
($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100;
|
||||
$self->{real_bytes_max} = $self->{bytes};
|
||||
$self->{real_bytes_free} = $self->{bytes_free};
|
||||
} elsif ($self->{bytes_max} > $self->{bytes}) {
|
||||
$self->{percent_used} =
|
||||
($self->{bytes} - $self->{bytes_free}) / $self->{bytes_max} * 100;
|
||||
$self->{real_bytes_max} = $self->{bytes_max};
|
||||
$self->{real_bytes_free} = $self->{bytes_free} + ($self->{bytes_max} - $self->{bytes});
|
||||
} else {
|
||||
# alter tablespace USERS add datafile 'users02.dbf'
|
||||
# size 5M autoextend on next 200K maxsize 6M;
|
||||
# bytes = 5M, maxbytes = 6M
|
||||
# ..... data arriving...until ORA-01652: unable to extend temp segment
|
||||
# bytes = 6M, maxbytes = 6M
|
||||
# alter database datafile 5 resize 8M;
|
||||
# bytes = 8M, maxbytes = 6M
|
||||
$self->{percent_used} =
|
||||
($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100;
|
||||
$self->{real_bytes_max} = $self->{bytes};
|
||||
$self->{real_bytes_free} = $self->{bytes_free};
|
||||
}
|
||||
}
|
||||
$self->{percent_free} = 100 - $self->{percent_used};
|
||||
my $tlen = 20;
|
||||
my $len = int((($params{mode} =~ /server::database::tablespace::usage/) ?
|
||||
$self->{percent_used} : $self->{percent_free} / 100 * $tlen) + 0.5);
|
||||
$self->{percent_as_bar} = '=' x $len . '_' x ($tlen - $len);
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::fragmentation/) {
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::segment::top10/) {
|
||||
DBD::Oracle::Server::Database::Tablespace::Segment::init_segments(%params);
|
||||
if (my @segments =
|
||||
DBD::Oracle::Server::Database::Tablespace::Segment::return_segments()) {
|
||||
$self->{segments} = \@segments;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire segment info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile/) {
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile::init_datafiles(%params);
|
||||
if (my @datafiles =
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile::return_datafiles()) {
|
||||
$self->{datafiles} = \@datafiles;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire datafile info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::iobalance/) {
|
||||
$params{tablespace} = $self->{name};
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile::init_datafiles(%params);
|
||||
if (my @datafiles =
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile::return_datafiles()) {
|
||||
$self->{datafiles} = \@datafiles;
|
||||
map { $self->{io_total} += $_->{io_total} } @datafiles;
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile::clear_datafiles();
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire datafile info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::segment::extendspace/) {
|
||||
$params{tablespace} = $self->{name};
|
||||
DBD::Oracle::Server::Database::Tablespace::Segment::init_segments(%params);
|
||||
my @segments =
|
||||
DBD::Oracle::Server::Database::Tablespace::Segment::return_segments();
|
||||
$self->{segments} = \@segments;
|
||||
DBD::Oracle::Server::Database::Tablespace::Segment::clear_segments();
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::remainingfreetime/) {
|
||||
# load historical data
|
||||
# calculate slope, intercept (go back periods * interval)
|
||||
# calculate remaining time
|
||||
$self->{percent_used} = $self->{bytes_max} == 0 ?
|
||||
($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100 :
|
||||
($self->{bytes} - $self->{bytes_free}) / $self->{bytes_max} * 100;
|
||||
$self->{usage_history} = $self->load_state( %params ) || [];
|
||||
my $now = time;
|
||||
my $lookback = ($params{lookback} || 30) * 24 * 3600;
|
||||
#$lookback = 91 * 24 * 3600;
|
||||
if (scalar(@{$self->{usage_history}})) {
|
||||
$self->trace(sprintf "loaded %d data sets from %s - %s",
|
||||
scalar(@{$self->{usage_history}}),
|
||||
scalar localtime((@{$self->{usage_history}})[0]->[0]),
|
||||
scalar localtime($now));
|
||||
# only data sets with valid usage. only newer than 91 days
|
||||
$self->{usage_history} =
|
||||
[ grep { defined $_->[1] && ($now - $_->[0]) < $lookback } @{$self->{usage_history}} ];
|
||||
$self->trace(sprintf "trimmed to %d data sets from %s - %s",
|
||||
scalar(@{$self->{usage_history}}),
|
||||
scalar localtime((@{$self->{usage_history}})[0]->[0]),
|
||||
scalar localtime($now));
|
||||
} else {
|
||||
$self->trace(sprintf "no historical data found");
|
||||
}
|
||||
push(@{$self->{usage_history}}, [ time, $self->{percent_used} ]);
|
||||
$params{save} = $self->{usage_history};
|
||||
$self->save_state(%params);
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::database::tablespace::usage/) {
|
||||
if (! $self->{bytes_max}) {
|
||||
$self->check_thresholds($self->{percent_used}, "90", "98");
|
||||
if ($self->{status} eq 'offline') {
|
||||
$self->add_nagios_warning(
|
||||
sprintf("tbs %s is offline", $self->{name})
|
||||
);
|
||||
} else {
|
||||
$self->add_nagios_critical(
|
||||
sprintf("tbs %s has has a problem, maybe needs recovery?", $self->{name})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
# 'tbs_system_usage_pct'=99.01%;90;98 percent used, warn, crit
|
||||
# 'tbs_system_usage'=693MB;630;686;0;700 used, warn, crit, 0, max=total
|
||||
$self->check_thresholds($self->{percent_used}, "90", "98"),
|
||||
$params{eyecandy} ?
|
||||
sprintf("[%s] %s", $self->{percent_as_bar}, $self->{name}) :
|
||||
sprintf("tbs %s usage is %.2f%%",
|
||||
$self->{name}, $self->{percent_used})
|
||||
);
|
||||
}
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_usage_pct\'=%.2f%%;%d;%d",
|
||||
lc $self->{name},
|
||||
$self->{percent_used},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_usage\'=%dMB;%d;%d;%d;%d",
|
||||
lc $self->{name},
|
||||
($self->{bytes} - $self->{bytes_free}) / 1048576,
|
||||
$self->{warningrange} * $self->{bytes_max} / 100 / 1048576,
|
||||
$self->{criticalrange} * $self->{bytes_max} / 100 / 1048576,
|
||||
0, $self->{bytes_max} / 1048576);
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_alloc\'=%dMB;;;0;%d",
|
||||
lc $self->{name},
|
||||
$self->{bytes} / 1048576,
|
||||
$self->{bytes_max} / 1048576);
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::fragmentation/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{fsfi}, "30:", "20:"),
|
||||
sprintf "tbs %s fsfi is %.2f", $self->{name}, $self->{fsfi});
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_fsfi\'=%.2f;%s;%s;0;100",
|
||||
lc $self->{name},
|
||||
$self->{fsfi},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::free/) {
|
||||
# ->percent_free
|
||||
# ->real_bytes_max
|
||||
#
|
||||
# ausgabe
|
||||
# perfdata tbs_<tbs>_free_pct
|
||||
# perfdata tbs_<tbs>_free (real_bytes_max - bytes) + bytes_free (with units)
|
||||
# perfdata tbs_<tbs>_alloc_free bytes_free (with units)
|
||||
#
|
||||
# umrechnen der thresholds
|
||||
# ()/%
|
||||
# MB
|
||||
# GB
|
||||
# KB
|
||||
if (($self->{warningrange} && $self->{warningrange} !~ /^\d+:/) ||
|
||||
($self->{criticalrange} && $self->{criticalrange} !~ /^\d+:/)) {
|
||||
$self->add_nagios_unknown("you want an alert if free space is _above_ a threshold????");
|
||||
return;
|
||||
}
|
||||
if (! $params{units}) {
|
||||
$params{units} = "%";
|
||||
}
|
||||
$self->{warning_bytes} = 0;
|
||||
$self->{critical_bytes} = 0;
|
||||
if ($params{units} eq "%") {
|
||||
if (! $self->{bytes_max}) {
|
||||
$self->check_thresholds($self->{percent_used}, "5:", "2:");
|
||||
if ($self->{status} eq 'offline') {
|
||||
$self->add_nagios_warning(
|
||||
sprintf("tbs %s is offline", $self->{name})
|
||||
);
|
||||
} else {
|
||||
$self->add_nagios_critical(
|
||||
sprintf("tbs %s has has a problem, maybe needs recovery?", $self->{name})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{percent_free}, "5:", "2:"),
|
||||
sprintf("tbs %s has %.2f%% free space left",
|
||||
$self->{name}, $self->{percent_free})
|
||||
);
|
||||
}
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_free_pct\'=%.2f%%;%d:;%d:",
|
||||
lc $self->{name},
|
||||
$self->{percent_free},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_free\'=%dMB;%.2f:;%.2f:;0;%.2f",
|
||||
lc $self->{name},
|
||||
$self->{real_bytes_free} / 1048576,
|
||||
$self->{warningrange} * $self->{bytes_max} / 100 / 1048576,
|
||||
$self->{criticalrange} * $self->{bytes_max} / 100 / 1048576,
|
||||
$self->{real_bytes_max} / 1048576);
|
||||
} else {
|
||||
my $factor = 1024 * 1024; # default MB
|
||||
if ($params{units} eq "GB") {
|
||||
$factor = 1024 * 1024 * 1024;
|
||||
} elsif ($params{units} eq "MB") {
|
||||
$factor = 1024 * 1024;
|
||||
} elsif ($params{units} eq "KB") {
|
||||
$factor = 1024;
|
||||
}
|
||||
$self->{warningrange} ||= "5:";
|
||||
$self->{criticalrange} ||= "2:";
|
||||
my $saved_warningrange = $self->{warningrange};
|
||||
my $saved_criticalrange = $self->{criticalrange};
|
||||
# : entfernen weil gerechnet werden muss
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->{warningrange} = $self->{warningrange} ?
|
||||
$self->{warningrange} * $factor : 5 * $factor;
|
||||
$self->{criticalrange} = $self->{criticalrange} ?
|
||||
$self->{criticalrange} * $factor : 2 * $factor;
|
||||
if (! $self->{bytes_max}) {
|
||||
$self->{percent_warning} = 0;
|
||||
$self->{percent_critical} = 0;
|
||||
$self->{warningrange} .= ':';
|
||||
$self->{criticalrange} .= ':';
|
||||
$self->check_thresholds($self->{real_bytes_free}, "5242880:", "1048576:");
|
||||
if ($self->{status} eq 'offline') {
|
||||
$self->add_nagios_warning(
|
||||
sprintf("tbs %s is offline", $self->{name})
|
||||
);
|
||||
} else {
|
||||
$self->add_nagios_critical(
|
||||
sprintf("tbs %s has a problem, maybe needs recovery?", $self->{name})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$self->{percent_warning} = 100 * $self->{warningrange} / $self->{real_bytes_max};
|
||||
$self->{percent_critical} = 100 * $self->{criticalrange} / $self->{real_bytes_max};
|
||||
$self->{warningrange} .= ':';
|
||||
$self->{criticalrange} .= ':';
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{real_bytes_free}, "5242880:", "1048576:"),
|
||||
sprintf("tbs %s has %.2f%s free space left", $self->{name},
|
||||
$self->{real_bytes_free} / $factor, $params{units})
|
||||
);
|
||||
}
|
||||
$self->{warningrange} = $saved_warningrange;
|
||||
$self->{criticalrange} = $saved_criticalrange;
|
||||
$self->{warningrange} =~ s/://g;
|
||||
$self->{criticalrange} =~ s/://g;
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_free_pct\'=%.2f%%;%.2f:;%.2f:",
|
||||
lc $self->{name},
|
||||
$self->{percent_free}, $self->{percent_warning},
|
||||
$self->{percent_critical});
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_free\'=%.2f%s;%.2f:;%.2f:;0;%.2f",
|
||||
lc $self->{name},
|
||||
$self->{real_bytes_free} / $factor, $params{units},
|
||||
$self->{warningrange},
|
||||
$self->{criticalrange},
|
||||
$self->{real_bytes_max} / $factor);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::fragmentation/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{fsfi}, "30:", "20:"),
|
||||
sprintf "tbs %s fsfi is %.2f", $self->{name}, $self->{fsfi});
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_fsfi\'=%.2f;%s;%s;0;100",
|
||||
lc $self->{name},
|
||||
$self->{fsfi},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::segment::top10/) {
|
||||
foreach (@{$self->{segments}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile::listdatafiles/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{datafiles}}) {
|
||||
printf "%s\n", $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile/) {
|
||||
foreach (@{$self->{datafiles}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::iobalance/) {
|
||||
my $cv = 0;
|
||||
if (scalar(@{$self->{datafiles}}) == 0) {
|
||||
$self->add_nagios($self->check_thresholds($cv, 50, 100),
|
||||
sprintf "%s has no datafiles", $self->{name});
|
||||
} elsif (scalar(@{$self->{datafiles}}) == 1) {
|
||||
$self->add_nagios($self->check_thresholds($cv, 50, 100),
|
||||
sprintf "%s has just 1 datafile", $self->{name});
|
||||
} elsif ($self->{io_total} == 0) {
|
||||
# nix los
|
||||
$self->check_thresholds(0, 50, 100);
|
||||
$self->add_nagios_ok(sprintf "%s datafiles io is well balanced",
|
||||
$self->{name});
|
||||
} else {
|
||||
my @unbalanced_datafiles = ();
|
||||
my $worstfactor = 0;
|
||||
my $level = $ERRORS{OK};
|
||||
# http://de.wikipedia.org/wiki/Standardabweichung_der_Grundgesamtheit
|
||||
# http://de.wikipedia.org/wiki/Variationskoeffizient
|
||||
|
||||
# arithmetisches mittel der stichprobe "x quer"
|
||||
my $averagetotal = $self->{io_total} / scalar(@{$self->{datafiles}});
|
||||
|
||||
# standardabweichung
|
||||
my $sum = 0;
|
||||
foreach (@{$self->{datafiles}}) {
|
||||
$sum += ($_->{io_total} - $averagetotal) ** 2;
|
||||
}
|
||||
my $sx = sqrt ($sum / (scalar(@{$self->{datafiles}}) - 1));
|
||||
|
||||
# relative standardabweichung (%RSD)
|
||||
$cv = $sx / $averagetotal * 100;
|
||||
|
||||
# jetzt werden diejenigen datafiles ermittelt, die aus der reihe tanzen
|
||||
# wie verhaelt sich ihre differenz zum mittelwert zur standardabweichung
|
||||
foreach my $datafile (@{$self->{datafiles}}) {
|
||||
my $delta = abs($datafile->{io_total} - $averagetotal);
|
||||
my $factor = $delta / $sx * 100;
|
||||
$worstfactor = $factor unless $factor <= $worstfactor;
|
||||
if ($self->check_thresholds($factor, 50, 100)) {
|
||||
push(@unbalanced_datafiles, $datafile);
|
||||
}
|
||||
}
|
||||
if ($self->check_thresholds($worstfactor, 50, 100)) {
|
||||
$self->add_nagios($self->check_thresholds($worstfactor, 50, 100),
|
||||
sprintf "%s datafiles %s io unbalanced (%f)", $self->{name},
|
||||
join(",", map { $_->{name} } @unbalanced_datafiles), $worstfactor);
|
||||
} else {
|
||||
$self->add_nagios_ok(sprintf "%s datafiles io is well balanced",
|
||||
$self->{name});
|
||||
}
|
||||
}
|
||||
# coefficient of variation (cv)
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_io_cv\'=%.2f%%;%.2f;%.2f",
|
||||
$self->{name}, $cv,
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::database::tablespace::remainingfreetime/) {
|
||||
my $lookback = $params{lookback} || 30;
|
||||
my $enoughvalues = 0;
|
||||
my $newest = time - $lookback * 24 * 3600;
|
||||
my @tmp = grep { $_->[0] > $newest } @{$self->{usage_history}};
|
||||
$self->trace(sprintf "found %d usable data sets since %s",
|
||||
scalar(@tmp), scalar localtime($newest));
|
||||
if ((scalar(@{$self->{usage_history}}) - scalar(@tmp) > 0) &&
|
||||
(scalar(@tmp) >= 2)) {
|
||||
# only if more than two values are available
|
||||
# only if we have data really reaching back some days
|
||||
# predicting with two values from the last hour makes no sense
|
||||
$self->{usage_history} = \@tmp;
|
||||
my $remaining = 99999;
|
||||
my $now = time; # normalisieren, so dass jetzt x=0
|
||||
my $n = 0; my $sumx = 0; my $sumx2 = 0; my $sumxy = 0; my $sumy = 0; my $sumy2 = 0; my $m = 0; my $r = 0;
|
||||
my $start_usage = undef;
|
||||
my $stop_usage = undef;
|
||||
foreach (@{$self->{usage_history}}) {
|
||||
next if $_->[0] < $newest;
|
||||
$start_usage = $_->[1] if ! defined $start_usage;
|
||||
$stop_usage = $_->[1];
|
||||
my $x = ($_->[0] - $now) / (24 * 3600);
|
||||
my $y = $_->[1];
|
||||
$n++; # increment number of data points by 1
|
||||
$sumx += $x; # compute sum of x
|
||||
$sumx2 += $x * $x; # compute sum of x**2
|
||||
$sumxy += $x * $y; # compute sum of x * y
|
||||
$sumy += $y; # compute sum of y
|
||||
$sumy2 += $y * $y; # compute sum of y**2
|
||||
}
|
||||
# compute slope
|
||||
$m = ($n * $sumxy - $sumx * $sumy) / ($n * $sumx2 - $sumx ** 2);
|
||||
# compute y-intercept
|
||||
$b = ($sumy * $sumx2 - $sumx * $sumxy) / ($n * $sumx2 - $sumx ** 2);
|
||||
# compute correlation coefficient
|
||||
#$r = ($sumxy - $sumx * $sumy / $n) /
|
||||
# sqrt(($sumx2 - ($sumx ** 2)/$n) * ($sumy2 - ($sumy ** 2)/$n));
|
||||
$self->debug(sprintf "slope: %f y-intersect: %f", $m, $b);
|
||||
if (abs($m) <= 0.000001) { # $m == 0 does not work even if $m is 0.000000
|
||||
$self->add_nagios_ok("tablespace usage is constant");
|
||||
} elsif ($m > 0) {
|
||||
$remaining = (100 - $b) / $m;
|
||||
$self->add_nagios($self->check_thresholds($remaining, "90:", "30:"),
|
||||
sprintf "tablespace %s will be full in %d days",
|
||||
$self->{name}, $remaining);
|
||||
$self->add_perfdata(sprintf "\'tbs_%s_days_until_full\'=%d;%s;%s",
|
||||
lc $self->{name},
|
||||
$remaining,
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} else {
|
||||
$self->add_nagios_ok("tablespace usage is decreasing");
|
||||
}
|
||||
} else {
|
||||
$self->add_nagios_ok("no data available for prediction");
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::database::tablespace::segment::extendspace/) {
|
||||
my $segments = 0;
|
||||
my @largesegments = ();
|
||||
foreach my $segment (@{$self->{segments}}) {
|
||||
$segments++;
|
||||
$segment->nagios(%params);
|
||||
if ($segment->{nagios_level}) {
|
||||
push(@largesegments, $segment->{name});
|
||||
}
|
||||
#$self->merge_nagios($segment);
|
||||
}
|
||||
if (! $segments) {
|
||||
$self->add_nagios_ok(
|
||||
sprintf "tablespace %s has no segments", $self->{name});
|
||||
} elsif (@largesegments) {
|
||||
if ($self->{allocation_type} ne "SYSTEM") {
|
||||
$self->add_nagios_critical(
|
||||
sprintf "tablespace %s cannot extend segment(s) %s", $self->{name},
|
||||
join(", ", @largesegments));
|
||||
} else {
|
||||
$self->add_nagios_ok(
|
||||
sprintf "tablespace %s free extents are large enough (autoallocate)",
|
||||
$self->{name});
|
||||
}
|
||||
} elsif (! $self->{nagios_level}) {
|
||||
$self->add_nagios_ok(
|
||||
sprintf "tablespace %s free extents are large enough",
|
||||
$self->{name});
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile/) {
|
||||
printf "%s\n", $self->dump();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,185 @@
|
||||
package DBD::Oracle::Server::Database::Tablespace::Datafile;
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Database::Tablespace);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @datafiles = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_datafile {
|
||||
push(@datafiles, shift);
|
||||
}
|
||||
|
||||
sub return_datafiles {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @datafiles;
|
||||
}
|
||||
|
||||
sub clear_datafiles {
|
||||
@datafiles = ();
|
||||
}
|
||||
|
||||
sub init_datafiles {
|
||||
my %params = @_;
|
||||
my $num_datafiles = 0;
|
||||
if (($params{mode} =~ /server::database::tablespace::datafile::iotraffic/) ||
|
||||
($params{mode} =~ /server::database::tablespace::datafile::listdatafiles/)) {
|
||||
# negative values can occur
|
||||
# column datafile format a30
|
||||
my @datafileresults = $params{handle}->fetchall_array(q{
|
||||
SELECT
|
||||
name datafile, phyrds reads, phywrts writes
|
||||
FROM
|
||||
v$datafile a, v$filestat b
|
||||
WHERE
|
||||
a.file# = b.file#
|
||||
UNION
|
||||
SELECT
|
||||
name datafile, phyrds reads, phywrts writes
|
||||
FROM
|
||||
v$tempfile a, v$tempstat b
|
||||
WHERE
|
||||
a.file# = b.file#
|
||||
});
|
||||
if (DBD::Oracle::Server::return_first_server()->windows_server()) {
|
||||
fileparse_set_fstype("MSWin32");
|
||||
}
|
||||
foreach (@datafileresults) {
|
||||
my ($name, $phyrds, $phywrts) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} &&
|
||||
(($name !~ /$params{selectname}/) &&
|
||||
(basename($name) !~ /$params{selectname}/));
|
||||
} else {
|
||||
next if $params{selectname} &&
|
||||
((lc $params{selectname} ne lc $name) &&
|
||||
(lc $params{selectname} ne lc basename($name)));
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{path} = $name;
|
||||
$thisparams{name} = basename($name);
|
||||
$thisparams{phyrds} = $phyrds;
|
||||
$thisparams{phywrts} = $phywrts;
|
||||
my $datafile =
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile->new(
|
||||
%thisparams);
|
||||
add_datafile($datafile);
|
||||
$num_datafiles++;
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::iobalance/) {
|
||||
my $sql = q{
|
||||
-- SELECT REGEXP_REPLACE(file_name,'^.*.\/.*.\/', '') file_name,
|
||||
SELECT file_name,
|
||||
SUM(phyrds), SUM(phywrts)
|
||||
FROM dba_temp_files, v$filestat
|
||||
WHERE tablespace_name = UPPER(?)
|
||||
AND file_id=file# GROUP BY tablespace_name, file_name
|
||||
UNION
|
||||
-- SELECT REGEXP_REPLACE(file_name,'^.*.\/.*.\/', '') file_name,
|
||||
SELECT file_name,
|
||||
SUM(phyrds), SUM(phywrts)
|
||||
FROM dba_data_files, v$filestat
|
||||
WHERE tablespace_name = UPPER(?)
|
||||
AND file_id=file# GROUP BY tablespace_name, file_name };
|
||||
if (! DBD::Oracle::Server::return_first_server()->version_is_minimum("9.2.0.3")) {
|
||||
# bug 2436600
|
||||
$sql = q{
|
||||
-- SELECT REGEXP_REPLACE(file_name,'^.*.\/.*.\/', '') file_name,
|
||||
SELECT file_name,
|
||||
SUM(phyrds), SUM(phywrts)
|
||||
FROM dba_data_files, v$filestat
|
||||
WHERE tablespace_name = UPPER(?)
|
||||
AND file_id=file# GROUP BY tablespace_name, file_name };
|
||||
}
|
||||
my @datafileresults = $params{handle}->fetchall_array($sql, $params{tablespace}, $params{tablespace});
|
||||
if (DBD::Oracle::Server::return_first_server()->windows_server()) {
|
||||
fileparse_set_fstype("MSWin32");
|
||||
}
|
||||
foreach (@datafileresults) {
|
||||
my ($name, $phyrds, $phywrts) = @{$_};
|
||||
my %thisparams = %params;
|
||||
$thisparams{path} = $name;
|
||||
$thisparams{name} = basename($name);
|
||||
$thisparams{phyrds} = $phyrds;
|
||||
$thisparams{phywrts} = $phywrts;
|
||||
my $datafile =
|
||||
DBD::Oracle::Server::Database::Tablespace::Datafile->new(
|
||||
%thisparams);
|
||||
add_datafile($datafile);
|
||||
$num_datafiles++;
|
||||
}
|
||||
if (! $num_datafiles) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
path => $params{path},
|
||||
name => $params{name},
|
||||
phyrds => $params{phyrds},
|
||||
phywrts => $params{phywrts},
|
||||
io_total => undef,
|
||||
io_total_per_sec => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::database::tablespace::iobalance/) {
|
||||
if (! defined $self->{phyrds}) {
|
||||
$self->add_nagios_critical(sprintf "unable to read datafile io %s", $@);
|
||||
} else {
|
||||
$params{differenciator} = $self->{path};
|
||||
$self->valdiff(\%params, qw(phyrds phywrts));
|
||||
$self->{io_total} = $self->{delta_phyrds} + $self->{delta_phywrts};
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::database::tablespace::datafile::iotraffic/) {
|
||||
if (! defined $self->{phyrds}) {
|
||||
$self->add_nagios_critical(sprintf "unable to read datafile io %s", $@);
|
||||
} else {
|
||||
$params{differenciator} = $self->{path};
|
||||
$self->valdiff(\%params, qw(phyrds phywrts));
|
||||
$self->{io_total_per_sec} = ($self->{delta_phyrds} + $self->{delta_phywrts}) /
|
||||
$self->{delta_timestamp};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::database::tablespace::datafile::iotraffic/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{io_total_per_sec}, "1000", "5000"),
|
||||
sprintf ("%s: %.2f IO Operations per Second",
|
||||
$self->{name}, $self->{io_total_per_sec}));
|
||||
$self->add_perfdata(sprintf "'dbf_%s_io_total_per_sec'=%.2f;%d;%d",
|
||||
$self->{name}, $self->{io_total_per_sec},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,293 @@
|
||||
package DBD::Oracle::Server::Database::Tablespace::Segment;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Database::Tablespace);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @segments = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_segment {
|
||||
push(@segments, shift);
|
||||
}
|
||||
|
||||
sub return_segments {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @segments;
|
||||
}
|
||||
|
||||
sub clear_segments {
|
||||
@segments = ();
|
||||
}
|
||||
|
||||
sub init_segments {
|
||||
my %params = @_;
|
||||
my $num_segments = 0;
|
||||
if (($params{mode} =~
|
||||
/server::database::tablespace::segment::top10logicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10physicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10bufferbusywaits/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10rowlockwaits/)) {
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = "dummy_segment";
|
||||
my $segment = DBD::Oracle::Server::Database::Tablespace::Segment->new(
|
||||
%thisparams);
|
||||
add_segment($segment);
|
||||
$num_segments++;
|
||||
} elsif ($params{mode} =~
|
||||
/server::database::tablespace::segment::extendspace/) {
|
||||
my @tablespaceresult = $params{handle}->fetchall_array(q{
|
||||
SELECT /*+ RULE */
|
||||
-- tablespace, segment, extent
|
||||
-- aber dadurch, dass nur das letzte extent selektiert wird
|
||||
-- werden praktisch nur tablespace und segmente ausgegeben
|
||||
b.tablespace_name "Tablespace",
|
||||
b.segment_type "Type",
|
||||
SUBSTR(ext.owner||'.'||ext.segment_name,1,50) "Object Name",
|
||||
DECODE(freespace.extent_management,
|
||||
'DICTIONARY', DECODE(b.extents,
|
||||
1, b.next_extent, ext.bytes * (1 + b.pct_increase / 100)),
|
||||
'LOCAL', DECODE(freespace.allocation_type,
|
||||
'UNIFORM', freespace.initial_extent,
|
||||
'SYSTEM', ext.bytes)
|
||||
) "Required Extent",
|
||||
freespace.largest "MaxAvail"
|
||||
FROM
|
||||
-- dba_segments b,
|
||||
-- dba_extents ext,
|
||||
(
|
||||
SELECT
|
||||
owner, segment_type, segment_name, extents, pct_increase,
|
||||
next_extent, tablespace_name
|
||||
FROM
|
||||
dba_segments
|
||||
WHERE
|
||||
tablespace_name = ?
|
||||
) b,
|
||||
(
|
||||
SELECT
|
||||
owner, segment_type, segment_name, extent_id, bytes,
|
||||
tablespace_name
|
||||
FROM
|
||||
dba_extents
|
||||
WHERE
|
||||
tablespace_name = ?
|
||||
) ext,
|
||||
(
|
||||
-- dictionary/local, uniform/system, initial, next
|
||||
-- und der groesste freie extent pro tablespace
|
||||
SELECT
|
||||
b.tablespace_name,
|
||||
b.extent_management,
|
||||
b.allocation_type,
|
||||
b.initial_extent,
|
||||
b.next_extent,
|
||||
max(a.bytes) largest
|
||||
FROM
|
||||
dba_free_space a,
|
||||
dba_tablespaces b
|
||||
WHERE
|
||||
b.tablespace_name = a.tablespace_name
|
||||
AND
|
||||
b.status = 'ONLINE'
|
||||
GROUP BY
|
||||
b.tablespace_name,
|
||||
b.extent_management,
|
||||
b.allocation_type,
|
||||
b.initial_extent,
|
||||
b.next_extent
|
||||
) freespace
|
||||
WHERE
|
||||
b.owner = ext.owner
|
||||
AND
|
||||
b.segment_type = ext.segment_type
|
||||
AND
|
||||
b.segment_name = ext.segment_name
|
||||
AND
|
||||
b.tablespace_name = ext.tablespace_name
|
||||
AND
|
||||
-- so landet nur das jeweils letzte extent im ergebnis
|
||||
(b.extents - 1) = ext.extent_id
|
||||
AND
|
||||
b.tablespace_name = freespace.tablespace_name
|
||||
AND
|
||||
freespace.tablespace_name = ?
|
||||
ORDER BY
|
||||
b.tablespace_name,
|
||||
b.segment_type,
|
||||
b.segment_name
|
||||
}, $params{tablespace}, $params{tablespace}, $params{tablespace});
|
||||
foreach (@tablespaceresult) {
|
||||
my ($tablespace_name, $segment_type, $object_name,
|
||||
$required_for_next_extent, $largest_free) = @{$_};
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $object_name;
|
||||
$thisparams{segment_type} = $segment_type;
|
||||
$thisparams{required_for_next_extent} = $required_for_next_extent;
|
||||
$thisparams{largest_free} = $largest_free;
|
||||
my $segment = DBD::Oracle::Server::Database::Tablespace::Segment->new(
|
||||
%thisparams);
|
||||
add_segment($segment);
|
||||
$num_segments++;
|
||||
}
|
||||
}
|
||||
if (! $num_segments) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
segment_type => $params{segment_type},
|
||||
required_for_next_extent => $params{required_for_next_extent},
|
||||
largest_free => $params{largest_free},
|
||||
num_users_among_top10logicalreads => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if (($params{mode} =~
|
||||
/server::database::tablespace::segment::top10logicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10physicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10bufferbusywaits/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10rowlockwaits/)) {
|
||||
my $sql;
|
||||
my $mode = (split(/::/, $params{mode}))[4];
|
||||
## -- SELECT owner, object_name, object_type, value, statistic_name
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("10.x")) {
|
||||
# this uses oracle analytic function rank() over (),
|
||||
# needs oracle >= 10.x
|
||||
# for more information see:
|
||||
# http://kenntwas.de/2010/linux/monitoring/check_oracle_health-seg-top10-abfragen-verbessern/
|
||||
$sql = q{
|
||||
SELECT DO.owner,
|
||||
DO.object_name,
|
||||
DO.object_type,
|
||||
SS.VALUE,
|
||||
SS.statistic_name
|
||||
FROM dba_objects DO,
|
||||
(SELECT *
|
||||
FROM (SELECT S.OBJ#,
|
||||
s.VALUE,
|
||||
s.statistic_name,
|
||||
RANK () OVER (ORDER BY s.VALUE DESC) rk
|
||||
FROM v$segstat s
|
||||
WHERE s.statistic_name = ?
|
||||
/* reduce data to significant values */
|
||||
AND VALUE <> 0)
|
||||
WHERE rk <= 10 /* top 10 */
|
||||
) SS
|
||||
WHERE DO.object_id = SS.obj#
|
||||
};
|
||||
} else {
|
||||
my $sql = q{
|
||||
SELECT COUNT(*)
|
||||
FROM (select DO.owner, DO.object_name, DO.object_type, SS.value,
|
||||
SS.statistic_name, row_number () over (order by value desc) RN
|
||||
FROM dba_objects DO, v$segstat SS
|
||||
WHERE DO.object_id = SS.obj#
|
||||
AND statistic_name = ?)
|
||||
WHERE RN <= 10
|
||||
AND owner not in
|
||||
('CTXSYS', 'DBSNMP', 'MDDATA', 'MDSYS', 'DMSYS', 'OLAPSYS',
|
||||
'ORDPLUGINS', 'ORDSYS', 'OUTLN', 'SI_INFORMTN_SCHEMA',
|
||||
'SYS', 'SYSMAN', 'SYSTEM')
|
||||
};
|
||||
# this is a very heavy operation and de-selecting system users
|
||||
# makes it even slower, so we fetch all data and do the filtering
|
||||
# later in perl.
|
||||
$sql = q{
|
||||
select DO.owner, DO.object_name, DO.object_type, SS.value,
|
||||
SS.statistic_name
|
||||
FROM dba_objects DO, v$segstat SS
|
||||
WHERE DO.object_id = SS.obj#
|
||||
AND statistic_name = ?
|
||||
};
|
||||
}
|
||||
my $statname = {
|
||||
top10logicalreads => "logical reads",
|
||||
top10physicalreads => "physical reads",
|
||||
top10bufferbusywaits => "buffer busy waits",
|
||||
top10rowlockwaits => "row lock waits",
|
||||
}->{$mode};
|
||||
#$self->{"num_users_among_".$mode} =
|
||||
# $self->{handle}->fetchrow_array($sql, $statname);
|
||||
# faster version
|
||||
# fetch everything
|
||||
my @sortedsessions = reverse sort { $a->[3] <=> $b->[3] } $self->{handle}->fetchall_array($sql, $statname);
|
||||
if (scalar(@sortedsessions) > 10) {
|
||||
@sortedsessions = (@sortedsessions)[0..9];
|
||||
}
|
||||
my @usersessions = map { $_->[0] !~ /^(CTXSYS|DBSNMP|MDDATA|MDSYS|DMSYS|OLAPSYS|ORDPLUGINS|ORDSYS|OUTLN|SI_INFORMTN_SCHEMA|SYS|SYSMAN|SYSTEM)$/ ? $_ : () } @sortedsessions;
|
||||
$self->{"num_users_among_".$mode} = scalar(@usersessions);
|
||||
if (scalar(@sortedsessions) == 0) {
|
||||
#if (! defined $self->{"num_users_among_".$mode}) {
|
||||
$self->add_nagios_critical(sprintf "unable to read top10: %s", $@);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if (($params{mode} =~
|
||||
/server::database::tablespace::segment::top10logicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10physicalreads/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10bufferbusywaits/) ||
|
||||
($params{mode} =~
|
||||
/server::database::tablespace::segment::top10rowlockwaits/)) {
|
||||
my $mode = (split(/::/, $params{mode}))[4];
|
||||
my $statname = {
|
||||
top10logicalreads => "logical reads",
|
||||
top10physicalreads => "physical reads",
|
||||
top10bufferbusywaits => "buffer busy waits",
|
||||
top10rowlockwaits => "row lock waits",
|
||||
}->{$mode};
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{"num_users_among_".$mode}, "1", "9"),
|
||||
sprintf "%d user processes among the top10 %s",
|
||||
$self->{"num_users_among_".$mode}, $statname);
|
||||
$statname =~ s/\s/_/g;
|
||||
$self->add_perfdata(sprintf "users_among_top10_%s=%d;%d;%d",
|
||||
$statname, $self->{"num_users_among_".$mode},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::database::tablespace::segment::extendspace/) {
|
||||
if ($self->{required_for_next_extent} > $self->{largest_free}) {
|
||||
$self->add_nagios_critical(
|
||||
sprintf "segment %s cannot extend", $self->{name});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,167 @@
|
||||
package DBD::Oracle::Server::Instance;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
sga => undef,
|
||||
processes => {},
|
||||
events => [],
|
||||
enqueues => [],
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga/) {
|
||||
$self->{sga} = DBD::Oracle::Server::Instance::SGA->new(%params);
|
||||
} elsif ($params{mode} =~ /server::instance::pga/) {
|
||||
$self->{pga} = DBD::Oracle::Server::Instance::PGA->new(%params);
|
||||
} elsif ($params{mode} =~ /server::instance::sysstat/) {
|
||||
DBD::Oracle::Server::Instance::Sysstat::init_sysstats(%params);
|
||||
if (my @sysstats =
|
||||
DBD::Oracle::Server::Instance::Sysstat::return_sysstats(%params)) {
|
||||
$self->{sysstats} = \@sysstats;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire sysstats info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::event/) {
|
||||
DBD::Oracle::Server::Instance::Event::init_events(%params);
|
||||
if (my @events =
|
||||
DBD::Oracle::Server::Instance::Event::return_events(%params)) {
|
||||
$self->{events} = \@events;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire event info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::enqueue/) {
|
||||
DBD::Oracle::Server::Instance::Enqueue::init_enqueues(%params);
|
||||
if (my @enqueues =
|
||||
DBD::Oracle::Server::Instance::Enqueue::return_enqueues(%params)) {
|
||||
$self->{enqueues} = \@enqueues;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire enqueue info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::connectedusers/) {
|
||||
$self->{connected_users} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM v$session WHERE type = 'USER'
|
||||
});
|
||||
} elsif ($params{mode} =~ /server::instance::rman::backup::problems/) {
|
||||
$self->{rman_backup_problems} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT COUNT(*) FROM v$rman_status WHERE status != 'COMPLETED'
|
||||
AND
|
||||
status != 'RUNNING'
|
||||
AND start_time > sysdate-3
|
||||
});
|
||||
} elsif ($params{mode} =~ /server::instance::sessionusage/) {
|
||||
$self->{session_usage} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT current_utilization/limit_value*100
|
||||
FROM v$resource_limit WHERE resource_name LIKE '%sessions%'
|
||||
});
|
||||
} elsif ($params{mode} =~ /server::instance::processusage/) {
|
||||
$self->{process_usage} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT current_utilization/limit_value*100
|
||||
FROM v$resource_limit WHERE resource_name LIKE '%processes%'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /server::instance::sga/) {
|
||||
$self->{sga}->nagios(%params);
|
||||
$self->merge_nagios($self->{sga});
|
||||
} elsif ($params{mode} =~ /server::instance::pga/) {
|
||||
$self->{pga}->nagios(%params);
|
||||
$self->merge_nagios($self->{pga});
|
||||
} elsif ($params{mode} =~ /server::instance::event::listevents/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name} } @{$self->{events}}) {
|
||||
printf "%10u%s %s %s\n", $_->{event_id}, $_->{idle} ? '*' : '', $_->{shortname}, $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::instance::event/) {
|
||||
foreach (@{$self->{events}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
if (! $self->{nagios_level} && ! $params{selectname}) {
|
||||
$self->add_nagios_ok("no wait problems");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sysstat::listsysstat/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name} } @{$self->{sysstats}}) {
|
||||
printf "%10d %s\n", $_->{number}, $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::instance::sysstat/) {
|
||||
foreach (@{$self->{sysstats}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
if (! $self->{nagios_level} && ! $params{selectname}) {
|
||||
$self->add_nagios_ok("no wait problems");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::enqueue::listenqueues/) {
|
||||
foreach (sort { $a->{name} cmp $b->{name} } @{$self->{enqueues}}) {
|
||||
printf "%s\n", $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::instance::enqueue/) {
|
||||
foreach (@{$self->{enqueues}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
if (! $self->{nagios_level} && ! $params{selectname}) {
|
||||
$self->add_nagios_ok("no enqueue problem");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::connectedusers/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{connected_users}, 50, 100),
|
||||
sprintf "%d connected users",
|
||||
$self->{connected_users});
|
||||
$self->add_perfdata(sprintf "connected_users=%d;%d;%d",
|
||||
$self->{connected_users},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::instance::rman::backup::problems/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{rman_backup_problems}, 1, 2),
|
||||
sprintf "rman had %d problems during the last 3 days",
|
||||
$self->{rman_backup_problems});
|
||||
$self->add_perfdata(sprintf "rman_backup_problems=%d;%d;%d",
|
||||
$self->{rman_backup_problems},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::instance::sessionusage/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{session_usage}, 80, 100),
|
||||
sprintf "%.2f%% of session resources used",
|
||||
$self->{session_usage});
|
||||
$self->add_perfdata(sprintf "session_usage=%.2f%%;%d;%d",
|
||||
$self->{session_usage},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::instance::processusage/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{process_usage}, 80, 100),
|
||||
sprintf "%.2f%% of process resources used",
|
||||
$self->{process_usage});
|
||||
$self->add_perfdata(sprintf "process_usage=%.2f%%;%d;%d",
|
||||
$self->{process_usage},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,220 @@
|
||||
package DBD::Oracle::Server::Instance::Enqueue;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @enqueues = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_enqueue {
|
||||
push(@enqueues, shift);
|
||||
}
|
||||
|
||||
sub return_enqueues {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @enqueues;
|
||||
}
|
||||
|
||||
sub init_enqueues {
|
||||
my %params = @_;
|
||||
my $num_enqueues = 0;
|
||||
if (($params{mode} =~ /server::instance::enqueue::contention/) ||
|
||||
($params{mode} =~ /server::instance::enqueue::waiting/) ||
|
||||
($params{mode} =~ /server::instance::enqueue::listenqueues/)) {
|
||||
# ora11 PE FP TA DL SR TQ KT PW XR SS SJ SQ IT IA UL WP RR KM
|
||||
# PD CF SW CT US TD TK JS FS CN DT TS TT JD SE MW AF TL
|
||||
# PV AS TM TX FB JQ MD TO TH PR RO MR DP WF TB SH RS CU
|
||||
# AE CI PG IS RT HW DR FU
|
||||
# ora10 PE FP TA DL SR TQ KT PW XR SS SQ PF IT IA UL WP KM PD
|
||||
# CF SW CT US TD AG JS DT TS TT CN JD SE MW AF TL PV AS
|
||||
# TM FB TX JQ MD TO PR RO MR SK DP WF TB SH RS CU AW CI
|
||||
# PG IS RT HW DR FU
|
||||
# ora9 CF CI CU DL DP DR DT DX FB HW IA IS IT JD MD MR PE PF
|
||||
# RO RT SQ SR SS SW TA TD TM TO TS TT TX UL US XR
|
||||
my @enqueueresults = $params{handle}->fetchall_array(q{
|
||||
SELECT inst_id, eq_type, total_req#, total_wait#,
|
||||
succ_req#, failed_req#, cum_wait_time
|
||||
FROM v$enqueue_stat
|
||||
});
|
||||
foreach (@enqueueresults) {
|
||||
my ($inst_id, $name, $total_requests, $total_waits,
|
||||
$succeeded_requests, $failed_requests, $cumul_wait_time) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if $params{selectname} && lc $params{selectname} ne lc $name;
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{total_requests} = $total_requests;
|
||||
$thisparams{total_waits} = $total_waits;
|
||||
$thisparams{succeeded_requests} = $succeeded_requests;
|
||||
$thisparams{failed_requests} = $failed_requests;
|
||||
$thisparams{cumul_wait_time} = $cumul_wait_time;
|
||||
my $enqueue = DBD::Oracle::Server::Instance::Enqueue->new(
|
||||
%thisparams);
|
||||
add_enqueue($enqueue);
|
||||
$num_enqueues++;
|
||||
}
|
||||
if (! $num_enqueues) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
total_requests => $params{total_requests},
|
||||
total_waits => $params{total_waits},
|
||||
succeeded_requests => $params{succeeded_requests},
|
||||
failed_requests => $params{failed_requests},
|
||||
cumul_wait_time => $params{cumul_wait_time}, # ! milliseconds
|
||||
contention => undef,
|
||||
percent_waited => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
$self->{name} =~ s/^\s+//;
|
||||
$self->{name} =~ s/\s+$//;
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if (($params{mode} =~ /server::instance::enqueue::contention/) ||
|
||||
($params{mode} =~ /server::instance::enqueue::waiting/)) {
|
||||
$params{differenciator} = lc $self->{name};
|
||||
$self->valdiff(\%params, qw(total_requests total_waits succeeded_requests
|
||||
failed_requests cumul_wait_time));
|
||||
# enqueue contention
|
||||
$self->{contention} = $self->{delta_total_requests} ?
|
||||
100 * $self->{delta_total_waits} / $self->{delta_total_requests} : 0;
|
||||
# enqueue waiting
|
||||
$self->{percent_waited} = ($self->{delta_cumul_wait_time} /
|
||||
($self->{delta_timestamp} * 1000)) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::enqueue::contention/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{contention}, "1", "10"),
|
||||
sprintf "enqueue %s %s: %.2f%% of the requests must wait ",
|
||||
$self->{name}, $self->longname(), $self->{contention});
|
||||
$self->add_perfdata(sprintf "'%s_contention'=%.2f%%;%s;%s '%s_requests'=%d '%s_waits'=%d",
|
||||
$self->{name},
|
||||
$self->{contention},
|
||||
$self->{warningrange}, $self->{criticalrange},
|
||||
$self->{name},
|
||||
$self->{delta_total_requests},
|
||||
$self->{name},
|
||||
$self->{delta_total_waits});
|
||||
} elsif ($params{mode} =~ /server::instance::enqueue::waiting/) {
|
||||
$self->add_nagios(
|
||||
# 1 ms wait in 5 minutes
|
||||
$self->check_thresholds($self->{percent_waited}, "0.0003333", "0.003333"),
|
||||
sprintf "enqueue %s %s: waiting %.4f%% of the time",
|
||||
$self->{name}, $self->longname(), $self->{percent_waited});
|
||||
$self->add_perfdata(sprintf "'%s_ms_waited'=%d '%s_pct_waited'=%.4f%%;%s;%s",
|
||||
$self->{name},
|
||||
$self->{delta_cumul_wait_time},
|
||||
$self->{name},
|
||||
$self->{percent_waited},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub longname {
|
||||
my $self = shift;
|
||||
my $abbrev = <<EOEO;
|
||||
BL, Buffer Cache Management
|
||||
BR, Backup/Restore
|
||||
CF, Controlfile Transaction
|
||||
CI, Cross-instance Call Invocation
|
||||
CU, Bind Enqueue
|
||||
DF, Datafile
|
||||
DL, Direct Loader Index Creation
|
||||
DM, Database Mount
|
||||
DR, Distributed Recovery Process
|
||||
DX, Distributed Transaction
|
||||
FP, File Object
|
||||
FS, File Set
|
||||
HW, High-Water Lock
|
||||
IN, Instance Number
|
||||
IR, Instance Recovery
|
||||
IS, Instance State
|
||||
IV, Library Cache Invalidation
|
||||
JI, Enqueue used during AJV snapshot refresh
|
||||
JQ, Job Queue
|
||||
KK, Redo Log "Kick"
|
||||
KO, Multiple Object Checkpoint
|
||||
L[A-P], Library Cache Lock
|
||||
LS, Log Start or Switch
|
||||
MM, Mount Definition
|
||||
MR, Media Recovery
|
||||
N[A-Z], Library Cache Pin
|
||||
PE, ALTER SYSTEM SET PARAMETER = VALUE
|
||||
PF, Password File
|
||||
PI, Parallel Slaves
|
||||
PR, Process Startup
|
||||
PS, Parallel Slave Synchronization
|
||||
Q[A-Z], Row Cache
|
||||
RO, Object Reuse
|
||||
RT, Redo Thread
|
||||
RW, Row Wait
|
||||
SC, System Commit Number
|
||||
SM, SMON
|
||||
SN, Sequence Number
|
||||
SQ, Sequence Number Enqueue
|
||||
SR, Synchronized Replication
|
||||
SS, Sort Segment
|
||||
ST, Space Management Transaction
|
||||
SV, Sequence Number Value
|
||||
TA, Transaction Recovery
|
||||
TC, Thread Checkpoint
|
||||
TE, Extend Table
|
||||
TM, DML Enqueue
|
||||
TO, Temporary Table Object Enqueue
|
||||
TS, Temporary Segment (also TableSpace)
|
||||
TT, Temporary Table
|
||||
TX, Transaction
|
||||
UL, User-defined Locks
|
||||
UN, User Name
|
||||
US, Undo Segment, Serialization
|
||||
WL, Being Written Redo Log
|
||||
XA, Instance Attribute Lock
|
||||
XI, Instance Registration Lock
|
||||
EOEO
|
||||
my $descriptions = {};
|
||||
foreach (split(/\n/, $abbrev)) {
|
||||
my ($short, $descr) = split /,/;
|
||||
if ($self->{name} =~ /^$short$/) {
|
||||
$descr =~ s/^\s+//g;
|
||||
return $descr;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,336 @@
|
||||
package DBD::Oracle::Server::Instance::Event;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @events = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_event {
|
||||
push(@events, shift);
|
||||
}
|
||||
|
||||
sub return_events {
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /server::instance::event::waits/) {
|
||||
return reverse
|
||||
sort { $a->{waits_per_sec} <=> $b->{waits_per_sec} } @events;
|
||||
} elsif ($params{mode} =~ /server::instance::event::waiting/) {
|
||||
return reverse
|
||||
sort { $a->{percent_waited} <=> $b->{percent_waited} } @events;
|
||||
} else {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @events;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_events {
|
||||
my %params = @_;
|
||||
my $num_events = 0;
|
||||
my %longnames = ();
|
||||
if (($params{mode} =~ /server::instance::event::wait/) || #waits, waiting
|
||||
($params{mode} =~ /server::instance::event::listevents/)) {
|
||||
my $sql;
|
||||
my @idlewaits = ();
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("10.x")) {
|
||||
@idlewaits = map { $_->[0] } $params{handle}->fetchall_array(q{
|
||||
SELECT name FROM v$event_name WHERE wait_class = 'Idle'
|
||||
});
|
||||
} elsif (DBD::Oracle::Server::return_first_server()->version_is_minimum("9.x")) {
|
||||
@idlewaits = (
|
||||
'smon timer',
|
||||
'pmon timer',
|
||||
'rdbms ipc message',
|
||||
'Null event',
|
||||
'parallel query dequeue',
|
||||
'pipe get',
|
||||
'client message',
|
||||
'SQL*Net message to client',
|
||||
'SQL*Net message from client',
|
||||
'SQL*Net more data from client',
|
||||
'dispatcher timer',
|
||||
'virtual circuit status',
|
||||
'lock manager wait for remote message',
|
||||
'PX Idle Wait',
|
||||
'PX Deq: Execution Msg',
|
||||
'PX Deq: Table Q Normal',
|
||||
'wakeup time manager',
|
||||
'slave wait',
|
||||
'i/o slave wait',
|
||||
'jobq slave wait',
|
||||
'null event',
|
||||
'gcs remote message',
|
||||
'gcs for action',
|
||||
'ges remote message',
|
||||
'queue messages',
|
||||
);
|
||||
}
|
||||
if ($params{mode} =~ /server::instance::event::listeventsbg/) {
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("10.x")) {
|
||||
$sql = q{
|
||||
SELECT e.event_id, e.event, 0, 0, 0, 0 FROM v$session_event e WHERE e.sid IN
|
||||
(SELECT s.sid FROM v$session s WHERE s.type = 'BACKGROUND') GROUP BY e.event, e.event_id
|
||||
};
|
||||
} else {
|
||||
$sql = q{
|
||||
SELECT n.event#, e.event, 0, 0, 0, 0 FROM v$session_event e, v$event_name n
|
||||
WHERE n.name = e.event AND e.sid IN
|
||||
(SELECT s.sid FROM v$session s WHERE s.type = 'BACKGROUND') GROUP BY e.event, n.event#
|
||||
};
|
||||
}
|
||||
} else {
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("10.x")) {
|
||||
$sql = q{
|
||||
SELECT e.event_id, e.name,
|
||||
NVL(s.total_waits, 0), NVL(s.total_timeouts, 0), NVL(s.time_waited, 0),
|
||||
NVL(s.time_waited_micro, 0), NVL(s.average_wait, 0)
|
||||
FROM v$event_name e LEFT JOIN sys.v_$system_event s ON e.name = s.event
|
||||
};
|
||||
} else {
|
||||
$sql = q{
|
||||
SELECT e.event#, e.name,
|
||||
NVL(s.total_waits, 0), NVL(s.total_timeouts, 0), NVL(s.time_waited, 0),
|
||||
NVL(s.time_waited_micro, 0), NVL(s.average_wait, 0)
|
||||
FROM v$event_name e LEFT JOIN sys.v_$system_event s ON e.name = s.event
|
||||
};
|
||||
}
|
||||
}
|
||||
my @eventresults = $params{handle}->fetchall_array($sql);
|
||||
foreach (@eventresults) {
|
||||
my ($event_no, $name, $total_waits, $total_timeouts,
|
||||
$time_waited, $time_waited_micro, $average_wait) = @{$_};
|
||||
$longnames{$name} = "";
|
||||
}
|
||||
abbreviate(\%longnames, 2);
|
||||
foreach (@eventresults) {
|
||||
my ($event_no, $name, $total_waits, $total_timeouts,
|
||||
$time_waited, $time_waited_micro, $average_wait) = @{$_};
|
||||
my $shortname = $longnames{$name}->{abbreviation};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if ($params{selectname} && (
|
||||
(($params{selectname} !~ /^\d+$/) &&
|
||||
(! grep /^$params{selectname}$/, map { $longnames{$_}->{abbreviation} }
|
||||
keys %longnames) &&
|
||||
(lc $params{selectname} ne lc $name)) ||
|
||||
(($params{selectname} !~ /^\d+$/) &&
|
||||
(grep /^$params{selectname}$/, map { $longnames{$_}->{abbreviation} }
|
||||
keys %longnames) &&
|
||||
(lc $params{selectname} ne lc $shortname)) ||
|
||||
($params{selectname} =~ /^\d+$/ &&
|
||||
($params{selectname} != $event_no))));
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{shortname} = $shortname;
|
||||
$thisparams{event_id} = $event_no; # bei > 10.x unbedingt event_id aus db holen
|
||||
$thisparams{total_waits} = $total_waits;
|
||||
$thisparams{total_timeouts} = $total_timeouts;
|
||||
$thisparams{time_waited} = $time_waited;
|
||||
$thisparams{time_waited_micro} = $time_waited_micro;
|
||||
$thisparams{average_wait} = $average_wait;
|
||||
$thisparams{idle} = scalar(grep { lc $name =~ /$_/ } @idlewaits);
|
||||
my $event = DBD::Oracle::Server::Instance::Event->new(
|
||||
%thisparams);
|
||||
add_event($event);
|
||||
$num_events++;
|
||||
}
|
||||
if (! $num_events) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub begindiff {
|
||||
# liefere indices fuer das erste untersch. wort und innerhalb diesem das erste untersch. zeichen
|
||||
my @names = @_;
|
||||
my $len = 100;
|
||||
my $first_diff_word = 0;
|
||||
my $first_diff_pos = 0;
|
||||
my $smallest_wordcnt = (sort { $a->{wordcnt} <=> $b->{wordcnt} } @names)[0]->{wordcnt};
|
||||
foreach my $wordno (0..$smallest_wordcnt-1) {
|
||||
my $wordequal = 1;
|
||||
my $refword = @{$names[0]->{words}}[$wordno];
|
||||
foreach (@names) {
|
||||
if (@{$_->{words}}[$wordno] ne $refword) {
|
||||
$wordequal = 0;
|
||||
}
|
||||
}
|
||||
$first_diff_word = $wordno;
|
||||
if (! $wordequal) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $smallest_wordlen =
|
||||
length(${(sort { length(${$a->{words}}[$first_diff_word]) <=> length(${$b->{words}}[$first_diff_word]) } @names)[0]->{words}}[$first_diff_word]);
|
||||
foreach my $posno (0..$smallest_wordlen-1) {
|
||||
my $posequal = 1;
|
||||
my $refpos = substr(@{$names[0]->{words}}[$first_diff_word], $posno, 1);
|
||||
foreach (@names) {
|
||||
if (substr(@{$_->{words}}[$first_diff_word], $posno, 1) ne $refpos) {
|
||||
$posequal = 0;
|
||||
}
|
||||
}
|
||||
$first_diff_pos = $posno;
|
||||
if (! $posequal) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
return ($first_diff_word, $first_diff_pos);
|
||||
}
|
||||
|
||||
sub abbreviate {
|
||||
#
|
||||
# => zeiger auf hash, dessen keys lange namen sind
|
||||
# <= gleicher hash mit ausgefuellten eindeutigen values
|
||||
#
|
||||
my $names = shift;
|
||||
my %done = ();
|
||||
my $collisions = {};
|
||||
foreach my $long (keys %{$names}) {
|
||||
# erstmal das noetige werkzeug schmieden
|
||||
# und kurzbezeichnungen aus jeweils zwei zeichen bilden
|
||||
$names->{$long} = {};
|
||||
$names->{$long}->{words} = [
|
||||
map { lc }
|
||||
map { my $x = $_; $x =~ s/[()\/\-]//g; $x }
|
||||
map { /^\-$/ ? () : $_ }
|
||||
split(/_|\s+/, $long) ];
|
||||
$names->{$long}->{wordcnt} = scalar (@{$names->{$long}->{words}});
|
||||
$names->{$long}->{shortwords} = [ map { substr $_, 0, 2 } @{$names->{$long}->{words}} ];
|
||||
$names->{$long}->{abbreviation} = join("_", @{$names->{$long}->{shortwords}});
|
||||
$names->{$long}->{unique} = 1;
|
||||
}
|
||||
individualize($names, -1, -1);
|
||||
}
|
||||
|
||||
sub individualize {
|
||||
my $names = shift;
|
||||
my $delword = shift;
|
||||
my $delpos = shift;
|
||||
my %done = ();
|
||||
my $collisions = {};
|
||||
if ($delword >= 0 && $delpos >= 0) {
|
||||
# delpos ist die position mit dem ersten unterschied. kann fuer den kuerzesten string
|
||||
# schon nicht mehr existieren.
|
||||
map {
|
||||
if (length(${$names->{$_}->{words}}[$delword]) > 2) {
|
||||
|
||||
if (length(${$names->{$_}->{words}}[$delword]) == $delpos) {
|
||||
${$names->{$_}->{shortwords}}[$delword] =
|
||||
substr(${$names->{$_}->{words}}[$delword], 0, 2)
|
||||
} else {
|
||||
${$names->{$_}->{shortwords}}[$delword] =
|
||||
substr(${$names->{$_}->{words}}[$delword], 0, 1).
|
||||
substr(${$names->{$_}->{words}}[$delword], $delpos);
|
||||
}
|
||||
}
|
||||
} keys %{$names};
|
||||
}
|
||||
map { $names->{$_}->{abbreviation} = join("_", @{$names->{$_}->{shortwords}}) } keys %{$names};
|
||||
map { $done{$names->{$_}->{abbreviation}}++ } keys %{$names};
|
||||
map { $names->{$_}->{unique} = $done{$names->{$_}->{abbreviation}} > 1 ? 0 : 1 } keys %{$names};
|
||||
#
|
||||
# hash mit abkuerzung als key und array(langnamen, ...) als value.
|
||||
# diese sind nicht eindeutig und muessen noch geschickter abgekuerzt werden
|
||||
#
|
||||
foreach my $collision (map { $names->{$_}->{unique} ? () : $_ } keys %{$names}) {
|
||||
if (! exists $collisions->{$names->{$collision}->{abbreviation}}) {
|
||||
$collisions->{$names->{$collision}->{abbreviation}} = [];
|
||||
}
|
||||
push(@{$collisions->{$names->{$collision}->{abbreviation}}}, $collision);
|
||||
}
|
||||
#
|
||||
# jeweils gruppen mit gemeinsamer, mehrdeutiger abkuerzung werden nochmals gerechnet
|
||||
#
|
||||
foreach my $collision (keys %{$collisions}) {
|
||||
my $newnames = {};
|
||||
# hilfestellung, wo es unterschiede gibt
|
||||
my($wordnum, $posnum) = begindiff(map { $names->{$_} } @{$collisions->{$collision}});
|
||||
map { $newnames->{$_} =
|
||||
$names->{$_} } grep { $names->{$_}->{abbreviation} eq $collision } keys %{$names};
|
||||
individualize($newnames, $wordnum, $posnum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
shortname => $params{shortname},
|
||||
event_id => $params{event_id}, # > 10.x
|
||||
total_waits => $params{total_waits},
|
||||
total_timeouts => $params{total_timeouts},
|
||||
time_waited => $params{time_waited}, # divide by 100
|
||||
time_waited_micro => $params{time_waited_micro}, # divide by 1000000
|
||||
average_wait => $params{average_wait},
|
||||
idle => $params{idle} || 0,
|
||||
waits_per_sec => undef,
|
||||
percent_waited => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
#$self->{name} =~ s/^\s+//;
|
||||
#$self->{name} =~ s/\s+$//;
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::event::wait/) {
|
||||
if (! defined $self->{total_waits}) {
|
||||
$self->add_nagios_critical("unable to get event info");
|
||||
} else {
|
||||
$params{differenciator} = lc $self->{name};
|
||||
$self->valdiff(\%params, qw(total_waits total_timeouts time_waited
|
||||
time_waited_micro average_wait));
|
||||
$self->{waits_per_sec} =
|
||||
$self->{delta_total_waits} / $self->{delta_timestamp};
|
||||
$self->{percent_waited} =
|
||||
100 * ($self->{delta_time_waited_micro} / 1000000 ) / $self->{delta_timestamp};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::event::waits/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{waits_per_sec}, "10", "100"),
|
||||
sprintf "%s : %.6f waits/sec", $self->{name}, $self->{waits_per_sec});
|
||||
$self->add_perfdata(sprintf "'%s_waits_per_sec'=%.6f;%s;%s",
|
||||
$self->{name},
|
||||
$self->{waits_per_sec},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~ /server::instance::event::waiting/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{percent_waited}, "0.1", "0.5"),
|
||||
sprintf "%s waits %.6f%% of the time", $self->{name}, $self->{percent_waited});
|
||||
$self->add_perfdata(sprintf "'%s_percent_waited'=%.6f%%;%s;%s",
|
||||
$self->{name},
|
||||
$self->{percent_waited},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
@ -0,0 +1,112 @@
|
||||
package DBD::Oracle::Server::Instance::PGA;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
internals => undef,
|
||||
pgas => [],
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::pga/) {
|
||||
$self->{internals} =
|
||||
DBD::Oracle::Server::Instance::PGA::Internals->new(%params);
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /server::instance::pga/) {
|
||||
$self->{internals}->nagios(%params);
|
||||
$self->merge_nagios($self->{internals});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
package DBD::Oracle::Server::Instance::PGA::Internals;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::PGA);
|
||||
|
||||
my $internals; # singleton, nur ein einziges mal instantiierbar
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
unless ($internals) {
|
||||
$internals = {
|
||||
handle => $params{handle},
|
||||
in_memory_sorts => undef,
|
||||
in_disk_sorts => undef,
|
||||
in_memory_sort_ratio => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless($internals, $class);
|
||||
$internals->init(%params);
|
||||
}
|
||||
return($internals);
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->debug("enter init");
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::pga::inmemorysortratio/) {
|
||||
($self->{in_memory_sorts}, $self->{in_disk_sorts}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT mem.value, dsk.value
|
||||
FROM v$sysstat mem, v$sysstat dsk
|
||||
WHERE mem.name='sorts (memory)' AND dsk.name='sorts (disk)'
|
||||
});
|
||||
if (! defined $self->{in_memory_sorts}) {
|
||||
$self->add_nagios_critical("unable to get pga ratio");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(in_memory_sorts in_disk_sorts));
|
||||
$self->{in_memory_sort_ratio} =
|
||||
($self->{delta_in_memory_sorts} + $self->{delta_in_disk_sorts}) == 0 ? 100 :
|
||||
100 * $self->{delta_in_memory_sorts} /
|
||||
($self->{delta_in_memory_sorts} + $self->{delta_in_disk_sorts});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::pga::inmemorysortratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{in_memory_sort_ratio}, "99:", "90:"),
|
||||
sprintf "PGA in-memory sort ratio %.2f%%",
|
||||
$self->{in_memory_sort_ratio});
|
||||
$self->add_perfdata(sprintf "pga_in_memory_sort_ratio=%.2f%%;%s;%s;0;100",
|
||||
$self->{in_memory_sort_ratio},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,95 @@
|
||||
package DBD::Oracle::Server::Instance::SGA;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
data_buffer => undef,
|
||||
shared_pool => undef,
|
||||
latches => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga::databuffer/) {
|
||||
$self->{data_buffer} = DBD::Oracle::Server::Instance::SGA::DataBuffer->new(
|
||||
%params);
|
||||
} elsif ($params{mode} =~ /server::instance::sga::sharedpool/) {
|
||||
$self->{shared_pool} = DBD::Oracle::Server::Instance::SGA::SharedPool->new(
|
||||
%params);
|
||||
} elsif ($params{mode} =~ /server::instance::sga::latch/) {
|
||||
DBD::Oracle::Server::Instance::SGA::Latch::init_latches(%params);
|
||||
if (my @latches =
|
||||
DBD::Oracle::Server::Instance::SGA::Latch::return_latches(%params)) {
|
||||
$self->{latches} = \@latches;
|
||||
} else {
|
||||
$self->add_nagios_critical("unable to aquire latch info");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sga::redolog/) {
|
||||
$self->{redo_log_buffer} =
|
||||
DBD::Oracle::Server::Instance::SGA::RedoLogBuffer->new(%params);
|
||||
} elsif ($params{mode} =~ /server::instance::sga::rollbacksegments/) {
|
||||
$self->{rollback_segments} =
|
||||
DBD::Oracle::Server::Instance::SGA::RollbackSegments->new(%params);
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /server::instance::sga::databuffer/) {
|
||||
$self->{data_buffer}->nagios(%params);
|
||||
$self->merge_nagios($self->{data_buffer});
|
||||
} elsif ($params{mode} =~ /server::instance::sga::sharedpool/) {
|
||||
$self->{shared_pool}->nagios(%params);
|
||||
$self->merge_nagios($self->{shared_pool});
|
||||
} elsif ($params{mode} =~ /server::instance::sga::latch::hitratio/) {
|
||||
if (! $self->{nagios_level}) {
|
||||
my $hitratio = 0;
|
||||
foreach (@{$self->{latches}}) {
|
||||
$hitratio = $hitratio + $_->{hitratio};
|
||||
}
|
||||
$hitratio = $hitratio / scalar(@{$self->{latches}});
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($hitratio, "98:", "95:"),
|
||||
sprintf "SGA latches hit ratio %.2f%%", $hitratio);
|
||||
$self->add_perfdata(sprintf "sga_latches_hit_ratio=%.2f%%;%s;%s",
|
||||
$hitratio, $self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sga::latch::listlatches/) {
|
||||
foreach (sort { $a->{number} <=> $b->{number} } @{$self->{latches}}) {
|
||||
printf "%03d %s\n", $_->{number}, $_->{name};
|
||||
}
|
||||
$self->add_nagios_ok("have fun");
|
||||
} elsif ($params{mode} =~ /server::instance::sga::latch/) {
|
||||
foreach (@{$self->{latches}}) {
|
||||
$_->nagios(%params);
|
||||
$self->merge_nagios($_);
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sga::redologbuffer/) {
|
||||
$self->{redo_log_buffer}->nagios(%params);
|
||||
$self->merge_nagios($self->{redo_log_buffer});
|
||||
} elsif ($params{mode} =~ /server::instance::sga::rollbacksegments/) {
|
||||
$self->{rollback_segments}->nagios(%params);
|
||||
$self->merge_nagios($self->{rollback_segments});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,75 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::DataBuffer;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
sum_physical_reads => undef,
|
||||
sum_physical_reads_direct => undef,
|
||||
sum_physical_reads_direct_lob => undef,
|
||||
sum_session_logical_reads => undef,
|
||||
hitratio => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga::databuffer::hitratio/) {
|
||||
($self->{sum_physical_reads}, $self->{sum_physical_reads_direct},
|
||||
$self->{sum_physical_reads_direct_lob},
|
||||
$self->{sum_session_logical_reads}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(DECODE(name, 'physical reads', value, 0)),
|
||||
SUM(DECODE(name, 'physical reads direct', value, 0)),
|
||||
SUM(DECODE(name, 'physical reads direct (lob)', value, 0)),
|
||||
SUM(DECODE(name, 'session logical reads', value, 0))
|
||||
FROM sys.v_$sysstat
|
||||
});
|
||||
if (! defined $self->{sum_physical_reads}) {
|
||||
$self->add_nagios_critical("unable to get sga buffer cache");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(sum_physical_reads sum_physical_reads_direct
|
||||
sum_physical_reads_direct_lob sum_session_logical_reads));
|
||||
$self->{hitratio} = $self->{delta_sum_session_logical_reads} ?
|
||||
100 - 100 * ((
|
||||
$self->{delta_sum_physical_reads} -
|
||||
$self->{delta_sum_physical_reads_direct_lob} -
|
||||
$self->{delta_sum_physical_reads_direct}) /
|
||||
$self->{delta_sum_session_logical_reads}) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::sga::databuffer::hitratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{hitratio}, "98:", "95:"),
|
||||
sprintf "SGA data buffer hit ratio %.2f%%", $self->{hitratio});
|
||||
$self->add_perfdata(sprintf "sga_data_buffer_hit_ratio=%.2f%%;%s;%s",
|
||||
$self->{hitratio},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,160 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::Latch;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @latches = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_latch {
|
||||
push(@latches, shift);
|
||||
}
|
||||
|
||||
sub return_latches {
|
||||
my %params = @_;
|
||||
if ($params{mode} =~ /server::instance::sga::latch::contention/) {
|
||||
return reverse
|
||||
sort { $a->{contention} <=> $b->{contention} } @latches;
|
||||
} else {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @latches;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_latches {
|
||||
my %params = @_;
|
||||
my $num_latches = 0;
|
||||
if (($params{mode} =~ /server::instance::sga::latch::contention/) ||
|
||||
($params{mode} =~ /server::instance::sga::latch::waiting/) ||
|
||||
($params{mode} =~ /server::instance::sga::latch::hitratio/) ||
|
||||
($params{mode} =~ /server::instance::sga::latch::listlatches/)) {
|
||||
my $sumsleeps = $params{handle}->fetchrow_array(q{
|
||||
SELECT SUM(sleeps) FROM v$latch
|
||||
});
|
||||
my @latchresult = $params{handle}->fetchall_array(q{
|
||||
SELECT latch#, name, gets, sleeps, misses, wait_time
|
||||
FROM v$latch
|
||||
});
|
||||
foreach (@latchresult) {
|
||||
my ($number, $name, $gets, $sleeps, $misses, $wait_time) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if ($params{selectname} && (
|
||||
($params{selectname} !~ /^\d+$/ && (lc $params{selectname} ne lc $name)) ||
|
||||
($params{selectname} =~ /^\d+$/ && ($params{selectname} != $number))));
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{number} = $number;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{gets} = $gets;
|
||||
$thisparams{misses} = $misses;
|
||||
$thisparams{sleeps} = $sleeps;
|
||||
$thisparams{wait_time} = $wait_time;
|
||||
$thisparams{sumsleeps} = $sumsleeps;
|
||||
my $latch = DBD::Oracle::Server::Instance::SGA::Latch->new(
|
||||
%thisparams);
|
||||
add_latch($latch);
|
||||
$num_latches++;
|
||||
}
|
||||
if (! $num_latches) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
number => $params{number},
|
||||
name => $params{name},
|
||||
gets => $params{gets},
|
||||
misses => $params{misses},
|
||||
sleeps => $params{sleeps},
|
||||
wait_time => $params{wait_time},
|
||||
sumsleeps => $params{sumsleeps},
|
||||
hitratio => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::latch::hitratio/) {
|
||||
if (! defined $self->{gets}) {
|
||||
$self->add_nagios_critical(
|
||||
sprintf "unable to get sga latches %s", $self->{name});
|
||||
} else {
|
||||
$params{differenciator} = lc $self->{name}.$self->{number};
|
||||
$self->valdiff(\%params, qw(gets misses));
|
||||
$self->{hitratio} = $self->{delta_gets} ?
|
||||
100 * ($self->{delta_gets} - $self->{delta_misses}) / $self->{delta_gets} : 100;
|
||||
}
|
||||
} elsif (($params{mode} =~ /server::instance::sga::latch::contention/) ||
|
||||
($params{mode} =~ /server::instance::sga::latch::waiting/)) {
|
||||
if (! defined $self->{gets}) {
|
||||
$self->add_nagios_critical(
|
||||
sprintf "unable to get sga latches %s", $self->{name});
|
||||
} else {
|
||||
$params{differenciator} = lc $self->{name}.$self->{number};
|
||||
$self->valdiff(\%params, qw(gets sleeps misses wait_time sumsleeps));
|
||||
# latch contention
|
||||
$self->{contention} = $self->{delta_gets} ?
|
||||
100 * $self->{delta_misses} / $self->{delta_gets} : 0;
|
||||
# latch percent of sleep during the elapsed time
|
||||
$self->{sleep_share} = $self->{delta_wait_time} ?
|
||||
((100 * $self->{wait_time}) / 1000) / $self->{delta_timestamp} : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::latch::hitratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{hitratio}, "98:", "95:"),
|
||||
sprintf "SGA latches hit ratio %.2f%%", $self->{hitratio});
|
||||
$self->add_perfdata(sprintf "sga_latches_hit_ratio=%.2f%%;%s;%s",
|
||||
$self->{hitratio}, $self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::latch::contention/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{contention}, "1", "2"),
|
||||
sprintf "SGA latch %s (#%d) contention %.2f%%",
|
||||
$self->{name}, $self->{number}, $self->{contention});
|
||||
$self->add_perfdata(sprintf "'latch_%d_contention'=%.2f%%;%s;%s",
|
||||
$self->{number}, $self->{contention}, $self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "'latch_%d_gets'=%u",
|
||||
$self->{number}, $self->{delta_gets});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::latch::waiting/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{sleep_share}, "0.1", "1"),
|
||||
sprintf "SGA latch %s (#%d) sleeping %.6f%% of the time",
|
||||
$self->{name}, $self->{number}, $self->{sleep_share});
|
||||
$self->add_perfdata(sprintf "'latch_%d_sleep_share'=%.6f%%;%s;%s;0;100",
|
||||
$self->{number}, $self->{sleep_share}, $self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,260 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::RedoLogBuffer;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
last_switch_interval => undef,
|
||||
redo_buffer_allocation_retries => undef,
|
||||
redo_entries => undef,
|
||||
retry_ratio => undef,
|
||||
redo_size => undef,
|
||||
redo_size_per_sec => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga::redologbuffer::switchinterval/) {
|
||||
if ($self->instance_rac()) {
|
||||
eval {
|
||||
# alles was jemals geswitcht hat, letzter switch, zweitletzter switch
|
||||
# jetzt - letzter switch = mindestlaenge des naechsten intervals
|
||||
# wenn das lang genug ist, dann war das letzte, kurze intervall
|
||||
# wohl nur ein ausreisser oder manueller switch
|
||||
# derzeit laufendes intervall, letztes intervall, vorletztes intervall
|
||||
($self->{next_switch_interval}, $self->{last_switch_interval}, $self->{nextto_last_switch_interval}) =
|
||||
$self->{handle}->fetchrow_array(q {
|
||||
WITH temptab AS
|
||||
(
|
||||
SELECT sequence#, first_time FROM sys.v_$log WHERE status = 'CURRENT'
|
||||
AND thread# = ?
|
||||
UNION ALL
|
||||
SELECT sequence#, first_time FROM sys.v_$log_history
|
||||
WHERE thread# = ?
|
||||
ORDER BY first_time DESC
|
||||
)
|
||||
SELECT
|
||||
(sysdate - a.first_time) * 1440 * 60 thisinterval,
|
||||
(a.first_time - b.first_time) * 1440 * 60 lastinterval,
|
||||
(b.first_time - c.first_time) * 1440 * 60 nexttolastinterval
|
||||
FROM
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 1
|
||||
) WHERE irow = 1
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) a,
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 2
|
||||
) WHERE irow = 2
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) b,
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 3
|
||||
) WHERE irow = 3
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) c
|
||||
}, $self->instance_thread(), $self->instance_thread());
|
||||
};
|
||||
} else {
|
||||
eval {
|
||||
# alles was jemals geswitcht hat, letzter switch, zweitletzter switch
|
||||
# jetzt - letzter switch = mindestlaenge des naechsten intervals
|
||||
# wenn das lang genug ist, dann war das letzte, kurze intervall
|
||||
# wohl nur ein ausreisser oder manueller switch
|
||||
# derzeit laufendes intervall, letztes intervall, vorletztes intervall
|
||||
($self->{next_switch_interval}, $self->{last_switch_interval}, $self->{nextto_last_switch_interval}) =
|
||||
$self->{handle}->fetchrow_array(q {
|
||||
WITH temptab AS
|
||||
(
|
||||
SELECT sequence#, first_time FROM sys.v_$log WHERE status = 'CURRENT'
|
||||
UNION ALL
|
||||
SELECT sequence#, first_time FROM sys.v_$log_history ORDER BY first_time DESC
|
||||
)
|
||||
SELECT
|
||||
(sysdate - a.first_time) * 1440 * 60 thisinterval,
|
||||
(a.first_time - b.first_time) * 1440 * 60 lastinterval,
|
||||
(b.first_time - c.first_time) * 1440 * 60 nexttolastinterval
|
||||
FROM
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 1
|
||||
) WHERE irow = 1
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) a,
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 2
|
||||
) WHERE irow = 2
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) b,
|
||||
(
|
||||
SELECT NVL(
|
||||
(
|
||||
SELECT first_time FROM (
|
||||
SELECT first_time, rownum AS irow FROM temptab WHERE ROWNUM <= 3
|
||||
) WHERE irow = 3
|
||||
) , to_date('20090624','YYYYMMDD')) as first_time FROM dual
|
||||
) c
|
||||
});
|
||||
};
|
||||
}
|
||||
if (! defined $self->{last_switch_interval}) {
|
||||
$self->add_nagios_critical(
|
||||
sprintf "unable to get last switch interval");
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sga::redologbuffer::retryratio/) {
|
||||
($self->{redo_buffer_allocation_retries}, $self->{redo_entries}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT a.value, b.value
|
||||
FROM v$sysstat a, v$sysstat b
|
||||
WHERE a.name = 'redo buffer allocation retries'
|
||||
AND b.name = 'redo entries'
|
||||
});
|
||||
if (! defined $self->{redo_buffer_allocation_retries}) {
|
||||
$self->add_nagios_critical("unable to get retry ratio");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(redo_buffer_allocation_retries redo_entries));
|
||||
$self->{retry_ratio} = $self->{delta_redo_entries} ?
|
||||
100 * $self->{delta_redo_buffer_allocation_retries} / $self->{delta_redo_entries} : 0;
|
||||
}
|
||||
} elsif ($params{mode} =~ /server::instance::sga::redologbuffer::iotraffic/) {
|
||||
$self->{redo_size} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT value FROM v$sysstat WHERE name = 'redo size'
|
||||
});
|
||||
if (! defined $self->{redo_size}) {
|
||||
$self->add_nagios_critical("unable to get redo size");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(redo_size));
|
||||
$self->{redo_size_per_sec} =
|
||||
$self->{delta_redo_size} / $self->{delta_timestamp};
|
||||
# Megabytes / sec
|
||||
$self->{redo_size_per_sec} = $self->{redo_size_per_sec} / 1048576;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::redologbuffer::switchinterval/) {
|
||||
my $nextlevel = $self->check_thresholds($self->{next_switch_interval}, "600:", "60:");
|
||||
my $nexttolastlevel = $self->check_thresholds($self->{nextto_last_switch_interval}, "600:", "60:");
|
||||
my $lastlevel = $self->check_thresholds($self->{last_switch_interval}, "600:", "60:");
|
||||
if ($lastlevel) {
|
||||
# nachschauen, ob sich die situation schon entspannt hat
|
||||
if ($nextlevel == 2) {
|
||||
# das riecht nach aerger. kann zwar auch daran liegen, weil der check unmittelbar nach dem kurzen switch
|
||||
# ausgefuehrt wird, aber dann bleibts beim soft-hard und beim retry schauts schon besser aus.
|
||||
if ($self->{next_switch_interval} < 0) {
|
||||
# jetzt geht gar nichts mehr
|
||||
$self->add_nagios(
|
||||
2,
|
||||
"Found a redo log with a timestamp in the future!!");
|
||||
$self->{next_switch_interval} = 0;
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
# 10: minutes, 1: minute = 600:, 60:
|
||||
$nextlevel,
|
||||
sprintf "Last redo log file switch interval was %d minutes%s. Next interval presumably >%d minutes",
|
||||
$self->{last_switch_interval} / 60,
|
||||
$self->instance_rac() ? sprintf " (thread %d)", $self->instance_thread() : "",
|
||||
$self->{next_switch_interval} / 60);
|
||||
}
|
||||
} elsif ($nextlevel == 1) {
|
||||
# das kommt daher, weil retry_interval < warningthreshold
|
||||
if ($nexttolastlevel) {
|
||||
# aber vorher war auch schon was faul. da braut sich vieleicht was zusammen.
|
||||
# die warnung ist sicher berechtigt.
|
||||
$self->add_nagios(
|
||||
$nextlevel,
|
||||
sprintf "Last redo log file switch interval was %d minutes%s. Next interval presumably >%d minutes. Second incident in a row.",
|
||||
$self->{last_switch_interval} / 60,
|
||||
$self->instance_rac() ? sprintf " (thread %d)", $self->instance_thread() : "",
|
||||
$self->{next_switch_interval} / 60);
|
||||
} else {
|
||||
# hier bin ich grosszuegig. vorletztes intervall war ok, letztes intervall war nicht ok.
|
||||
# ich rechne mir also chancen aus, dass $nextlevel nur auf warning ist, weil der retry zu schnell
|
||||
# nach dem letzten switch stattfindet. sollte sich entspannen und wenns wirklich ein problem gibt
|
||||
# dann kommt sowieso wieder ein switch. also erstmal ok.
|
||||
$self->add_nagios(
|
||||
0,
|
||||
sprintf "Last redo log file switch interval was %d minutes%s. Next interval presumably >%d minutes. Probably a single incident.",
|
||||
$self->{last_switch_interval} / 60,
|
||||
$self->instance_rac() ? sprintf " (thread %d)", $self->instance_thread() : "",
|
||||
$self->{next_switch_interval} / 60);
|
||||
}
|
||||
} else {
|
||||
# war wohl ein einzelfall. also gehen wir davon aus, dass das warninglevel nur wegen des retrys
|
||||
# unterschritten wurde und der naechste switch wieder lange genug sein wird
|
||||
$self->add_nagios(
|
||||
$nextlevel, # sollte 0 sein
|
||||
sprintf "Last redo log file switch interval was %d minutes%s. Next interval presumably >%d minutes",
|
||||
$self->{last_switch_interval} / 60,
|
||||
$self->instance_rac() ? sprintf " (thread %d)", $self->instance_thread() : "",
|
||||
$self->{next_switch_interval} / 60);
|
||||
}
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
$lastlevel,
|
||||
sprintf "Last redo log file switch interval was %d minutes%s. Next interval presumably >%d minutes",
|
||||
$self->{last_switch_interval} / 60,
|
||||
$self->instance_rac() ? sprintf " (thread %d)", $self->instance_thread() : "",
|
||||
$self->{next_switch_interval} / 60);
|
||||
}
|
||||
$self->add_perfdata(sprintf "redo_log_file_switch_interval=%ds;%s;%s",
|
||||
$self->{last_switch_interval},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::redologbuffer::retryratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{retry_ratio}, "1", "10"),
|
||||
sprintf "Redo log retry ratio is %.6f%%",$self->{retry_ratio});
|
||||
$self->add_perfdata(sprintf "redo_log_retry_ratio=%.6f%%;%s;%s",
|
||||
$self->{retry_ratio},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::redologbuffer::iotraffic/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{redo_size_per_sec}, "100", "200"),
|
||||
sprintf "Redo log io is %.6f MB/sec", $self->{redo_size_per_sec});
|
||||
$self->add_perfdata(sprintf "redo_log_io_per_sec=%.6f;%s;%s",
|
||||
$self->{redo_size_per_sec},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,244 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::RollbackSegments;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
# only create one object with new which stands for all rollback segments
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
gets => undef,
|
||||
waits => undef,
|
||||
wraps => undef,
|
||||
extends => undef,
|
||||
undo_header_waits => undef,
|
||||
undo_block_waits => undef,
|
||||
rollback_segment_hit_ratio => undef,
|
||||
rollback_segment_header_contention => undef,
|
||||
rollback_segment_block_contention => undef,
|
||||
rollback_segment_extents => undef,
|
||||
rollback_segment_wraps => undef,
|
||||
rollback_segment_wraps_persec => undef,
|
||||
rollback_segment_extends => undef,
|
||||
rollback_segment_extends_persec => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga::rollbacksegments::wraps/) {
|
||||
$self->{wraps} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(wraps) FROM v$rollstat
|
||||
});
|
||||
if (! defined $self->{wraps}) {
|
||||
$self->add_nagios_critical("unable to get rollback segments stats");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(wraps));
|
||||
$self->{rollback_segment_wraps} = $self->{delta_wraps};
|
||||
$self->{rollback_segment_wraps_persec} = $self->{delta_wraps} /
|
||||
$self->{delta_timestamp};
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::extends/) {
|
||||
$self->{extends} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(extends) FROM v$rollstat
|
||||
});
|
||||
if (! defined $self->{extends}) {
|
||||
$self->add_nagios_critical("unable to get rollback segments stats");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(extends));
|
||||
$self->{rollback_segment_extends} = $self->{delta_extends};
|
||||
$self->{rollback_segment_extends_persec} = $self->{delta_extends} /
|
||||
$self->{delta_timestamp};
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::headercontention/) {
|
||||
($self->{undo_header_waits}, $self->{waits}) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT (
|
||||
SELECT SUM(count)
|
||||
FROM v$waitstat
|
||||
WHERE class = 'undo header' OR class = 'system undo header'
|
||||
) undo, (
|
||||
SELECT SUM(count)
|
||||
FROM v$waitstat
|
||||
) complete
|
||||
FROM DUAL
|
||||
});
|
||||
if (! defined $self->{undo_header_waits}) {
|
||||
$self->add_nagios_critical("unable to get rollback segments wait stats");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(undo_header_waits waits));
|
||||
$self->{rollback_segment_header_contention} =
|
||||
$self->{delta_waits} ? 100 * $self->{delta_undo_header_waits} / $self->{delta_waits} : 0;
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::blockcontention/) {
|
||||
($self->{undo_block_waits}, $self->{waits}) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT (
|
||||
SELECT SUM(count)
|
||||
FROM v$waitstat
|
||||
WHERE class = 'undo block' OR class = 'system undo block'
|
||||
) undo, (
|
||||
SELECT SUM(count)
|
||||
FROM v$waitstat
|
||||
) complete
|
||||
FROM DUAL
|
||||
});
|
||||
if (! defined $self->{undo_block_waits}) {
|
||||
$self->add_nagios_critical("unable to get rollback segments wait stats");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(undo_block_waits waits));
|
||||
$self->{rollback_segment_block_contention} =
|
||||
$self->{delta_waits} ? 100 * $self->{delta_undo_block_waits} / $self->{delta_waits} : 0;
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::hitratio/) {
|
||||
($self->{waits}, $self->{gets}) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(waits), SUM(gets) FROM v$rollstat
|
||||
});
|
||||
if (! defined $self->{gets}) {
|
||||
$self->add_nagios_critical("unable to get rollback segments wait stats");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(waits gets));
|
||||
$self->{rollback_segment_hit_ratio} = $self->{delta_gets} ?
|
||||
100 - 100 * $self->{delta_waits} / $self->{delta_gets} : 100;
|
||||
}
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::avgactivesize/) {
|
||||
if ($params{selectname}) {
|
||||
$self->{rollback_segment_optimization_size} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT AVG(s.optsize / 1048576) optmization_size
|
||||
FROM v$rollstat s, v$rollname n
|
||||
WHERE s.usn = n.usn AND n.name != 'SYSTEM' AND n.name = ?
|
||||
}, $params{selectname}) || 0;
|
||||
$self->{rollback_segment_average_active} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT AVG(s.aveactive / 1048576) average_active
|
||||
FROM v$rollstat s, v$rollname n
|
||||
WHERE s.usn = n.usn AND n.name != 'SYSTEM' AND n.name = ?
|
||||
}, $params{selectname}) || 0;
|
||||
} else {
|
||||
$self->{rollback_segment_optimization_size} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT AVG(s.optsize / 1048576) optmization_size
|
||||
FROM v$rollstat s, v$rollname n
|
||||
WHERE s.usn = n.usn AND n.name != 'SYSTEM'
|
||||
}) || 0;
|
||||
$self->{rollback_segment_average_active} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT AVG(s.aveactive / 1048576) average_active
|
||||
FROM v$rollstat s, v$rollname n
|
||||
WHERE s.usn = n.usn AND n.name != 'SYSTEM'
|
||||
}) || 0;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::sga::rollbacksegments::wraps/) {
|
||||
if ($params{absolute}) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_wraps}, "1", "100"),
|
||||
sprintf "Rollback segment wraps %d times",
|
||||
$self->{rollback_segment_wraps});
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_wraps_persec}, "1", "100"),
|
||||
sprintf "Rollback segment wraps %.2f/sec",
|
||||
$self->{rollback_segment_wraps_persec});
|
||||
}
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_wraps=%d;%s;%s",
|
||||
$self->{rollback_segment_wraps},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_wraps_rate=%.2f;%s;%s",
|
||||
$self->{rollback_segment_wraps_persec},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::extends/) {
|
||||
if ($params{absolute}) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_extends}, "1", "100"),
|
||||
sprintf "Rollback segment extends %d times",
|
||||
$self->{rollback_segment_extends});
|
||||
} else {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_extends_persec}, "1", "100"),
|
||||
sprintf "Rollback segment extends %.2f/sec",
|
||||
$self->{rollback_segment_extends_persec});
|
||||
}
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_extends=%d;%s;%s",
|
||||
$self->{rollback_segment_extends},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_extends_rate=%.2f;%s;%s",
|
||||
$self->{rollback_segment_extends_persec},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::headercontention/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_header_contention}, "1", "2"),
|
||||
sprintf "Rollback segment header contention is %.2f%%",
|
||||
$self->{rollback_segment_header_contention});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_header_contention=%.2f%%;%s;%s",
|
||||
$self->{rollback_segment_header_contention},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::blockcontention/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_block_contention}, "1", "2"),
|
||||
sprintf "Rollback segment block contention is %.2f%%",
|
||||
$self->{rollback_segment_block_contention});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_block_contention=%.2f%%;%s;%s",
|
||||
$self->{rollback_segment_block_contention},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::hitratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds(
|
||||
$self->{rollback_segment_hit_ratio}, "99:", "98:"),
|
||||
sprintf "Rollback segment hit ratio is %.2f%%",
|
||||
$self->{rollback_segment_hit_ratio});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_hit_ratio=%.2f%%;%s;%s",
|
||||
$self->{rollback_segment_hit_ratio},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} =~
|
||||
/server::instance::sga::rollbacksegments::avgactivesize/) {
|
||||
$self->add_nagios_ok(sprintf "Rollback segment average size %.2f MB",
|
||||
$self->{rollback_segment_average_active});
|
||||
$self->add_perfdata(
|
||||
sprintf "rollback_segment_avgsize=%.2f rollback_segment_optsize=%.2f",
|
||||
$self->{rollback_segment_average_active},
|
||||
$self->{rollback_segment_optimization_size});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,149 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::SharedPool;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
free => undef,
|
||||
reloads => undef,
|
||||
pins => undef,
|
||||
handle => $params{handle},
|
||||
library_cache => undef,
|
||||
dictionary_cache => undef,
|
||||
parse_soft => undef,
|
||||
parse_hard => undef,
|
||||
parse_failures => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sga::sharedpool::librarycache/) {
|
||||
$self->{library_cache} =
|
||||
DBD::Oracle::Server::Instance::SGA::SharedPool::LibraryCache->new(
|
||||
%params);
|
||||
} elsif ($params{mode} =~ /server::instance::sga::sharedpool::dictionarycache/) {
|
||||
$self->{dictionary_cache} =
|
||||
DBD::Oracle::Server::Instance::SGA::SharedPool::DictionaryCache->new(
|
||||
%params);
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::free") {
|
||||
$self->init_shared_pool_free(%params);
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::reloads") {
|
||||
$self->init_shared_pool_reloads(%params);
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::softparse") {
|
||||
$self->init_shared_pool_parser(%params);
|
||||
}
|
||||
}
|
||||
|
||||
sub init_shared_pool_reloads {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
($self->{reloads}, $self->{pins}) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(reloads), SUM(pins)
|
||||
FROM v$librarycache
|
||||
WHERE namespace IN ('SQL AREA','TABLE/PROCEDURE','BODY','TRIGGER')
|
||||
});
|
||||
if (! defined $self->{reloads}) {
|
||||
$self->add_nagios_critical("unable to get sga reloads");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(reloads pins));
|
||||
$self->{reload_ratio} = $self->{delta_pins} ?
|
||||
100 * $self->{delta_reloads} / $self->{delta_pins} : 100;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_shared_pool_free {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (DBD::Oracle::Server::return_first_server()->version_is_minimum("9.x")) {
|
||||
$self->{free_percent} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT ROUND(a.bytes / b.sm * 100,2) FROM
|
||||
(SELECT bytes FROM v$sgastat
|
||||
WHERE name='free memory' AND pool='shared pool') a,
|
||||
(SELECT SUM(bytes) sm FROM v$sgastat
|
||||
WHERE pool = 'shared pool' AND bytes <=
|
||||
(SELECT bytes FROM v$sgastat
|
||||
WHERE name='free memory' AND pool='shared pool')) b
|
||||
});
|
||||
} else {
|
||||
# i don't know if the above code works for 8.x, so i leave the old one here
|
||||
$self->{free_percent} = $self->{handle}->fetchrow_array(q{
|
||||
SELECT ROUND((SUM(DECODE(name, 'free memory', bytes, 0)) /
|
||||
SUM(bytes)) * 100,2) FROM v$sgastat where pool = 'shared pool'
|
||||
});
|
||||
}
|
||||
if (! defined $self->{free_percent}) {
|
||||
$self->add_nagios_critical("unable to get sga free");
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub init_shared_pool_parser {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
($self->{parse_total}, $self->{parse_hard}, $self->{parse_failures}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT
|
||||
(SELECT value FROM v$sysstat WHERE name = 'parse count (total)'),
|
||||
(SELECT value FROM v$sysstat WHERE name = 'parse count (hard)'),
|
||||
(SELECT value FROM v$sysstat WHERE name = 'parse count (failures)')
|
||||
FROM DUAL
|
||||
});
|
||||
if (! defined $self->{parse_total}) {
|
||||
$self->add_nagios_critical("unable to get parser");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(parse_total parse_hard parse_failures));
|
||||
$self->{parse_soft_ratio} = $self->{delta_parse_total} ?
|
||||
100 * ($self->{delta_parse_total} - $self->{delta_parse_hard}) /
|
||||
$self->{delta_parse_total} : 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::sga::sharedpool::librarycache/) {
|
||||
$self->{library_cache}->nagios(%params);
|
||||
$self->merge_nagios($self->{library_cache});
|
||||
} elsif ($params{mode} =~ /server::instance::sga::sharedpool::dictionarycache/) {
|
||||
$self->{dictionary_cache}->nagios(%params);
|
||||
$self->merge_nagios($self->{dictionary_cache});
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::free") {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{free_percent}, "10:", "5:"),
|
||||
sprintf "SGA shared pool free %.2f%%", $self->{free_percent});
|
||||
$self->add_perfdata(sprintf "sga_shared_pool_free=%.2f%%;%s;%s",
|
||||
$self->{free_percent}, $self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::reloads") {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{reload_ratio}, "1", "10"),
|
||||
sprintf "SGA shared pool reload ratio %.2f%%", $self->{reload_ratio});
|
||||
$self->add_perfdata(sprintf "sga_shared_pool_reload_ratio=%.2f%%;%s;%s",
|
||||
$self->{reload_ratio}, $self->{warningrange}, $self->{criticalrange});
|
||||
} elsif ($params{mode} eq "server::instance::sga::sharedpool::softparse") {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds( $self->{parse_soft_ratio}, "98:", "90:"),
|
||||
sprintf "Soft parse ratio %.2f%%", $self->{parse_soft_ratio});
|
||||
$self->add_perfdata(sprintf "soft_parse_ratio=%.2f%%;%s;%s",
|
||||
$self->{parse_soft_ratio},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::SharedPool::DictionaryCache;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA::SharedPool);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
sum_gethits => undef,
|
||||
sum_gets => undef,
|
||||
hitratio => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::sharedpool::dictionarycache::hitratio/) {
|
||||
($self->{sum_gets}, $self->{sum_gethits}) =
|
||||
$self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(gets), SUM(gets-getmisses) FROM v$rowcache
|
||||
});
|
||||
if (! defined $self->{sum_gets}) {
|
||||
$self->add_nagios_critical("unable to get sga dc");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(sum_gets sum_gethits));
|
||||
$self->{hitratio} = $self->{delta_sum_gets} ?
|
||||
(100 * $self->{delta_sum_gethits} / $self->{delta_sum_gets}) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::sharedpool::dictionarycache::hitratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{hitratio}, "95:", "90:"),
|
||||
sprintf "SGA dictionary cache hit ratio %.2f%%", $self->{hitratio});
|
||||
$self->add_perfdata(sprintf "sga_dictionary_cache_hit_ratio=%.2f%%;%s;%s",
|
||||
$self->{hitratio}, $self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,68 @@
|
||||
package DBD::Oracle::Server::Instance::SGA::SharedPool::LibraryCache;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance::SGA::SharedPool);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
sum_gets => undef,
|
||||
sum_gethits => undef,
|
||||
sum_pins => undef,
|
||||
sum_pinhits => undef,
|
||||
get_hitratio => undef,
|
||||
pin_hitratio => undef,
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::sharedpool::librarycache::hitratio/) {
|
||||
($self->{sum_gethits}, $self->{sum_gets}, $self->{sum_pinhits},
|
||||
$self->{sum_pins}) = $self->{handle}->fetchrow_array(q{
|
||||
SELECT SUM(gethits), SUM(gets), SUM(pinhits), SUM(pins)
|
||||
FROM v$librarycache
|
||||
});
|
||||
if (! defined $self->{sum_gets} || ! defined $self->{sum_pinhits}) {
|
||||
$self->add_nagios_critical("unable to get sga lc");
|
||||
} else {
|
||||
$self->valdiff(\%params, qw(sum_gets sum_gethits sum_pins sum_pinhits));
|
||||
$self->{get_hitratio} = $self->{delta_sum_gets} ?
|
||||
(100 * $self->{delta_sum_gethits} / $self->{delta_sum_gets}) : 0;
|
||||
$self->{pin_hitratio} = $self->{delta_sum_pins} ?
|
||||
(100 * $self->{delta_sum_pinhits} / $self->{delta_sum_pins}) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~
|
||||
/server::instance::sga::sharedpool::librarycache::hitratio/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{get_hitratio}, "98:", "95:"),
|
||||
sprintf "SGA library cache hit ratio %.2f%%", $self->{get_hitratio});
|
||||
$self->add_perfdata(sprintf "sga_library_cache_hit_ratio=%.2f%%;%s;%s",
|
||||
$self->{get_hitratio}, $self->{warningrange}, $self->{criticalrange});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -0,0 +1,113 @@
|
||||
package DBD::Oracle::Server::Instance::Sysstat;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(DBD::Oracle::Server::Instance);
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
{
|
||||
my @sysstats = ();
|
||||
my $initerrors = undef;
|
||||
|
||||
sub add_sysstat {
|
||||
push(@sysstats, shift);
|
||||
}
|
||||
|
||||
sub return_sysstats {
|
||||
return reverse
|
||||
sort { $a->{name} cmp $b->{name} } @sysstats;
|
||||
}
|
||||
|
||||
sub init_sysstats {
|
||||
my %params = @_;
|
||||
my $num_sysstats = 0;
|
||||
my %longnames = ();
|
||||
if (($params{mode} =~ /server::instance::sysstat::rate/) ||
|
||||
($params{mode} =~ /server::instance::sysstat::listsysstats/)) {
|
||||
my @sysstatresults = $params{handle}->fetchall_array(q{
|
||||
SELECT statistic#, name, class, value FROM v$sysstat
|
||||
});
|
||||
foreach (@sysstatresults) {
|
||||
my ($number, $name, $class, $value) = @{$_};
|
||||
if ($params{regexp}) {
|
||||
next if $params{selectname} && $name !~ /$params{selectname}/;
|
||||
} else {
|
||||
next if ($params{selectname} && (
|
||||
($params{selectname} !~ /^\d+$/ && (lc $params{selectname} ne lc $name)) ||
|
||||
($params{selectname} =~ /^\d+$/ && ($params{selectname} != $number))));
|
||||
}
|
||||
my %thisparams = %params;
|
||||
$thisparams{name} = $name;
|
||||
$thisparams{number} = $number;
|
||||
$thisparams{class} = $class;
|
||||
$thisparams{value} = $value;
|
||||
my $sysstat = DBD::Oracle::Server::Instance::Sysstat->new(
|
||||
%thisparams);
|
||||
add_sysstat($sysstat);
|
||||
$num_sysstats++;
|
||||
}
|
||||
if (! $num_sysstats) {
|
||||
$initerrors = 1;
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
handle => $params{handle},
|
||||
name => $params{name},
|
||||
number => $params{number},
|
||||
class => $params{class},
|
||||
value => $params{value},
|
||||
rate => $params{rate},
|
||||
count => $params{count},
|
||||
warningrange => $params{warningrange},
|
||||
criticalrange => $params{criticalrange},
|
||||
};
|
||||
#$self->{name} =~ s/^\s+//;
|
||||
#$self->{name} =~ s/\s+$//;
|
||||
bless $self, $class;
|
||||
$self->init(%params);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
$self->init_nagios();
|
||||
if ($params{mode} =~ /server::instance::sysstat::rate/) {
|
||||
$params{differenciator} = lc $self->{name};
|
||||
$self->valdiff(\%params, qw(value));
|
||||
$self->{rate} = $self->{delta_value} / $self->{delta_timestamp};
|
||||
}
|
||||
}
|
||||
|
||||
sub nagios {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
if (! $self->{nagios_level}) {
|
||||
if ($params{mode} =~ /server::instance::sysstat::rate/) {
|
||||
$self->add_nagios(
|
||||
$self->check_thresholds($self->{rate}, "10", "100"),
|
||||
sprintf "%.6f %s/sec", $self->{rate}, $self->{name});
|
||||
$self->add_perfdata(sprintf "'%s_per_sec'=%.6f;%s;%s",
|
||||
$self->{name},
|
||||
$self->{rate},
|
||||
$self->{warningrange}, $self->{criticalrange});
|
||||
$self->add_perfdata(sprintf "'%s'=%u",
|
||||
$self->{name},
|
||||
$self->{delta_value});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
@ -0,0 +1,103 @@
|
||||
package Extraopts;
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Data::Dumper;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my %params = @_;
|
||||
my $self = {
|
||||
file => $params{file},
|
||||
commandline => $params{commandline},
|
||||
config => {},
|
||||
section => 'default_no_section',
|
||||
};
|
||||
bless $self, $class;
|
||||
$self->prepare_file_and_section();
|
||||
$self->init();
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub prepare_file_and_section {
|
||||
my $self = shift;
|
||||
if (! defined $self->{file}) {
|
||||
# ./check_stuff --extra-opts
|
||||
$self->{section} = basename($0);
|
||||
$self->{file} = $self->get_default_file();
|
||||
} elsif ($self->{file} =~ /^[^@]+$/) {
|
||||
# ./check_stuff --extra-opts=special_opts
|
||||
$self->{section} = $self->{file};
|
||||
$self->{file} = $self->get_default_file();
|
||||
} elsif ($self->{file} =~ /^@(.*)/) {
|
||||
# ./check_stuff --extra-opts=@/etc/myconfig.ini
|
||||
$self->{section} = basename($0);
|
||||
$self->{file} = $1;
|
||||
} elsif ($self->{file} =~ /^(.*?)@(.*)/) {
|
||||
# ./check_stuff --extra-opts=special_opts@/etc/myconfig.ini
|
||||
$self->{section} = $1;
|
||||
$self->{file} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_default_file {
|
||||
my $self = shift;
|
||||
foreach my $default (qw(/etc/nagios/plugins.ini
|
||||
/usr/local/nagios/etc/plugins.ini
|
||||
/usr/local/etc/nagios/plugins.ini
|
||||
/etc/opt/nagios/plugins.ini
|
||||
/etc/nagios-plugins.ini
|
||||
/usr/local/etc/nagios-plugins.ini
|
||||
/etc/opt/nagios-plugins.ini)) {
|
||||
if (-f $default) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
if (! defined $self->{file}) {
|
||||
$self->{errors} = sprintf 'no extra-opts file specified and no default file found';
|
||||
} elsif (! -f $self->{file}) {
|
||||
$self->{errors} = sprintf 'could not open %s', $self->{file};
|
||||
} else {
|
||||
my $data = do { local (@ARGV, $/) = $self->{file}; <> };
|
||||
my $in_section = 'default_no_section';
|
||||
foreach my $line (split(/\n/, $data)) {
|
||||
if ($line =~ /\[(.*)\]/) {
|
||||
$in_section = $1;
|
||||
} elsif ($line =~ /(.*?)\s*=\s*(.*)/) {
|
||||
$self->{config}->{$in_section}->{$1} = $2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub is_valid {
|
||||
my $self = shift;
|
||||
return ! exists $self->{errors};
|
||||
}
|
||||
|
||||
sub overwrite {
|
||||
my $self = shift;
|
||||
my %commandline = ();
|
||||
if (scalar(keys %{$self->{config}->{default_no_section}}) > 0) {
|
||||
foreach (keys %{$self->{config}->{default_no_section}}) {
|
||||
$commandline{$_} = $self->{config}->{default_no_section}->{$_};
|
||||
}
|
||||
}
|
||||
if (exists $self->{config}->{$self->{section}}) {
|
||||
foreach (keys %{$self->{config}->{$self->{section}}}) {
|
||||
$commandline{$_} = $self->{config}->{$self->{section}}->{$_};
|
||||
}
|
||||
}
|
||||
foreach (keys %commandline) {
|
||||
if (! exists $self->{commandline}->{$_}) {
|
||||
$self->{commandline}->{$_} = $commandline{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,604 @@
|
||||
|
||||
package main;
|
||||
|
||||
use strict;
|
||||
use Getopt::Long qw(:config no_ignore_case);
|
||||
use File::Basename;
|
||||
use lib dirname($0);
|
||||
use Nagios::DBD::Oracle::Server;
|
||||
use Nagios::DBD::Oracle::Server::Instance;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::DataBuffer;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::SharedPool;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::SharedPool::LibraryCache;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::SharedPool::DictionaryCache;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::Latches;
|
||||
use Nagios::DBD::Oracle::Server::Instance::PGA;
|
||||
use Nagios::DBD::Oracle::Server::Instance::SGA::RedoLogBuffer;
|
||||
|
||||
|
||||
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
|
||||
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
|
||||
|
||||
use vars qw ($PROGNAME $REVISION $CONTACT $TIMEOUT $STATEFILESDIR $needs_restart %commandline);
|
||||
|
||||
$PROGNAME = "check_oracle_health";
|
||||
$REVISION = '$Revision: #PACKAGE_VERSION# $';
|
||||
$CONTACT = 'gerhard.lausser@consol.de';
|
||||
$TIMEOUT = 60;
|
||||
$STATEFILESDIR = '#STATEFILES_DIR#';
|
||||
$needs_restart = 0;
|
||||
|
||||
my @modes = (
|
||||
['server::tnsping',
|
||||
'tnsping', undef,
|
||||
'Check the reachability of the server' ],
|
||||
['server::connectiontime',
|
||||
'connection-time', undef,
|
||||
'Time to connect to the server' ],
|
||||
['server::instance::connectedusers',
|
||||
'connected-users', undef,
|
||||
'Number of currently connected users' ],
|
||||
['server::instance::sessionusage',
|
||||
'session-usage', undef,
|
||||
'Percentage of sessions used' ],
|
||||
['server::instance::processusage',
|
||||
'process-usage', undef,
|
||||
'Percentage of processes used' ],
|
||||
['server::instance::rman::backup::problems',
|
||||
'rman-backup-problems', undef,
|
||||
'Number of rman backup errors during the last 3 days' ],
|
||||
['server::instance::sga::databuffer::hitratio',
|
||||
'sga-data-buffer-hit-ratio', undef,
|
||||
'Data Buffer Cache Hit Ratio' ],
|
||||
['server::instance::sga::sharedpool::librarycache::hitratio',
|
||||
'sga-library-cache-hit-ratio', undef,
|
||||
'Library Cache Hit Ratio' ],
|
||||
['server::instance::sga::sharedpool::dictionarycache::hitratio',
|
||||
'sga-dictionary-cache-hit-ratio', undef,
|
||||
'Dictionary Cache Hit Ratio' ],
|
||||
['server::instance::sga::latch::hitratio',
|
||||
'sga-latches-hit-ratio', undef,
|
||||
'Latches Hit Ratio' ],
|
||||
['server::instance::sga::sharedpool::reloads',
|
||||
'sga-shared-pool-reload-ratio', ['sga-shared-pool-reloads'],
|
||||
'Shared Pool Reloads vs. Pins' ],
|
||||
['server::instance::sga::sharedpool::free',
|
||||
'sga-shared-pool-free', undef,
|
||||
'Shared Pool Free Memory' ],
|
||||
['server::instance::pga::inmemorysortratio',
|
||||
'pga-in-memory-sort-ratio', undef,
|
||||
'PGA in-memory sort ratio' ],
|
||||
['server::database::invalidobjects',
|
||||
'invalid-objects', undef,
|
||||
'Number of invalid objects in database' ],
|
||||
['server::database::stalestats',
|
||||
'stale-statistics', undef,
|
||||
'Find objects with stale optimizer statistics' ],
|
||||
['server::database::blockcorruption',
|
||||
'corrupted-blocks', undef,
|
||||
'Number of corrupted blocks in database' ],
|
||||
['server::database::tablespace::usage',
|
||||
'tablespace-usage', undef,
|
||||
'Used space in tablespaces' ],
|
||||
['server::database::tablespace::free',
|
||||
'tablespace-free', undef,
|
||||
'Free space in tablespaces' ],
|
||||
['server::database::tablespace::remainingfreetime',
|
||||
'tablespace-remaining-time', undef,
|
||||
'Remaining time until a tablespace is full' ],
|
||||
['server::database::tablespace::fragmentation',
|
||||
'tablespace-fragmentation', undef,
|
||||
'Free space fragmentation index' ],
|
||||
['server::database::tablespace::iobalance',
|
||||
'tablespace-io-balance', undef,
|
||||
'balanced io of all datafiles' ],
|
||||
['server::database::tablespace::segment::extendspace',
|
||||
'tablespace-can-allocate-next', undef,
|
||||
'Segments (of a tablespace) can allocate next extent' ],
|
||||
['server::database::tablespace::datafile::iotraffic',
|
||||
'datafile-io-traffic', undef,
|
||||
'io operations/per sec of a datafile' ],
|
||||
['server::database::datafilesexisting',
|
||||
'datafiles-existing', undef,
|
||||
'Percentage of the maximum possible number of datafiles' ],
|
||||
['server::instance::sga::sharedpool::softparse',
|
||||
'soft-parse-ratio', undef,
|
||||
'Percentage of soft parses' ],
|
||||
['server::instance::sga::redologbuffer::switchinterval',
|
||||
'switch-interval', ['redo-switch-interval', 'rac-switch-interval'],
|
||||
'Time between redo log file switches' ],
|
||||
['server::instance::sga::redologbuffer::retryratio',
|
||||
'retry-ratio', ['redo-retry-ratio'],
|
||||
'Redo buffer allocation retries' ],
|
||||
['server::instance::sga::redologbuffer::iotraffic',
|
||||
'redo-io-traffic', undef,
|
||||
'Redo log io bytes per second' ],
|
||||
['server::instance::sga::rollbacksegments::headercontention',
|
||||
'roll-header-contention', undef,
|
||||
'Rollback segment header contention' ],
|
||||
['server::instance::sga::rollbacksegments::blockcontention',
|
||||
'roll-block-contention', undef,
|
||||
'Rollback segment block contention' ],
|
||||
['server::instance::sga::rollbacksegments::hitratio',
|
||||
'roll-hit-ratio', undef,
|
||||
'Rollback segment hit ratio (gets/waits)' ],
|
||||
['server::instance::sga::rollbacksegments::wraps',
|
||||
'roll-wraps', undef,
|
||||
'Rollback segment wraps (per sec)' ],
|
||||
['server::instance::sga::rollbacksegments::extends',
|
||||
'roll-extends', undef,
|
||||
'Rollback segment extends (per sec)' ],
|
||||
['server::instance::sga::rollbacksegments::avgactivesize',
|
||||
'roll-avgactivesize', undef,
|
||||
'Rollback segment average active size' ],
|
||||
['server::database::tablespace::segment::top10logicalreads',
|
||||
'seg-top10-logical-reads', undef,
|
||||
'user objects among top 10 logical reads' ],
|
||||
['server::database::tablespace::segment::top10physicalreads',
|
||||
'seg-top10-physical-reads', undef,
|
||||
'user objects among top 10 physical reads' ],
|
||||
['server::database::tablespace::segment::top10bufferbusywaits',
|
||||
'seg-top10-buffer-busy-waits', undef,
|
||||
'user objects among top 10 buffer busy waits' ],
|
||||
['server::database::tablespace::segment::top10rowlockwaits',
|
||||
'seg-top10-row-lock-waits', undef,
|
||||
'user objects among top 10 row lock waits' ],
|
||||
['server::instance::event::waits',
|
||||
'event-waits', undef,
|
||||
'processes wait events' ],
|
||||
['server::instance::event::waiting',
|
||||
'event-waiting', undef,
|
||||
'time spent by processes waiting for an event' ],
|
||||
['server::instance::enqueue::contention',
|
||||
'enqueue-contention', undef,
|
||||
'percentage of enqueue requests which must wait' ],
|
||||
['server::instance::enqueue::waiting',
|
||||
'enqueue-waiting', undef,
|
||||
'percentage of time spent waiting for the enqueue' ],
|
||||
['server::instance::sga::latch::contention',
|
||||
'latch-contention', undef,
|
||||
'percentage of latch get requests which must wait' ],
|
||||
['server::instance::sga::latch::waiting',
|
||||
'latch-waiting', undef,
|
||||
'percentage of time a latch spends sleeping' ],
|
||||
['server::instance::sysstat::rate',
|
||||
'sysstat', undef,
|
||||
'change of sysstat values over time' ],
|
||||
['server::database::flash_recovery_area::usage',
|
||||
'flash-recovery-area-usage', undef,
|
||||
'Used space in flash recovery area' ],
|
||||
['server::database::flash_recovery_area::free',
|
||||
'flash-recovery-area-free', undef,
|
||||
'Free space in flash recovery area' ],
|
||||
['server::sql',
|
||||
'sql', undef,
|
||||
'any sql command returning a single number' ],
|
||||
['server::database::tablespace::listtablespaces',
|
||||
'list-tablespaces', undef,
|
||||
'convenience function which lists all tablespaces' ],
|
||||
['server::database::tablespace::datafile::listdatafiles',
|
||||
'list-datafiles', undef,
|
||||
'convenience function which lists all datafiles' ],
|
||||
['server::instance::enqueue::listenqueues',
|
||||
'list-enqueues', undef,
|
||||
'convenience function which lists all enqueues' ],
|
||||
['server::instance::sga::latch::listlatches',
|
||||
'list-latches', undef,
|
||||
'convenience function which lists all latches' ],
|
||||
['server::instance::event::listevents',
|
||||
'list-events', undef,
|
||||
'convenience function which lists all events' ],
|
||||
['server::instance::event::listeventsbg',
|
||||
'list-background-events', undef,
|
||||
'convenience function which lists all background events' ],
|
||||
['server::instance::sysstat::listsysstats',
|
||||
'list-sysstats', undef,
|
||||
'convenience function which lists all statistics from v$sysstat' ],
|
||||
);
|
||||
|
||||
sub print_usage () {
|
||||
print <<EOUS;
|
||||
Usage:
|
||||
$PROGNAME [-v] [-t <timeout>] --connect=<connect string>
|
||||
--username=<username> --password=<password> --mode=<mode>
|
||||
--tablespace=<tablespace>
|
||||
$PROGNAME [-h | --help]
|
||||
$PROGNAME [-V | --version]
|
||||
|
||||
Options:
|
||||
--connect
|
||||
the connect string
|
||||
--username
|
||||
the oracle user
|
||||
--password
|
||||
the oracle user's password
|
||||
--warning
|
||||
the warning range
|
||||
--critical
|
||||
the critical range
|
||||
--mode
|
||||
the mode of the plugin. select one of the following keywords:
|
||||
EOUS
|
||||
my $longest = length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0]);
|
||||
my $format = " %-".
|
||||
(length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0])).
|
||||
"s\t(%s)\n";
|
||||
foreach (@modes) {
|
||||
printf $format, $_->[1], $_->[3];
|
||||
}
|
||||
printf "\n";
|
||||
print <<EOUS;
|
||||
--name
|
||||
the name of the tablespace, datafile, wait event,
|
||||
latch, enqueue, or sql statement depending on the mode.
|
||||
--name2
|
||||
if name is a sql statement, this statement would appear in
|
||||
the output and the performance data. This can be ugly, so
|
||||
name2 can be used to appear instead.
|
||||
--regexp
|
||||
if this parameter is used, name will be interpreted as a
|
||||
regular expression.
|
||||
--units
|
||||
one of %, KB, MB, GB. This is used for a better output of mode=sql
|
||||
and for specifying thresholds for mode=tablespace-free
|
||||
--ident
|
||||
outputs instance and database names
|
||||
|
||||
Tablespace-related modes check all tablespaces in one run by default.
|
||||
If only a single tablespace should be checked, use the --name parameter.
|
||||
The same applies to datafile-related modes.
|
||||
|
||||
tablespace-remaining-time will take historical data into account. The number
|
||||
of days in the past can be given with the --lookback parameter. (Default: 30)
|
||||
|
||||
In mode sql you can url-encode the statement so you will not have to mess
|
||||
around with special characters in your Nagios service definitions.
|
||||
Instead of
|
||||
--name="select count(*) from v\$session where status = 'ACTIVE'"
|
||||
you can say
|
||||
--name=select%20count%28%2A%29%20from%20v%24session%20where%20status%20%3D%20%27ACTIVE%27
|
||||
For your convenience you can call check_oracle_health with the --encode
|
||||
option and it will encode the standard input.
|
||||
|
||||
EOUS
|
||||
#
|
||||
# --basis
|
||||
# one of rate, delta, value
|
||||
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print "Copyright (c) 2008 Gerhard Lausser\n\n";
|
||||
print "\n";
|
||||
print " Check various parameters of Oracle databases \n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
support();
|
||||
}
|
||||
|
||||
|
||||
sub print_revision ($$) {
|
||||
my $commandName = shift;
|
||||
my $pluginRevision = shift;
|
||||
$pluginRevision =~ s/^\$Revision: //;
|
||||
$pluginRevision =~ s/ \$\s*$//;
|
||||
print "$commandName ($pluginRevision)\n";
|
||||
print "This nagios plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of this plugin under the terms of the GNU General Public License.\n";
|
||||
}
|
||||
|
||||
sub support () {
|
||||
my $support='Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software. \nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n';
|
||||
$support =~ s/@/\@/g;
|
||||
$support =~ s/\\n/\n/g;
|
||||
print $support;
|
||||
}
|
||||
|
||||
sub contact_author ($$) {
|
||||
my $item = shift;
|
||||
my $strangepattern = shift;
|
||||
if ($commandline{verbose}) {
|
||||
printf STDERR
|
||||
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n".
|
||||
"You found a line which is not recognized by %s\n".
|
||||
"This means, certain components of your system cannot be checked.\n".
|
||||
"Please contact the author %s and\nsend him the following output:\n\n".
|
||||
"%s /%s/\n\nThank you!\n".
|
||||
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
|
||||
$PROGNAME, $CONTACT, $item, $strangepattern;
|
||||
}
|
||||
}
|
||||
|
||||
%commandline = ();
|
||||
my @params = (
|
||||
"timeout|t=i",
|
||||
"version|V",
|
||||
"help|h",
|
||||
"verbose|v",
|
||||
"debug|d",
|
||||
"connect|c=s",
|
||||
"username|u=s",
|
||||
"password|p=s",
|
||||
"mode|m=s",
|
||||
"tablespace=s",
|
||||
"datafile=s",
|
||||
"waitevent=s",
|
||||
"name=s",
|
||||
"name2=s",
|
||||
"regexp",
|
||||
"perfdata",
|
||||
"warning=s",
|
||||
"critical=s",
|
||||
"dbthresholds:s",
|
||||
"absolute|a",
|
||||
"basis",
|
||||
"lookback|l=i",
|
||||
"environment|e=s%",
|
||||
"method=s",
|
||||
"runas|r=s",
|
||||
"scream",
|
||||
"shell",
|
||||
"eyecandy",
|
||||
"encode",
|
||||
"units=s",
|
||||
"ident",
|
||||
"3",
|
||||
"statefilesdir=s",
|
||||
"with-mymodules-dyn-dir=s",
|
||||
"report=s",
|
||||
"extra-opts:s");
|
||||
|
||||
if (! GetOptions(\%commandline, @params)) {
|
||||
print_help();
|
||||
exit $ERRORS{UNKNOWN};
|
||||
}
|
||||
|
||||
if (exists $commandline{'extra-opts'}) {
|
||||
# read the extra file and overwrite other parameters
|
||||
my $extras = Extraopts->new(file => $commandline{'extra-opts'}, commandline => \%commandline);
|
||||
if (! $extras->is_valid()) {
|
||||
printf "extra-opts are not valid: %s\n", $extras->{errors};
|
||||
exit $ERRORS{UNKNOWN};
|
||||
} else {
|
||||
$extras->overwrite();
|
||||
}
|
||||
}
|
||||
|
||||
if (exists $commandline{version}) {
|
||||
print_revision($PROGNAME, $REVISION);
|
||||
exit $ERRORS{OK};
|
||||
}
|
||||
|
||||
if (exists $commandline{help}) {
|
||||
print_help();
|
||||
exit $ERRORS{OK};
|
||||
} elsif (! exists $commandline{mode}) {
|
||||
printf "Please select a mode\n";
|
||||
print_help();
|
||||
exit $ERRORS{OK};
|
||||
}
|
||||
|
||||
if ($commandline{mode} eq "encode") {
|
||||
my $input = <>;
|
||||
chomp $input;
|
||||
$input =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
|
||||
printf "%s\n", $input;
|
||||
exit $ERRORS{OK};
|
||||
}
|
||||
|
||||
if (exists $commandline{3}) {
|
||||
$ENV{NRPE_MULTILINESUPPORT} = 1;
|
||||
}
|
||||
|
||||
if (exists $commandline{timeout}) {
|
||||
$TIMEOUT = $commandline{timeout};
|
||||
}
|
||||
|
||||
if (exists $commandline{verbose}) {
|
||||
$DBD::Oracle::Server::verbose = exists $commandline{verbose};
|
||||
}
|
||||
|
||||
if (exists $commandline{scream}) {
|
||||
# $DBD::Oracle::Server::hysterical = exists $commandline{scream};
|
||||
}
|
||||
|
||||
if (exists $commandline{method}) {
|
||||
# dbi, snmp or sqlplus
|
||||
} else {
|
||||
$commandline{method} = "dbi";
|
||||
}
|
||||
|
||||
if (exists $commandline{report}) {
|
||||
# short, long, html
|
||||
} else {
|
||||
$commandline{report} = "long";
|
||||
}
|
||||
|
||||
if (exists $commandline{'with-mymodules-dyn-dir'}) {
|
||||
$DBD::Oracle::Server::my_modules_dyn_dir = $commandline{'with-mymodules-dyn-dir'};
|
||||
} else {
|
||||
$DBD::Oracle::Server::my_modules_dyn_dir = '#MYMODULES_DYN_DIR#';
|
||||
}
|
||||
|
||||
if (exists $commandline{environment}) {
|
||||
# if the desired environment variable values are different from
|
||||
# the environment of this running script, then a restart is necessary.
|
||||
# because setting $ENV does _not_ change the environment of the running script.
|
||||
foreach (keys %{$commandline{environment}}) {
|
||||
if ((! $ENV{$_}) || ($ENV{$_} ne $commandline{environment}->{$_})) {
|
||||
$needs_restart = 1;
|
||||
$ENV{$_} = $commandline{environment}->{$_};
|
||||
printf STDERR "new %s=%s forces restart\n", $_, $ENV{$_}
|
||||
if $DBD::Oracle::Server::verbose;
|
||||
}
|
||||
}
|
||||
# e.g. called with --runas dbnagio. shlib_path environment variable is stripped
|
||||
# during the sudo.
|
||||
# so the perl interpreter starts without a shlib_path. but --runas cares for
|
||||
# a --environment shlib_path=...
|
||||
# so setting the environment variable in the code above and restarting the
|
||||
# perl interpreter will help it find shared libs
|
||||
}
|
||||
|
||||
if (exists $commandline{runas}) {
|
||||
# remove the runas parameter
|
||||
# exec sudo $0 ... the remaining parameters
|
||||
$needs_restart = 1;
|
||||
# if the calling script has a path for shared libs and there is no --environment
|
||||
# parameter then the called script surely needs the variable too.
|
||||
foreach my $important_env qw(LD_LIBRARY_PATH SHLIB_PATH
|
||||
ORACLE_HOME TNS_ADMIN ORA_NLS ORA_NLS33 ORA_NLS10) {
|
||||
if ($ENV{$important_env} && ! scalar(grep { /^$important_env=/ }
|
||||
keys %{$commandline{environment}})) {
|
||||
$commandline{environment}->{$important_env} = $ENV{$important_env};
|
||||
printf STDERR "add important --environment %s=%s\n",
|
||||
$important_env, $ENV{$important_env} if $DBD::Oracle::Server::verbose;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($needs_restart) {
|
||||
my @newargv = ();
|
||||
my $runas = undef;
|
||||
if (exists $commandline{runas}) {
|
||||
$runas = $commandline{runas};
|
||||
delete $commandline{runas};
|
||||
}
|
||||
foreach my $option (keys %commandline) {
|
||||
if (grep { /^$option/ && /=/ } @params) {
|
||||
if (ref ($commandline{$option}) eq "HASH") {
|
||||
foreach (keys %{$commandline{$option}}) {
|
||||
push(@newargv, sprintf "--%s", $option);
|
||||
push(@newargv, sprintf "%s=%s", $_, $commandline{$option}->{$_});
|
||||
}
|
||||
} else {
|
||||
push(@newargv, sprintf "--%s", $option);
|
||||
push(@newargv, sprintf "%s", $commandline{$option});
|
||||
}
|
||||
} else {
|
||||
push(@newargv, sprintf "--%s", $option);
|
||||
}
|
||||
}
|
||||
if ($runas && ($> == 0)) {
|
||||
# this was not my idea. some people connect as root to their nagios clients.
|
||||
exec "su", "-c", sprintf("%s %s", $0, join(" ", @newargv)), "-", $runas;
|
||||
} elsif ($runas) {
|
||||
exec "sudo", "-S", "-u", $runas, $0, @newargv;
|
||||
} else {
|
||||
exec $0, @newargv;
|
||||
# this makes sure that even a SHLIB or LD_LIBRARY_PATH are set correctly
|
||||
# when the perl interpreter starts. Setting them during runtime does not
|
||||
# help loading e.g. libclntsh.so
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (exists $commandline{shell}) {
|
||||
# forget what you see here.
|
||||
system("/bin/sh");
|
||||
}
|
||||
|
||||
if (! exists $commandline{statefilesdir}) {
|
||||
if (exists $ENV{OMD_ROOT}) {
|
||||
$commandline{statefilesdir} = $ENV{OMD_ROOT}."/var/tmp/check_oracle_health";
|
||||
} else {
|
||||
$commandline{statefilesdir} = $STATEFILESDIR;
|
||||
}
|
||||
}
|
||||
|
||||
if (exists $commandline{name}) {
|
||||
# objects can be encoded like an url
|
||||
# with s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
|
||||
if (($commandline{mode} ne "sql") ||
|
||||
(($commandline{mode} eq "sql") &&
|
||||
($commandline{name} =~ /select%20/i))) { # protect ... like '%cac%' ... from decoding
|
||||
$commandline{name} =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
|
||||
}
|
||||
if ($commandline{name} =~ /^0$/) {
|
||||
# without this, $params{selectname} would be treated like undef
|
||||
$commandline{name} = "00";
|
||||
}
|
||||
}
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
printf "UNKNOWN - %s timed out after %d seconds\n", $PROGNAME, $TIMEOUT;
|
||||
exit $ERRORS{UNKNOWN};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
my $nagios_level = $ERRORS{UNKNOWN};
|
||||
my $nagios_message = "";
|
||||
my $perfdata = "";
|
||||
my $racmode = 0;
|
||||
if ($commandline{mode} =~ /^rac-([^\-.]+)/) {
|
||||
$racmode = 1;
|
||||
$commandline{mode} =~ s/^rac\-//g;
|
||||
}
|
||||
if ($commandline{mode} =~ /^my-([^\-.]+)/) {
|
||||
my $param = $commandline{mode};
|
||||
$param =~ s/\-/::/g;
|
||||
push(@modes, [$param, $commandline{mode}, undef, 'my extension']);
|
||||
} elsif ((! grep { $commandline{mode} eq $_ } map { $_->[1] } @modes) &&
|
||||
(! grep { $commandline{mode} eq $_ } map { defined $_->[2] ? @{$_->[2]} : () } @modes)) {
|
||||
printf "UNKNOWN - mode %s\n", $commandline{mode};
|
||||
print_usage();
|
||||
exit 3;
|
||||
}
|
||||
|
||||
my %params = (
|
||||
timeout => $TIMEOUT,
|
||||
mode => (
|
||||
map { $_->[0] }
|
||||
grep {
|
||||
($commandline{mode} eq $_->[1]) ||
|
||||
( defined $_->[2] && grep { $commandline{mode} eq $_ } @{$_->[2]})
|
||||
} @modes
|
||||
)[0],
|
||||
cmdlinemode => $commandline{mode},
|
||||
racmode => $racmode,
|
||||
method => $commandline{method} ||
|
||||
$ENV{NAGIOS__SERVICEORACLE_METH} ||
|
||||
$ENV{NAGIOS__HOSTORACLE_METH} || 'dbi',
|
||||
connect => $commandline{connect} ||
|
||||
$ENV{NAGIOS__SERVICEORACLE_SID} ||
|
||||
$ENV{NAGIOS__HOSTORACLE_SID} ||
|
||||
$ENV{ORACLE_SID},
|
||||
username => $commandline{username} ||
|
||||
$ENV{NAGIOS__SERVICEORACLE_USER} ||
|
||||
$ENV{NAGIOS__HOSTORACLE_USER},
|
||||
password => $commandline{password} ||
|
||||
$ENV{NAGIOS__SERVICEORACLE_PASS} ||
|
||||
$ENV{NAGIOS__HOSTORACLE_PASS},
|
||||
warningrange => $commandline{warning},
|
||||
criticalrange => $commandline{critical},
|
||||
dbthresholds => $commandline{dbthresholds},
|
||||
absolute => $commandline{absolute},
|
||||
lookback => $commandline{lookback},
|
||||
tablespace => $commandline{tablespace},
|
||||
datafile => $commandline{datafile},
|
||||
basis => $commandline{basis},
|
||||
selectname => $commandline{name} || $commandline{tablespace} || $commandline{datafile},
|
||||
regexp => $commandline{regexp},
|
||||
name => $commandline{name},
|
||||
name2 => $commandline{name2} || $commandline{name},
|
||||
units => $commandline{units},
|
||||
eyecandy => $commandline{eyecandy},
|
||||
statefilesdir => $commandline{statefilesdir},
|
||||
ident => $commandline{ident},
|
||||
verbose => $commandline{verbose},
|
||||
report => $commandline{report},
|
||||
);
|
||||
|
||||
my $server = undef;
|
||||
|
||||
$server = DBD::Oracle::Server->new(%params);
|
||||
$server->nagios(%params);
|
||||
$server->calculate_result();
|
||||
$nagios_message = $server->{nagios_message};
|
||||
$nagios_level = $server->{nagios_level};
|
||||
$perfdata = $server->{perfdata};
|
||||
|
||||
printf "%s - %s", $ERRORCODES{$nagios_level}, $nagios_message;
|
||||
printf " | %s", $perfdata if $perfdata;
|
||||
printf "\n";
|
||||
exit $nagios_level;
|
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/awk
|
||||
|
||||
function which(c,path) {
|
||||
cmd = "test -x " c;
|
||||
|
||||
if (system(cmd)==0) {
|
||||
return c;
|
||||
}
|
||||
|
||||
sub(/\/.*\//,"",c);
|
||||
for (dir in path) {
|
||||
cmd = "test -x " path[dir] "/" c;
|
||||
if (system(cmd)==0) {
|
||||
return path[dir] "/" c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
# used to replace "use lib utils.pm" with "use lib @libexecdir"
|
||||
#
|
||||
function led() {
|
||||
led1 = "@libexecdir@";
|
||||
led2 = "@exec_prefix@";
|
||||
led3 = "@prefix@";
|
||||
if ( match(led1, /^\$\{exec_prefix\}/ ) != 0 ) {
|
||||
return "\"" led3 "/libexec\" " ;
|
||||
|
||||
}
|
||||
return "\"" led1 "\"" ;
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/);
|
||||
|
||||
}
|
||||
|
||||
# scripting language (first line)
|
||||
|
||||
/^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");}
|
||||
/^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");}
|
||||
/^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");}
|
||||
/^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");}
|
||||
|
||||
# add to libexecdir to INC for perl utils.pm
|
||||
/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } }
|
||||
|
||||
|
||||
# Replace the placeholders with the values from configure
|
||||
/#PERL#/ {sub(/#PERL#/,"@PERL@");}
|
||||
/#GZIP#/ {sub(/#GZIP#/,"@GZIP@");}
|
||||
/#STATEFILES_DIR#/ {sub(/#STATEFILES_DIR#/,"@STATEFILES_DIR@");}
|
||||
/#PACKAGE_VERSION#/ {sub(/#PACKAGE_VERSION#/,"@PACKAGE_VERSION@");}
|
||||
/#MYMODULES_DYN_DIR#/ {sub(/#MYMODULES_DYN_DIR#/,"@MYMODULES_DYN_DIR@");}
|
||||
|
||||
{
|
||||
print;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
##
|
||||
## Process this file with automake to produce Makefile.in
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
#all: tests
|
||||
|
||||
TEST_VERBOSE=0
|
||||
TEST_TYPE=test_$(LINKTYPE)
|
||||
TEST_FILE = test.pl
|
||||
TEST_FILES = *.t
|
||||
TESTDB_SW = -d
|
||||
|
||||
#EXTRA_DIST = *.t bin var etc
|
||||
EXTRA_DIST = *.t
|
||||
|
||||
tests:
|
||||
$(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
|
||||
# PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
|
||||
|
297
check_oracle_health/src/check_oracle_health-1.6.9/t/Makefile.in
Normal file
297
check_oracle_health/src/check_oracle_health-1.6.9/t/Makefile.in
Normal file
@ -0,0 +1,297 @@
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = t
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
INSTALL = @INSTALL@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CAT = @CAT@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
GREP = @GREP@
|
||||
GZIP = @GZIP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_OPTS = @INSTALL_OPTS@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MYMODULES_DIR = @MYMODULES_DIR@
|
||||
MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
RELEASE = @RELEASE@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
STATEFILES_DIR = @STATEFILES_DIR@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_nagios_group = @with_nagios_group@
|
||||
with_nagios_user = @with_nagios_user@
|
||||
AUTOMAKE_OPTIONS = 1.3 no-dependencies
|
||||
|
||||
#all: tests
|
||||
TEST_VERBOSE = 0
|
||||
TEST_TYPE = test_$(LINKTYPE)
|
||||
TEST_FILE = test.pl
|
||||
TEST_FILES = *.t
|
||||
TESTDB_SW = -d
|
||||
|
||||
#EXTRA_DIST = *.t bin var etc
|
||||
EXTRA_DIST = *.t
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu t/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu t/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
uninstall-info-am:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
|
||||
tests:
|
||||
$(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
|
||||
# PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
@ -0,0 +1,488 @@
|
||||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# MySQL Database Server Tests via check_oracle_healthdb
|
||||
#
|
||||
#
|
||||
# These are the database permissions required for this test:
|
||||
# GRANT SELECT ON $db.* TO $user@$host INDENTIFIED BY '$password';
|
||||
# GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host;
|
||||
# Check with:
|
||||
# mysql -u$user -p$password -h$host $db
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
|
||||
plan skip_all => "check_oracle_health not compiled" unless (-x "check_oracle_health");
|
||||
|
||||
plan tests => 51;
|
||||
|
||||
my $bad_login_output = '/Access denied for user /';
|
||||
my $oracle_dsn = getTestParameter(
|
||||
"ORACLE_DSN",
|
||||
"Command line parameters to specify login access",
|
||||
"bba"
|
||||
);
|
||||
|
||||
my $oracle_user = getTestParameter(
|
||||
"ORACLE_USER",
|
||||
"Command line parameters to specify login access",
|
||||
"nagios"
|
||||
);
|
||||
|
||||
my $oracle_pass = getTestParameter(
|
||||
"ORACLE_PASS",
|
||||
"Command line parameters to specify login access",
|
||||
"oradbmon"
|
||||
);
|
||||
|
||||
my $oracle_method = getTestParameter(
|
||||
"ORACLE_METHOD",
|
||||
"Command line parameters to specify login access",
|
||||
"tns"
|
||||
);
|
||||
|
||||
my $login = {
|
||||
'ora9' => {
|
||||
'tns' => ' --connect=ora9 --user=system --password=consol --method=tns ',
|
||||
'sqlplus' => ' --connect=ora9 --user=system --password=consol --method=sqlplus ',
|
||||
},
|
||||
'ora10' => {
|
||||
'tns' => ' --connect=ora10 --user=system --password=consol --method=tns ',
|
||||
'sqlplus' => ' --connect=ora10 --user=system --password=consol --method=sqlplus ',
|
||||
},
|
||||
'bba' => {
|
||||
'tns' => ' --connect=bba --user=nagios --password=oradbmon --method=tns ',
|
||||
'sqlplus' => ' --connect=bba --user=nagios --password=oradbmon --method=sqlplus ',
|
||||
},
|
||||
};
|
||||
|
||||
my $oracle_login_details = $login->{$oracle_dsn}->{$oracle_method};
|
||||
|
||||
|
||||
my $result;
|
||||
SKIP: {
|
||||
$result = NPTest->testCmd("./check_oracle_health -V");
|
||||
cmp_ok( $result->return_code, '==', 0, "expected result");
|
||||
like( $result->output, '/check_oracle_health \(\d+[\.\d]+\)/', "Expected message for -V");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health --help");
|
||||
cmp_ok( $result->return_code, '==', 0, "expected result");
|
||||
like( $result->output, "/connection-time/", "Expected message");
|
||||
like( $result->output, "/sga-data-buffer-hit-ratio/", "Expected message");
|
||||
like( $result->output, "/pga-in-memory-sort-ratio/", "Expected message");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tnsping");
|
||||
cmp_ok( $result->return_code, '==', 0, "connect ok");
|
||||
like( $result->output, "/OK - connection established/", "Expected output tnsping");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=connection-time --warning=10 --critical=20");
|
||||
cmp_ok( $result->return_code, '==', 0, "connect ok");
|
||||
like( $result->output, "/OK - (\\d+\\.\\d+) seconds to connect | connection_time=(\\d+\\.\\d+);1;5/", "Expected output connection-time");
|
||||
diag("./check_oracle_health $oracle_login_details --mode=connection-time");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=connected-users");
|
||||
cmp_ok( $result->return_code, '==', 0, "connect ok");
|
||||
like( $result->output, "/OK - ([0-9]+) connected users | connected_users=([0-9]+);1;5/", "Expected output connected-users");
|
||||
$result->output =~ /([0-9]+) connected users \| connected_users=([0-9]+);50;100/;
|
||||
ok($1 == $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
# caches
|
||||
diag("buffer cache");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-data-buffer-hit-ratio");
|
||||
like( $result->output, "/SGA data buffer hit ratio ([\.0-9]+)% .* sga_data_buffer_hit_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message cache hits");
|
||||
$result->output =~ /SGA data buffer hit ratio ([\.0-9]+)% .* sga_data_buffer_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
my $value = $1; my $pvalue = $2; my $warn = $3; my $crit = $4;
|
||||
my $expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-data-buffer-hit-ratio --warning=80: --critical=50:");
|
||||
like( $result->output, "/SGA data buffer hit ratio ([\.0-9]+)% .* sga_data_buffer_hit_ratio=([\.0-9]+)%;80:;50:/", "Expected message own cache hits");
|
||||
$result->output =~ /SGA data buffer hit ratio ([\.0-9]+)% .* sga_data_buffer_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
diag($result->output);
|
||||
|
||||
diag("library cache");
|
||||
# library cache
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-library-cache-hit-ratio");
|
||||
like( $result->output, "/SGA library cache hit ratio ([\.0-9]+)% .* sga_library_cache_hit_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message libcache hits");
|
||||
$result->output =~ /SGA library cache hit ratio ([\.0-9]+)% .* sga_library_cache_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-library-cache-hit-ratio --warning=80: --critical=50:");
|
||||
like( $result->output, "/SGA library cache hit ratio ([\.0-9]+)% .* sga_library_cache_hit_ratio=([\.0-9]+)%;80:;50:/", "Expected message own libcache hits");
|
||||
$result->output =~ /SGA library cache hit ratio ([\.0-9]+)% .* sga_library_cache_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
diag($result->output);
|
||||
|
||||
|
||||
diag("dictionary cache");
|
||||
# dictionary cache
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-dictionary-cache-hit-ratio");
|
||||
like( $result->output, "/SGA dictionary cache hit ratio ([\.0-9]+)% .* sga_dictionary_cache_hit_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message dictcache hits");
|
||||
$result->output =~ /SGA dictionary cache hit ratio ([\.0-9]+)% .* sga_dictionary_cache_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-dictionary-cache-hit-ratio --warning=80: --critical=50:");
|
||||
like( $result->output, "/SGA dictionary cache hit ratio ([\.0-9]+)% .* sga_dictionary_cache_hit_ratio=([\.0-9]+)%;80:;50:/", "Expected message own dictcache hits");
|
||||
$result->output =~ /SGA dictionary cache hit ratio ([\.0-9]+)% .* sga_dictionary_cache_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
diag($result->output);
|
||||
|
||||
diag("latches");
|
||||
# latches
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-latches-hit-ratio");
|
||||
like( $result->output, "/SGA latches hit ratio ([\.0-9]+)% .* sga_latches_hit_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message latch hits");
|
||||
$result->output =~ /SGA latches hit ratio ([\.0-9]+)% .* sga_latches_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-latches-hit-ratio --warning=85: --critical=55:");
|
||||
like( $result->output, "/SGA latches hit ratio ([\.0-9]+)% .* sga_latches_hit_ratio=([\.0-9]+)%;98:;95:/", "Expected message latches");
|
||||
$result->output =~ /SGA latches hit ratio ([\.0-9]+)% .* sga_latches_hit_ratio=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
diag($result->output);
|
||||
|
||||
diag("reloads");
|
||||
diag("./check_oracle_health $oracle_login_details --mode=sga-shared-pool-reloads");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-shared-pool-reloads");
|
||||
like( $result->output, "/SGA shared pool reload ratio ([\.0-9]+)% .* sga_shared_pool_reload_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message reloads");
|
||||
$result->output =~ /SGA shared pool reload ratio ([\.0-9]+)% .* sga_shared_pool_reload_ratio=([\.0-9]+)%;([\.0-9]+);([\.0-9]+)/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value > $warn;
|
||||
$expec = 2 if $value > $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-shared-pool-reload-ratio --warning=10 --critical=12");
|
||||
like( $result->output, "/SGA shared pool reload ratio ([\.0-9]+)% .* sga_shared_pool_reload_ratio=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+)/", "Expected message reloads");
|
||||
$result->output =~ /SGA shared pool reload ratio ([\.0-9]+)% .* sga_shared_pool_reload_ratio=([\.0-9]+)%;([\.0-9]+);([\.0-9]+)/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value > $warn;
|
||||
$expec = 2 if $value > $crit;
|
||||
diag($result->output);
|
||||
ok($warn == 10 && $crit == 12);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
diag($result->output);
|
||||
|
||||
diag("free");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-shared-pool-free");
|
||||
like( $result->output, "/SGA shared pool free ([\.0-9]+)% .* sga_shared_pool_free=([\.0-9]+)%;([\.0-9:]+):;([\.0-9:]+):/", "Expected message reloads");
|
||||
$result->output =~ /SGA shared pool free ([\.0-9]+)% .* sga_shared_pool_free=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
cmp_ok( $value, '==', $pvalue);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sga-shared-pool-free --warning=5: --critical=1:");
|
||||
like( $result->output, "/SGA shared pool free ([\.0-9]+)% .* sga_shared_pool_free=([\.0-9]+)%;([\.0-9:]+):;([\.0-9:]+):/", "Expected message free");
|
||||
$result->output =~ /SGA shared pool free ([\.0-9]+)% .* sga_shared_pool_free=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+):/;
|
||||
$value = $1; $pvalue = $2; $warn = $3; $crit = $4;
|
||||
$expec = 0;
|
||||
$expec = 1 if $value < $warn;
|
||||
$expec = 2 if $value < $crit;
|
||||
ok($value == $pvalue);
|
||||
ok($warn == 5 && $crit == 1);
|
||||
cmp_ok( $result->return_code, '==', $expec, "exitcode ok");
|
||||
diag($result->output);
|
||||
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("inmemsort");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=pga-in-memory-sort-ratio");
|
||||
like( $result->output, "/PGA in-memory sort ratio [0-9\.]+% \| pga_in_memory_sort_ratio=[0-9\.]+%;99:;90:/", "Expected inmemsort");
|
||||
$result->output =~ /PGA in-memory sort ratio ([0-9\.]+)% \| pga_in_memory_sort_ratio=([0-9\.]+)%;99:;90:/;
|
||||
ok($1 == $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("top10");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=seg-top10-logical-reads");
|
||||
like( $result->output, "/[0-9]+ user processes among the top10 logical reads \| users_among_top10_logical_reads=[0-9]+;1;9/", "Expected top 10");
|
||||
$result->output =~ /([0-9]+) user processes among the top10 logical reads \| users_among_top10_logical_reads=([0-9]+);1;9/;
|
||||
ok($1 == $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("invalid objects");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=invalid-objects");
|
||||
diag("./check_oracle_health $oracle_login_details --mode=invalid-objects");
|
||||
like( $result->output, "/(no invalid objects)|([0-9]+ invalid objects)/", "Expected no invalid objects");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=stale-statistics");
|
||||
like( $result->output, "/([0-9]+) objects with stale statistics .* stale_stats_objects=([0-9]+);10;100/", "Expected no stale objects");
|
||||
$result->output =~ /([0-9]+) objects with stale statistics .* stale_stats_objects=([0-9]+);10;100/;
|
||||
ok($1 == $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("tablespace usage");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-usage");
|
||||
like( $result->output, '/tbs (\w+) usage is ([\.0-9]+)%, tbs (\w+) usage is ([\.0-9]+)%, .* \'tbs_(\w+)_usage_pct\'=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+) \'tbs_(\w+)_usage\'=(\d+)MB;\d+;\d+;0;\d+ \'tbs_users_alloc\'=(\d+)MB;;;0;(\d+) \'tbs_(\w+)_usage_pct\'=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+) \'tbs_(\w+)_usage\'=(\d+)MB;\d+;\d+;0;\d+ \'tbs_(\w+)_alloc\'=(\d+)MB;;;0;(\d+)/', "Expected message tbs usage");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-usage --tablespace=USERS");
|
||||
like( $result->output, '/tbs USERS usage is ([\.0-9]+)% \| \'tbs_users_usage_pct\'=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+) \'tbs_users_usage\'=(\d+)MB;\d+;\d+;0;\d+ \'tbs_users_alloc\'=(\d+)MB;;;0;(\d+)$/', "Expected message tbs usage");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-usage --name=USERS");
|
||||
like( $result->output, '/tbs USERS usage is ([\.0-9]+)% \| \'tbs_users_usage_pct\'=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+) \'tbs_users_usage\'=(\d+)MB;\d+;\d+;0;\d+ \'tbs_users_alloc\'=(\d+)MB;;;0;(\d+)$/', "Expected message tbs usage");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-usage --name=users");
|
||||
like( $result->output, '/tbs USERS usage is ([\.0-9]+)% \| \'tbs_users_usage_pct\'=([\.0-9]+)%;([\.0-9:]+);([\.0-9:]+) \'tbs_users_usage\'=(\d+)MB;\d+;\d+;0;\d+ \'tbs_users_alloc\'=(\d+)MB;;;0;(\d+)$/', "Expected message tbs usage");
|
||||
diag($result->output);
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-fragmentation --name=users");
|
||||
like( $result->output, '/tbs USERS fsfi is ([\.0-9]+) \| \'tbs_users_fsfi\'=([\.0-9]+);([\.0-9:]+);([\.0-9:]+);0;100$/', "Expected message tbs frag");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("tablespace free");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-free --name=SYSTEM");
|
||||
like( $result->output, '/tbs SYSTEM has ([\.0-9]+)% free space left .* \'tbs_system_free_pct\'=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+): \'tbs_system_free\'=([\.0-9]+)MB;([\.0-9]+):;([\.0-9]+):;0;([\.0-9]+)/');
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=tablespace-free --name=SYSTEM --units=KB");
|
||||
like( $result->output, '/tbs SYSTEM has ([\.0-9]+)KB free space left .* \'tbs_system_free_pct\'=([\.0-9]+)%;([\.0-9]+):;([\.0-9]+): \'tbs_system_free\'=([\.0-9]+)KB;([\.0-9]+):;([\.0-9]+):;0;([\.0-9]+)/');
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag ("parser");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=soft-parse-ratio");
|
||||
like( $result->output, '/Soft parse ratio ([\.0-9]+)% \| soft_parse_ratio=([\.0-9]+)%;(\d+):;(\d+):/', "Expected ratio");
|
||||
$result->output =~ /Soft parse ratio ([\.0-9]+)% \| soft_parse_ratio=([\.0-9]+)%;(\d+):;(\d+):/;
|
||||
my $ratio = $1; my $pratio = $2; my $warn = $3; my $crit = $4;
|
||||
ok($ratio == $pratio);
|
||||
ok($warn == 98 && $crit == 90);
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=soft-parse-ratio --warning=80: --critical=50:");
|
||||
like( $result->output, '/Soft parse ratio ([\.0-9]+)% \| soft_parse_ratio=([\.0-9]+)%;(\d+):;(\d+):/', "Expected ratio");
|
||||
$result->output =~ /Soft parse ratio ([\.0-9]+)% \| soft_parse_ratio=([\.0-9]+)%;(\d+):;(\d+):/;
|
||||
$ratio = $1; $pratio = $2; $warn = $3; $crit = $4;
|
||||
ok($ratio == $pratio);
|
||||
ok($warn == 80 && $crit == 50);
|
||||
diag($result->output);
|
||||
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("redo log switch interval");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=switch-interval");
|
||||
like( $result->output, '/(OK|WARNING|CRITICAL) - Last redo log file switch interval was (\d+) minutes \| redo_log_file_switch_interval=(\d+)s;(\d+):;(\d+):/', "expected interval");
|
||||
$result->output =~ / Last redo log file switch interval was (\d+) minutes \| redo_log_file_switch_interval=(\d+)s;(\d+):;(\d+):/;
|
||||
my $ratio = $1; my $pratio = $2; my $warn = $3; my $crit = $4;
|
||||
ok($ratio == int($pratio / 60));
|
||||
ok($warn == 600 && $crit == 60);
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=switch-interval --warning=1000: --critical=10:");
|
||||
like( $result->output, '/(OK|WARNING|CRITICAL) - Last redo log file switch interval was (\d+) minutes \| redo_log_file_switch_interval=(\d+)s;1000:;10:/', "expected interval with threshold");
|
||||
$result->output =~ /OK - Last redo log file switch interval was (\d+) minutes \| redo_log_file_switch_interval=(\d+)s;(\d+):;(\d+):/;
|
||||
$ratio = $1; $pratio = $2; $warn = $3; $crit = $4;
|
||||
ok($ratio == int($pratio / 60));
|
||||
ok($warn == 1000 && $crit == 10);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("retry ratio");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=retry-ratio");
|
||||
like( $result->output, '/Redo log retry ratio is ([0-9\.]+)% \| redo_log_retry_ratio=([\d\.]+)%;1;10/', "expected ratio");
|
||||
$result->output =~ /Redo log retry ratio is ([0-9\.]+)% \| redo_log_retry_ratio=([\d\.]+)%;1;10/;
|
||||
my $ratio = $1; my $pratio = $2; my $warn = $3; my $crit = $4;
|
||||
ok($ratio == $pratio);
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=retry-ratio --warning=2 --critical=20");
|
||||
like( $result->output, '/Redo log retry ratio is ([0-9\.]+)% \| redo_log_retry_ratio=([\d\.]+)%;(\d+);(\d+)/', "expected ratio");
|
||||
$result->output =~ /Redo log retry ratio is ([0-9\.]+)% \| redo_log_retry_ratio=([\d\.]+)%;(\d+);(\d+)/;
|
||||
$ratio = $1; $pratio = $2; $warn = $3; $crit = $4;
|
||||
ok($ratio == $pratio);
|
||||
ok($warn == 2 && $crit == 20);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("redo io");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=redo-io-traffic --warning=101 --critical=201");
|
||||
diag($result->output);
|
||||
like( $result->output, '/Redo log io is ([0-9\.]+) MB\/sec \| redo_log_io_per_sec=([0-9\.]+);101;201/', "expected traffic");
|
||||
$result->output =~ /Redo log io is ([0-9\.]+) MB\/sec \| redo_log_io_per_sec=([0-9\.]+);([0-9\.]+);([0-9\.]+)/;
|
||||
my $io = $1; my $pio = $2; my $warn = $3; my $crit = $4;
|
||||
printf "io %s pio %s\n", $io, $pio;
|
||||
ok($io == $pio);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
|
||||
SKIP: {
|
||||
diag ("rollback segments");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=roll-header-contention");
|
||||
like( $result->output, '/Rollback segment header contention is ([0-9\.]+)% \| rollback_segment_header_contention=([\d\.]+)%;1;2/', "expected contention");
|
||||
$result->output =~ /Rollback segment header contention is ([0-9\.]+)% \| rollback_segment_header_contention=([\d\.]+)%;1;2/;
|
||||
my $cont = $1; my $pcont = $2; my $warn = $3; my $crit = $4;
|
||||
ok(sprintf("%.2f", $cont) == $pcont);
|
||||
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=roll-header-contention --warning=5 --critical=25");
|
||||
like( $result->output, '/Rollback segment header contention is ([0-9\.]+)% \| rollback_segment_header_contention=([\d\.]+)%;5;25/', "expected contention");
|
||||
$result->output =~ /Rollback segment header contention is ([0-9\.]+)% \| rollback_segment_header_contention=([\d\.]+)%;(\d+);(\d+)/;
|
||||
$cont = $1; $pcont = $2; $warn = $3; $crit = $4;
|
||||
ok(sprintf("%.2f", $cont) == $pcont);
|
||||
ok($warn == 5 && $crit == 25);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag ("datafile io");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=datafile-io-traffic --datafile=system01.dbf --critical=3000");
|
||||
like( $result->output, '/system01.dbf: ([\d\.]+) IO Operations per Second \| \'dbf_system01.dbf_io_total_per_sec\'=([\d\.]+);1000;3000/');
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=datafile-io-traffic --name=system01.dbf --critical=3000");
|
||||
like( $result->output, '/system01.dbf: ([\d\.]+) IO Operations per Second \| \'dbf_system01.dbf_io_total_per_sec\'=([\d\.]+);1000;3000/');
|
||||
$result->output =~ /system01.dbf: ([\d\.]+) IO Operations per Second \| 'dbf_system01.dbf_io_total_per_sec'=([\d\.]+);1000;3000/;
|
||||
diag($result->output);
|
||||
ok($1 == $2);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("latches");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=latch-contention --name=1");
|
||||
like( $result->output, '/SGA (.*?) \(#1\) contention [0-9\.]+% \| \'latch_1_contention\'=[0-9\.]+%;1;2 \'latch_1_gets\'=[0-9]+/');
|
||||
$result->output =~ /SGA (.*?) \(#1\) contention ([\d\.]+)% \| 'latch_1_contention\'=([\d\.]+)%;1;2 \'latch_1_gets\'=\d+/;
|
||||
ok($2 eq $3);
|
||||
diag($result->output);
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=latch-waiting --name=1");
|
||||
like( $result->output, '/SGA (.*?) \(#1\) sleeping [0-9\.]+% of the time \| \'latch_1_sleep_share\'=[0-9\.]+%;0.1;1;0;100/');
|
||||
$result->output =~ /SGA (.*?) \(#1\) sleeping ([\d\.]+)% of the time \| \'latch_1_sleep_share\'=([\d\.]+)%;0.1;1;0;100/;
|
||||
ok($2 eq $3);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("events");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=event-waits --name='log file sync'");
|
||||
like( $result->output, '/log file sync : ([\d\.]+) waits\/sec \| \'log file sync_waits_per_sec\'=([\d\.]+);10;100/');
|
||||
$result->output =~ /log file sync : ([\d\.]+) waits\/sec \| \'log file sync_waits_per_sec\'=([\d\.]+);10;100/;
|
||||
ok($1 eq $2);
|
||||
diag($result->output);
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=event-waiting --name='log file sync'");
|
||||
like( $result->output, '/log file sync waits ([\d\.]+)% of the time \| \'log file sync_percent_waited\'=([\d\.]+)%;0.1;0.5/');
|
||||
$result->output =~ /log file sync waits ([\d\.]+)% of the time \| \'log file sync_percent_waited\'=([\d\.]+)%;0.1;0.5/;
|
||||
ok($1 eq $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("enqueues");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=enqueue-contention --name=HW");
|
||||
like( $result->output, '/enqueue HW High-Water Lock: ([\d\.]+)% of the requests must wait \| \'HW_contention\'=([\d\.]+)%;1;10 \'HW_requests\'=([\d]+) \'HW_waits\'=([\d]+)/');
|
||||
$result->output =~ /enqueue HW High-Water Lock: ([\d\.]+)% of the requests must wait \| \'HW_contention\'=([\d\.]+)%;1;10 \'HW_requests\'=([\d]+) \'HW_waits\'=([\d]+)/;
|
||||
ok($1 eq $2);
|
||||
diag($result->output);
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=enqueue-waiting --name=HW");
|
||||
like( $result->output, '/enqueue HW High-Water Lock: waiting ([\d\.]+)% of the time \| \'HW_ms_waited\'=([\d]+) \'HW_pct_waited\'=([\d\.]+)%;0.0003333;0.003333/');
|
||||
$result->output =~ /enqueue HW High-Water Lock: waiting ([\d\.]+)% of the time \| \'HW_ms_waited\'=([\d]+) \'HW_pct_waited\'=([\d\.]+)%;0.0003333;0.003333/;
|
||||
ok($3 == $1);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag("systats");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sysstat --name='sorts (memory)' --warning=12 --critical=15");
|
||||
like( $result->output, '/([\d\.]+) sorts \(memory\)\/sec \| \'sorts \(memory\)_per_sec\'=([\d\.]+);12;15 \'sorts \(memory\)\'=([\d]+)/');
|
||||
$result->output =~ /([\d\.]+) sorts \(memory\)\/sec \| \'sorts \(memory\)_per_sec\'=([\d\.]+);12;15 \'sorts \(memory\)\'=([\d]+)/;
|
||||
ok($1 eq $2);
|
||||
diag($result->output);
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
diag ("generic sql");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name='select count(*) from v\$latch'");
|
||||
like( $result->output, '/CRITICAL - select count\(\*\) from v\$latch: ([\d]+) \| \'select count\(\*\) from v\$latch\'=([\d]+);1;5/');
|
||||
$result->output =~ /CRITICAL - select count\(\*\) from v\$latch: ([\d]+) \| 'select count\(\*\) from v\$latch'=([\d]+);1;5/;
|
||||
ok($1 == $2);
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name='select count(*) from v\$latch' --name2='so a kaas'");
|
||||
like( $result->output, '/CRITICAL - so a kaas: ([\d]+) \| \'so a kaas\'=([\d]+);1;5/');
|
||||
$result->output =~ /CRITICAL - so a kaas: ([\d]+) \| 'so a kaas'=([\d]+);1;5/;
|
||||
ok($1 == $2);
|
||||
diag($result->output);
|
||||
|
||||
my $hash = NPTest->testCmd("echo 'select 4/3 from dual' | ./check_oracle_health $oracle_login_details --mode=encode")->output;
|
||||
ok($hash eq "select%204%2F3%20from%20dual");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name=$hash --name2=calc");
|
||||
my $match = 'WARNING \- calc\: 1\.33 | \'calc\'=1\.33;1;5';
|
||||
like( $result->output, '/'.$match.'/');
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name=$hash --name2=calc --units=B");
|
||||
$match = 'WARNING \- calc\: 1\.33B | \'calc\'=1\.33B;1;5';
|
||||
like( $result->output, '/'.$match.'/');
|
||||
|
||||
$hash = NPTest->testCmd("echo 'select 4/2 from dual' | ./check_oracle_health $oracle_login_details --mode=encode")->output;
|
||||
ok($hash eq "select%204%2F2%20from%20dual");
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name=$hash --name2=calc");
|
||||
$match = 'WARNING \- calc\: 2 | \'calc\'=2;1;5';
|
||||
like( $result->output, '/'.$match.'/');
|
||||
$result = NPTest->testCmd("./check_oracle_health $oracle_login_details --mode=sql --name=$hash --name2=calc --units=B");
|
||||
$match = 'WARNING \- calc\: 2B | \'calc\'=2B;1;5';
|
||||
like( $result->output, '/'.$match.'/');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user