Merge tag 'upstream/1.4.5'
Upstream version 1.4.5
This commit is contained in:
commit
3b1c07639b
716
ABOUT-NLS
Normal file
716
ABOUT-NLS
Normal file
|
@ -0,0 +1,716 @@
|
|||
Notes on the Free Translation Project
|
||||
*************************************
|
||||
|
||||
Free software is going international! The Free Translation Project is
|
||||
a way to get maintainers of free software, translators, and users all
|
||||
together, so that will gradually become able to speak many languages.
|
||||
A few packages already provide translations for their messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||
assume that the distributed package does use GNU `gettext' internally,
|
||||
itself available at your nearest GNU archive site. But you do _not_
|
||||
need to install GNU `gettext' prior to configuring, installing or using
|
||||
this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
available translations. They tell how people wanting to contribute and
|
||||
work at translations should contact the appropriate team.
|
||||
|
||||
When reporting bugs in the `intl/' directory or bugs which may be
|
||||
related to internationalization, you should tell about the version of
|
||||
`gettext' which is used. The information can be found in the
|
||||
`intl/VERSION' file, in internationalized packages.
|
||||
|
||||
Quick configuration advice
|
||||
==========================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in the
|
||||
operating system where this package is being installed. So far, only
|
||||
the `gettext' implementation in the GNU C library version 2 provides as
|
||||
many features (such as locale alias, message inheritance, automatic
|
||||
charset conversion or plural form handling) as the implementation here.
|
||||
It is also not possible to offer this additional functionality on top
|
||||
of a `catgets' implementation. Future versions of GNU `gettext' will
|
||||
very likely convey even more functionality. So it might be a good idea
|
||||
to change to GNU `gettext' as soon as possible.
|
||||
|
||||
So you need _not_ provide this option if you are using GNU libc 2 or
|
||||
you have installed a recent copy of the GNU gettext package with the
|
||||
included `libintl'.
|
||||
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some packages are "localizable" when properly installed; the programs
|
||||
they contain can be made to speak your own native language. Most such
|
||||
packages use GNU `gettext'. Other packages have their own ways to
|
||||
internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system already
|
||||
provides the GNU `gettext' functions. If not, the GNU `gettext' own
|
||||
library will be used. This library is wholly contained within this
|
||||
package, usually in the `intl/' subdirectory, so prior installation of
|
||||
the GNU `gettext' package is _not_ required. Installers may use
|
||||
special options at configuration time for changing the default
|
||||
behaviour. The commands:
|
||||
|
||||
./configure --with-included-gettext
|
||||
./configure --disable-nls
|
||||
|
||||
will respectively bypass any pre-existing `gettext' to use the
|
||||
internationalizing routines provided within this package, or else,
|
||||
_totally_ disable translation of messages.
|
||||
|
||||
When you already have GNU `gettext' installed on your system and run
|
||||
configure without an option for your new package, `configure' will
|
||||
probably detect the previously built and installed `libintl.a' file and
|
||||
will decide to use this. This might be not what is desirable. You
|
||||
should use the more recent version of the GNU `gettext' library. I.e.
|
||||
if the file `intl/VERSION' shows that the library which comes with this
|
||||
package is more recent, you should use
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to prevent auto-detection.
|
||||
|
||||
The configuration process will not test for the `catgets' function
|
||||
and therefore it will not be used. The reason is that even an
|
||||
emulation of `gettext' on top of `catgets' could not provide all the
|
||||
extensions of the GNU `gettext' library.
|
||||
|
||||
Internationalized packages have usually many `po/LL.po' files, where
|
||||
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||
translations have been forbidden at `configure' time by using the
|
||||
`--disable-nls' switch, all available translations are installed
|
||||
together with the package. However, the environment variable `LINGUAS'
|
||||
may be set, prior to configuration, to limit the installed set.
|
||||
`LINGUAS' should then contain a space separated list of two-letter
|
||||
codes, stating which languages are allowed.
|
||||
|
||||
Using This Package
|
||||
==================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
|
||||
and `CC' is an ISO 3166 two-letter country code. For example, let's
|
||||
suppose that you speak German and live in Germany. At the shell
|
||||
prompt, merely execute `setenv LANG de_DE' (in `csh'),
|
||||
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
|
||||
This can be done from your `.login' or `.profile' file, once and for
|
||||
all.
|
||||
|
||||
You might think that the country code specification is redundant.
|
||||
But in fact, some languages have dialects in different countries. For
|
||||
example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
|
||||
country code serves to distinguish the dialects.
|
||||
|
||||
The locale naming convention of `LL_CC', with `LL' denoting the
|
||||
language and `CC' denoting the country, is the one use on systems based
|
||||
on GNU libc. On other systems, some variations of this scheme are
|
||||
used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
|
||||
locales supported by your system for your country by running the command
|
||||
`locale -a | grep '^LL''.
|
||||
|
||||
Not all programs have translations for all languages. By default, an
|
||||
English message is shown in place of a nonexistent translation. If you
|
||||
understand other languages, you can set up a priority list of languages.
|
||||
This is done through a different environment variable, called
|
||||
`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
|
||||
for the purpose of message handling, but you still need to have `LANG'
|
||||
set to the primary language; this is required by other parts of the
|
||||
system libraries. For example, some Swedish users who would rather
|
||||
read translations in German than English for when Swedish is not
|
||||
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
|
||||
|
||||
In the `LANGUAGE' environment variable, but not in the `LANG'
|
||||
environment variable, `LL_CC' combinations can be abbreviated as `LL'
|
||||
to denote the language's main dialect. For example, `de' is equivalent
|
||||
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
|
||||
(Portuguese as spoken in Portugal) in this context.
|
||||
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list. The up-to-date list of
|
||||
teams can be found at the Free Translation Project's homepage,
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
|
||||
area.
|
||||
|
||||
If you'd like to volunteer to _work_ at translating messages, you
|
||||
should become a member of the translating team for your own language.
|
||||
The subscribing address is _not_ the same as the list itself, it has
|
||||
`-request' appended. For example, speakers of Swedish can send a
|
||||
message to `sv-request@li.org', having this message body:
|
||||
|
||||
subscribe
|
||||
|
||||
Keep in mind that team members are expected to participate
|
||||
_actively_ in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `translation@iro.umontreal.ca' to reach the
|
||||
coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology in use. Proven linguistic skill are praised more than
|
||||
programming skill, here.
|
||||
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of December
|
||||
2003. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination, with a
|
||||
translation percentage of at least 50%.
|
||||
|
||||
Ready PO files am az be bg ca cs da de el en en_GB eo es
|
||||
+-------------------------------------------+
|
||||
a2ps | [] [] [] [] |
|
||||
aegis | () |
|
||||
ant-phone | () |
|
||||
anubis | |
|
||||
ap-utils | |
|
||||
bash | [] [] [] [] |
|
||||
batchelor | |
|
||||
bfd | [] [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] |
|
||||
bluez-pin | [] [] |
|
||||
clisp | |
|
||||
clisp | [] [] [] |
|
||||
coreutils | [] [] [] [] |
|
||||
cpio | [] [] [] |
|
||||
darkstat | [] () [] |
|
||||
diffutils | [] [] [] [] [] [] [] |
|
||||
e2fsprogs | [] [] |
|
||||
enscript | [] [] [] [] |
|
||||
error | [] [] [] [] [] |
|
||||
fetchmail | [] () [] [] [] [] |
|
||||
fileutils | [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] |
|
||||
flex | [] [] [] [] |
|
||||
fslint | |
|
||||
gas | [] |
|
||||
gawk | [] [] [] [] |
|
||||
gbiff | [] |
|
||||
gcal | [] |
|
||||
gcc | [] [] |
|
||||
gettext | [] [] [] [] [] |
|
||||
gettext-examples | [] [] [] |
|
||||
gettext-runtime | [] [] [] [] [] |
|
||||
gettext-tools | [] [] [] |
|
||||
gimp-print | [] [] [] [] [] |
|
||||
gliv | |
|
||||
glunarclock | [] [] |
|
||||
gnubiff | [] |
|
||||
gnucash | [] () [] [] |
|
||||
gnucash-glossary | [] () [] |
|
||||
gnupg | [] () [] [] [] [] |
|
||||
gpe-aerial | [] |
|
||||
gpe-beam | [] [] |
|
||||
gpe-calendar | [] [] |
|
||||
gpe-clock | [] [] |
|
||||
gpe-conf | [] [] |
|
||||
gpe-contacts | [] [] |
|
||||
gpe-edit | [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] [] |
|
||||
gpe-ownerinfo | [] [] |
|
||||
gpe-sketchbook | [] [] |
|
||||
gpe-su | [] [] |
|
||||
gpe-taskmanager | [] [] |
|
||||
gpe-timesheet | [] |
|
||||
gpe-today | [] [] |
|
||||
gpe-todo | [] [] |
|
||||
gphoto2 | [] [] [] [] |
|
||||
gprof | [] [] [] |
|
||||
gpsdrive | () () () |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gtick | () |
|
||||
hello | [] [] [] [] [] [] |
|
||||
id-utils | [] [] |
|
||||
indent | [] [] [] [] |
|
||||
jpilot | [] [] [] |
|
||||
jtag | |
|
||||
jwhois | [] |
|
||||
kbd | [] [] [] [] [] |
|
||||
latrine | () |
|
||||
ld | [] [] |
|
||||
libc | [] [] [] [] [] [] |
|
||||
libgpewidget | [] [] |
|
||||
libiconv | [] [] [] [] [] |
|
||||
lifelines | [] () |
|
||||
lilypond | [] |
|
||||
lingoteach | |
|
||||
lingoteach_lessons | () () |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] [] |
|
||||
make | [] [] [] |
|
||||
man-db | [] () [] [] () |
|
||||
minicom | [] [] [] |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] () [] [] [] |
|
||||
nano_1_0 | [] () [] [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] [] [] [] |
|
||||
ptx | [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] [] [] [] [] |
|
||||
rpm | [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] [] [] |
|
||||
sed | [] [] [] [] [] |
|
||||
sh-utils | [] [] [] |
|
||||
shared-mime-info | |
|
||||
sharutils | [] [] [] [] [] [] |
|
||||
silky | () |
|
||||
skencil | [] () [] |
|
||||
sketch | [] () [] |
|
||||
soundtracker | [] [] [] |
|
||||
sp | [] |
|
||||
tar | [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] [] [] |
|
||||
tin | () () |
|
||||
tuxpaint | [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] [] [] [] |
|
||||
vorbis-tools | [] [] [] [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] |
|
||||
xchat | [] [] [] [] |
|
||||
xfree86_xkb_xml | [] |
|
||||
xpad | [] |
|
||||
+-------------------------------------------+
|
||||
am az be bg ca cs da de el en en_GB eo es
|
||||
0 0 8 3 37 38 56 73 15 1 5 12 64
|
||||
|
||||
et fa fi fr ga gl he hr hu id is it ja
|
||||
+----------------------------------------+
|
||||
a2ps | [] [] [] () |
|
||||
aegis | |
|
||||
ant-phone | |
|
||||
anubis | [] |
|
||||
ap-utils | [] |
|
||||
bash | [] [] |
|
||||
batchelor | [] |
|
||||
bfd | [] |
|
||||
binutils | [] [] |
|
||||
bison | [] [] [] [] |
|
||||
bluez-pin | [] [] [] [] [] |
|
||||
clisp | |
|
||||
clisp | [] |
|
||||
coreutils | [] [] [] [] [] [] |
|
||||
cpio | [] [] [] |
|
||||
darkstat | () [] [] [] |
|
||||
diffutils | [] [] [] [] [] [] [] |
|
||||
e2fsprogs | |
|
||||
enscript | [] [] |
|
||||
error | [] [] [] [] |
|
||||
fetchmail | [] |
|
||||
fileutils | [] [] [] [] [] [] |
|
||||
findutils | [] [] [] [] [] [] [] [] [] [] |
|
||||
flex | [] [] |
|
||||
fslint | |
|
||||
gas | [] |
|
||||
gawk | [] [] [] |
|
||||
gbiff | |
|
||||
gcal | [] |
|
||||
gcc | [] |
|
||||
gettext | [] [] |
|
||||
gettext-examples | [] [] |
|
||||
gettext-runtime | [] [] [] [] |
|
||||
gettext-tools | [] [] |
|
||||
gimp-print | [] [] |
|
||||
gliv | () |
|
||||
glunarclock | [] [] [] [] |
|
||||
gnubiff | |
|
||||
gnucash | () [] |
|
||||
gnucash-glossary | [] |
|
||||
gnupg | [] [] [] [] [] [] [] |
|
||||
gpe-aerial | [] |
|
||||
gpe-beam | [] |
|
||||
gpe-calendar | [] [] [] |
|
||||
gpe-clock | [] |
|
||||
gpe-conf | [] |
|
||||
gpe-contacts | [] [] |
|
||||
gpe-edit | [] [] |
|
||||
gpe-go | [] |
|
||||
gpe-login | [] [] |
|
||||
gpe-ownerinfo | [] [] [] |
|
||||
gpe-sketchbook | [] |
|
||||
gpe-su | [] |
|
||||
gpe-taskmanager | [] |
|
||||
gpe-timesheet | [] [] [] |
|
||||
gpe-today | [] [] |
|
||||
gpe-todo | [] [] |
|
||||
gphoto2 | [] [] [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () [] () () |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] [] [] [] [] [] [] [] |
|
||||
gretl | [] |
|
||||
gtick | [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] [] |
|
||||
indent | [] [] [] [] [] [] [] [] [] |
|
||||
jpilot | [] () |
|
||||
jtag | |
|
||||
jwhois | [] [] [] [] |
|
||||
kbd | [] |
|
||||
latrine | |
|
||||
ld | [] |
|
||||
libc | [] [] [] [] [] |
|
||||
libgpewidget | [] [] [] [] |
|
||||
libiconv | [] [] [] [] [] [] [] [] [] |
|
||||
lifelines | () |
|
||||
lilypond | [] |
|
||||
lingoteach | [] [] |
|
||||
lingoteach_lessons | |
|
||||
lynx | [] [] [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | |
|
||||
make | [] [] [] [] [] |
|
||||
man-db | () () |
|
||||
minicom | [] [] [] [] |
|
||||
mysecretdiary | [] [] |
|
||||
nano | [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] |
|
||||
opcodes | [] |
|
||||
parted | [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] [] [] [] |
|
||||
rpm | |
|
||||
screem | |
|
||||
scrollkeeper | [] |
|
||||
sed | [] [] [] [] [] [] [] [] [] |
|
||||
sh-utils | [] [] [] [] [] [] [] |
|
||||
shared-mime-info | [] |
|
||||
sharutils | [] [] [] [] [] |
|
||||
silky | [] () |
|
||||
skencil | [] |
|
||||
sketch | [] |
|
||||
soundtracker | [] [] [] [] |
|
||||
sp | [] () |
|
||||
tar | [] [] [] [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] [] |
|
||||
textutils | [] [] [] [] [] |
|
||||
tin | [] () |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] [] [] () [] |
|
||||
vorbis-tools | [] |
|
||||
wastesedge | () |
|
||||
wdiff | [] [] [] [] [] [] |
|
||||
wget | [] [] [] [] [] [] [] |
|
||||
xchat | [] [] [] |
|
||||
xfree86_xkb_xml | |
|
||||
xpad | [] |
|
||||
+----------------------------------------+
|
||||
et fa fi fr ga gl he hr hu id is it ja
|
||||
21 1 25 86 24 24 8 10 38 31 1 23 32
|
||||
|
||||
ko lg lt lv ms nb nl nn no pl pt pt_BR ro
|
||||
+-------------------------------------------+
|
||||
a2ps | () [] [] () () [] [] |
|
||||
aegis | () () |
|
||||
ant-phone | [] [] |
|
||||
anubis | [] [] [] [] [] |
|
||||
ap-utils | [] () [] |
|
||||
bash | [] [] |
|
||||
batchelor | [] |
|
||||
bfd | [] |
|
||||
binutils | |
|
||||
bison | [] [] [] [] |
|
||||
bluez-pin | [] [] [] |
|
||||
clisp | |
|
||||
clisp | [] |
|
||||
coreutils | [] |
|
||||
cpio | [] [] [] [] [] |
|
||||
darkstat | [] [] [] [] |
|
||||
diffutils | [] [] [] [] |
|
||||
e2fsprogs | [] |
|
||||
enscript | [] [] [] |
|
||||
error | [] [] [] |
|
||||
fetchmail | [] [] () |
|
||||
fileutils | [] [] |
|
||||
findutils | [] [] [] [] [] |
|
||||
flex | [] [] [] [] |
|
||||
fslint | [] [] |
|
||||
gas | |
|
||||
gawk | [] [] [] |
|
||||
gbiff | [] [] |
|
||||
gcal | |
|
||||
gcc | |
|
||||
gettext | [] [] [] |
|
||||
gettext-examples | [] [] |
|
||||
gettext-runtime | [] [] [] |
|
||||
gettext-tools | [] [] [] |
|
||||
gimp-print | [] |
|
||||
gliv | [] [] [] |
|
||||
glunarclock | [] [] [] |
|
||||
gnubiff | |
|
||||
gnucash | [] [] () |
|
||||
gnucash-glossary | [] [] |
|
||||
gnupg | [] |
|
||||
gpe-aerial | [] [] [] |
|
||||
gpe-beam | [] [] [] |
|
||||
gpe-calendar | [] [] [] |
|
||||
gpe-clock | [] [] [] |
|
||||
gpe-conf | [] [] [] |
|
||||
gpe-contacts | [] [] [] |
|
||||
gpe-edit | [] [] [] |
|
||||
gpe-go | [] [] |
|
||||
gpe-login | [] [] [] |
|
||||
gpe-ownerinfo | [] [] [] |
|
||||
gpe-sketchbook | [] [] [] |
|
||||
gpe-su | [] [] [] |
|
||||
gpe-taskmanager | [] [] [] |
|
||||
gpe-timesheet | [] [] [] |
|
||||
gpe-today | [] [] [] |
|
||||
gpe-todo | [] [] [] |
|
||||
gphoto2 | [] |
|
||||
gprof | [] [] |
|
||||
gpsdrive | () () () [] |
|
||||
gramadoir | [] |
|
||||
grep | [] [] [] [] |
|
||||
gretl | |
|
||||
gtick | [] [] |
|
||||
hello | [] [] [] [] [] [] [] [] [] [] |
|
||||
id-utils | [] [] [] |
|
||||
indent | [] [] [] |
|
||||
jpilot | () () |
|
||||
jtag | |
|
||||
jwhois | [] [] [] [] |
|
||||
kbd | [] [] [] |
|
||||
latrine | [] |
|
||||
ld | |
|
||||
libc | [] [] [] [] [] |
|
||||
libgpewidget | [] [] [] |
|
||||
libiconv | [] [] [] [] |
|
||||
lifelines | |
|
||||
lilypond | |
|
||||
lingoteach | |
|
||||
lingoteach_lessons | |
|
||||
lynx | [] [] |
|
||||
m4 | [] [] [] [] |
|
||||
mailutils | [] [] |
|
||||
make | [] [] [] [] |
|
||||
man-db | [] |
|
||||
minicom | [] [] [] |
|
||||
mysecretdiary | [] [] [] |
|
||||
nano | [] [] [] [] |
|
||||
nano_1_0 | [] [] [] [] [] |
|
||||
opcodes | [] [] |
|
||||
parted | [] [] [] [] |
|
||||
ptx | [] [] [] [] [] [] [] |
|
||||
python | |
|
||||
radius | [] |
|
||||
recode | [] [] [] |
|
||||
rpm | [] [] |
|
||||
screem | |
|
||||
scrollkeeper | [] [] [] [] |
|
||||
sed | [] [] [] |
|
||||
sh-utils | [] |
|
||||
shared-mime-info | [] |
|
||||
sharutils | [] |
|
||||
silky | |
|
||||
skencil | [] [] |
|
||||
sketch | [] [] |
|
||||
soundtracker | |
|
||||
sp | |
|
||||
tar | [] [] [] [] [] [] |
|
||||
texinfo | [] [] [] |
|
||||
textutils | [] [] |
|
||||
tin | |
|
||||
tuxpaint | [] [] [] [] [] [] [] [] [] |
|
||||
util-linux | [] [] |
|
||||
vorbis-tools | [] [] |
|
||||
wastesedge | |
|
||||
wdiff | [] [] [] [] |
|
||||
wget | [] [] |
|
||||
xchat | [] [] |
|
||||
xfree86_xkb_xml | [] |
|
||||
xpad | [] [] |
|
||||
+-------------------------------------------+
|
||||
ko lg lt lv ms nb nl nn no pl pt pt_BR ro
|
||||
12 0 1 2 12 10 60 4 4 38 25 35 76
|
||||
|
||||
ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
|
||||
+-------------------------------------------+
|
||||
a2ps | [] [] [] [] [] | 16
|
||||
aegis | () | 0
|
||||
ant-phone | | 2
|
||||
anubis | [] [] [] | 9
|
||||
ap-utils | () | 3
|
||||
bash | [] | 9
|
||||
batchelor | | 2
|
||||
bfd | [] [] | 6
|
||||
binutils | [] [] [] | 7
|
||||
bison | [] [] [] | 14
|
||||
bluez-pin | [] [] [] | 13
|
||||
clisp | | 0
|
||||
clisp | | 5
|
||||
coreutils | [] [] [] [] [] | 16
|
||||
cpio | [] [] [] | 14
|
||||
darkstat | [] [] [] () () | 12
|
||||
diffutils | [] [] [] [] | 22
|
||||
e2fsprogs | [] [] | 5
|
||||
enscript | [] [] [] | 12
|
||||
error | [] [] [] | 15
|
||||
fetchmail | [] [] [] | 11
|
||||
fileutils | [] [] [] [] [] [] | 17
|
||||
findutils | [] [] [] [] [] [] [] | 29
|
||||
flex | [] [] [] | 13
|
||||
fslint | | 2
|
||||
gas | [] | 3
|
||||
gawk | [] [] | 12
|
||||
gbiff | | 3
|
||||
gcal | [] [] | 4
|
||||
gcc | [] | 4
|
||||
gettext | [] [] [] [] [] [] | 16
|
||||
gettext-examples | [] [] [] [] | 11
|
||||
gettext-runtime | [] [] [] [] [] [] [] [] [] | 21
|
||||
gettext-tools | [] [] [] [] [] [] | 14
|
||||
gimp-print | [] [] | 10
|
||||
gliv | | 3
|
||||
glunarclock | [] [] [] [] | 13
|
||||
gnubiff | | 1
|
||||
gnucash | [] [] [] | 9
|
||||
gnucash-glossary | [] [] [] | 8
|
||||
gnupg | [] [] [] [] | 17
|
||||
gpe-aerial | [] [] | 7
|
||||
gpe-beam | [] [] | 8
|
||||
gpe-calendar | [] [] [] [] [] | 13
|
||||
gpe-clock | [] [] [] [] | 10
|
||||
gpe-conf | [] [] [] | 9
|
||||
gpe-contacts | [] [] [] [] | 11
|
||||
gpe-edit | [] [] [] [] [] [] | 12
|
||||
gpe-go | [] | 5
|
||||
gpe-login | [] [] [] [] [] [] | 13
|
||||
gpe-ownerinfo | [] [] [] [] [] | 13
|
||||
gpe-sketchbook | [] [] [] | 9
|
||||
gpe-su | [] [] [] [] | 10
|
||||
gpe-taskmanager | [] [] [] [] | 10
|
||||
gpe-timesheet | [] [] [] [] [] | 12
|
||||
gpe-today | [] [] [] [] [] [] | 13
|
||||
gpe-todo | [] [] [] [] [] | 12
|
||||
gphoto2 | [] [] [] | 11
|
||||
gprof | [] [] | 9
|
||||
gpsdrive | [] [] | 4
|
||||
gramadoir | | 3
|
||||
grep | [] [] [] [] [] | 26
|
||||
gretl | | 2
|
||||
gtick | [] | 5
|
||||
hello | [] [] [] [] [] | 33
|
||||
id-utils | [] [] [] | 12
|
||||
indent | [] [] [] [] [] | 21
|
||||
jpilot | [] [] [] [] [] | 9
|
||||
jtag | [] | 1
|
||||
jwhois | () () [] [] | 11
|
||||
kbd | [] [] | 11
|
||||
latrine | | 1
|
||||
ld | [] [] | 5
|
||||
libc | [] [] [] [] | 20
|
||||
libgpewidget | [] [] [] [] | 13
|
||||
libiconv | [] [] [] [] [] [] [] [] [] | 27
|
||||
lifelines | [] | 2
|
||||
lilypond | [] | 3
|
||||
lingoteach | | 2
|
||||
lingoteach_lessons | () | 0
|
||||
lynx | [] [] [] [] | 14
|
||||
m4 | [] [] [] | 15
|
||||
mailutils | [] | 5
|
||||
make | [] [] [] [] | 16
|
||||
man-db | [] | 5
|
||||
minicom | [] | 11
|
||||
mysecretdiary | [] [] | 10
|
||||
nano | [] [] [] [] [] | 17
|
||||
nano_1_0 | [] [] [] [] | 17
|
||||
opcodes | [] [] | 6
|
||||
parted | [] [] [] | 15
|
||||
ptx | [] [] [] | 22
|
||||
python | | 0
|
||||
radius | [] | 4
|
||||
recode | [] [] [] [] | 20
|
||||
rpm | [] [] [] | 7
|
||||
screem | [] [] | 2
|
||||
scrollkeeper | [] [] [] [] | 15
|
||||
sed | [] [] [] [] [] [] | 23
|
||||
sh-utils | [] [] [] | 14
|
||||
shared-mime-info | [] [] | 4
|
||||
sharutils | [] [] [] [] [] | 17
|
||||
silky | () | 2
|
||||
skencil | [] | 6
|
||||
sketch | [] | 6
|
||||
soundtracker | [] [] | 9
|
||||
sp | [] | 3
|
||||
tar | [] [] [] [] [] | 24
|
||||
texinfo | [] [] [] [] | 14
|
||||
textutils | [] [] [] [] [] | 16
|
||||
tin | | 1
|
||||
tuxpaint | [] [] [] [] [] | 29
|
||||
util-linux | [] [] [] | 15
|
||||
vorbis-tools | [] | 8
|
||||
wastesedge | | 0
|
||||
wdiff | [] [] [] [] | 18
|
||||
wget | [] [] [] [] [] [] [] [] | 23
|
||||
xchat | [] [] [] [] [] | 14
|
||||
xfree86_xkb_xml | [] [] [] [] [] [] | 8
|
||||
xpad | | 4
|
||||
+-------------------------------------------+
|
||||
51 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW
|
||||
120 domains 59 42 16 25 81 0 56 12 1 10 21 22 1260
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
used for implementing regional variants of languages, or language
|
||||
dialects.
|
||||
|
||||
For a PO file in the matrix above to be effective, the package to
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If December 2003 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites. The most
|
||||
up-to-date matrix with full percentage details can be found at
|
||||
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
|
||||
|
||||
Using `gettext' in new packages
|
||||
===============================
|
||||
|
||||
If you are writing a freely available program and want to
|
||||
internationalize it you are welcome to use GNU `gettext' in your
|
||||
package. Of course you have to respect the GNU Library General Public
|
||||
License which covers the use of the GNU `gettext' library. This means
|
||||
in particular that even non-free programs can use `libintl' as a shared
|
||||
library, whereas only free software can use `libintl' as a static
|
||||
library or use modified versions of `libintl'.
|
||||
|
||||
Once the sources are changed appropriately and the setup can handle
|
||||
the use of `gettext' the only thing missing are the translations. The
|
||||
Free Translation Project is also available for packages which are not
|
||||
developed inside the GNU project. Therefore the information given above
|
||||
applies also for every other Free Software Project. Contact
|
||||
`translation@iro.umontreal.ca' to make the `.pot' files available to
|
||||
the translation teams.
|
29
ACKNOWLEDGEMENTS
Normal file
29
ACKNOWLEDGEMENTS
Normal file
|
@ -0,0 +1,29 @@
|
|||
This file contains the origin of code copied verbatim into some or all of the Nagios plugins.
|
||||
|
||||
The NagiosPlugin team thanks the original authors.
|
||||
|
||||
Copied code is cited in the source by indented commnents of the form
|
||||
|
||||
.. indent level .. /* Author YYYY sub-citation see ACKNOWLEDGEMENTS */
|
||||
|
||||
.. copied code
|
||||
/* Author YYYY sub-citation */
|
||||
|
||||
King, Alecs 2004
|
||||
getmac.c posted at http://lists.freebsd.org/pipermail/freebsd-hackers/2004-June/007415.html
|
||||
The sysctl interface to the *BSD kernel is used to get the host MAC address in check_dhcp.c
|
||||
|
||||
Kompf, Martin 200-2003 Copyright the author
|
||||
http://cplus.kompf.de/macaddr.html
|
||||
Using the DLPI support on SysV systems to get the host MAC address in check_dhcp.c
|
||||
|
||||
Stenberg, Daniel
|
||||
Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se>
|
||||
http://curl.haxx.se/
|
||||
Use of duplication of macros in m4/np_curl.m4
|
||||
|
||||
Coreutils team
|
||||
Copyright (C) 91, 1995-2004 Free Software Foundation, Inc.
|
||||
http://www.gnu.org/software/coreutils/
|
||||
Use of macros and lib files in m4/np_coreutils.m4 and lib/. Setuid installs in plugins-root
|
||||
|
14
AUTHORS
Normal file
14
AUTHORS
Normal file
|
@ -0,0 +1,14 @@
|
|||
The Nagios Plugins are brought to you by the Nagios Plugins Development Team.
|
||||
|
||||
Jeremy T Bouse
|
||||
Peter Bray
|
||||
Karl DeBisschop
|
||||
Ethan Galstad
|
||||
Sean Finney
|
||||
Subhendu Ghosh
|
||||
Stanley Hopcroft
|
||||
Matthew Kent
|
||||
Harper Mann
|
||||
Benoit Mortier
|
||||
Ton Voon
|
||||
Michael Wirtgen
|
19
BUGS
Normal file
19
BUGS
Normal file
|
@ -0,0 +1,19 @@
|
|||
This file lists known bugs in this specific release. It lists the major bugs from the Nagios
|
||||
Plugins page on Sourceforge at http://sourceforge.net/tracker/?group_id=29880&atid=397597.
|
||||
|
||||
For the 1.4.4 release:
|
||||
|
||||
1578214 - check_proc crashes on Itanium2
|
||||
1573700 - check_swap on HP-UX incorrect
|
||||
1573638 - check_swap SEGVs on Sol 10
|
||||
1475899 - check_tcp segfaults with multiple -s or -e args
|
||||
1447642 - check_ping segfault on Sol 10
|
||||
1344584 - check_snmp counter64 values not handled correctly
|
||||
1291987 - urlize useragent does not work
|
||||
1225470 - check_swap perf data incorrect
|
||||
1218438 - check_radius linking to wrong header
|
||||
1108499 - check_ping with -U on Debian fails
|
||||
1094326 - check_ide_smart usage errors
|
||||
1090549 - check_dhcp ignores DHCP replies
|
||||
990948 - check_disk_smb doesn't allow spaces in share names
|
||||
|
37
CHANGES
Normal file
37
CHANGES
Normal file
|
@ -0,0 +1,37 @@
|
|||
This file documents the major additions and syntax changes between releases.
|
||||
|
||||
1.4.4
|
||||
New C based check_ntp. The perl version is now deprecated.
|
||||
New check_apt plugin
|
||||
Notice: plugins in contrib/ will start to be removed from this distribution.
|
||||
Please check at http://www.nagiosexchange.org for contributed plugins
|
||||
Major bug fixes to check_disk where values were incorrectly calculated and alerted on.
|
||||
check_udp2 removed. check_udp is now linked to check_tcp.c
|
||||
check_mailq now errors if the sub-program run returns non-zero return code. This would appear
|
||||
as if mailqs were okay when the nagios user could not query the mail-queues
|
||||
Compile problems with check_snmp fixed
|
||||
|
||||
1.4.3
|
||||
Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install
|
||||
SSL plugins work with gnutls as well as OpenSSL
|
||||
check_mysql_query added to run arbitrary SQL commands, with threshold checking
|
||||
libtool now required for development systems
|
||||
Notice: check_udp (compiled from check_udp.c) will be deprecated in the next release.
|
||||
check_udp2 should be used instead and will be renamed to check_udp
|
||||
|
||||
1.4.2
|
||||
Fix for Redhat ES4 for check_dns and check_dig
|
||||
|
||||
1.4
|
||||
IPv6 support in check_ping, check_by_ssh, check_http, check_ldap, check_smtp, check_tcp
|
||||
Internationalisation support
|
||||
Performance data added to most plugins
|
||||
check_disk now using GNU coreutils code
|
||||
New plugins - check_dhcp, check_icmp
|
||||
contrib/check_citrix has been replaced by contrib/check_ica* (requires packet_utils.pm in libexec)
|
||||
check_http --min changed to --pagesize, added max so min:max in check
|
||||
check_vsz and check_rss deprecated - functionality moved into check_procs
|
||||
check_swap % thresholds changed to measure amount free, instead of amount used
|
||||
check_disk syntax changes for -p, -m/-M, defaults to MB instead of kB
|
||||
check_procs -C expects no path for the command name
|
||||
|
116
CODING
Normal file
116
CODING
Normal file
|
@ -0,0 +1,116 @@
|
|||
The following guidelines are intended to aid programmers in creating
|
||||
code that is consistent with the existing core plugins.
|
||||
|
||||
The primary goals of these standards are internal consistency, and
|
||||
readability in a wide range of environments.
|
||||
|
||||
|
||||
1. C Language Programming
|
||||
|
||||
All code should comply with the requirements of the Free Software
|
||||
Foundation Coding standards (which are currently available at
|
||||
http://www.gnu.org/prep/standards_toc.html). We also follow most of
|
||||
the FSF guidelines. Developers may suggest deviations from the FSF
|
||||
style recommendations, which will be considered by open discussion on
|
||||
the nagiosplug-devel mailing list. Any such deviations will apply to
|
||||
the entire code base to ensure consistency.
|
||||
|
||||
Currently, the exceptions to FSF recommendations are roughly equivalent
|
||||
to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
|
||||
exceptions are as follows:
|
||||
|
||||
a) leading white space for a statement should be formatted as tabs,
|
||||
with one tab for each code indentation level.
|
||||
|
||||
b) in statement continuation lines, format whitespace up to the column
|
||||
starting the statement as tabs, format the rest as spaces (this
|
||||
results in code that is legible regardless of tab-width setting).
|
||||
|
||||
c) with the exception of the above, tabs should generally be avoided
|
||||
|
||||
d) when tab width is 2 spaces, line-length should not exceed 80
|
||||
characters
|
||||
|
||||
e) The opening brace of an if or while block is on the same line as
|
||||
the end of the conditional expression (the '-br' option).
|
||||
|
||||
|
||||
2. Perl Language Programming
|
||||
|
||||
Taken from the O'Reilly book "Programming Perl" (3rd edition, pages 604-606) with
|
||||
modifications for clarity and to cohere with C coding standards.
|
||||
|
||||
*) Always check the return code of system calls.
|
||||
|
||||
a) Use tab indentation.
|
||||
|
||||
b) Put space before the opening brace of a multiline block.
|
||||
|
||||
c) A short block may be put on one line, including braces.
|
||||
|
||||
d) Never omit the semicolon.
|
||||
|
||||
e) Surround most operators with space.
|
||||
|
||||
$x = 5; # do this
|
||||
$y=5; # don't do this
|
||||
|
||||
f) Surround a "complex" subscript (inside brackets) with space.
|
||||
|
||||
g) Put empty lines between chunks of code that do different things.
|
||||
|
||||
*) Always check the return code of system calls.
|
||||
|
||||
h) Put a newline between closing brace and else or elsif.
|
||||
|
||||
i) Do not put space between a function name and its opening parenthesis.
|
||||
|
||||
j) Do not put space before a semicolon.
|
||||
|
||||
k) Put space after each comma.
|
||||
|
||||
l) Break long lines after an operator (but before 'and' and 'or', even when
|
||||
spelled as && and ||)).
|
||||
|
||||
*) Always check the return code of system calls.
|
||||
|
||||
m) Line up corresponding items vertically.
|
||||
|
||||
n) Use redundant parentheses only where it increases readability.
|
||||
|
||||
o) An opening brace should be put on the same line as its preceding keyword,
|
||||
if possible; otherwise, line them up vertically.
|
||||
|
||||
while ($condition) {
|
||||
# do something
|
||||
}
|
||||
|
||||
while ($this_condition and $that_condition and $some_other_condition
|
||||
and $this_really_really_really_long_condition)
|
||||
{
|
||||
# do something
|
||||
}
|
||||
|
||||
p) Do things the most readable way. For instance:
|
||||
|
||||
open(FOO, $foo) or die "Can't open $foo: $!";
|
||||
|
||||
is better than
|
||||
|
||||
die "Can't open $foo: $!" unless open(FOO, $foo);
|
||||
|
||||
because the second way hides the main point of the statement in a modifier.
|
||||
|
||||
q) Just because an operator lets you assume default arguments doesn't mean
|
||||
that you should always use them. The defaults are there for lazy programmers
|
||||
writing one-shot, non-shared programs. If you want your program to be readable,
|
||||
consider supplying the argument.
|
||||
|
||||
r) Choose mnemonic identifiers. That is, don't name your variables $h, $c
|
||||
and $w. Try $hostaddress, $critical and $warning instead ($host, $crit and
|
||||
$warn is OK too).
|
||||
|
||||
s) Use underscore to split words in long identifiers. That is, use
|
||||
$service_port instead of $ServicePort as the former is much more readable.
|
||||
|
||||
*) Always check the return code of system calls.
|
340
COPYING
Normal file
340
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) <year> <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) year 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.
|
87
FAQ
Normal file
87
FAQ
Normal file
|
@ -0,0 +1,87 @@
|
|||
Frequently Asked Questions
|
||||
**************************
|
||||
|
||||
1. Q: Where can I find documentation for <insert name> plugin?
|
||||
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include internal documentation. The documentation
|
||||
can be read executing plugin with the '-h' option ('--help' if
|
||||
long options are enabled). If the '-h' option does not work, that
|
||||
is a bug.
|
||||
|
||||
2. Q: What version of <insert name> plugin am I running?
|
||||
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include detailed version information. When executed
|
||||
with the '-V' option, a version string will be printed:
|
||||
|
||||
check_radius (nagios-plugins 1.3.0-alpha1) 1.11
|
||||
|
||||
Note that this string include both the assigned package release
|
||||
name and the CVS-generated revision for the individual plugin.
|
||||
Authors should strictly adhere to this format. All bug reports
|
||||
and help requests should reference this information.
|
||||
|
||||
3. Q: What information do I need to include when asking for help or
|
||||
submitting a bug report?
|
||||
|
||||
A: At a minimum, the output from 'uname -a' and the version string
|
||||
from '<plugin_name> -V' and, of course, a description of the
|
||||
problem and any solution/patch.
|
||||
|
||||
4. Q: I'm using Redhat Linux (or some other RPM-based distribution).
|
||||
Which packages should I install?
|
||||
|
||||
A: The package nagios-plugins-<version>.<arch>.rpm contains only
|
||||
those plugins that should work on any POSIX compliant system. In
|
||||
other words, you should be able to install this package on your
|
||||
system, no matter what else is or in not installed.
|
||||
|
||||
However, most of us have more complex systems than barebones
|
||||
POSIX. We tried creating a variety of separate packages so
|
||||
each dependency could be installed cleanly, but many people
|
||||
found that this resulted in too many packages. So in the end,
|
||||
all the non-POSIX plugins were folded into one RPM
|
||||
(nagios-plugins-<version>.<arch>.rpm). Most people will need to
|
||||
use RPM's '--nodeps' option to install this package.
|
||||
|
||||
5. Q: My system uses the .deb package format. What packages should I
|
||||
install?
|
||||
|
||||
A: We strive for cooperation between all packagers and developers.
|
||||
The answers for .deb are the same as for RPM, after changing the
|
||||
package name suffixes accordingly.
|
||||
|
||||
6. Q: I prefer to build my own RPMs. Do I need to install all of the
|
||||
various dependencies?
|
||||
|
||||
A: Beginning with the 1.2.9-1 release, you may run
|
||||
|
||||
rpm --define 'custom 1' -ta nagios-plugins-<release>.tar.gz
|
||||
|
||||
In prior releases, you must unpack the tarball and build the
|
||||
RPM using nagios-custom.spec with 'rpm -ba'.
|
||||
|
||||
7. Q: I get an error like
|
||||
|
||||
Warning: Return code of 127 for check of service 'PING' on host 'anyhost' was out of bounds.
|
||||
|
||||
when I run Nagios. (Often check_ping runs just fine on the
|
||||
command line).
|
||||
|
||||
A: Commonly, system administrators will make security as tight as
|
||||
possible on the monitoring system. Sometimes this includes OS
|
||||
options or hardening scripts that prevent unprivileged users from
|
||||
running the ping command. Nagios runs with no more privileges
|
||||
than 'nobody' -- check to be sure that the nagios user can
|
||||
actually run check ping. (This can also happen with other binaries
|
||||
executed by nagios, but ping seems to be far and away the biggest
|
||||
offender.)
|
||||
|
||||
8. Q: I have a plugin to offer. What do I do to get it accepted?
|
||||
|
||||
A: Send it to nagiosplug-devel@lists.sourceforge.net. Usually, we
|
||||
just drop it into contrib until we have a chance to check if the
|
||||
standard options are used, etc.
|
||||
|
||||
You can also get feedback on improving the plugin via the mailing list.
|
231
INSTALL
Normal file
231
INSTALL
Normal file
|
@ -0,0 +1,231 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 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=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PREFIX', the package will
|
||||
use PREFIX 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=DIR' 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.
|
||||
|
10
LEGAL
Normal file
10
LEGAL
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
All source code, binaries, documentation, and information contained
|
||||
in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
|
||||
INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE.
|
||||
|
||||
Nagios and the Nagios logo are trademarks of Ethan Galstad. All
|
||||
other trademarks, servicemarks, registered trademarks, and
|
||||
registered servicemarks are the property of their respective owner(s).
|
||||
|
56
Makefile.am
Normal file
56
Makefile.am
Normal file
|
@ -0,0 +1,56 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = lib plugins plugins-scripts plugins-root m4 po
|
||||
|
||||
EXTRA_DIST = config.rpath \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \
|
||||
REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm contrib pkg nagios-plugins.spec \
|
||||
config_test/Makefile config_test/run_tests config_test/child_test.c \
|
||||
tools/tinderbox_build
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\"
|
||||
|
||||
dist-hook:
|
||||
make THANKS nagios-plugins.spec pkg/fedora/nagios-plugins.spec
|
||||
|
||||
install-root:
|
||||
cd plugins-root && $(MAKE) $@
|
||||
|
||||
test:
|
||||
cd lib && $(MAKE) test
|
||||
cd plugins; $(MAKE) test
|
||||
cd plugins-scripts; $(MAKE) test
|
||||
|
||||
nagios-plugins.spec: nagios-plugins.spec.in
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@
|
||||
|
||||
pkg/fedora/nagios-plugins.spec: nagios-plugins.spec.in
|
||||
$(top_srcdir)/mkinstalldirs pkg/fedora
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;/^# Requires$$/r $(top_srcdir)/pkg/fedora/requires" $? > $@
|
||||
|
||||
# Solaris pkgmk
|
||||
BUILDDIR = build-solaris
|
||||
PACKDIR = build-pkg
|
||||
PKGSCRIPT = pkg/solaris/solpkg
|
||||
|
||||
solpkg:
|
||||
if [ ! -d $(BUILDDIR) ] ; then mkdir $(BUILDDIR); fi
|
||||
if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
|
||||
$(MAKE) all
|
||||
$(MAKE) DESTDIR=$$PWD/$(BUILDDIR) install
|
||||
$(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
|
||||
cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
|
||||
|
||||
THANKS: THANKS.in
|
||||
@echo "This software is brought to you by the Nagios Plugins Development Team. However," > $@
|
||||
@echo "there have been many contributors to this project. Everyone below has helped in " >> $@
|
||||
@echo "raising bug reports, creating patches or contributing new plugins." >> $@
|
||||
@echo "" >> $@
|
||||
perl -e ' while (<>) { print STDERR "Duplicate: $$_",$$/ if ($$a{$$_}) ; $$a{$$_}++}; print sort by_last_field (keys %a); sub by_last_field { ($$a1) = $$a =~ /\s(\w+)$$/; ($$b1) = $$b =~ /\s(\w+)$$/; $$a1 cmp $$b1}' $? >> $@
|
||||
|
||||
pkgclean:
|
||||
rm -rf $(BUILDDIR) $(PACKDIR)
|
756
Makefile.in
Normal file
756
Makefile.in
Normal file
|
@ -0,0 +1,756 @@
|
|||
# Makefile.in generated by automake 1.9.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/command.cfg.in \
|
||||
$(srcdir)/config.h.in $(srcdir)/test.pl.in \
|
||||
$(top_srcdir)/configure $(top_srcdir)/pkg/solaris/pkginfo.in \
|
||||
ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS \
|
||||
compile config.guess config.rpath config.sub depcomp \
|
||||
install-sh ltmain.sh missing mkinstalldirs
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/afs.m4 \
|
||||
$(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/basename.m4 \
|
||||
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/exitfail.m4 \
|
||||
$(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/fcntl-safer.m4 \
|
||||
$(top_srcdir)/m4/fstypename.m4 $(top_srcdir)/m4/fsusage.m4 \
|
||||
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/ls-mntd-fs.m4 \
|
||||
$(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/np_coreutils.m4 $(top_srcdir)/m4/np_curl.m4 \
|
||||
$(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/regex.m4 \
|
||||
$(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/stdbool.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unistd-safer.m4 \
|
||||
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/xalloc.m4 \
|
||||
$(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 = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = command.cfg test.pl pkg/solaris/pkginfo
|
||||
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@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_H = @ALLOCA_H@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BASENAME = @BASENAME@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\"
|
||||
DEPDIR = @DEPDIR@
|
||||
DEPLIBS = @DEPLIBS@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRAS = @EXTRAS@
|
||||
EXTRAS_ROOT = @EXTRAS_ROOT@
|
||||
EXTRA_NETOBJS = @EXTRA_NETOBJS@
|
||||
EXTRA_TEST = @EXTRA_TEST@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GETOPT_H = @GETOPT_H@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
HAVE__BOOL = @HAVE__BOOL@
|
||||
HOSTNAME = @HOSTNAME@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
KMEM_GROUP = @KMEM_GROUP@
|
||||
KRBINCLUDE = @KRBINCLUDE@
|
||||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
MYSQLCFLAGS = @MYSQLCFLAGS@
|
||||
MYSQLCONFIG = @MYSQLCONFIG@
|
||||
MYSQLINCLUDE = @MYSQLINCLUDE@
|
||||
MYSQLLIBS = @MYSQLLIBS@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
NEED_VA_LIST = @NEED_VA_LIST@
|
||||
OBJEXT = @OBJEXT@
|
||||
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@
|
||||
PATH_TO_APTGET = @PATH_TO_APTGET@
|
||||
PATH_TO_DIG = @PATH_TO_DIG@
|
||||
PATH_TO_FPING = @PATH_TO_FPING@
|
||||
PATH_TO_LMSTAT = @PATH_TO_LMSTAT@
|
||||
PATH_TO_LSPS = @PATH_TO_LSPS@
|
||||
PATH_TO_MAILQ = @PATH_TO_MAILQ@
|
||||
PATH_TO_NSLOOKUP = @PATH_TO_NSLOOKUP@
|
||||
PATH_TO_PING = @PATH_TO_PING@
|
||||
PATH_TO_PING6 = @PATH_TO_PING6@
|
||||
PATH_TO_PS = @PATH_TO_PS@
|
||||
PATH_TO_QMAIL_QSTAT = @PATH_TO_QMAIL_QSTAT@
|
||||
PATH_TO_QSTAT = @PATH_TO_QSTAT@
|
||||
PATH_TO_QUAKESTAT = @PATH_TO_QUAKESTAT@
|
||||
PATH_TO_RPCINFO = @PATH_TO_RPCINFO@
|
||||
PATH_TO_SMBCLIENT = @PATH_TO_SMBCLIENT@
|
||||
PATH_TO_SNMPGET = @PATH_TO_SNMPGET@
|
||||
PATH_TO_SNMPGETNEXT = @PATH_TO_SNMPGETNEXT@
|
||||
PATH_TO_SSH = @PATH_TO_SSH@
|
||||
PATH_TO_SWAP = @PATH_TO_SWAP@
|
||||
PATH_TO_SWAPINFO = @PATH_TO_SWAPINFO@
|
||||
PATH_TO_UPTIME = @PATH_TO_UPTIME@
|
||||
PATH_TO_WHO = @PATH_TO_WHO@
|
||||
PERL = @PERL@
|
||||
PGINCLUDE = @PGINCLUDE@
|
||||
PGLIBS = @PGLIBS@
|
||||
PKG_ARCH = @PKG_ARCH@
|
||||
PLUGIN_TEST = @PLUGIN_TEST@
|
||||
POSUB = @POSUB@
|
||||
POW_LIB = @POW_LIB@
|
||||
PYTHON = @PYTHON@
|
||||
RADIUSLIBS = @RADIUSLIBS@
|
||||
RANLIB = @RANLIB@
|
||||
RELEASE = @RELEASE@
|
||||
REV_DATESTAMP = @REV_DATESTAMP@
|
||||
REV_TIMESTAMP = @REV_TIMESTAMP@
|
||||
SCRIPT_TEST = @SCRIPT_TEST@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
SOCKETLIBS = @SOCKETLIBS@
|
||||
SSLINCLUDE = @SSLINCLUDE@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
STDBOOL_H = @STDBOOL_H@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
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@
|
||||
check_tcp_ssl = @check_tcp_ssl@
|
||||
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_trusted_path = @with_trusted_path@
|
||||
SUBDIRS = lib plugins plugins-scripts plugins-root m4 po
|
||||
EXTRA_DIST = config.rpath \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \
|
||||
REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm contrib pkg nagios-plugins.spec \
|
||||
config_test/Makefile config_test/run_tests config_test/child_test.c \
|
||||
tools/tinderbox_build
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
localedir = $(datadir)/locale
|
||||
|
||||
# Solaris pkgmk
|
||||
BUILDDIR = build-solaris
|
||||
PACKDIR = build-pkg
|
||||
PKGSCRIPT = pkg/solaris/solpkg
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) 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)
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
command.cfg: $(top_builddir)/config.status $(srcdir)/command.cfg.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
test.pl: $(top_builddir)/config.status $(srcdir)/test.pl.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
pkg/solaris/pkginfo: $(top_builddir)/config.status $(top_srcdir)/pkg/solaris/pkginfo.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
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):
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
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) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
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:
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
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) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
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) config.h.in $(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) config.h.in $(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) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(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)/. $(distdir)/config_test $(distdir)/m4 $(distdir)/pkg/solaris $(distdir)/plugins-scripts $(distdir)/po $(distdir)/tools
|
||||
@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 -777 -exec chmod a+rwx {} \; -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 config.h
|
||||
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 clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||
distclean-libtool 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 mostlyclean-libtool
|
||||
|
||||
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-libtool 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-hdr distclean-libtool \
|
||||
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-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
|
||||
tags tags-recursive uninstall uninstall-am uninstall-info-am
|
||||
|
||||
|
||||
dist-hook:
|
||||
make THANKS nagios-plugins.spec pkg/fedora/nagios-plugins.spec
|
||||
|
||||
install-root:
|
||||
cd plugins-root && $(MAKE) $@
|
||||
|
||||
test:
|
||||
cd lib && $(MAKE) test
|
||||
cd plugins; $(MAKE) test
|
||||
cd plugins-scripts; $(MAKE) test
|
||||
|
||||
nagios-plugins.spec: nagios-plugins.spec.in
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@
|
||||
|
||||
pkg/fedora/nagios-plugins.spec: nagios-plugins.spec.in
|
||||
$(top_srcdir)/mkinstalldirs pkg/fedora
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;/^# Requires$$/r $(top_srcdir)/pkg/fedora/requires" $? > $@
|
||||
|
||||
solpkg:
|
||||
if [ ! -d $(BUILDDIR) ] ; then mkdir $(BUILDDIR); fi
|
||||
if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
|
||||
$(MAKE) all
|
||||
$(MAKE) DESTDIR=$$PWD/$(BUILDDIR) install
|
||||
$(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
|
||||
cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
|
||||
|
||||
THANKS: THANKS.in
|
||||
@echo "This software is brought to you by the Nagios Plugins Development Team. However," > $@
|
||||
@echo "there have been many contributors to this project. Everyone below has helped in " >> $@
|
||||
@echo "raising bug reports, creating patches or contributing new plugins." >> $@
|
||||
@echo "" >> $@
|
||||
perl -e ' while (<>) { print STDERR "Duplicate: $$_",$$/ if ($$a{$$_}) ; $$a{$$_}++}; print sort by_last_field (keys %a); sub by_last_field { ($$a1) = $$a =~ /\s(\w+)$$/; ($$b1) = $$b =~ /\s(\w+)$$/; $$a1 cmp $$b1}' $? >> $@
|
||||
|
||||
pkgclean:
|
||||
rm -rf $(BUILDDIR) $(PACKDIR)
|
||||
# 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:
|
642
NPTest.pm
Normal file
642
NPTest.pm
Normal file
|
@ -0,0 +1,642 @@
|
|||
package NPTest;
|
||||
|
||||
#
|
||||
# Helper Functions for testing Nagios Plugins
|
||||
#
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(getTestParameter checkCmd skipMissingCmd);
|
||||
@EXPORT_OK = qw(DetermineTestHarnessDirectory TestsFrom SetCacheFilename);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use IO::File;
|
||||
use Data::Dumper;
|
||||
|
||||
use Test;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = do { my @r = (q$Revision: 1.13 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NPTest - Simplify the testing of Nagios Plugins
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This modules provides convenience functions to assist in the testing
|
||||
of Nagios Plugins, making the testing code easier to read and write;
|
||||
hopefully encouraging the development of a more complete test suite for
|
||||
the Nagios Plugins. It is based on the patterns of testing seen in the
|
||||
1.4.0 release, and continues to use the L<Test> module as the basis of
|
||||
testing.
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
This module defines three public functions, C<getTestParameter(...)>,
|
||||
C<checkCmd(...)> and C<skipMissingCmd(...)>. These are exported by
|
||||
default via the C<use NPTest;> statement.
|
||||
|
||||
=over
|
||||
|
||||
=item getTestParameter( "ENV_VARIABLE", $brief_description, $default )
|
||||
|
||||
$default is optional.
|
||||
|
||||
This function allows the test harness
|
||||
developer to interactively request test parameter information from the
|
||||
user. The user can accept the developer's default value or reply "none"
|
||||
which will then be returned as "" for the test to skip if appropriate.
|
||||
|
||||
If a parameter needs to be entered and the test is run without a tty
|
||||
attached (such as a cronjob), the parameter will be assigned as if it
|
||||
was "none". Tests can check for the parameter and skip if not set.
|
||||
|
||||
Responses are stored in an external, file-based
|
||||
cache so subsequent test runs will use these values. The user is able
|
||||
to change the values by amending the values in the file /var/tmp/NPTest.pm,
|
||||
or by setting the appropriate environment variable before running the test.
|
||||
|
||||
The option exists to store parameters in a scoped means, allowing a
|
||||
test harness to a localise a parameter should the need arise. This
|
||||
allows a parameter of the same name to exist in a test harness
|
||||
specific scope, while not affecting the globally scoped parameter. The
|
||||
scoping identifier is the name of the test harness sans the trailing
|
||||
".t". All cache searches first look to a scoped parameter before
|
||||
looking for the parameter at global scope. Thus for a test harness
|
||||
called "check_disk.t" requesting the parameter "mountpoint_valid", the
|
||||
cache is first searched for "check_disk"/"mountpoint_valid", if this
|
||||
fails, then a search is conducted for "mountpoint_valid".
|
||||
|
||||
To facilitate quick testing setup, it is possible to accept all the
|
||||
developer provided defaults by setting the environment variable
|
||||
"NPTEST_ACCEPTDEFAULT" to "1" (or any other perl truth value). Note
|
||||
that, such defaults are not stored in the cache, as there is currently
|
||||
no mechanism to edit existing cache entries, save the use of text
|
||||
editor or removing the cache file completely.
|
||||
|
||||
=item C<testCmd($command)>
|
||||
|
||||
Call with NPTest->testCmd("./check_disk ...."). This returns a NPTest object
|
||||
which you can then run $object->return_code or $object->output against.
|
||||
|
||||
Testing of results would be done in your test script, not in this module.
|
||||
|
||||
=item C<checkCmd(...)>
|
||||
|
||||
This function is obsolete. Use C<testCmd()> instead.
|
||||
|
||||
This function attempts to encompass the majority of test styles used
|
||||
in testing Nagios Plugins. As each plug-in is a separate command, the
|
||||
typical tests we wish to perform are against the exit status of the
|
||||
command and the output (if any) it generated. Simplifying these tests
|
||||
into a single function call, makes the test harness easier to read and
|
||||
maintain and allows additional functionality (such as debugging) to be
|
||||
provided without additional effort on the part of the test harness
|
||||
developer.
|
||||
|
||||
It is possible to enable debugging via the environment variable
|
||||
C<NPTEST_DEBUG>. If this environment variable exists and its value in PERL's
|
||||
boolean context evaluates to true, debugging is enabled.
|
||||
|
||||
The function prototype can be expressed as follows:
|
||||
|
||||
Parameter 1 : command => DEFINED SCALAR(string)
|
||||
Parameter 2 : desiredExitStatus => ONE OF
|
||||
SCALAR(integer)
|
||||
ARRAYREF(integer)
|
||||
HASHREF(integer,string)
|
||||
UNDEFINED
|
||||
Parameter 3 : desiredOutput => SCALAR(string) OR UNDEFINED
|
||||
Parameter 4 : exceptions => HASH(integer,string) OR UNDEFINED
|
||||
Returns : SCALAR(integer) as defined by Test::ok(...)
|
||||
|
||||
The function treats the first parameter C<$command> as a command line
|
||||
to execute as part of the test, it is executed only once and its exit
|
||||
status (C<$?E<gt>E<gt>8>) and output are captured.
|
||||
|
||||
At this point if debugging is enabled the command, its exit status and
|
||||
output are displayed to the tester.
|
||||
|
||||
C<checkCmd(...)> allows the testing of either the exit status or the
|
||||
generated output or both, not testing either will result in neither
|
||||
the C<Test::ok(...)> or C<Test::skip(...)> functions being called,
|
||||
something you probably don't want. Note that each defined test
|
||||
(C<$desiredExitStatus> and C<$desiredOutput>) results in a invocation
|
||||
of either C<Test::ok(...)> or C<Test::skip(...)>, so remember this
|
||||
when counting the number of tests to place in the C<Test::plan(...)>
|
||||
call.
|
||||
|
||||
Many Nagios Plugins test network services, some of which may not be
|
||||
present on all systems. To cater for this, C<checkCmd(...)> allows the
|
||||
tester to define exceptions based on the command's exit status. These
|
||||
exceptions are provided to skip tests if the test case developer
|
||||
believes the service is not being provided. For example, if a site
|
||||
does not have a POP3 server, the test harness could map the
|
||||
appropriate exit status to a useful message the person running the
|
||||
tests, telling the reason the test is being skipped.
|
||||
|
||||
Example:
|
||||
|
||||
my %exceptions = ( 2 =E<gt> "No POP Server present?" );
|
||||
|
||||
$t += checkCmd( "./check_pop I<some args>", 0, undef, %exceptions );
|
||||
|
||||
Thus, in the above example, an exit status of 2 does not result in a
|
||||
failed test case (as the exit status is not the desired value of 0),
|
||||
but a skipped test case with the message "No POP Server present?"
|
||||
given as the reason.
|
||||
|
||||
Sometimes the exit status of a command should be tested against a set
|
||||
of possible values, rather than a single value, this could especially
|
||||
be the case in failure testing. C<checkCmd(...)> support two methods
|
||||
of testing against a set of desired exit status values.
|
||||
|
||||
=over
|
||||
|
||||
=item *
|
||||
|
||||
Firstly, if C<$desiredExitStatus> is a reference to an array of exit
|
||||
stati, if the actual exit status of the command is present in the
|
||||
array, it is used in the call to C<Test::ok(...)> when testing the
|
||||
exit status.
|
||||
|
||||
=item *
|
||||
|
||||
Alternatively, if C<$desiredExitStatus> is a reference to a hash of
|
||||
exit stati (mapped to the strings "continue" or "skip"), similar
|
||||
processing to the above occurs with the side affect of determining if
|
||||
any generated output testing should proceed. Note: only the string
|
||||
"skip" will result in generated output testing being skipped.
|
||||
|
||||
=back
|
||||
|
||||
=item C<skipMissingCmd(...)>
|
||||
|
||||
If a command is missing and the test harness must C<Test::skip()> some
|
||||
or all of the tests in a given test harness this function provides a
|
||||
simple iterator to issue an appropriate message the requested number
|
||||
of times.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Test>
|
||||
|
||||
The rest of the code, as I have only commented on the major public
|
||||
functions that test harness writers will use, not all the code present
|
||||
in this helper module.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (c) 2005 Peter Bray. All rights reserved.
|
||||
|
||||
This package is free software and is provided "as is" without express
|
||||
or implied warranty. It may be used, redistributed and/or modified
|
||||
under the same terms as the Nagios Plugins release.
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# Package Scope Variables
|
||||
#
|
||||
|
||||
my( %CACHE ) = ();
|
||||
|
||||
# I'm not really sure wether to house a site-specific cache inside
|
||||
# or outside of the extracted source / build tree - lets default to outside
|
||||
my( $CACHEFILENAME ) = ( exists( $ENV{'NPTEST_CACHE'} ) && $ENV{'NPTEST_CACHE'} )
|
||||
? $ENV{'NPTEST_CACHE'} : "/var/tmp/NPTest.cache"; # "../Cache.pdd";
|
||||
|
||||
#
|
||||
# Testing Functions
|
||||
#
|
||||
|
||||
sub checkCmd
|
||||
{
|
||||
my( $command, $desiredExitStatus, $desiredOutput, %exceptions ) = @_;
|
||||
|
||||
my $result = NPTest->testCmd($command);
|
||||
|
||||
my $output = $result->output;
|
||||
my $exitStatus = $result->return_code;
|
||||
|
||||
$output = "" unless defined( $output );
|
||||
chomp( $output );
|
||||
|
||||
my $testStatus;
|
||||
|
||||
my $testOutput = "continue";
|
||||
|
||||
if ( defined( $desiredExitStatus ) )
|
||||
{
|
||||
if ( ref $desiredExitStatus eq "ARRAY" )
|
||||
{
|
||||
if ( scalar( grep { $_ == $exitStatus } @{$desiredExitStatus} ) )
|
||||
{
|
||||
$desiredExitStatus = $exitStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
$desiredExitStatus = -1;
|
||||
}
|
||||
}
|
||||
elsif ( ref $desiredExitStatus eq "HASH" )
|
||||
{
|
||||
if ( exists( ${$desiredExitStatus}{$exitStatus} ) )
|
||||
{
|
||||
if ( defined( ${$desiredExitStatus}{$exitStatus} ) )
|
||||
{
|
||||
$testOutput = ${$desiredExitStatus}{$exitStatus};
|
||||
}
|
||||
$desiredExitStatus = $exitStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
$desiredExitStatus = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %exceptions && exists( $exceptions{$exitStatus} ) )
|
||||
{
|
||||
$testStatus += skip( $exceptions{$exitStatus}, $exitStatus, $desiredExitStatus );
|
||||
$testOutput = "skip";
|
||||
}
|
||||
else
|
||||
{
|
||||
$testStatus += ok( $exitStatus, $desiredExitStatus );
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( $desiredOutput ) )
|
||||
{
|
||||
if ( $testOutput ne "skip" )
|
||||
{
|
||||
$testStatus += ok( $output, $desiredOutput );
|
||||
}
|
||||
else
|
||||
{
|
||||
$testStatus += skip( "Skipping output test as requested", $output, $desiredOutput );
|
||||
}
|
||||
}
|
||||
|
||||
return $testStatus;
|
||||
}
|
||||
|
||||
|
||||
sub skipMissingCmd
|
||||
{
|
||||
my( $command, $count ) = @_;
|
||||
|
||||
my $testStatus;
|
||||
|
||||
for ( 1 .. $count )
|
||||
{
|
||||
$testStatus += skip( "Missing ${command} - tests skipped", 1 );
|
||||
}
|
||||
|
||||
return $testStatus;
|
||||
}
|
||||
|
||||
sub getTestParameter
|
||||
{
|
||||
my( $param, $envvar, $default, $brief, $scoped );
|
||||
my $new_style;
|
||||
if (scalar @_ <= 3) {
|
||||
($param, $brief, $default) = @_;
|
||||
$envvar = $param;
|
||||
$new_style = 1;
|
||||
} else {
|
||||
( $param, $envvar, $default, $brief, $scoped ) = @_;
|
||||
$new_style = 0;
|
||||
}
|
||||
|
||||
# Apply default values for optional arguments
|
||||
$scoped = ( defined( $scoped ) && $scoped );
|
||||
|
||||
my $testharness = basename( (caller(0))[1], ".t" ); # used for scoping
|
||||
|
||||
if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} )
|
||||
{
|
||||
return $ENV{$envvar};
|
||||
}
|
||||
|
||||
my $cachedValue = SearchCache( $param, $testharness );
|
||||
if ( defined( $cachedValue ) )
|
||||
{
|
||||
# This save required to convert to new style because the key required is
|
||||
# changing to the environment variable
|
||||
if ($new_style == 0) {
|
||||
SetCacheParameter( $envvar, undef, $cachedValue );
|
||||
}
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
my $defaultValid = ( defined( $default ) && $default );
|
||||
my $autoAcceptDefault = ( exists( $ENV{'NPTEST_ACCEPTDEFAULT'} ) && $ENV{'NPTEST_ACCEPTDEFAULT'} );
|
||||
|
||||
if ( $autoAcceptDefault && $defaultValid )
|
||||
{
|
||||
return $default;
|
||||
}
|
||||
|
||||
# Set "none" if no terminal attached (eg, tinderbox build servers when new variables set)
|
||||
return "" unless (-t STDERR);
|
||||
|
||||
my $userResponse = "";
|
||||
|
||||
while ( $userResponse eq "" )
|
||||
{
|
||||
print STDERR "\n";
|
||||
print STDERR "Test Harness : $testharness\n";
|
||||
print STDERR "Test Parameter : $param\n";
|
||||
print STDERR "Environment Variable : $envvar\n" if ($param ne $envvar);
|
||||
print STDERR "Brief Description : $brief\n";
|
||||
print STDERR "Enter value (or 'none') ", ($defaultValid ? "[${default}]" : "[]"), " => ";
|
||||
$userResponse = <STDIN>;
|
||||
$userResponse = "" if ! defined( $userResponse ); # Handle EOF
|
||||
chomp( $userResponse );
|
||||
if ( $defaultValid && $userResponse eq "" )
|
||||
{
|
||||
$userResponse = $default;
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "\n";
|
||||
|
||||
if ($userResponse =~ /^(na|none)$/) {
|
||||
$userResponse = "";
|
||||
}
|
||||
|
||||
# define all user responses at global scope
|
||||
SetCacheParameter( $param, ( $scoped ? $testharness : undef ), $userResponse );
|
||||
|
||||
return $userResponse;
|
||||
}
|
||||
|
||||
#
|
||||
# Internal Cache Management Functions
|
||||
#
|
||||
|
||||
sub SearchCache
|
||||
{
|
||||
my( $param, $scope ) = @_;
|
||||
|
||||
LoadCache();
|
||||
|
||||
if ( exists( $CACHE{$scope} ) && exists( $CACHE{$scope}{$param} ) )
|
||||
{
|
||||
return $CACHE{$scope}{$param};
|
||||
}
|
||||
|
||||
if ( exists( $CACHE{$param} ) )
|
||||
{
|
||||
return $CACHE{$param};
|
||||
}
|
||||
return undef; # Need this to say "nothing found"
|
||||
}
|
||||
|
||||
sub SetCacheParameter
|
||||
{
|
||||
my( $param, $scope, $value ) = @_;
|
||||
|
||||
if ( defined( $scope ) )
|
||||
{
|
||||
$CACHE{$scope}{$param} = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$CACHE{$param} = $value;
|
||||
}
|
||||
|
||||
SaveCache();
|
||||
}
|
||||
|
||||
sub LoadCache
|
||||
{
|
||||
return if exists( $CACHE{'_cache_loaded_'} );
|
||||
|
||||
if ( -f $CACHEFILENAME )
|
||||
{
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
||||
if ( ! $fileHandle->open( "< ${CACHEFILENAME}" ) )
|
||||
{
|
||||
print STDERR "NPTest::LoadCache() : Problem opening ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my( $fileContents ) = join( "\n", <$fileHandle> );
|
||||
|
||||
$fileHandle->close();
|
||||
|
||||
my( $contentsRef ) = eval $fileContents;
|
||||
%CACHE = %{$contentsRef};
|
||||
|
||||
}
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
}
|
||||
|
||||
|
||||
sub SaveCache
|
||||
{
|
||||
delete $CACHE{'_cache_loaded_'};
|
||||
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
||||
if ( ! $fileHandle->open( "> ${CACHEFILENAME}" ) )
|
||||
{
|
||||
print STDERR "NPTest::LoadCache() : Problem saving ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my( $dataDumper ) = new Data::Dumper( [ \%CACHE ] );
|
||||
|
||||
$dataDumper->Terse(1);
|
||||
|
||||
print $fileHandle $dataDumper->Dump();
|
||||
|
||||
$fileHandle->close();
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
}
|
||||
|
||||
#
|
||||
# (Questionable) Public Cache Management Functions
|
||||
#
|
||||
|
||||
sub SetCacheFilename
|
||||
{
|
||||
my( $filename ) = @_;
|
||||
|
||||
# Unfortunately we can not validate the filename
|
||||
# in any meaningful way, as it may not yet exist
|
||||
$CACHEFILENAME = $filename;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Test Harness Wrapper Functions
|
||||
#
|
||||
|
||||
sub DetermineTestHarnessDirectory
|
||||
{
|
||||
my( $userSupplied ) = @_;
|
||||
|
||||
# User Supplied
|
||||
if ( defined( $userSupplied ) && $userSupplied )
|
||||
{
|
||||
if ( -d $userSupplied )
|
||||
{
|
||||
return $userSupplied;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # userSupplied is invalid -> FAIL
|
||||
}
|
||||
}
|
||||
|
||||
# Simple Case : "t" is a subdirectory of the current directory
|
||||
if ( -d "./t" )
|
||||
{
|
||||
return "./t";
|
||||
}
|
||||
|
||||
# To be honest I don't understand which case satisfies the
|
||||
# original code in test.pl : when $tstdir == `pwd` w.r.t.
|
||||
# $tstdir =~ s|^(.*)/([^/]+)/?$|$1/$2|; and if (-d "../../$2/t")
|
||||
# Assuming pwd is "/a/b/c/d/e" then we are testing for "/a/b/c/e/t"
|
||||
# if I understand the code correctly (a big assumption)
|
||||
|
||||
# Simple Case : the current directory is "t"
|
||||
my $pwd = cwd();
|
||||
|
||||
if ( $pwd =~ m|/t$| )
|
||||
{
|
||||
return $pwd;
|
||||
|
||||
# The alternate that might work better is
|
||||
# chdir( ".." );
|
||||
# return "./t";
|
||||
# As the current test harnesses assume the application
|
||||
# to be tested is in the current directory (ie "./check_disk ....")
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub TestsFrom
|
||||
{
|
||||
my( $directory, $excludeIfAppMissing ) = @_;
|
||||
|
||||
$excludeIfAppMissing = 0 unless defined( $excludeIfAppMissing );
|
||||
|
||||
if ( ! opendir( DIR, $directory ) )
|
||||
{
|
||||
print STDERR "NPTest::TestsFrom() - Failed to open ${directory} : $!\n";
|
||||
return ();
|
||||
}
|
||||
|
||||
my( @tests ) = ();
|
||||
|
||||
my $filename;
|
||||
my $application;
|
||||
|
||||
while ( $filename = readdir( DIR ) )
|
||||
{
|
||||
if ( $filename =~ m/\.t$/ )
|
||||
{
|
||||
if ( $excludeIfAppMissing )
|
||||
{
|
||||
$application = basename( $filename, ".t" );
|
||||
if ( ! -e $application )
|
||||
{
|
||||
print STDERR "No application (${application}) found for test harness (${filename})\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
push @tests, "${directory}/${filename}";
|
||||
}
|
||||
}
|
||||
|
||||
closedir( DIR );
|
||||
|
||||
return sort @tests;
|
||||
}
|
||||
|
||||
# All the new object oriented stuff below
|
||||
|
||||
sub new {
|
||||
my $type = shift;
|
||||
my $self = {};
|
||||
return bless $self, $type;
|
||||
}
|
||||
|
||||
# Accessors
|
||||
sub return_code {
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{return_code} = shift;
|
||||
} else {
|
||||
return $self->{return_code};
|
||||
}
|
||||
}
|
||||
sub output {
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{output} = shift;
|
||||
} else {
|
||||
return $self->{output};
|
||||
}
|
||||
}
|
||||
|
||||
sub perf_output {
|
||||
my $self = shift;
|
||||
$_ = $self->{output};
|
||||
/\|(.*)$/;
|
||||
return $1 || "";
|
||||
}
|
||||
|
||||
sub only_output {
|
||||
my $self = shift;
|
||||
$_ = $self->{output};
|
||||
/(.*?)\|/;
|
||||
return $1 || "";
|
||||
}
|
||||
|
||||
sub testCmd {
|
||||
my $class = shift;
|
||||
my $command = shift or die "No command passed to testCmd";
|
||||
my $object = $class->new;
|
||||
|
||||
my $output = `$command`;
|
||||
$object->return_code($? >> 8);
|
||||
$_ = $? & 127;
|
||||
if ($_) {
|
||||
die "Got signal $_ for command $command";
|
||||
}
|
||||
chomp $output;
|
||||
$object->output($output);
|
||||
|
||||
if ($ENV{'NPTEST_DEBUG'}) {
|
||||
my ($pkg, $file, $line) = caller(0);
|
||||
print "testCmd: Called from line $line in $file", $/;
|
||||
print "Testing: $command", $/;
|
||||
print "Output: ", $object->output, $/;
|
||||
print "Return code: ", $object->return_code, $/;
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
1;
|
||||
#
|
||||
# End of File
|
||||
#
|
114
README
Normal file
114
README
Normal file
|
@ -0,0 +1,114 @@
|
|||
Nagios Plugins README
|
||||
---------------------
|
||||
|
||||
* For instructions on installing these plugins 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 or plugins
|
||||
that have been added, read the Changelog file.
|
||||
|
||||
* Some plugins require that you have additional programs and/or
|
||||
libraries installed on your system before they can be used. Plugins
|
||||
that are dependent on other programs/libraries that are missing are
|
||||
usually not compiled. Read the REQUIREMENTS file for more information.
|
||||
|
||||
* For a list of outstanding bugs for this release, see the BUGS file.
|
||||
|
||||
* Individual plugins are self documenting. All plugins that comply with
|
||||
the basic guidelines for development will provide detailed help when
|
||||
invoked with the '-h' or '--help' options.
|
||||
|
||||
* The file command.cfg contains example configurations for many of the
|
||||
plugins
|
||||
|
||||
* The win32 subdir contains plugins specific to the Win32 platform.
|
||||
These are scripts or binaries.
|
||||
|
||||
You can check for the latest plugins at:
|
||||
http://sourceforge.net/projects/nagiosplug/
|
||||
|
||||
Send mail to nagiosplug-help@lists.sourceforge.net for assistance. Please
|
||||
include the OS type and 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.
|
||||
|
||||
Send mail to nagiosplug-devel@lists.sourceforge.net for developer discussions.
|
||||
|
||||
For patch submissions and bug reports, please use the appropriate resources at
|
||||
http://sourceforge.net/projects/nagiosplug/ (navigate to the bug tool and/or
|
||||
patch tool from the summary page). Patches should be relative to the current
|
||||
CVS head (development), or to the head of the current stable branch. Also,
|
||||
please include version information for your OS and the plugin(s) your are
|
||||
patching/reporting.
|
||||
|
||||
|
||||
|
||||
|
||||
Nagios Plugins Quick-and-Dirty Installation Instructions
|
||||
--------------------------------------------------------
|
||||
|
||||
0) If you are using the CVS tree, you will need m4, gettext, automake, and autoconf.
|
||||
To start out, run ./tools/setup
|
||||
|
||||
For more detail, see the developer guidelines at
|
||||
http://nagiosplug.sourceforge.net/developer-guidelines.html.
|
||||
|
||||
|
||||
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-cgiurl=SOMEURL
|
||||
|
||||
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 CGIURL with the path used to access the Nagios CGIs with
|
||||
a web browser (default is '/nagios/cgi-bin')
|
||||
|
||||
|
||||
2) Compile the plugins with the following command:
|
||||
|
||||
make
|
||||
|
||||
|
||||
3) Install the compiled plugins and plugin scripts with the following command:
|
||||
|
||||
make install
|
||||
|
||||
The installation procedure will attempt to place the plugins in a
|
||||
'libexec/' subdirectory in the base directory you specified with
|
||||
the --prefix argument to the configure script.
|
||||
|
||||
4) There are some plugins that require setuid. If you run make install as
|
||||
a non root user, they will not be installed. To install, switch to root and
|
||||
run:
|
||||
|
||||
make install-root
|
||||
|
||||
5) Verify that your host configuration file (hosts.cfg) for Nagios contains
|
||||
the correct paths to the new plugins.
|
||||
|
||||
|
||||
|
||||
That's it! If you have any problems or questions, feel free send mail
|
||||
to nagiosplug-help@lists.sourceforge.net
|
||||
|
||||
|
||||
|
||||
LICENSE STUFF
|
||||
-------------
|
||||
|
||||
This software is released under the GNU Public License with the additional
|
||||
exemption that compiling, linking and/or using OpenSSL is allowed.
|
||||
|
||||
See the COPYING file for the complete GPL text.
|
||||
|
||||
|
||||
--
|
||||
Nagios Plugins Team
|
79
REQUIREMENTS
Normal file
79
REQUIREMENTS
Normal file
|
@ -0,0 +1,79 @@
|
|||
Nagios Plugin Requirements
|
||||
--------------------------
|
||||
|
||||
Some plugins require that you have additional programs and/or
|
||||
libraries installed on your system before they can be used. Plugins
|
||||
that are dependent on other programs/libraries that are missing are
|
||||
usually not compiled. Requirements for various plugins are listed
|
||||
below...
|
||||
|
||||
check_fping:
|
||||
- Requires the fping utility distributed with SATAN. Either
|
||||
download and install SATAN or grab the fping program from
|
||||
http://www.fping.com
|
||||
http://www.stanford.edu/~schemers/docs/fping/fping.html
|
||||
ftp://ftp.redhat.com/pub/contrib/libc6/SRPMS/fping-2.2b1-1.src.rpm
|
||||
ftp://ftp.redhat.com/pub/contrib/libc6/RPMS/fping-2.2b1-1.i386.rpm
|
||||
Note that the fping command must be setuid root to function.
|
||||
|
||||
check_game:
|
||||
- Requires the qstat utility available from
|
||||
http://www.qstat.org
|
||||
http://www.activesw.com/people/steve/qstat.html
|
||||
Last tested on qstat 2.3d BETA
|
||||
|
||||
check_hpjd:
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net
|
||||
The snmpget binary is all that is required.
|
||||
|
||||
check_ldap:
|
||||
- Requires the LDAP libraries available from
|
||||
http://www.openldap.org
|
||||
Lib: libldap, liblber
|
||||
Redhat Source: openldap-1.2.9-6.i386.rpm, openldap-devel-1.2.9-6.i386.rpm
|
||||
|
||||
check_mysql, check_mysql_query:
|
||||
- Requires the MySQL libraries available from
|
||||
http://www.mysql.org
|
||||
Lib: libmysql, libmysqlclient
|
||||
Redhat Powertools Source: mysql-3.20.32a-3.i386.rpm, mysql-devel-3.20.32a-3.i386.rpm (these seem to be broken, however)
|
||||
RPMS from www.mysql.org work better
|
||||
Must have mysql_config in PATH or specified with --with-mysql=DIR for DIR/bin/mysql_config
|
||||
|
||||
check_pqsql:
|
||||
- Requires the PostgreSQL libraries available from
|
||||
http://www.postgresql.org
|
||||
|
||||
check_radius:
|
||||
- Requires the radiusclient library available from
|
||||
http://www.cityline.net/~lf/radius/
|
||||
RPM (rpmfind): radiusclient-0.3.1-1, radiusclient-devel-0.3.1-1
|
||||
|
||||
check_snmp:
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net
|
||||
|
||||
check_ifstatus/check_ifoperstatus
|
||||
- Requires Net::SNMP perl module
|
||||
http://www.perl.com/CPAN/modules/by-authors/id/D/DT/DTOWN/
|
||||
|
||||
check_nwstat:
|
||||
- Requires MRTGEXT NLM for Novell Servers
|
||||
http://www.engr.wisc.edu/~drews/mrtg/
|
||||
|
||||
check_nt:
|
||||
- Requires NSClient to run on the NT server to monitor
|
||||
http://nsclient.ready2run.nl/
|
||||
|
||||
check_ups:
|
||||
- Requires Network UPS Tools (>= 1.4) to run on the server to monitor
|
||||
http://www.networkupstools.org/
|
||||
|
||||
OS Specific Issues
|
||||
------------------
|
||||
|
||||
HP-UX 11.11
|
||||
You need to use the version of gcc provided by HP at version 3.3.3.
|
||||
Also, you need GNU make 3.8
|
||||
|
75
SUPPORT
Normal file
75
SUPPORT
Normal file
|
@ -0,0 +1,75 @@
|
|||
SUPPORT
|
||||
|
||||
Using the mailing lists and tracker databases at SourceForge are the
|
||||
best ways to obtain direct support for the Nagios Plugins. There may
|
||||
also be commercial support options available to you -- check
|
||||
http://www.nagios.org/ to track the current status of commercial
|
||||
support offerings.
|
||||
|
||||
There are two mailing lists associated with Nagios Plugin development:
|
||||
'help' (mailto:nagiosplug-help@lists.sourceforge.net), and 'devel'
|
||||
(mailto:nagiosplug-devel@lists.sourceforge.net). Unless you are fairly
|
||||
certain you have found a bug or that you are requesting a new feature,
|
||||
please direct support requests to 'help'.
|
||||
|
||||
Because these lists are handled entirely by volunteers, and because
|
||||
these same volunteers are often plugin developers who can also use
|
||||
their time to fix bug and provide feature requests, it is generally in
|
||||
you interest to do a modest amount of legwork before posting to either
|
||||
of these lists.
|
||||
|
||||
Plugins that are in the contrib directories are provided as-is. We will
|
||||
try to help, but sometimes the plugins have dependencies that the nagios-plugin
|
||||
developers do not have access to. You may be able to try the authors
|
||||
directly.
|
||||
|
||||
In brief, always provide the version of the software that you are
|
||||
using, and when requesting features or reporting bugs, first check to
|
||||
see that the issue has not already been addressed in the CVS tree.
|
||||
|
||||
GETTING HELP
|
||||
|
||||
Requests to 'help' require posting the version number of the
|
||||
plugin. The best place to include the version information is in the
|
||||
subject. A good post would have a subject like:
|
||||
|
||||
Can I use SSL with check_imap (nagios-plugins 1.3.0-beta2) 1.12
|
||||
|
||||
If you do not include the version of the plugin, you risk having your
|
||||
post silently ignored.
|
||||
|
||||
Be advised that the core plugins (and in fact many of the contributed
|
||||
plugins) will provide a description of their use when invoked with the
|
||||
'--help' option. Please read the help carefully and in it's entirety
|
||||
before asking for support.
|
||||
|
||||
REPORTING BUGS AND SUBMITTING PATCHES
|
||||
|
||||
Bug reports, investigations of possible bugs, feature requests, and
|
||||
patch submissions should be submitted to the development list at
|
||||
mailto:nagiosplug-devel@lists.sourceforge.net. Please raise a tracker first
|
||||
in Sourceforge, otherwise your email is likely to be missed over time.
|
||||
|
||||
You should identify the version, preferably in the subject line.
|
||||
However, to best use developer resources, it is suggested that you
|
||||
reference your report to one of the following sources:
|
||||
|
||||
1) The most recent release, including beta's
|
||||
|
||||
2) The twice-daily snapshots (there's a link provided on
|
||||
http://nagiosplug.sourceforge.net)
|
||||
|
||||
3) The current CVS tree from sourceforge
|
||||
|
||||
(This does not mean you should run any of these sources in a
|
||||
production environment - the latter two you clearly should
|
||||
not. However, if you find a bug, you should determine whether it is
|
||||
still present in one of these sources, preferably either (2) or (3)
|
||||
which are most recent.)
|
||||
|
||||
From experience, I know that most bugs can be fixed with only a few
|
||||
more moments work than it takes to determine if the bug is still
|
||||
present in the CVS tree. If you can save a developer the expense of
|
||||
that time, you ensure that bugs are fixed more rapidly, and thus you
|
||||
ensure your problem resolution is reflected in a stable release more
|
||||
quickly.
|
206
THANKS
Normal file
206
THANKS
Normal file
|
@ -0,0 +1,206 @@
|
|||
This software is brought to you by the Nagios Plugins Development Team. However,
|
||||
there have been many contributors to this project. Everyone below has helped in
|
||||
raising bug reports, creating patches or contributing new plugins.
|
||||
|
||||
dag rob?le
|
||||
Randy O'Meara
|
||||
Lance Albertson
|
||||
David Alden
|
||||
Rodger Allen
|
||||
Paul Allen
|
||||
Patrick Allen
|
||||
Felipe Gustavo de Almeida
|
||||
Michael Almond
|
||||
Michael Anthon
|
||||
Paula Arnold
|
||||
Kondoros Attila
|
||||
Daniel Austin
|
||||
Markus Baertschi
|
||||
Bradley Baetz
|
||||
Michael Bakker
|
||||
Jeremy Baumgartner
|
||||
Andreas Behal
|
||||
Lutz Behnke
|
||||
Simon Bellwood
|
||||
Allan Bennett
|
||||
Guy Van Den Bergh
|
||||
Tom Bertelston
|
||||
Jeffery Blank
|
||||
Tom De Blende
|
||||
Eric Bollengier
|
||||
Richard Brodie
|
||||
Matthew Brown
|
||||
Jason Burnett
|
||||
Carlos Canau
|
||||
Jim Carroll
|
||||
Ian Cass
|
||||
Arnold Cavazos
|
||||
Alex Chaffee
|
||||
Eric Chen
|
||||
Alwyn Cherrington
|
||||
Ben Clewett
|
||||
Charlie Cook
|
||||
Garry Cook
|
||||
Ollie Cook
|
||||
Jason Crawford
|
||||
David Croft
|
||||
Robert Dale
|
||||
Rok Debevc
|
||||
Marcos Della
|
||||
Phil Dibowitz
|
||||
Jason Dixon
|
||||
Paul Dlug
|
||||
Andy Doran
|
||||
Rainer Duffner
|
||||
Ian Duggan
|
||||
Edwin Eefting
|
||||
Mike Emigh
|
||||
Hans Engelen
|
||||
Matthew Ericson
|
||||
Andreas Ericsson
|
||||
Ragnar Hojland Espinosa
|
||||
O'Shaughnessy Evans
|
||||
Merijn Evertse
|
||||
Karl Ewald
|
||||
Paul Farrall
|
||||
Reuben Farrelly
|
||||
Paulo Fessel
|
||||
Paulo Afonso Graner Fessel
|
||||
James Fidell
|
||||
Johan Fischer
|
||||
Rick Frey
|
||||
Matt Garrett
|
||||
Robby Giffin
|
||||
Florian Gleixner
|
||||
Flo Gleixner
|
||||
Aravind Gottipati
|
||||
Kev Green
|
||||
Steve Greenland
|
||||
Olaf Greis
|
||||
Steven Grimm
|
||||
Jon Hallett
|
||||
Steve Hanselman
|
||||
Michael Haro
|
||||
Gunnar Hellekson
|
||||
Johannes Herlitz
|
||||
Ian Holsman
|
||||
Peter Hoogendijk
|
||||
Chester Hosey
|
||||
Bob Ingraham
|
||||
Cire Iriarte
|
||||
Valdimir Ivaschenko
|
||||
Mark Jewiss
|
||||
Frank Kannemann
|
||||
Roy Sigurd Karlsbakk
|
||||
Jason Kau
|
||||
Bo Kersey
|
||||
Serhan Kiymaz
|
||||
John Koyle
|
||||
Steven Kreuzer
|
||||
Christoph Kron
|
||||
Alexander Kulak
|
||||
Bill Kunkel
|
||||
Pascal Larisch
|
||||
Gerhard Lausser
|
||||
Lynne Lawrence
|
||||
Sakari Lehtonen
|
||||
Pedro Leite
|
||||
Larry Low
|
||||
Jacob Lundqvist
|
||||
Guenther Mair
|
||||
Michael Markstaller
|
||||
John Marquart
|
||||
Ernst-Dieter Martin
|
||||
Jason Martin
|
||||
Christopher Maser
|
||||
Mathieu Masseboeuf
|
||||
Alexander Matey
|
||||
Richard Mayhew
|
||||
Patrick McCormick
|
||||
Mike McHenry
|
||||
Jan-Piet Mens
|
||||
Sven Meyer
|
||||
Christian Mies
|
||||
Russell Miller
|
||||
Janos Mohacsi
|
||||
Gerd Mueller
|
||||
Michael Musikhin
|
||||
Jan-Frode Myklebust
|
||||
Sivakumar Nellurandi
|
||||
Truongchinh Nguyen
|
||||
Simon L Nielsen
|
||||
Thomas Nilsen
|
||||
Walbert Oberngruber
|
||||
Craig Orsinger
|
||||
Remi Paulmier
|
||||
Fabian Pehla
|
||||
Matt Perry
|
||||
Matthew Peters
|
||||
William Pietri
|
||||
Tomasz Pilat
|
||||
Myke Place
|
||||
Ari Pollak
|
||||
Marc Poulin
|
||||
Matt Pounsett
|
||||
Peter Pramberger
|
||||
Arnaud Quette
|
||||
Darian Rackham
|
||||
Phil Randal
|
||||
Abid Rasheed
|
||||
Jeremy Reed
|
||||
Joe Rhett
|
||||
Cliff Rice
|
||||
Alain Richard
|
||||
Didi Rieder
|
||||
Steve Rigler
|
||||
Kenny Root
|
||||
Wolfgang Rosenauer
|
||||
John Rouillard
|
||||
Jonathan Rozes
|
||||
Sascha Runschke
|
||||
Dietmar Ruzicka
|
||||
Ralph Rye
|
||||
Alen Salamun
|
||||
Sven Schaffranneck
|
||||
Thomas Schimpke
|
||||
Benjamin Schmid
|
||||
Henning Schmiedehausen
|
||||
Cove Schneider
|
||||
Russell Scibetti
|
||||
Noel Sebastien
|
||||
Lonny Selinger
|
||||
Nathan Shafer
|
||||
Tom Shields
|
||||
Sean Shore
|
||||
Antony Simmonds
|
||||
John Sivak
|
||||
Nikolay Sturm
|
||||
David Sullivan
|
||||
Kjell Sundtjonn
|
||||
Ziya Suzen
|
||||
Michael Tiernan
|
||||
Ronald Tin
|
||||
Ibere Tizio
|
||||
Julien Touche
|
||||
Kyle Tucker
|
||||
Jerome Tytgat
|
||||
Jon Vandegrift
|
||||
Laurent Vaslin
|
||||
Carole Verdon
|
||||
Ludse Verhoeven
|
||||
Robert August Vincent
|
||||
Dave Viner
|
||||
Nathan Vonnahme
|
||||
John Warburton
|
||||
Christian G Warden
|
||||
Stuart Webster
|
||||
Holger Weiss
|
||||
Torsten Werner
|
||||
Ben Whaley
|
||||
Adrian Wieczorek
|
||||
Sebastian Wiesinger
|
||||
Paul Wiggins
|
||||
Howard Wilkinson
|
||||
Shawn Wills
|
||||
Mario Witte
|
||||
Jamie Zawinski
|
78
acinclude.m4
Normal file
78
acinclude.m4
Normal file
|
@ -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)"])
|
||||
|
7045
aclocal.m4
vendored
Normal file
7045
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
275
command.cfg.in
Normal file
275
command.cfg.in
Normal file
|
@ -0,0 +1,275 @@
|
|||
###############################################################################
|
||||
# COMMAND CONFIGURATION
|
||||
#
|
||||
# $Id: command.cfg.in,v 1.13 2004/12/02 04:48:37 mattkent Exp $
|
||||
#
|
||||
# SYNTAX:
|
||||
# command[<command_name>]=<command_line>
|
||||
#
|
||||
# <command_name> = A short name used to identify the command
|
||||
# <command_line> = The actual command line. The command line doesn't have to
|
||||
# be surrounded in quotes, but may contain quotes as needed within
|
||||
# the command line. Take care to use single quotes at the
|
||||
# outer edges of commands or you will have command line
|
||||
# expansion problems when the command is executed by the shell.
|
||||
# Any valid shell command can be used. Multiple commands can
|
||||
# be separated with semicolons, piping is allowed. The
|
||||
# command line can contain macros, but not are macros are valid
|
||||
# at all time (notifications, service checks, etc). See the
|
||||
# HTML documentaion for more informationon on using macros in
|
||||
# commands.
|
||||
#
|
||||
# Note: Service check, service notification, host check, host notification,
|
||||
# service event handler, and host event handler functions are all defined
|
||||
# here.
|
||||
#
|
||||
# Note: Use the convertcfg program in the contrib directory of the Nagios
|
||||
# distribution to convert this file into a object file format.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# Service notification command - send email with problem summary
|
||||
|
||||
command[notify-by-email]=/bin/printf "$OUTPUT$" | /bin/mail -s '$SERVICESTATE$ alert for $HOSTALIAS$/$SERVICEDESC$' $CONTACTEMAIL$
|
||||
|
||||
# Service notification command - send email to alphanumeric pager
|
||||
# gateway The notify-by-epager command assumes that each contact has a
|
||||
# pager email gateway, and that the address has been entered into the
|
||||
# appropriate contact field instead of an actual pager number.
|
||||
# (i.e. 'pagejoe@nowhere.com' routes mail to Joe's alphanumeric pager)
|
||||
|
||||
command[notify-by-epager]=/bin/echo "$OUTPUT$" | /bin/mail -s '$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$' $CONTACTPAGER$
|
||||
|
||||
# Host notification commands (one for email, one for alphanumeric
|
||||
# pager with email gateway)
|
||||
|
||||
command[host-notify-by-email]=/bin/echo -e "***** Nagios *****\n\nHost "$HOSTALIAS$" is $HOSTSTATE$!\n\nDate/Time: $DATETIME$\n" | /bin/mail -s 'Host $HOSTNAME$ is $HOSTSTATE$!' $CONTACTEMAIL$
|
||||
|
||||
command[host-notify-by-epager]=/bin/echo '$HOSTALIAS$ is $HOSTSTATE$!' | /bin/mail -s 'Host $HOSTNAME$ is $HOSTSTATE$!' $CONTACTPAGER$
|
||||
|
||||
|
||||
## Send notifications to a pager using modem with Qpage (www.qpage.com)
|
||||
|
||||
command[notify-by-qpage]=/usr/bin/printf "Service: %s\nHost: %s\nAddress: %s\nState: %s\nInfo: %s\nDate: %s" '$SERVICEDESC$' '$HOSTNAME$' '$HOSTADDRESS$' '$SERVICESTATE$' '$OUTPUT$' '$DATETIME' | /usr/local/bin/qpage -l 0 -p $CONTACTPAGER$
|
||||
|
||||
command[host-notify-by-qpage]=/usr/bin/printf "Host: %s is %s\nInfo: %s\nDate: %s" '$HOSTALIAS$' '$HOSTSTATES$' '$OUTPUT$' '$DATETIME' | /usr/local/bin/qpage -l 0 -p $CONTACTPAGER$
|
||||
|
||||
## Send notifications using SMSclient (www.smsclient.org)
|
||||
command[notify-by-smsclient]=/usr/bin/sms_client -q $CONTACTPAGER$ "$NOTIFICATIONTYPE$: $HOSTADDRESS$ $HOSTALIAS$: $SERVICEDESC$ is $SERVICESTATE$"
|
||||
command[host-notify-by-smsclient]=/usr/bin/sms_client -q $CONTACTPAGER$ "Host $HOSTALIAS$ is $HOSTSTATE$; $OUTPUT$; $DATETIME$"
|
||||
|
||||
|
||||
|
||||
|
||||
# These are some example service check commands. See the HTML
|
||||
# documentation on the plugins for examples of how to configure
|
||||
# command definitions.
|
||||
|
||||
command[check_tcp]=@libexecdir@/check_tcp -H $HOSTADDRESS$ -p $ARG1$
|
||||
command[check_udp]=@libexecdir@/check_udp -H $HOSTADDRESS$ -p $ARG1$
|
||||
command[check_ftp]=@libexecdir@/check_ftp -H $HOSTADDRESS$
|
||||
command[check_pop]=@libexecdir@/check_pop -H $HOSTADDRESS$
|
||||
command[check_smtp]=@libexecdir@/check_smtp -H $HOSTADDRESS$
|
||||
command[check_nntp]=@libexecdir@/check_nntp -H $HOSTADDRESS$
|
||||
command[check_telnet]=@libexecdir@/check_tcp -H $HOSTADDRESS$ -p 23
|
||||
command[check_users]=@libexecdir@/check_users -w $ARG1$ -c $ARG2$
|
||||
command[check_ntp]=@libexecdir@/check_ntp -H $HOSTADDRESS$
|
||||
command[check_ntp_ntpq]=@libexecdir@/check_ntp -H $HOSTADDRESS$ -j 10 -k 15
|
||||
command[check_flexlm]=@libexecdir@/check_flexlm -F $ARG1$
|
||||
command[check_hpjd]=@libexecdir@/check_hpjd -H $HOSTADDRESS$ -C public
|
||||
command[check_mrtg]=@libexecdir@/check_mrtg $ARG1$ 10 AVG $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
|
||||
command[traffic_average]=@libexecdir@/check_mrtgtraf $ARG1$ 10 AVG $ARG2$ $ARG3$ $ARG4$ $ARG5$
|
||||
command[check_load]=@libexecdir@/check_load $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
|
||||
|
||||
command[check_disk]=@libexecdir@/check_disk -w 85% -c 95% -p $ARG1$
|
||||
command[check_dns]=@libexecdir@/check_dns -H www.yahoo.com -s $HOSTADDRESS$
|
||||
command[check_http]=@libexecdir@/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$
|
||||
command[check_http2]=@libexecdir@/check_http -H $ARG1$ -I $HOSTADDRESS$ -w $ARG2$ -c $ARG3$
|
||||
command[check_pgsql]=@libexecdir@/check_pgsql -H $HOSTADDRESS$
|
||||
command[check_ping]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 10:20% -c 60:100%
|
||||
command[check_procs]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$
|
||||
command[check_procs_zombie]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s Z
|
||||
command[check_procs_httpd]=@libexecdir@/check_procs -w 5:$ARG1$ -c 1:$ARG2$ -C httpd
|
||||
command[check_procs_vsz]=@libexecdir@/check_procs -w 8096 -c 16182 -C httpd --metric VSZ
|
||||
command[check_ups]=@libexecdir@/check_ups -H $HOSTADDRESS$ -u $ARG1$
|
||||
|
||||
# An example of using check_by_ssh as an active service check
|
||||
command[ssh_disk]=@libexecdir@/check_by_ssh -H $HOSTADDRESS$ -C '@libexecdir@/check_disk -w 85% -c 95% -p $ARG1$'
|
||||
|
||||
#
|
||||
# UCD_SNMP equivalents for some of the commands above
|
||||
#
|
||||
|
||||
command[snmp_load]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.10.1.5.1,.1.3.6.1.4.1.2021.10.1.5.2,.1.3.6.1.4.1.2021.10.1.5.3 -w :$ARG2$,:$ARG3$,:$ARG4$ -w :$ARG5$,:$ARG6$,:$ARG7$ -l load
|
||||
|
||||
command[snmp_cpustats]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.11.9.0,.1.3.6.1.4.1.2021.11.10.0,.1.3.6.1.4.1.2021.11.11.0 -l 'CPU usage (user system idle)' -u '%'
|
||||
|
||||
command[snmp_procname]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.2.1.5.$ARG2$ -w $ARG3$:$ARG4$ -c $ARG5$:$ARG6$
|
||||
|
||||
command[snmp_disk]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.9.1.7.$ARG1$,1.3.6.1.4.1.2021.9.1.9.$ARG1$ -w $ARG2$:,:$ARG3$ -c $ARG4$:,:$ARG5$ -u 'kB free (','% used)' -l 'disk space'
|
||||
|
||||
command[snmp_mem]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.4.6.0,.1.3.6.1.4.1.2021.4.5.0 -w $ARG2$: -c $ARG3$:
|
||||
|
||||
command[snmp_swap]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.4.4.0,.1.3.6.1.4.1.2021.4.3.0 -w $ARG2$: -c $ARG3$:
|
||||
|
||||
#
|
||||
# Slightly more generic SNMP OIDs
|
||||
# note: using partial textual OIDs here - use numeric oids if you don't have MIBDIRS defined per Net-SNMP (net-snmp.org)
|
||||
|
||||
command[snmp_procs]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrSystem.hrSystemProcesses -w :$ARG2$ -c :$ARG3$ -l processes
|
||||
|
||||
command[snmp_users]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrSystem.hrSystemNumUsers -w :$ARG2$ -c :$ARG3$ -l users
|
||||
|
||||
command[snmp_mem2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.101,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.101 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_swap2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.102,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.102 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_mem3]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.101,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.101 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_swap3]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.102,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.102 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_disk2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.$ARG2$ -w $ARG3$ -c $ARG4$
|
||||
|
||||
command[snmp_tcpopen]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o tcp.tcpCurrEstab.0 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_tcpstats]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o tcp.tcpActiveOpens.0,tcp.tcpPassiveOpens.0,tcp.tcpInSegs.0,tcp.tcpOutSegs.0,tcp.tcpRetransSegs.0 -l 'TCP stats'
|
||||
|
||||
|
||||
# Some snmp based network device checks (requires Net::SNMP perl module)
|
||||
|
||||
# check all admin-up interfaces
|
||||
command[check_ifstatus]=@libexecdir@/check_ifstatus -H $HOSTADDRESS$ -C public
|
||||
|
||||
# check particular interface by snmp ifIndex key
|
||||
command[check_ifoperstatus_ifindex]=@libexecdir@/check_ifoperstatus -H $HOSTADDRESS$ -C public -k $ARG1$
|
||||
|
||||
# check particular interface by snmp ifDescr value (verify uniqueness before using)
|
||||
command[check_ifoperstatus_ifdescr]=@libexecdir@/check_ifoperstatus -H $HOSTADDRESS$ -C public -d $ARG1$
|
||||
|
||||
# verify all you BGP session on a device are running (only returns warning due to some hardcoded option - to be fixed soon)
|
||||
command[check_snmp_bgpstate]=@libexecdir@/check_bgpstate -H $HOSTADDRESS$ -C public
|
||||
|
||||
#
|
||||
# SNMP NetApp checks (Jason Truong)
|
||||
#
|
||||
#
|
||||
#command[check_netapp_uptime]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.2.1.1.3.0 --delimiter=')' -l "Uptime is"
|
||||
#
|
||||
#command[check_netapp_cpuload]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.789.1.2.1.3.0 -w 90 -c 95 -u '%' -l "CPU LOAD "
|
||||
#
|
||||
#command[check_netapp_numdisks]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.789.1.6.4.1.0,.1.3.6.1.4.1.789.1.6.4.2.0,.1.3.6.1.4.1.789.1.6.4.8.0,.1.3.6.1.4.1.789.1.6.4.7.0 -u 'Total Disks','Active','Spare','Failed' -l ""
|
||||
#
|
||||
|
||||
#
|
||||
# SNMP Compaq Insight Agent (oids courtesy of vol)
|
||||
#
|
||||
# the following 4 return the following codes: other=1, ok=2, degraded=3, failed=4
|
||||
#
|
||||
#command[check_compaq_thermalCondition]=@libexec@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.232.6.2.1.0,.1.3.6.1.4.1.232.6.2.2.0,.1.3.6.1.4.1.232.6.2.3.0,.1.3.6.1.4.1.232.6.2.4.0 -u 'ThermalCondition','ThermalTemp','ThermalSystem','ThermalCPUFan' -w 2:2,2:2,2:2,2:2 -c 1:2,1:2,1:2,1:2 -l "Thermal status "
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
||||
# This command checks to see if a host is "alive" by pinging it. The
|
||||
# check must result in a 100% packet loss or 5 second (5000ms) round
|
||||
# trip average to produce an error.
|
||||
|
||||
# This command checks to see if a host is "alive" by pinging it.
|
||||
command[check-host-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a printer is "alive" by pinging it.
|
||||
command[check-printer-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a switch is "alive" by pinging it.
|
||||
command[check-switch-alive]=@libexecdir@/check_ping $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a router is "alive" by pinging it.
|
||||
command[check-router-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# Check if a host is alive by doing a fast ping instead of a regular ping
|
||||
command[check-fast-alive]=@libexecdir@/check_fping -H $HOSTADDRESS$
|
||||
|
||||
# Check if the IMAP service is alive (default port=143)
|
||||
command[check-imap]=@libexecdir@/check_imap -H $HOSTADDRESS$
|
||||
|
||||
# Check RPC services
|
||||
command[check-rpc]=@libexecdir@/check_rpc -H $HOSTADDRESS$ -C $ARG1$
|
||||
|
||||
# Check if the NFS server is running (version 2 and version 3)
|
||||
command[check-nfs]=@libexecdir@/check_rpc -H $HOSTADDRESS$ -C nfs -c2,3
|
||||
|
||||
# Check game servers
|
||||
command[check_quake]=@libexecdir@/check_game qs $HOSTADDRESS$
|
||||
command[check_unreal]=@libexecdir@/check_game uns $HOSTADDRESS$ -p $ARG1$ -pf 8
|
||||
|
||||
# Check a port that should be open
|
||||
command[check_nmap]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 30 -p $ARG1$
|
||||
|
||||
# Check a port that should be open and another that *could* be open,
|
||||
# but no warning is given if optional port is closed.
|
||||
|
||||
command[check_nmap_optional]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -o $ARG2$
|
||||
|
||||
# Specify range to nmap
|
||||
command[check_nmap_range]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -r $ARG2$
|
||||
|
||||
# Specify both optional and range
|
||||
command[check_nmap_opt_range]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -o $ARG2$ -r$ARG3$
|
||||
|
||||
# Check Radius
|
||||
command[check_radius]=@libexecdir@/check_radius $ARG1$ $ARG2$ $HOSTADDRESS$ 1812 $ARG3$
|
||||
|
||||
|
||||
# Check HTTP proxy
|
||||
# This is a command for checking squid or other proxy servers which uses check
|
||||
# http to ensure an HTTP 200 comes back ..... i.e. squid actually
|
||||
# serves the page and not an error message.
|
||||
# Using check_http will allow verification of authenticated proxies
|
||||
#
|
||||
# Note:: This used to call "check_reply" which was pretty close to check_tcp
|
||||
# The functionality of check_reply has been merged into check_tcp
|
||||
|
||||
command[check_squid]=@libexecdir@/check_http -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -e 'HTTP/1.0 200 OK'
|
||||
|
||||
|
||||
## Check RealAudio url
|
||||
command[check_real_url]=@libexecdir@/check_real $HOSTADDRESS$ -p $ARG1$ -wt $ARG2$ -ct $ARG3$ -to 5 -u $ARG4$
|
||||
|
||||
## Check RealAudio server response
|
||||
command[check_real]=@libexecdir@/check_real $HOSTADDRESS$ -p $ARG1$ -wt $ARG2$ -ct $ARG3$ -to 5
|
||||
|
||||
# NetWare checks via check_nwstat ( see "check_nwstat -h" for more options)
|
||||
# how many current logins
|
||||
command[check_netware_logins]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOGINS" -w $ARG1$ -c $ARG2$
|
||||
# how many current connections
|
||||
command[check_nwstat_conns]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v CONNS -w $ARG1$ -c $ARG2$
|
||||
# 1 minute avg cpu load
|
||||
command[check_netware_1load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD1" -w 70 -c 90
|
||||
# 5 minute avg cpu load
|
||||
command[check_netware_5load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD5" -w 70 -c 90
|
||||
# 15 minute avg cpu load
|
||||
command[check_netware_15load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD15" -w 70 -c 90
|
||||
# Disk volume (% free)
|
||||
command[check_nwstat_vol_p]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v VPF$ARG1$ -w $ARG2$ -c $ARG3$
|
||||
# Disk volume (KB free)
|
||||
command[check_nwstat_vol_k]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v VKF$ARG1$ -w $ARG2$ -c $ARG3$
|
||||
# % Long term cache hits
|
||||
command[check_nwstat_ltch]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v LTCH -w $ARG1$ -c $ARG2$
|
||||
# % (of max) used packet receive buffers
|
||||
command[check_nwstat_puprb]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v PUPRB -w $ARG1$ -c $ARG2$
|
||||
# Check to see if the DS database is open
|
||||
command[check_nwstat_dsdb]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v DSDB
|
||||
|
||||
|
||||
|
||||
# Netware 5 abends
|
||||
command[check_netware_abend]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "ABENDS" -w 10 -c 30
|
||||
# Netware 5 number of current service procs
|
||||
command[check_nwstat_csprocs]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v CSPROCS -w $ARG1$ -c $ARG2$
|
||||
|
||||
|
||||
# Still have to write sample entries for the following:
|
||||
#
|
||||
# check_ldap
|
||||
# check_overcr
|
142
compile
Executable file
142
compile
Executable file
|
@ -0,0 +1,142 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2004-10-12.08
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
1453
config.guess
vendored
Executable file
1453
config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
914
config.h.in
Normal file
914
config.h.in
Normal file
|
@ -0,0 +1,914 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the Andrew File System. */
|
||||
#undef AFS
|
||||
|
||||
/* URL of CGI programs */
|
||||
#undef CGIURL
|
||||
|
||||
/* Define if 3-argument BSD swapctl exists */
|
||||
#undef CHECK_SWAP_SWAPCTL_BSD
|
||||
|
||||
/* Define if 2-argument SVR4 swapctl exists */
|
||||
#undef CHECK_SWAP_SWAPCTL_SVR4
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if using `getloadavg.c'. */
|
||||
#undef C_GETLOADAVG
|
||||
|
||||
/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
|
||||
#undef DGUX
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define on systems for which file names may have a so-called `drive letter'
|
||||
prefix, define this to compute the length of that prefix, including the
|
||||
colon. */
|
||||
#undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
|
||||
|
||||
/* Define if the backslash character may also serve as a file name component
|
||||
separator. */
|
||||
#undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
|
||||
|
||||
#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
|
||||
# define FILE_SYSTEM_PREFIX_LEN(Filename) \
|
||||
((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
|
||||
#else
|
||||
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
|
||||
#endif
|
||||
|
||||
/* Define to 1 if the `getloadavg' function needs to be run setuid or setgid.
|
||||
*/
|
||||
#undef GETLOADAVG_PRIVILEGED
|
||||
|
||||
/* Define to 1 if you have `alloca' after including <alloca.h>, a header that
|
||||
may be supplied by this distribution. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define HAVE_ALLOCA_H for backward compatibility with older code that
|
||||
includes <alloca.h> only if HAVE_ALLOCA_H is defined. */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the `asprintf' function. */
|
||||
#undef HAVE_ASPRINTF
|
||||
|
||||
/* Define to 1 if strtold conforms to C99. */
|
||||
#undef HAVE_C99_STRTOLD
|
||||
|
||||
/* Define if system has C99 compatible vsnprintf */
|
||||
#undef HAVE_C99_VSNPRINTF
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
|
||||
CoreFoundation framework. */
|
||||
#undef HAVE_CFLOCALECOPYCURRENT
|
||||
|
||||
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
|
||||
the CoreFoundation framework. */
|
||||
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
|
||||
|
||||
/* Define to 1 if you have the <crypto.h> header file. */
|
||||
#undef HAVE_CRYPTO_H
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#undef HAVE_CTYPE_H
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_CLEARERR_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_FEOF_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FERROR_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FFLUSH_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FGETS_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FPUTC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FPUTS_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FREAD_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_FWRITE_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_GETCHAR_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if
|
||||
you don't. */
|
||||
#undef HAVE_DECL_PUTCHAR_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_PUTC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `swapctl', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SWAPCTL
|
||||
|
||||
/* Define to 1 if you have the declaration of `sysconf', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_SYSCONF
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <dustat.h> header file. */
|
||||
#undef HAVE_DUSTAT_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
/* Define to 1 if you have the <features.h> header file. */
|
||||
#undef HAVE_FEATURES_H
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#undef HAVE_FLOOR
|
||||
|
||||
/* Define to 1 if you have the <fs_info.h> header file. */
|
||||
#undef HAVE_FS_INFO_H
|
||||
|
||||
/* Define to 1 if you have the `fs_stat_dev' function. */
|
||||
#undef HAVE_FS_STAT_DEV
|
||||
|
||||
/* Define if struct statfs has the f_fstypename member. */
|
||||
#undef HAVE_F_FSTYPENAME_IN_STATFS
|
||||
|
||||
/* Does system provide RFC 2553/Posix getaddrinfo? */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Number of parameters to gethostbyname_r or 0 if not available */
|
||||
#undef HAVE_GETHOSTBYNAME_R
|
||||
|
||||
/* Set when getipnodebyname is available */
|
||||
#undef HAVE_GETIPNODEBYNAME
|
||||
|
||||
/* Define to 1 if you have the `getloadavg' function. */
|
||||
#undef HAVE_GETLOADAVG
|
||||
|
||||
/* Define to 1 if you have the `getmntent' function. */
|
||||
#undef HAVE_GETMNTENT
|
||||
|
||||
/* Define to 1 if you have the `getmntinfo' function. */
|
||||
#undef HAVE_GETMNTINFO
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the `getopt_long_only' function. */
|
||||
#undef HAVE_GETOPT_LONG_ONLY
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define if gettimeofday is found */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <gnutls/openssl.h> header file. */
|
||||
#undef HAVE_GNUTLS_OPENSSL_H
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
|
||||
declares uintmax_t. */
|
||||
#undef HAVE_INTTYPES_H_WITH_UINTMAX
|
||||
|
||||
/* Define to 1 if you have the `isblank' function. */
|
||||
#undef HAVE_ISBLANK
|
||||
|
||||
/* Define to 1 if you have the <krb5.h> header file. */
|
||||
#undef HAVE_KRB5_H
|
||||
|
||||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
|
||||
#undef HAVE_LANGINFO_CODESET
|
||||
|
||||
/* Define to 1 if you have the `ldap_get_option' function. */
|
||||
#undef HAVE_LDAP_GET_OPTION
|
||||
|
||||
/* Define to 1 if you have the `ldap_init' function. */
|
||||
#undef HAVE_LDAP_INIT
|
||||
|
||||
/* Define to 1 if you have the `ldap_set_option' function. */
|
||||
#undef HAVE_LDAP_SET_OPTION
|
||||
|
||||
/* Define to 1 if you have the `ldap_start_tls_s' function. */
|
||||
#undef HAVE_LDAP_START_TLS_S
|
||||
|
||||
/* Define to 1 if you have the `crypt' library (-lcrypt). */
|
||||
#undef HAVE_LIBCRYPT
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define to 1 if you have the `dgc' library (-ldgc). */
|
||||
#undef HAVE_LIBDGC
|
||||
|
||||
/* Define to 1 if you have the `kstat' library (-lkstat). */
|
||||
#undef HAVE_LIBKSTAT
|
||||
|
||||
/* Define to 1 if you have the `ldap' library (-lldap). */
|
||||
#undef HAVE_LIBLDAP
|
||||
|
||||
/* Define to 1 if you have the `lwres' library (-llwres). */
|
||||
#undef HAVE_LIBLWRES
|
||||
|
||||
/* Define to 1 if you have the `pq' library (-lpq). */
|
||||
#undef HAVE_LIBPQ
|
||||
|
||||
/* Define to 1 if you have the <libpq-fe.h> header file. */
|
||||
#undef HAVE_LIBPQ_FE_H
|
||||
|
||||
/* Define to 1 if you have the `radiusclient' library (-lradiusclient). */
|
||||
#undef HAVE_LIBRADIUSCLIENT
|
||||
|
||||
/* Define to 1 if you have the `listmntent' function. */
|
||||
#undef HAVE_LISTMNTENT
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the <lwres/netdb.h> header file. */
|
||||
#undef HAVE_LWRES_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <mach/mach.h> header file. */
|
||||
#undef HAVE_MACH_MACH_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#undef HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <math.h> header file. */
|
||||
#undef HAVE_MATH_H
|
||||
|
||||
/* Define to 1 if you have the `mbrtowc' function. */
|
||||
#undef HAVE_MBRTOWC
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#undef HAVE_MEMPCPY
|
||||
|
||||
/* Define to 1 if you have the <mntent.h> header file. */
|
||||
#undef HAVE_MNTENT_H
|
||||
|
||||
/* Define to 1 if you have the `next_dev' function. */
|
||||
#undef HAVE_NEXT_DEV
|
||||
|
||||
/* Define to 1 if you have the <nlist.h> header file. */
|
||||
#undef HAVE_NLIST_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/crypto.h> header file. */
|
||||
#undef HAVE_OPENSSL_CRYPTO_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/err.h> header file. */
|
||||
#undef HAVE_OPENSSL_ERR_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/pem.h> header file. */
|
||||
#undef HAVE_OPENSSL_PEM_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/rsa.h> header file. */
|
||||
#undef HAVE_OPENSSL_RSA_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/ssl.h> header file. */
|
||||
#undef HAVE_OPENSSL_SSL_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/x509.h> header file. */
|
||||
#undef HAVE_OPENSSL_X509_H
|
||||
|
||||
/* Define to 1 if you have the <pem.h> header file. */
|
||||
#undef HAVE_PEM_H
|
||||
|
||||
/* Define to 1 if you have the <pgsql/libpq-fe.h> header file. */
|
||||
#undef HAVE_PGSQL_LIBPQ_FE_H
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */
|
||||
#undef HAVE_POSTGRESQL_LIBPQ_FE_H
|
||||
|
||||
/* Define if /proc/loadavg or similar exists */
|
||||
#undef HAVE_PROC_LOADAVG
|
||||
|
||||
/* Define if we have /proc/meminfo */
|
||||
#undef HAVE_PROC_MEMINFO
|
||||
|
||||
/* Define to 1 if you have the `pstat_getdynamic' function. */
|
||||
#undef HAVE_PSTAT_GETDYNAMIC
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
|
||||
and to 0 otherwise. */
|
||||
#undef HAVE_REALLOC
|
||||
|
||||
/* Define to 1 if you have the <rsa.h> header file. */
|
||||
#undef HAVE_RSA_H
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#undef HAVE_SIGNAL_H
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define if SSL libraries are found */
|
||||
#undef HAVE_SSL
|
||||
|
||||
/* Define to 1 if you have the <ssl.h> header file. */
|
||||
#undef HAVE_SSL_H
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define to 1 if stdbool.h conforms to C99. */
|
||||
#undef HAVE_STDBOOL_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
|
||||
uintmax_t. */
|
||||
#undef HAVE_STDINT_H_WITH_UINTMAX
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define to 1 if you have the `strtod' function. */
|
||||
#undef HAVE_STRTOD
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#undef HAVE_STRTOL
|
||||
|
||||
/* Define to 1 if you have the `strtoul' function. */
|
||||
#undef HAVE_STRTOUL
|
||||
|
||||
/* Define to 1 if `f_fstypename' is member of `struct fsstat'. */
|
||||
#undef HAVE_STRUCT_FSSTAT_F_FSTYPENAME
|
||||
|
||||
/* Define to 1 if `n_un.n_name' is member of `struct nlist'. */
|
||||
#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
|
||||
|
||||
/* Define to 1 if `se_nblks' is member of `struct swapent'. */
|
||||
#undef HAVE_STRUCT_SWAPENT_SE_NBLKS
|
||||
|
||||
/* Define if we have a timeval structure */
|
||||
#undef HAVE_STRUCT_TIMEVAL
|
||||
|
||||
/* Define if swap/swapinfo command is found */
|
||||
#undef HAVE_SWAP
|
||||
|
||||
/* Define to 1 if the system has the type `swapent_t'. */
|
||||
#undef HAVE_SWAPENT_T
|
||||
|
||||
/* Define to 1 if the system has the type `swaptbl_t'. */
|
||||
#undef HAVE_SWAPTBL_T
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#undef HAVE_SYSLOG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/filsys.h> header file. */
|
||||
#undef HAVE_SYS_FILSYS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/fs/s5param.h> header file. */
|
||||
#undef HAVE_SYS_FS_S5PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/fs_types.h> header file. */
|
||||
#undef HAVE_SYS_FS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/loadavg.h> header file. */
|
||||
#undef HAVE_SYS_LOADAVG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/mntent.h> header file. */
|
||||
#undef HAVE_SYS_MNTENT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/mount.h> header file. */
|
||||
#undef HAVE_SYS_MOUNT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/statfs.h> header file. */
|
||||
#undef HAVE_SYS_STATFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/statvfs.h> header file. */
|
||||
#undef HAVE_SYS_STATVFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/swap.h> header file. */
|
||||
#undef HAVE_SYS_SWAP_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ucred.h> header file. */
|
||||
#undef HAVE_SYS_UCRED_H
|
||||
|
||||
/* Define to 1 if you have the <sys/unistd.h> header file. */
|
||||
#undef HAVE_SYS_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
/* Define to 1 if you have the <sys/vfs.h> header file. */
|
||||
#undef HAVE_SYS_VFS_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
|
||||
#undef HAVE_UINTMAX_T
|
||||
|
||||
/* Define to 1 if you have the <uio.h> header file. */
|
||||
#undef HAVE_UIO_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the 'unsigned long long' type. */
|
||||
#undef HAVE_UNSIGNED_LONG_LONG
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
#undef HAVE_VASPRINTF
|
||||
|
||||
/* Whether va_copy() is available */
|
||||
#undef HAVE_VA_COPY
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to 1 if you have the `wcrtomb' function. */
|
||||
#undef HAVE_WCRTOMB
|
||||
|
||||
/* Define to 1 if you have the `wcscoll' function. */
|
||||
#undef HAVE_WCSCOLL
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
/* Define to 1 if you have the <x509.h> header file. */
|
||||
#undef HAVE_X509_H
|
||||
|
||||
/* Define to 1 if the system has the type `_Bool'. */
|
||||
#undef HAVE__BOOL
|
||||
|
||||
/* Whether __va_copy() is available */
|
||||
#undef HAVE___VA_COPY
|
||||
|
||||
#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
#else
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
#endif
|
||||
|
||||
/* Define if there is no specific function for reading the list of mounted
|
||||
file systems. fread will be used to read /etc/mnttab. (SVR2) */
|
||||
#undef MOUNTED_FREAD
|
||||
|
||||
/* Define if (like SVR2) there is no specific function for reading the list of
|
||||
mounted file systems, and your system has these header files: <sys/fstyp.h>
|
||||
and <sys/statfs.h>. (SVR3) */
|
||||
#undef MOUNTED_FREAD_FSTYP
|
||||
|
||||
/* Define if there are functions named next_dev and fs_stat_dev for reading
|
||||
the list of mounted file systems. (BeOS) */
|
||||
#undef MOUNTED_FS_STAT_DEV
|
||||
|
||||
/* Define if there is a function named getfsstat for reading the list of
|
||||
mounted file systems. (DEC Alpha running OSF/1) */
|
||||
#undef MOUNTED_GETFSSTAT
|
||||
|
||||
/* Define if there is a function named getmnt for reading the list of mounted
|
||||
file systems. (Ultrix) */
|
||||
#undef MOUNTED_GETMNT
|
||||
|
||||
/* Define if there is a function named getmntent for reading the list of
|
||||
mounted file systems, and that function takes a single argument. (4.3BSD,
|
||||
SunOS, HP-UX, Dynix, Irix) */
|
||||
#undef MOUNTED_GETMNTENT1
|
||||
|
||||
/* Define if there is a function named getmntent for reading the list of
|
||||
mounted file systems, and that function takes two arguments. (SVR4) */
|
||||
#undef MOUNTED_GETMNTENT2
|
||||
|
||||
/* Define if there is a function named getmntinfo for reading the list of
|
||||
mounted file systems. (4.4BSD, Darwin) */
|
||||
#undef MOUNTED_GETMNTINFO
|
||||
|
||||
/* Define if there is a function named listmntent that can be used to list all
|
||||
mounted file systems. (UNICOS) */
|
||||
#undef MOUNTED_LISTMNTENT
|
||||
|
||||
/* Define if there is a function named mntctl that can be used to read the
|
||||
list of mounted file systems, and there is a system header file that
|
||||
declares `struct vmount.' (AIX) */
|
||||
#undef MOUNTED_VMOUNT
|
||||
|
||||
/* Define if gettimeofday is needed */
|
||||
#undef NEED_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
|
||||
on `HAVE_STRUCT_NLIST_N_UN_N_NAME */
|
||||
#undef NLIST_NAME_UNION
|
||||
|
||||
/* path and args for nslookup */
|
||||
#undef NSLOOKUP_COMMAND
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Path to apt-get command, if present */
|
||||
#undef PATH_TO_APTGET
|
||||
|
||||
/* Path to dig command, if present */
|
||||
#undef PATH_TO_DIG
|
||||
|
||||
/* path to fping */
|
||||
#undef PATH_TO_FPING
|
||||
|
||||
/* path to lmstat */
|
||||
#undef PATH_TO_LMSTAT
|
||||
|
||||
/* path to qmail-qstat */
|
||||
#undef PATH_TO_MAILQ
|
||||
|
||||
/* path to qstat/quakestat */
|
||||
#undef PATH_TO_QSTAT
|
||||
|
||||
/* path to rpcinfo binary */
|
||||
#undef PATH_TO_RPCINFO
|
||||
|
||||
/* path to smbclient binary */
|
||||
#undef PATH_TO_SMBCLIENT
|
||||
|
||||
/* path to snmpget binary */
|
||||
#undef PATH_TO_SNMPGET
|
||||
|
||||
/* path to snmpgetnext binary */
|
||||
#undef PATH_TO_SNMPGETNEXT
|
||||
|
||||
/* path to uptime binary */
|
||||
#undef PATH_TO_UPTIME
|
||||
|
||||
/* path and args for ICMPv6 ping command */
|
||||
#undef PING6_COMMAND
|
||||
|
||||
/* Define if packet count must precede host */
|
||||
#undef PING6_PACKETS_FIRST
|
||||
|
||||
/* path and args for ICMP ping command */
|
||||
#undef PING_COMMAND
|
||||
|
||||
/* Define if ping has its own timeout option that should be set */
|
||||
#undef PING_HAS_TIMEOUT
|
||||
|
||||
/* Define if packet count must precede host */
|
||||
#undef PING_PACKETS_FIRST
|
||||
|
||||
/* Location of /proc/loadavg */
|
||||
#undef PROC_LOADAVG
|
||||
|
||||
/* path to /proc/meminfo if name changes */
|
||||
#undef PROC_MEMINFO
|
||||
|
||||
/* Number of columns in ps command */
|
||||
#undef PS_COLS
|
||||
|
||||
/* Verbatim command to execute for ps in check_procs */
|
||||
#undef PS_COMMAND
|
||||
|
||||
/* Format string for scanning ps output in check_procs */
|
||||
#undef PS_FORMAT
|
||||
|
||||
/* Whether the ps utility uses the "procetime" field */
|
||||
#undef PS_USES_PROCETIME
|
||||
|
||||
/* Variable list for sscanf of 'ps' output */
|
||||
#undef PS_VARLIST
|
||||
|
||||
/* Forced workaround on redhat in spopen */
|
||||
#undef REDHAT_SPOPEN_ERROR
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define type of socket size */
|
||||
#undef SOCKET_SIZE_TYPE
|
||||
|
||||
/* path to ssh binary */
|
||||
#undef SSH_COMMAND
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if the block counts reported by statfs may be truncated to 2GB and
|
||||
the correct values may be stored in the f_spare array. (SunOS 4.1.2, 4.1.3,
|
||||
and 4.1.3_U1 are reported to have this problem. SunOS 4.1.1 seems not to be
|
||||
affected.) */
|
||||
#undef STATFS_TRUNCATES_BLOCK_COUNTS
|
||||
|
||||
/* Define if there is no specific function for reading file systems usage
|
||||
information and you have the <sys/filsys.h> header file. (SVR2) */
|
||||
#undef STAT_READ_FILSYS
|
||||
|
||||
/* Define if statfs takes 2 args and struct statfs has a field named f_bsize.
|
||||
(4.3BSD, SunOS 4, HP-UX, AIX PS/2) */
|
||||
#undef STAT_STATFS2_BSIZE
|
||||
|
||||
/* Define if statfs takes 2 args and struct statfs has a field named f_fsize.
|
||||
(4.4BSD, NetBSD) */
|
||||
#undef STAT_STATFS2_FSIZE
|
||||
|
||||
/* Define if statfs takes 2 args and the second argument has type struct
|
||||
fs_data. (Ultrix) */
|
||||
#undef STAT_STATFS2_FS_DATA
|
||||
|
||||
/* Define if statfs takes 3 args. (DEC Alpha running OSF/1) */
|
||||
#undef STAT_STATFS3_OSF1
|
||||
|
||||
/* Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin) */
|
||||
#undef STAT_STATFS4
|
||||
|
||||
/* Define if there is a function named statvfs. (SVR4) */
|
||||
#undef STAT_STATVFS
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 on System V Release 4. */
|
||||
#undef SVR4
|
||||
|
||||
/* Path to swap/swapinfo binary, with any args */
|
||||
#undef SWAP_COMMAND
|
||||
|
||||
/* Conversion factor to MB */
|
||||
#undef SWAP_CONVERSION
|
||||
|
||||
/* Format string for parsing swap output */
|
||||
#undef SWAP_FORMAT
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Define to 1 for Encore UMAX. */
|
||||
#undef UMAX
|
||||
|
||||
/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of
|
||||
<sys/cpustats.h>. */
|
||||
#undef UMAX4_3
|
||||
|
||||
/* Define if using gnutls libraries */
|
||||
#undef USE_GNUTLS
|
||||
|
||||
/* Enable IPv6 support */
|
||||
#undef USE_IPV6
|
||||
|
||||
/* Define if using OpenSSL libraries */
|
||||
#undef USE_OPENSSL
|
||||
|
||||
/* Define to 1 if you want getc etc. to use unlocked I/O if available.
|
||||
Unlocked I/O can improve performance in unithreaded apps, but it is not
|
||||
safe for multithreaded apps. */
|
||||
#undef USE_UNLOCKED_IO
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* path and arguments for invoking 'who' */
|
||||
#undef WHO_COMMAND
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* OSF needs this for getaddrinfo */
|
||||
#undef _OSF_SOURCE
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define if you want regoff_t to be at least as wide POSIX requires. */
|
||||
#undef _REGEX_LARGE_OFFSETS
|
||||
|
||||
/* Enable extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
|
||||
/* Define to rpl_ if the getopt replacement functions and variables should be
|
||||
used. */
|
||||
#undef __GETOPT_PREFIX
|
||||
|
||||
/* bsd specific code in check_dhcp.c */
|
||||
#undef __bsd__
|
||||
|
||||
/* hpux specific code in check_dhcp.c */
|
||||
#undef __hpux__
|
||||
|
||||
/* sun specific code in check_dhcp.c */
|
||||
#undef __linux__
|
||||
|
||||
/* sun specific code in check_dhcp.c */
|
||||
#undef __sun__
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#undef malloc
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to rpl_re_comp if the replacement should be used. */
|
||||
#undef re_comp
|
||||
|
||||
/* Define to rpl_re_compile_fastmap if the replacement should be used. */
|
||||
#undef re_compile_fastmap
|
||||
|
||||
/* Define to rpl_re_compile_pattern if the replacement should be used. */
|
||||
#undef re_compile_pattern
|
||||
|
||||
/* Define to rpl_re_exec if the replacement should be used. */
|
||||
#undef re_exec
|
||||
|
||||
/* Define to rpl_re_match if the replacement should be used. */
|
||||
#undef re_match
|
||||
|
||||
/* Define to rpl_re_match_2 if the replacement should be used. */
|
||||
#undef re_match_2
|
||||
|
||||
/* Define to rpl_re_search if the replacement should be used. */
|
||||
#undef re_search
|
||||
|
||||
/* Define to rpl_re_search_2 if the replacement should be used. */
|
||||
#undef re_search_2
|
||||
|
||||
/* Define to rpl_re_set_registers if the replacement should be used. */
|
||||
#undef re_set_registers
|
||||
|
||||
/* Define to rpl_re_set_syntax if the replacement should be used. */
|
||||
#undef re_set_syntax
|
||||
|
||||
/* Define to rpl_re_syntax_options if the replacement should be used. */
|
||||
#undef re_syntax_options
|
||||
|
||||
/* Define to rpl_realloc if the replacement function should be used. */
|
||||
#undef realloc
|
||||
|
||||
/* Define to rpl_regcomp if the replacement should be used. */
|
||||
#undef regcomp
|
||||
|
||||
/* Define to rpl_regerror if the replacement should be used. */
|
||||
#undef regerror
|
||||
|
||||
/* Define to rpl_regexec if the replacement should be used. */
|
||||
#undef regexec
|
||||
|
||||
/* Define to rpl_regfree if the replacement should be used. */
|
||||
#undef regfree
|
||||
|
||||
/* Define to equivalent of C99 restrict keyword, or to nothing if this is not
|
||||
supported. Do not define if restrict is supported directly. */
|
||||
#undef restrict
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
#undef socklen_t
|
||||
|
||||
/* Define to unsigned long or unsigned long long if <stdint.h> and
|
||||
<inttypes.h> don't define. */
|
||||
#undef uintmax_t
|
513
config.rpath
Executable file
513
config.rpath
Executable file
|
@ -0,0 +1,513 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2002 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except M$VC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shlibext=
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux*)
|
||||
echo '__INTEL_COMPILER' > conftest.$ac_ext
|
||||
if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
# Intel icc
|
||||
wl='-Qoption,ld,'
|
||||
fi
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
if test "x$host_vendor" = xsni; then
|
||||
wl='-LD'
|
||||
else
|
||||
wl='-Wl,'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX, the GNU linker is very broken
|
||||
ld_shlibs=no
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
if test "x$host_vendor" = xsno; then
|
||||
hardcode_direct=yes # is this really true???
|
||||
else
|
||||
hardcode_direct=no # Motorola manual says yes, but my tests say they lie
|
||||
fi
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv5*)
|
||||
hardcode_libdir_flag_spec=
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4.2uw2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
;;
|
||||
sysv5uw7* | unixware7*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
libname_spec='lib$name'
|
||||
sys_lib_dlsearch_path_spec="/lib /usr/lib"
|
||||
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
shlibext=so
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
shlibext=so
|
||||
;;
|
||||
amigaos*)
|
||||
shlibext=ixlibrary
|
||||
;;
|
||||
beos*)
|
||||
shlibext=so
|
||||
;;
|
||||
bsdi4*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
|
||||
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
case $GCC,$host_os in
|
||||
yes,cygwin*)
|
||||
shlibext=dll.a
|
||||
;;
|
||||
yes,mingw*)
|
||||
shlibext=dll
|
||||
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
|
||||
;;
|
||||
yes,pw32*)
|
||||
shlibext=dll
|
||||
;;
|
||||
*)
|
||||
shlibext=dll
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shlibext=dylib
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
shlibext=sl
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
shlibext=so
|
||||
case "$host_os" in
|
||||
irix5*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
|
||||
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
|
||||
;;
|
||||
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
|
||||
;;
|
||||
linux-gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
netbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
newsos6)
|
||||
shlibext=so
|
||||
;;
|
||||
openbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shlibext=dll
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
|
||||
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
|
||||
;;
|
||||
sco3.2v5*)
|
||||
shlibext=so
|
||||
;;
|
||||
solaris*)
|
||||
shlibext=so
|
||||
;;
|
||||
sunos4*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
shlibext=so
|
||||
case "$host_vendor" in
|
||||
motorola)
|
||||
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
uts4*)
|
||||
shlibext=so
|
||||
;;
|
||||
dgux*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
shlibext=so
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
# Compile-time system search path for libraries
|
||||
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
|
||||
|
||||
# Run-time system search path for libraries
|
||||
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"
|
||||
|
||||
EOF
|
1566
config.sub
vendored
Executable file
1566
config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
12
config_test/Makefile
Normal file
12
config_test/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
all: child_test
|
||||
|
||||
child_test: child_test.c
|
||||
gcc -o child_test child_test.c
|
||||
|
||||
test:
|
||||
./run_tests 10 100 > /dev/null
|
||||
|
||||
clean:
|
||||
rm -f child_test
|
||||
|
77
config_test/child_test.c
Normal file
77
config_test/child_test.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html
|
||||
// Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
void popen_sigchld_handler (int);
|
||||
int childtermd;
|
||||
|
||||
int main(){
|
||||
char str[1024];
|
||||
int pipefd[2];
|
||||
pid_t pid;
|
||||
int status, died;
|
||||
|
||||
if (signal (SIGCHLD, popen_sigchld_handler) == SIG_ERR) {
|
||||
printf ("Cannot catch SIGCHLD\n");
|
||||
_exit(-1);
|
||||
}
|
||||
|
||||
pipe (pipefd);
|
||||
switch(pid=fork()){
|
||||
case -1:
|
||||
printf("can't fork\n");
|
||||
_exit(-1);
|
||||
|
||||
case 0 : // this is the code the child runs
|
||||
close(1); // close stdout
|
||||
// pipefd[1] is for writing to the pipe. We want the output
|
||||
// that used to go to the standard output (file descriptor 1)
|
||||
// to be written to the pipe. The following command does this,
|
||||
// creating a new file descripter 1 (the lowest available)
|
||||
// that writes where pipefd[1] goes.
|
||||
dup (pipefd[1]); // points pipefd at file descriptor
|
||||
// the child isn't going to read from the pipe, so
|
||||
// pipefd[0] can be closed
|
||||
close (pipefd[0]);
|
||||
|
||||
//These are the commands to run, with success commented. dig and nslookup only problems
|
||||
//execl ("/bin/date","date",0); // 100%
|
||||
//execl ("/bin/cat", "cat", "/etc/hosts", 0); // 100%
|
||||
//execl ("/usr/bin/dig", "dig", "redhat.com", 0); // 69%
|
||||
//execl("/bin/sleep", "sleep", "1", 0); // 100%
|
||||
execl ("/usr/bin/nslookup","nslookup","redhat.com",0); // 90% (after 100 tests), 40% (after 10 tests)
|
||||
//execl ("/bin/ping","ping","-c","1","localhost",0); // 100%
|
||||
//execl ("/bin/ping","ping","-c","1","192.168.10.32",0); // 100%
|
||||
_exit(0);
|
||||
|
||||
default: // this is the code the parent runs
|
||||
|
||||
close(0); // close stdin
|
||||
// Set file descriptor 0 (stdin) to read from the pipe
|
||||
dup (pipefd[0]);
|
||||
// the parent isn't going to write to the pipe
|
||||
close (pipefd[1]);
|
||||
// Now read from the pipe
|
||||
fgets(str, 1023, stdin);
|
||||
//printf("1st line output is %s\n", str);
|
||||
|
||||
//while (!childtermd); // Uncomment this line to fix
|
||||
|
||||
died= wait(&status);
|
||||
//printf("died=%d status=%d\n", died, status);
|
||||
if (died > 0) _exit(0);
|
||||
else _exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
popen_sigchld_handler (int signo)
|
||||
{
|
||||
if (signo == SIGCHLD) {
|
||||
//printf("Caught sigchld\n");
|
||||
childtermd = 1;
|
||||
}
|
||||
}
|
30
config_test/run_tests
Executable file
30
config_test/run_tests
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/ksh
|
||||
# $1 is the number of iterations to run
|
||||
# If $2 is specified, this is the number of times you run each iteration
|
||||
# If there is a fail at run, exit 1
|
||||
# Prints to stdout # of successes and passes
|
||||
# Prints to stderr a dot for each run
|
||||
|
||||
total_runs=$2
|
||||
[[ -z $total_runs ]] && total_runs=1
|
||||
run=1
|
||||
while [[ $run -le $total_runs ]] ; do
|
||||
i=0
|
||||
success=0
|
||||
fail=0
|
||||
while [[ $i -lt $1 ]] ; do
|
||||
./child_test
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
success=$(($success+1))
|
||||
else
|
||||
fail=$((fail+1))
|
||||
fi
|
||||
i=$(($i+1))
|
||||
done
|
||||
print "Success=$success Fail=$fail"
|
||||
[[ $fail -gt 0 ]] && exit 1
|
||||
run=$(($run+1))
|
||||
[[ $total_runs -gt 1 ]] && print -u2 -n "."
|
||||
done
|
||||
[[ $total_runs -gt 1 ]] && print -u2
|
||||
exit 0
|
1742
configure.in
Normal file
1742
configure.in
Normal file
File diff suppressed because it is too large
Load diff
87
contrib/CVS/Entries
Normal file
87
contrib/CVS/Entries
Normal file
|
@ -0,0 +1,87 @@
|
|||
/README.TXT/1.4/Thu Jan 27 02:27:13 2005//Tr1_4_5
|
||||
/check_adptraid.sh/1.1/Sun Feb 9 14:20:30 2003//Tr1_4_5
|
||||
/check_apache.pl/1.1.1.1/Thu Feb 28 06:42:53 2002//Tr1_4_5
|
||||
/check_apc_ups.pl/1.2/Wed Aug 14 19:02:31 2002//Tr1_4_5
|
||||
/check_appletalk.pl/1.1/Tue Feb 18 04:05:01 2003//Tr1_4_5
|
||||
/check_arping.pl/1.1/Thu Jan 27 04:44:29 2005//Tr1_4_5
|
||||
/check_asterisk.pl/1.1/Tue Feb 1 04:19:31 2005//Tr1_4_5
|
||||
/check_axis.sh/1.2/Mon May 26 10:09:23 2003//Tr1_4_5
|
||||
/check_backup.pl/1.1/Sun Apr 7 05:13:57 2002//Tr1_4_5
|
||||
/check_bgpstate.pl/1.2/Sun Feb 23 17:10:39 2003//Tr1_4_5
|
||||
/check_breeze.pl/1.1/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_cluster.c/1.1/Tue Jun 18 01:05:26 2002//Tr1_4_5
|
||||
/check_cluster2.c/1.1/Fri Mar 12 03:40:57 2004//Tr1_4_5
|
||||
/check_compaq_insight.pl/1.1/Sun Feb 9 14:20:30 2003//Tr1_4_5
|
||||
/check_cpqarray.c/1.1/Thu Jan 27 04:46:08 2005//Tr1_4_5
|
||||
/check_digitemp.pl/1.1/Thu Aug 1 04:46:01 2002//Tr1_4_5
|
||||
/check_dlswcircuit.pl/1.1.1.1/Thu Feb 28 06:42:53 2002//Tr1_4_5
|
||||
/check_dns_random.pl/1.2/Wed Jan 29 05:27:20 2003//Tr1_4_5
|
||||
/check_email_loop.pl/1.5/Tue Nov 29 23:21:06 2005//Tr1_4_5
|
||||
/check_fan_cpq_present/1.1/Thu Jan 27 04:52:58 2005//Tr1_4_5
|
||||
/check_fan_fsc_present/1.1/Thu Jan 27 04:53:21 2005//Tr1_4_5
|
||||
/check_flexlm.pl/1.1/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_frontpage/1.1/Thu Jan 27 04:45:00 2005//Tr1_4_5
|
||||
/check_hltherm.c/1.1/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_hprsc.pl/1.2/Thu Nov 25 03:01:23 2004//Tr1_4_5
|
||||
/check_http-with-client-certificate.c/1.1/Tue Feb 1 04:19:42 2005//Tr1_4_5
|
||||
/check_hw.sh/1.1/Thu Nov 25 04:30:04 2004//Tr1_4_5
|
||||
/check_ica_master_browser.pl/1.1/Tue Jan 25 09:09:33 2005//Tr1_4_5
|
||||
/check_ica_metaframe_pub_apps.pl/1.1/Tue Jan 25 09:07:39 2005//Tr1_4_5
|
||||
/check_ica_program_neigbourhood.pl/1.1/Tue Jan 25 09:05:53 2005//Tr1_4_5
|
||||
/check_inodes-freebsd.pl/1.1/Wed Aug 14 19:00:17 2002//Tr1_4_5
|
||||
/check_inodes.pl/1.1/Thu Apr 18 21:59:26 2002//Tr1_4_5
|
||||
/check_ipxping.c/1.2/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_javaproc.pl/1.1/Mon Nov 18 21:58:58 2002//Tr1_4_5
|
||||
/check_joy.sh/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_linux_raid.pl/1.5/Wed Jun 7 14:28:33 2006//Tr1_4_5
|
||||
/check_lmmon.pl/1.1/Tue Jun 25 13:55:07 2002//Tr1_4_5
|
||||
/check_log2.pl/1.2/Fri Dec 16 18:41:45 2005//Tr1_4_5
|
||||
/check_lotus.pl/1.1/Tue Jan 25 09:04:26 2005//Tr1_4_5
|
||||
/check_maxchannels.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_maxwanstate.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_mem.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_ms_spooler.pl/1.1/Tue Jul 16 00:04:42 2002//Tr1_4_5
|
||||
/check_mssql.sh/1.3/Tue Aug 5 09:56:13 2003//Tr1_4_5
|
||||
/check_nagios.pl/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
/check_nagios_db.pl/1.1/Wed Aug 14 19:01:58 2002//Tr1_4_5
|
||||
/check_nagios_db_pg.pl/1.1/Mon Apr 19 13:13:23 2004//Tr1_4_5
|
||||
/check_netapp.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_nmap.py/1.2/Wed Dec 1 03:50:37 2004//Tr1_4_5
|
||||
/check_ora_table_space.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_oracle_instance.pl/1.1/Wed Apr 3 02:58:47 2002//Tr1_4_5
|
||||
/check_oracle_tbs/1.2/Fri Feb 4 00:27:38 2005//Tr1_4_5
|
||||
/check_pcpmetric.py/1.1/Thu Jan 27 04:45:46 2005//Tr1_4_5
|
||||
/check_pfstate/1.1/Thu Jan 27 04:43:49 2005//Tr1_4_5
|
||||
/check_qmailq.pl/1.1.1.1/Thu Feb 28 06:42:53 2002//Tr1_4_5
|
||||
/check_rbl.c/1.3/Thu Dec 2 00:30:32 2004//Tr1_4_5
|
||||
/check_remote_nagios_status.pl/1.1/Sun Feb 9 14:16:28 2003//Tr1_4_5
|
||||
/check_rrd_data.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_sap.sh/1.2/Tue May 27 13:10:01 2003//Tr1_4_5
|
||||
/check_smart.pl/1.1/Thu Jan 27 10:32:48 2005//Tr1_4_5
|
||||
/check_smb.sh/1.1/Wed Aug 14 15:29:58 2002//Tr1_4_5
|
||||
/check_snmp_disk_monitor.pl/1.1/Thu Aug 22 14:42:43 2002//Tr1_4_5
|
||||
/check_snmp_printer.pl/1.1/Sun Jan 18 20:07:01 2004//Tr1_4_5
|
||||
/check_snmp_process_monitor.pl/1.2/Thu Aug 22 22:08:46 2002//Tr1_4_5
|
||||
/check_snmp_procs.pl/1.1/Tue Feb 17 13:23:31 2004//Tr1_4_5
|
||||
/check_sockets.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/check_sybase/1.3/Fri Apr 29 00:27:49 2005//Tr1_4_5
|
||||
/check_temp_cpq/1.1/Thu Jan 27 04:53:41 2005//Tr1_4_5
|
||||
/check_temp_fsc/1.1/Thu Jan 27 04:53:59 2005//Tr1_4_5
|
||||
/check_timeout.c/1.1.1.1/Thu Feb 28 06:42:53 2002//Tr1_4_5
|
||||
/check_traceroute-pure_perl.pl/1.1/Tue Feb 1 12:43:58 2005//Tr1_4_5
|
||||
/check_traceroute.pl/1.1/Thu Jan 27 10:34:16 2005//Tr1_4_5
|
||||
/check_uptime.c/1.2/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_vcs.pl/1.1/Thu May 23 16:39:59 2002//Tr1_4_5
|
||||
/check_wave.pl/1.1/Fri Mar 1 02:42:56 2002//Tr1_4_5
|
||||
/check_wins.pl/1.3/Thu Nov 25 04:46:16 2004//Tr1_4_5
|
||||
/checkciscotemp.pl/1.3/Tue Jan 28 07:44:56 2003//Tr1_4_5
|
||||
/mrtgext.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/nagios_sendim.pl/1.1/Mon Nov 18 21:58:58 2002//Tr1_4_5
|
||||
/packet_utils.pm/1.1/Tue Jan 25 09:12:47 2005//Tr1_4_5
|
||||
/rblcheck-dns/1.1/Mon Nov 29 05:07:33 2004//Tr1_4_5
|
||||
/rblcheck-web/1.1/Mon Nov 29 05:07:33 2004//Tr1_4_5
|
||||
/restrict.pl/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
/sched_downtime.pl/1.1/Sun Feb 9 14:16:29 2003//Tr1_4_5
|
||||
/urlize.pl/1.2/Tue Jun 10 05:04:09 2003//Tr1_4_5
|
||||
/utils.py/1.1.1.1/Thu Feb 28 06:42:54 2002//Tr1_4_5
|
||||
D
|
2
contrib/CVS/Entries.Log
Normal file
2
contrib/CVS/Entries.Log
Normal file
|
@ -0,0 +1,2 @@
|
|||
A D/aix////
|
||||
A D/tarballs////
|
1
contrib/CVS/Repository
Normal file
1
contrib/CVS/Repository
Normal file
|
@ -0,0 +1 @@
|
|||
nagiosplug/contrib
|
1
contrib/CVS/Root
Normal file
1
contrib/CVS/Root
Normal file
|
@ -0,0 +1 @@
|
|||
:ext:tonvoon@nagiosplug.cvs.sourceforge.net:/cvsroot/nagiosplug
|
1
contrib/CVS/Tag
Normal file
1
contrib/CVS/Tag
Normal file
|
@ -0,0 +1 @@
|
|||
Nr1_4_5
|
56
contrib/README.TXT
Normal file
56
contrib/README.TXT
Normal file
|
@ -0,0 +1,56 @@
|
|||
Contrib Plugins README
|
||||
----------------------
|
||||
|
||||
This directory contains plugins which have been contributed by various people, but that
|
||||
have not yet been incorporated into the core plugins distribution.
|
||||
|
||||
Most Perl plugins should work without modification. Some of the C plugins may require
|
||||
a few tweaks to compile.
|
||||
|
||||
If you have questions regarding the use of these plugins, try contacting the author(s)
|
||||
or post a message to the nagiosplug-help mailing list (nagiosplug-help@lists.sourceforge.net)
|
||||
requesting assistance.
|
||||
|
||||
|
||||
|
||||
Contrib Tarballs
|
||||
----------------
|
||||
|
||||
In addition to the plugins located in this directory, there are some additional tarballs
|
||||
containing plugins in the tarballs/ subdirectory. They have not yet been organized.
|
||||
A brief description of their contents follows.
|
||||
|
||||
|
||||
berger-ping.tar.gz - Perl script version of the check_ping plugin and a corresponding
|
||||
CGI (mtr.cgi) that uses mtr to traceroute a path to a host.
|
||||
(Gary Berger)
|
||||
|
||||
bowen-langley_plugins.tar.gz
|
||||
- Several C plugins including check_inode, check_boot, etc.
|
||||
(Adam Bown & Thomas Langley)
|
||||
|
||||
|
||||
check_bgp-1.0.tar.gz - Perl script intended for monitoring BGP sessions on Cisco routers.
|
||||
Uses Net::Telnet to telnet into a cisco router and
|
||||
run "sh ip bgp"
|
||||
|
||||
check_memory.tgz - C plugin to check available system memory
|
||||
|
||||
check_radius.tar.gz - C program to check RADIUS authentication. This is a hacked version of
|
||||
the Cistron Radiusd program radtest that acts as a plugin for Nagios.
|
||||
The vast majority of the code was written by someone at Livingston
|
||||
Enterprises and Cistron. NOTE: Due to the copyright restrictions in
|
||||
this code, it cannot be distributed under the GPL license, and thus
|
||||
will not appear in the core plugin distribution!
|
||||
(Adam Jacob)
|
||||
|
||||
radius.tar.gz - Code modifications necessary to make the radexample app
|
||||
supplied with the radiusclient code work as a RADIUS plugin
|
||||
for Nagios (Nick Shore)
|
||||
|
||||
fetchlog-0.94.tar.gz - C program: The fetchlog utility displays the last new messages of a
|
||||
logfile. It is similar like tail(1) but offers some extra functionality
|
||||
for output formatting. fetchlog can be used standalone or as a Nagios
|
||||
plugin to monitor local logfiles or together with Net-SNMP to monitor
|
||||
remote logfiles. The README shows how to setup fetchlog for Nagios.
|
||||
(Alexander Haderer)
|
6
contrib/aix/CVS/Entries
Normal file
6
contrib/aix/CVS/Entries
Normal file
|
@ -0,0 +1,6 @@
|
|||
/check_failed/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
/check_io/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
/check_kerberos/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
/check_queue/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
/pg_stat/1.1.1.1/Thu Feb 28 06:42:55 2002//Tr1_4_5
|
||||
D
|
1
contrib/aix/CVS/Repository
Normal file
1
contrib/aix/CVS/Repository
Normal file
|
@ -0,0 +1 @@
|
|||
nagiosplug/contrib/aix
|
1
contrib/aix/CVS/Root
Normal file
1
contrib/aix/CVS/Root
Normal file
|
@ -0,0 +1 @@
|
|||
:ext:tonvoon@nagiosplug.cvs.sourceforge.net:/cvsroot/nagiosplug
|
1
contrib/aix/CVS/Tag
Normal file
1
contrib/aix/CVS/Tag
Normal file
|
@ -0,0 +1 @@
|
|||
Nr1_4_5
|
48
contrib/aix/check_failed
Normal file
48
contrib/aix/check_failed
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
#======================
|
||||
# Created May 25, 2000
|
||||
#======================
|
||||
|
||||
# This scripts is for checking for failed root login attempts on
|
||||
# any machine running AIX which has a failedlogin file in /etc/security
|
||||
# The purpose is to thwart (good word) any unauthorised people from
|
||||
# even trying to log in as root. This plugin has been developed for Nagios
|
||||
# running on AIX.
|
||||
# Lonny Selinger SpEnTBoY lonny@abyss.za.org
|
||||
# May
|
||||
|
||||
|
||||
my $server = $ARGV[0];
|
||||
|
||||
if (!$ARGV[0]) {
|
||||
print "You must specify a server to check\n";
|
||||
print "usage: ./check_failed <Server Name>\n";
|
||||
exit (-1);
|
||||
} else {
|
||||
open (DATE, "/bin/date '+%b %d' |");
|
||||
while (<DATE>) {
|
||||
$dline = $_;
|
||||
@dresults = $dline;
|
||||
chop $dresults[0];
|
||||
}
|
||||
open (SULOG, "rsh $server -l root who /etc/security/failedlogin | grep root |");
|
||||
while (<SULOG>) {
|
||||
$line = $_;
|
||||
@results = split (/\s+/,$line);
|
||||
if ($line =~ /^root/) {
|
||||
if (join(' ', @results[2,3]) eq $dresults[0]) {
|
||||
print "FAILED root login on $dresults[0], node: $ARGV[0] from $results[5]\n";
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (join(' ', @results[2,3]) ne $dresults[0]) {
|
||||
print "No Failed Root Logins on This Node\n";
|
||||
exit(0);
|
||||
}
|
||||
exit(0);
|
||||
close(SULOG);
|
||||
close(DATE);
|
||||
|
||||
|
69
contrib/aix/check_io
Normal file
69
contrib/aix/check_io
Normal file
|
@ -0,0 +1,69 @@
|
|||
#! /bin/sh
|
||||
|
||||
#=================================================================
|
||||
#
|
||||
# I/O Checker (KBPS)
|
||||
# This Script uses iostat to monitor disk io
|
||||
# Useful for notifications of disk thrashing.
|
||||
#
|
||||
# Authors: TheRocker
|
||||
# SpEnTBoY
|
||||
#
|
||||
# Email: therocker@pawprints.2y.net
|
||||
# lonny@abyss.za.org
|
||||
#
|
||||
#================================================================
|
||||
|
||||
NUMBER1=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c1 | line`
|
||||
NUMBER2=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c2 | line`
|
||||
TMPFILE=/tmp/iotest.hndl
|
||||
TMPTOO=/tmp/iotwo.hndl
|
||||
|
||||
#===========================================================
|
||||
#
|
||||
# We do an evaluation on $NUMBER1 and $NUMBER2 to see if
|
||||
# disk io is exceeding 40%.
|
||||
#
|
||||
#===========================================================
|
||||
|
||||
if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
|
||||
then
|
||||
|
||||
`rsh $1 -l root iostat -d | grep -v cd0 | tr -s ' '| cut -d' ' -f1,2 | grep -e "4[0-9]." >> $TMPFILE`
|
||||
|
||||
#====================================================================
|
||||
#
|
||||
# Of course, there may be more than one hard disk on the node
|
||||
# so we use this bit of code to report on more than one instance
|
||||
# of excessive disk IO.
|
||||
#
|
||||
#====================================================================
|
||||
|
||||
LINES=`wc -l /tmp/iotest.hndl | cut -c8`
|
||||
LINESCTL=`wc -l /tmp/iotest.hndl | cut -c8 `
|
||||
echo "WARNING!!! Disk I/O Exceeding 40% on --> \c"
|
||||
|
||||
while [ $LINESCTL != 0 ]
|
||||
do
|
||||
|
||||
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
|
||||
cat $TMPTOO > $TMPFILE
|
||||
LINESCTL=$(( $LINESCTL -1 ))
|
||||
LINES=$(( $LINES -1 ))
|
||||
DATA=`head -1 /tmp/iotest.hndl`
|
||||
echo "( $DATA ) "
|
||||
|
||||
|
||||
done
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
rm -f $TMPTOO
|
||||
exit 1
|
||||
|
||||
else
|
||||
|
||||
print "No Disk I/O Exceeding 40%...OK"
|
||||
exit 0
|
||||
|
||||
fi
|
49
contrib/aix/check_kerberos
Normal file
49
contrib/aix/check_kerberos
Normal file
|
@ -0,0 +1,49 @@
|
|||
#! /bin/sh
|
||||
|
||||
#=========================================================================
|
||||
# Kerberos Ticket Checker
|
||||
#
|
||||
# This script is handy if you allow kerberos tickets to expire
|
||||
# on your nodes. The script will simply warn you when a node has
|
||||
# kerberos tickets expiring on the current date. This will allow to
|
||||
# re-initialize the tickets if you wish to do so.
|
||||
#
|
||||
# Nothing fancy here, all Nagios will show is the number of tickets
|
||||
# that are going to (or already have) expired.
|
||||
#
|
||||
# An item of note:
|
||||
#
|
||||
# We made no provisions for the weekend. If tickets expire on the
|
||||
# weekend and nobody is around, you won't see a warning on the
|
||||
# Nagios console because we look for expired on the current day
|
||||
# only. It's a good idea to have this warning emailed to the
|
||||
# appropriate admin and if there is something critical that relies
|
||||
# on Kerberos, you might want to send a page.
|
||||
#
|
||||
# Authors: TheRocker
|
||||
# SpEnTBoY
|
||||
#
|
||||
# Email: therocker@pawprints.2y.net
|
||||
# lonny@abyss.za.org
|
||||
#=========================================================================
|
||||
|
||||
TMPFILE=/tmp/kerbtmp.hndl
|
||||
DATE=`date +%b' '%d`
|
||||
|
||||
rsh $1 -l root /usr/lpp/ssp/kerberos/bin/klist | tr -s ' ' | cut -d' ' -f4,5,6 | grep -e "$DATE" > $TMPFILE
|
||||
|
||||
|
||||
if [ -s $TMPFILE ]
|
||||
then
|
||||
|
||||
LINES=`wc -l /tmp/kerbtmp.hndl | cut -c7-8`
|
||||
echo "Kerberos Tickets set to expire --> \c"
|
||||
echo "$LINES \c"
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
exit 1
|
||||
|
||||
fi
|
||||
echo "Kerberos Tickets are valid"
|
||||
exit 0
|
67
contrib/aix/check_queue
Normal file
67
contrib/aix/check_queue
Normal file
|
@ -0,0 +1,67 @@
|
|||
#! /bin/sh
|
||||
|
||||
#===============================================================
|
||||
# Print Queue Checker
|
||||
#
|
||||
# The print queue checker simply looks for an occurance of a
|
||||
# DOWN queue. A note of warning, if you use remote queues in
|
||||
# AIX to redirect print jobs from the AIX queue to an NT print
|
||||
# server that print through DLC rather than IP, it will be very
|
||||
# s - l - o - w. But it will work.
|
||||
#
|
||||
# Author: TheRocker
|
||||
# Email: therocker@pawprints.2y.net
|
||||
#===============================================================
|
||||
|
||||
TMPFILE=/tmp/qtmp.hndl
|
||||
TMPTOO=/tmp/qtwo.hndl
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# This script will also work on AIX 4.2.1 BUT you have to change
|
||||
# the following line. AIX 4.2.1 does not support the -W option
|
||||
# with lpstat. For AIX 4.2.1 just remove the -W option and it should
|
||||
# work just fine.
|
||||
#
|
||||
#=======================================================================
|
||||
|
||||
`rsh $1 -l root lpstat -W | grep -e "DOWN" | tr -s ' ' | cut -d' ' -f1,3 > /tmp/qtmp.hndl 2> /tmp/q_err`
|
||||
|
||||
if [ -s $TMPFILE ]
|
||||
then
|
||||
|
||||
#=======================================================
|
||||
#
|
||||
# If you've seen the other AIX scripts I wrote you may
|
||||
# notice that I use this bit of code a lot. Well it
|
||||
# works and appears to be all purpose.
|
||||
#
|
||||
#=======================================================
|
||||
|
||||
LINES=`wc -l /tmp/qtmp.hndl | cut -c8`
|
||||
LINESCTL=`wc -l /tmp/qtmp.hndl | cut -c8`
|
||||
|
||||
echo "Print Queue DOWN --> \c"
|
||||
|
||||
while [ $LINESCTL != 0 ]
|
||||
do
|
||||
|
||||
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
|
||||
cat $TMPTOO > $TMPFILE
|
||||
LINESCTL=$(( $LINESCTL -1 ))
|
||||
LINES=$(( $LINES -1 ))
|
||||
DATA=`head -1 /tmp/qtmp.hndl`
|
||||
echo "( $DATA ) \c"
|
||||
|
||||
|
||||
done
|
||||
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
rm -f $TMPTOO
|
||||
exit 2
|
||||
|
||||
fi
|
||||
echo "Print Queues Running... OK"
|
||||
exit 0
|
45
contrib/aix/pg_stat
Normal file
45
contrib/aix/pg_stat
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/ksh
|
||||
|
||||
#==============================================================================
|
||||
# Script was originally created to collect stats and dump then to a log file
|
||||
# every five minutes. But we like this better (the log file thing is still
|
||||
# good if you want to track availability).
|
||||
#
|
||||
# Authors: SpEnTBoY
|
||||
# TheRocker
|
||||
#
|
||||
# Email: lonny@abyss.za.org
|
||||
# therocker@pawprints.2y.net
|
||||
#==============================================================================
|
||||
|
||||
#=========================================================================================
|
||||
#
|
||||
# The best way to do this is to use Kerberos but we use rsh here because our monitoring
|
||||
# workstation doesn't have Kerberos installed. In order for this to work, the remote
|
||||
# host ($1) must have a .rhosts file that contains a line like:
|
||||
#
|
||||
# monitorhost nagiosuser
|
||||
#
|
||||
#=========================================================================================
|
||||
|
||||
PAGING2=`rsh $1 -l root lsps -a -s | grep -v Paging | tr -s ' '| cut -d' ' -f3 | cut -d'%' -f1`
|
||||
|
||||
|
||||
if [ "$PAGING2" -gt "35" ] && [ "$PAGING2" -lt "50" ]
|
||||
then
|
||||
echo "Paging Space is over 35% ("$PAGING2")%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PAGING2" -gt "49" ]
|
||||
then
|
||||
echo "WARNING! Paging Space is over 50% ("$PAGING2")%"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$PAGING2" -lt "34" ]
|
||||
then
|
||||
echo "Paging Space is less than 34% ("$PAGING2")%"
|
||||
exit 0
|
||||
fi
|
||||
|
75
contrib/check_adptraid.sh
Normal file
75
contrib/check_adptraid.sh
Normal file
|
@ -0,0 +1,75 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Modified check_sensors to check the alarm status of an Adaptec 3200S RAID
|
||||
# controller.
|
||||
#
|
||||
# Scott Lambert -- lambert@lambertfam.org
|
||||
#
|
||||
# Tested on FreeBSD 4.7 with the adptfbsd_323.tgz package installed. This
|
||||
# package installs all it's programs into /usr/dpt.
|
||||
#
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||
REVISION=`echo '$Revision: 1.1 $' | sed -e 's/[^0-9.]//g'`
|
||||
|
||||
. $PROGPATH/utils.sh
|
||||
|
||||
RAIDUTIL_CMD="/usr/dpt/raidutil -A ?"
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $PROGNAME"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
print_revision $PROGNAME $REVISION
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "This plugin checks alarm status of Adaptec 3200S RAID controller."
|
||||
echo ""
|
||||
support
|
||||
exit 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
-h)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
-V)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
raidutiloutput=`$RAIDUTIL_CMD 2>&1`
|
||||
status=$?
|
||||
if test "$1" = "-v" -o "$1" = "--verbose"; then
|
||||
echo ${raidutiloutput}
|
||||
fi
|
||||
if test ${status} -eq 127; then
|
||||
echo "RAIDUTIL UNKNOWN - command not found (did you install raidutil?)"
|
||||
exit -1
|
||||
elif test ${status} -ne 0 ; then
|
||||
echo "WARNING - raidutil returned state $status"
|
||||
exit 1
|
||||
fi
|
||||
if echo ${raidutiloutput} | egrep On > /dev/null; then
|
||||
echo RAID CRITICAL - RAID alarm detected!
|
||||
exit 2
|
||||
else
|
||||
echo raid ok
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
esac
|
283
contrib/check_apache.pl
Normal file
283
contrib/check_apache.pl
Normal file
|
@ -0,0 +1,283 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# (c)2001 Sebastian Hetze, Linux Information Systems AG
|
||||
# send bug reports to <S.Hetze@Linux-AG.com>
|
||||
#
|
||||
# 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 (or with Nagios); if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#
|
||||
# Check apache status information provided by mod_status to find
|
||||
# out about the load (number of servers working) and the
|
||||
# performance (average response time for recent requests).
|
||||
#
|
||||
# Usage:
|
||||
# check_apache -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]
|
||||
#
|
||||
# check_apache <host> <warn> <crit> <url> (if you cannot avoid it)
|
||||
#
|
||||
|
||||
use LWP::UserAgent;
|
||||
use URI::URL;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
$version=0.01;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
#
|
||||
# some default values
|
||||
#
|
||||
$perf_w=500;
|
||||
$perf_c=1000;
|
||||
$load_w=20;
|
||||
$load_c=30;
|
||||
$TIMEOUT=15;
|
||||
|
||||
#
|
||||
# get command line options the regular way
|
||||
#
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"l" => \$opt_l, "load" => \$opt_l,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"u=s" => \$opt_u, "url=s" => \$opt_u);
|
||||
|
||||
#
|
||||
# handle the verbose stuff first
|
||||
#
|
||||
if ($opt_V) {
|
||||
print "\n";
|
||||
print "check_apache nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General Public License.\n";
|
||||
print "For more information about these matters, see the file named COPYING.\n";
|
||||
print "\n";
|
||||
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#
|
||||
# now get options the weired way and set the defaults
|
||||
# if nothing else is provided
|
||||
#
|
||||
$opt_H = shift unless ($opt_H);
|
||||
print_usage() unless ($opt_H);
|
||||
|
||||
if($opt_l) {
|
||||
$autostring="?auto";
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = $load_w);
|
||||
$warn = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = $load_c);
|
||||
$alert = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
} else {
|
||||
$autostring="";
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = $perf_w);
|
||||
$warn = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = $perf_c);
|
||||
$alert = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
}
|
||||
|
||||
($opt_u) || ($opt_u = shift) || ($opt_u = "/server-status");
|
||||
|
||||
|
||||
#
|
||||
# dont let us wait forever...
|
||||
#
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from HTTP server (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
#
|
||||
# now we set things up for the real work
|
||||
# and fire up the request
|
||||
#
|
||||
$ua = new LWP::UserAgent;
|
||||
$ua->agent("Nagios/0.1 " . $ua->agent);
|
||||
|
||||
|
||||
$urlstring = "http://" . $opt_H . $opt_u . $autostring;
|
||||
$url = url($urlstring);
|
||||
|
||||
my $req = new HTTP::Request 'GET', $url;
|
||||
my $res = $ua->request($req);
|
||||
|
||||
#
|
||||
# hopefully we´ve got something usefull
|
||||
#
|
||||
if ($res->is_success) {
|
||||
if($opt_l) {
|
||||
foreach $_ (split /^/m, $res->content) {
|
||||
next if /^\s*$/;
|
||||
#
|
||||
# this is the load checking section
|
||||
# we parse the whole content, just in case someone
|
||||
# wants to use this some day in the future
|
||||
#
|
||||
if (/^Total Accesses:\s+([0-9.]+)/) { $accesses = $1; next; }
|
||||
if (/^Total kBytes:\s+([0-9.]+)/) { $kbytes = $1; next; }
|
||||
if (/^CPULoad:\s+([0-9.]+)\s+/) { $load = $1; next; }
|
||||
if (/^Uptime:\s+([0-9.]+)\s+/) { $uptime = $1; next; }
|
||||
if (/^ReqPerSec:\s+([0-9.]+)\s+/) { $rps = $1; next; }
|
||||
if (/^BytesPerSec:\s+([0-9.]+)\s+/) { $bps = $1; next; }
|
||||
if (/^BytesPerReq:\s+([0-9.]+)\s+/) { $bpr = $1; next; }
|
||||
if (/^BusyServers:\s+([0-9.]+)\s+/) { $busy = $1; next; }
|
||||
if (/^IdleServers:\s+([0-9.]+)\s+/) { $idle = $1; next; }
|
||||
if (/^Scoreboard:\s+([SRWKDLG_.]+)\s+/) { $score = $1; next; }
|
||||
print "Unknown Status\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
#
|
||||
# now we even parse the whole scoreboard, just for fun
|
||||
#
|
||||
foreach $scorepoint (split //m, $score) {
|
||||
if($scorepoint eq '.') { $scores{'.'}+=1; next; } # Unused
|
||||
if($scorepoint eq '_') { $scores{'_'}+=1; next; } # Waiting
|
||||
if($scorepoint eq 'S') { $scores{'S'}+=1; next; } # Starting
|
||||
if($scorepoint eq 'R') { $scores{'R'}+=1; next; } # Reading
|
||||
if($scorepoint eq 'W') { $scores{'W'}+=1; next; } # Writing
|
||||
if($scorepoint eq 'K') { $scores{'K'}+=1; next; } # Keepalive
|
||||
if($scorepoint eq 'D') { $scores{'D'}+=1; next; } # DNS Lookup
|
||||
if($scorepoint eq 'L') { $scores{'L'}+=1; next; } # Logging
|
||||
if($scorepoint eq 'G') { $scores{'G'}+=1; next; } # Going
|
||||
}
|
||||
|
||||
if($busy>$alert) {
|
||||
printf "HTTPD CRITICAL: %.0f servers running\n", $busy;
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
if($busy>$warn) {
|
||||
printf "HTTPD WARNING: %.0f servers running\n", $busy;
|
||||
exit $ERRORS{"WARNING"};
|
||||
}
|
||||
printf "HTTPD ok: %.0f servers running, %d idle\n", $busy, $idle;
|
||||
exit $ERRORS{"OK"};
|
||||
|
||||
} else {
|
||||
#
|
||||
# this is the performance check section
|
||||
# We are a bit lazy here, no parsing of the initial data
|
||||
# block and the scoreboard.
|
||||
# However, you have the whole set of per server
|
||||
# information to play with ;-)
|
||||
# The actual performance is measured by adding up the
|
||||
# milliseconds required to process the most recent
|
||||
# requests of all instances and then taking the average.
|
||||
#
|
||||
foreach $tablerow (split /<tr>/m, $res->content) {
|
||||
($empty,$Srv,$PID,$Acc,$M,$CPU,$SS,$Req,$Conn,$Child,$Slot,$Client,$VHost,$Request)
|
||||
= split /<td>/, $tablerow;
|
||||
if($Req) {
|
||||
$lines+=1;
|
||||
$req_sum+=$Req;
|
||||
}
|
||||
undef $Req;
|
||||
}
|
||||
$average=$req_sum/$lines;
|
||||
if($average>$alert) {
|
||||
printf "HTTPD CRITICAL: average response time %.0f
|
||||
milliseconds\n", $average;
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
if($average>$warn) {
|
||||
printf "HTTPD WARNING: average response time %.0f
|
||||
milliseconds\n", $average;
|
||||
exit $ERRORS{"WARNING"};
|
||||
}
|
||||
if($average>0) {
|
||||
printf "HTTPD ok: average response time %.0f milliseconds\n",
|
||||
$average;
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
print "Unknown Status\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
} else {
|
||||
print "HTTP request failed\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# ok, now we are almost through
|
||||
# These last subroutines do the things for those that do not
|
||||
# read source code.
|
||||
#
|
||||
sub print_usage () {
|
||||
print "Usage: $0 -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]\n"; }
|
||||
|
||||
sub print_help () {
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "check_apache nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General Public License.\n";
|
||||
print "For more information about these matters, see the file named COPYING.\n";
|
||||
print "\n";
|
||||
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "This plugin checks the apache HTTP service on the specified host.\n";
|
||||
print "It uses the mod_status facilities provided by the apache server.\n";
|
||||
print "The monitoring server must be authorized in httpd.conf.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "Options:\n";
|
||||
print " -H, --hostname=ADDRESS\n";
|
||||
print " host name argument for server.\n";
|
||||
print " -l, --load\n";
|
||||
print " check load instead of performance.\n";
|
||||
print " -h, --help\n";
|
||||
print " print detailed help screen.\n";
|
||||
print " -V, --version\n";
|
||||
print " print version information.\n";
|
||||
print " -w, --warning=INTEGER\n";
|
||||
print " load / performance level at which a warning message will be gererated.\n";
|
||||
print " -c, --critical=INTEGER\n";
|
||||
print " load / performance level at which a critical message will be gererated.\n";
|
||||
print " -u, --url=PATH\n";
|
||||
print " location to call mod_status.\n";
|
||||
print "\n";
|
||||
print " Defaults for performance checking are $perf_w/$perf_c msec.\n";
|
||||
print " Defaults for load checking are $load_w/$load_c servers running.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
#
|
||||
# the end
|
||||
#
|
307
contrib/check_apc_ups.pl
Normal file
307
contrib/check_apc_ups.pl
Normal file
|
@ -0,0 +1,307 @@
|
|||
#! /usr/bin/perl -wT
|
||||
#
|
||||
# Check_apc_ups - Check APC UPS status via SNMP
|
||||
# Shamelessly copied from check_breeze.pl
|
||||
#
|
||||
# To do:
|
||||
# - Send SNMP queries directly, instead of forking `snmpget`.
|
||||
# - Make the status less verbose. Maybe we can send an "onLine, time
|
||||
# remaining: hh:mm:ss" if all is well, and a list of specific problems
|
||||
# if something is broken.
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R $opt_r
|
||||
$opt_L $opt_l $PROGNAME);
|
||||
use lib utils.pm;
|
||||
use utils qw(%ERRORS &print_revision &support &usage);
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub get_snmp_int_val ($);
|
||||
sub escalate_exitval ($);
|
||||
|
||||
$ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"T=s" => \$opt_T, "temp-critical" => \$opt_T,
|
||||
"t=s" => \$opt_t, "temp-warning" => \$opt_t,
|
||||
"R=s" => \$opt_R, "runtime-critical" => \$opt_R,
|
||||
"r=s" => \$opt_r, "runtime-warning" => \$opt_r,
|
||||
"L=s" => \$opt_L, "load-critical" => \$opt_L,
|
||||
"l=s" => \$opt_l, "load-warning" => \$opt_l,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||
|
||||
($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n");
|
||||
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
|
||||
($host) || usage("Invalid host: $opt_H\n");
|
||||
|
||||
# Defaults
|
||||
|
||||
$opt_R *= 60 * 100 if (defined $opt_R); # Convert minutes to secs/100
|
||||
$opt_r *= 60 * 100 if (defined $opt_R);
|
||||
|
||||
my $tempcrit = $opt_T || 60;
|
||||
my $tempwarn = $opt_t || 40;
|
||||
my $runtimecrit = $opt_R || 30 * 60 * 100; # Secs / 100
|
||||
my $runtimewarn = $opt_r || 60 * 60 * 100;
|
||||
my $loadcrit = $opt_L || 85;
|
||||
my $loadwarn = $opt_l || 50;
|
||||
|
||||
if ($tempcrit !~ /\d+/) { usage ("Invalid critical temperature threshold.\n"); }
|
||||
if ($tempwarn !~ /\d+/) { usage ("Invalid critical temperature threshold.\n"); }
|
||||
|
||||
if ($runtimecrit !~ /\d+/) {
|
||||
usage ("Invalid critical run time threshold.\n");
|
||||
}
|
||||
if ($runtimewarn !~ /\d+/) {
|
||||
usage ("Invalid warning run time threshold.\n");
|
||||
}
|
||||
|
||||
if ($loadcrit !~ /\d+/ || $loadcrit < 0 || $loadcrit > 100) {
|
||||
usage ("Invalid critical load threshold.\n");
|
||||
}
|
||||
if ($loadwarn !~ /\d+/ || $loadwarn < 0 || $loadwarn > 100) {
|
||||
usage ("Invalid warning load threshold.\n");
|
||||
}
|
||||
|
||||
|
||||
# APC UPS OIDs
|
||||
# APC MIBs are available at ftp://ftp.apcftp.com/software/pnetmib/mib
|
||||
my $upsBasicOutputStatus = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
|
||||
my $upsBasicBatteryStatus = ".1.3.6.1.4.1.318.1.1.1.2.1.1.0";
|
||||
my $upsAdvInputLineFailCause = ".1.3.6.1.4.1.318.1.1.1.3.2.5.0";
|
||||
my $upsAdvBatteryTemperature = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0";
|
||||
my $upsAdvBatteryRunTimeRemaining = ".1.3.6.1.4.1.318.1.1.1.2.2.3.0";
|
||||
my $upsAdvBatteryReplaceIndicator = ".1.3.6.1.4.1.318.1.1.1.2.2.4.0";
|
||||
my $upsAdvOutputLoad = ".1.3.6.1.4.1.318.1.1.1.4.2.3.0";
|
||||
my $upsAdvTestDiagnosticsResults = ".1.3.6.1.4.1.318.1.1.1.7.2.3.0";
|
||||
|
||||
my @outputStatVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ undef, undef ], # pad 1
|
||||
[ "onLine", $ERRORS{'OK'} ], # 2
|
||||
[ "onBattery", $ERRORS{'WARNING'} ], # 3
|
||||
[ "onSmartBoost", $ERRORS{'WARNING'} ], # 4
|
||||
[ "timedSleeping", $ERRORS{'WARNING'} ], # 5
|
||||
[ "softwareBypass", $ERRORS{'WARNING'} ], # 6
|
||||
[ "off", $ERRORS{'CRITICAL'} ], # 7
|
||||
[ "rebooting", $ERRORS{'WARNING'} ], # 8
|
||||
[ "switchedBypass", $ERRORS{'WARNING'} ], # 9
|
||||
[ "hardwareFailureBypass", $ERRORS{'CRITICAL'} ], # 10
|
||||
[ "sleepingUntilPowerReturn", $ERRORS{'CRITICAL'} ], # 11
|
||||
[ "onSmartTrim", $ERRORS{'WARNING'} ], # 12
|
||||
);
|
||||
|
||||
my @failCauseVals = (
|
||||
undef,
|
||||
"noTransfer",
|
||||
"highLineVoltage",
|
||||
"brownout",
|
||||
"blackout",
|
||||
"smallMomentarySag",
|
||||
"deepMomentarySag",
|
||||
"smallMomentarySpike",
|
||||
"largeMomentarySpike",
|
||||
"selfTest",
|
||||
"rateOfVoltageChnage",
|
||||
);
|
||||
|
||||
my @battStatVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ undef, undef ], # pad 1
|
||||
[ "batteryNormal", $ERRORS{'OK'} ], # 2
|
||||
[ "batteryLow", $ERRORS{'CRITICAL'} ], # 3
|
||||
);
|
||||
|
||||
my @battReplVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ "noBatteryNeedsReplacing", $ERRORS{'OK'} ], # 1
|
||||
[ "batteryNeedsReplacing", $ERRORS{'CRITICAL'} ], # 2
|
||||
);
|
||||
|
||||
my @diagnosticsResultsVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ "OK", $ERRORS{'OK'} ], # 1
|
||||
[ "failed", $ERRORS{'CRITICAL'} ], # 2
|
||||
[ "invalidTest", $ERRORS{'CRITICAL'} ], # 3
|
||||
[ "testInProgress", $ERRORS{'OK'} ], # 4
|
||||
);
|
||||
|
||||
my $exitval = $ERRORS{'UNKNOWN'};
|
||||
my $data;
|
||||
my $onbattery = 3;
|
||||
|
||||
$data = get_snmp_int_val( $upsBasicOutputStatus );
|
||||
|
||||
print "Output status: ";
|
||||
if (defined ($data) && defined ($outputStatVals[$data][0])) {
|
||||
print "$outputStatVals[$data][0] | ";
|
||||
escalate_exitval($outputStatVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryRunTimeRemaining );
|
||||
|
||||
print "Rem time: ";
|
||||
if (defined ($data)) {
|
||||
my $hrs = int($data / (60 * 60 * 100)); # Data is hundredths of a second
|
||||
my $mins = int($data / (60 * 100)) % 60;
|
||||
my $secs = ($data % 100) / 100;
|
||||
printf "%d:%02d:%05.2f | ", $hrs, $mins, $secs;
|
||||
if ($data <= $runtimecrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data <= $runtimewarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsBasicBatteryStatus );
|
||||
|
||||
print "Battery status: ";
|
||||
if (defined ($data) && defined ($battStatVals[$data][0])) {
|
||||
my $failcause = "unknown";
|
||||
my $fc = get_snmp_int_val( $upsAdvInputLineFailCause );
|
||||
if ($data == $onbattery) {
|
||||
if (defined ($failCauseVals[$fc])) { $failcause = $failCauseVals[$fc]; }
|
||||
print "$battStatVals[$data][0] ($failcause) | ";
|
||||
} else {
|
||||
print "$battStatVals[$data][0] | ";
|
||||
}
|
||||
escalate_exitval($battStatVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryTemperature );
|
||||
|
||||
print "Battery temp(C): ";
|
||||
if (defined ($data)) {
|
||||
print "$data | ";
|
||||
if ($data >= $tempcrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data >= $tempwarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryReplaceIndicator );
|
||||
|
||||
print "Battery repl: ";
|
||||
if (defined ($data) && defined ($battReplVals[$data][0])) {
|
||||
print "$battReplVals[$data][0] | ";
|
||||
escalate_exitval($battReplVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvOutputLoad );
|
||||
|
||||
print "Output load (%): ";
|
||||
if (defined ($data)) {
|
||||
print "$data | ";
|
||||
if ($data >= $loadcrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data >= $loadwarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvTestDiagnosticsResults );
|
||||
|
||||
print "Diag result: ";
|
||||
if (defined ($data) && defined ($diagnosticsResultsVals[$data][0])) {
|
||||
print "$diagnosticsResultsVals[$data][0]\n";
|
||||
escalate_exitval($diagnosticsResultsVals[$data][1]);
|
||||
} else {
|
||||
print "unknown\n";
|
||||
}
|
||||
|
||||
|
||||
exit $exitval;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -T temp -t temp -R minutes -r minutes\n";
|
||||
print " -L percent -l percent\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
print "Copyright (c) 2001 Gerald Combs/Jeffrey Blank/Karl DeBisschop
|
||||
|
||||
This plugin reports the status of an APC UPS equipped with an SNMP management
|
||||
module.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print "
|
||||
-H, --hostname=HOST
|
||||
Name or IP address of host to check
|
||||
-T --temp-critical
|
||||
Battery degrees C above which a CRITICAL status will result (default: 60)
|
||||
-t --temp-warning
|
||||
Battery degrees C above which a WARNING status will result (default: 40)
|
||||
-R --runtime-critical
|
||||
Minutes remaining below which a CRITICAL status will result (default: 30)
|
||||
-r --runtime-warning
|
||||
Minutes remaining below which a WARNING status will result (default: 60)
|
||||
-L --load-critical
|
||||
Output load pct above which a CRITICAL status will result (default: 85
|
||||
-l --load-warning
|
||||
Output load pct above which a WARNING status will result (default: 50
|
||||
|
||||
";
|
||||
support();
|
||||
}
|
||||
|
||||
sub get_snmp_int_val ($) {
|
||||
my $val=0;
|
||||
my $oid = shift(@_);
|
||||
|
||||
$val = `/usr/bin/snmpget $host public $oid 2> /dev/null`;
|
||||
my @test = split(/ /,$val,3);
|
||||
|
||||
return undef unless (defined ($test[2]));
|
||||
|
||||
if ($test[2] =~ /\(\d+\)/) { # Later versions of UCD SNMP
|
||||
($val) = ($test[2] =~ /\((\d+)\)/);
|
||||
} elsif ($test[2] =~ /: \d+/) {
|
||||
($val) = ($test[2] =~ /: (\d+)/);
|
||||
} else {
|
||||
$val = $test[2];
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
sub escalate_exitval ($) {
|
||||
my $newval = shift(@_);
|
||||
|
||||
if ($newval > $exitval) { $exitval = $newval; }
|
||||
}
|
210
contrib/check_appletalk.pl
Normal file
210
contrib/check_appletalk.pl
Normal file
|
@ -0,0 +1,210 @@
|
|||
#! /usr/bin/perl -wT
|
||||
#
|
||||
# check_atalk_ping plugin for nagios
|
||||
#
|
||||
# usage:
|
||||
# check_atalk_ping atalkaddress
|
||||
#
|
||||
# Checks if an atalkhost responds to an atalk echo
|
||||
# using "aecho"
|
||||
#
|
||||
# initial version: 23 October 2002 by Stefan Beck, IT Software Solutions
|
||||
# current status: $Revision: 1.1 $
|
||||
#
|
||||
# Copyright Notice: GPL
|
||||
#
|
||||
BEGIN {
|
||||
if ( $0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/ ) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
delete $ENV{'LANG'};
|
||||
}
|
||||
|
||||
use strict;
|
||||
use lib utils.pm;
|
||||
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use vars qw($PROGNAME);
|
||||
|
||||
$PROGNAME = "check_atalk";
|
||||
|
||||
my (
|
||||
$verbose, $host, $warning_avg, $warning_loss,
|
||||
$critical_avg, $critical_loss, $count, $cmd,
|
||||
$avg, $loss, $line
|
||||
);
|
||||
my ( $opt_c, $opt_w, $opt_H, $opt_p );
|
||||
$opt_c = $opt_w = $opt_p = $opt_H = '';
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
# Just in case of problems, let's not hang NetSaint
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "Plugin Timeout\n";
|
||||
exit 2;
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
delete @ENV{ 'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
|
||||
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure( 'bundling', 'no_ignore_case' );
|
||||
GetOptions(
|
||||
"V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"p|packets=i" => \$opt_p,
|
||||
"c|critical=s" => \$opt_c,
|
||||
"w|warning=s" => \$opt_w,
|
||||
"H|hostname=s" => \$opt_H
|
||||
);
|
||||
|
||||
|
||||
# appletalk hostname ot address
|
||||
$opt_H = shift unless ($opt_H);
|
||||
unless ($opt_H) { print_usage (); exit $ERRORS{'UNKNOWN'}; }
|
||||
if ( $opt_H && $opt_H =~ m/^([-a-zA-Z\.\:0-9]+)$/ ) {
|
||||
$host = $1;
|
||||
}
|
||||
else {
|
||||
print "$opt_H is not a valid host name\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
# number of packets
|
||||
$opt_p = 5 unless $opt_p;
|
||||
if ( $opt_p && $opt_p =~ m/^([1-9]+[0-9]*)$/ ) {
|
||||
$count = $1;
|
||||
}
|
||||
else {
|
||||
print "$opt_p is not a valid packet number\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ( $opt_w && $opt_w =~ m/^([1-9]+[0-9]*),([1-9][0-9]*)%$/ ) {
|
||||
$warning_avg = $1;
|
||||
$warning_loss = $2;
|
||||
}
|
||||
else {
|
||||
print "$opt_w is not a valid threshold\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ( $opt_c && $opt_c =~ m/^([1-9]+[0-9]*),([1-9][0-9]*)%$/ ) {
|
||||
$critical_avg = $1;
|
||||
$critical_loss = $2;
|
||||
}
|
||||
else {
|
||||
print "$opt_c is not a valid threshold\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
$cmd = "/usr/bin/aecho -c $count $host 2>&1 |";
|
||||
print "$cmd\n" if ($verbose);
|
||||
open CMD, $cmd;
|
||||
|
||||
while (<CMD>) {
|
||||
print $_ if ($verbose);
|
||||
$line = $_;
|
||||
|
||||
# 5 packets sent, 5 packets received, 0% packet loss
|
||||
# round-trip (ms) min/avg/max = 0/0/0
|
||||
|
||||
if (/received, ([0-9]+)% packet loss/) {
|
||||
$loss = $1;
|
||||
}
|
||||
if (/min\/avg\/max = [0-9]+\/([0-9]+)\/[0-9]+/) {
|
||||
$avg = $1;
|
||||
}
|
||||
}
|
||||
|
||||
sub print_help() {
|
||||
print_revision( $PROGNAME, '$Revision: 1.1 $ ' );
|
||||
print "Copyright (c) 2002 Stefan Beck\n";
|
||||
print "\n";
|
||||
print "Check if an atalkhost responds to an atalk echo using\n";
|
||||
print " aecho -c <packets> <atalkhost>\n";
|
||||
print "\n";
|
||||
print_usage ();
|
||||
print "\n";
|
||||
print "-H, --hostname=HOST\n";
|
||||
print " host to ping\n";
|
||||
print "-w, --warning=THRESHOLD\n";
|
||||
print " warning threshold pair\n";
|
||||
print "-c, --critical=THRESHOLD\n";
|
||||
print " critical threshold pair\n";
|
||||
print "-p, --packets=INTEGER\n";
|
||||
print " number of ICMP ECHO packets to send (Default: 5)\n";
|
||||
print "\n";
|
||||
print
|
||||
"THRESHOLD is <rta>,<pl>% where <rta> is the round trip average
|
||||
travel\n";
|
||||
print
|
||||
"time (ms) which triggers a WARNING or CRITICAL state, and <pl>
|
||||
is the\n";
|
||||
print "percentage of packet loss to trigger an alarm state.\n";
|
||||
print "\n";
|
||||
|
||||
support();
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "$PROGNAME -H atalkhost -w <wrta>,<wpl>% -c <crta>,<cpl>%\n";
|
||||
print " [-p packets] [-t timeout] [-L]\n";
|
||||
print "$PROGNAME [-h | --help]\n";
|
||||
print "$PROGNAME [-V | --version]\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision( $PROGNAME, '$Revision: 1.1 $ ' );
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help ();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
my $state = "OK";
|
||||
my $answer = undef;
|
||||
|
||||
if ( defined $loss && defined $avg ) {
|
||||
if ( $loss >= $critical_loss ) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ( $avg >= $critical_avg ) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ( $loss >= $warning_loss ) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
elsif ( $avg >= $warning_avg ) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
else {
|
||||
$state = "OK";
|
||||
}
|
||||
$answer = "Appletalk PING $state - Packet loss = $loss%, RTA = $avg
|
||||
ms\n";
|
||||
}
|
||||
else {
|
||||
$state = "UNKNOWN";
|
||||
$answer = "UNKNOWN - $line";
|
||||
}
|
||||
print $answer;
|
||||
exit $ERRORS{$state};
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
This sf.net email is sponsored by:ThinkGeek
|
||||
Welcome to geek heaven.
|
||||
http://thinkgeek.com/sf
|
||||
_______________________________________________
|
||||
Nagios-devel mailing list
|
||||
Nagios-devel@lists.sourceforge.net
|
||||
https://lists.sourceforge.net/lists/listinfo/nagios-devel
|
120
contrib/check_arping.pl
Normal file
120
contrib/check_arping.pl
Normal file
|
@ -0,0 +1,120 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# check_arping.pl - Nagios plugin to check host status via ARP ping
|
||||
#
|
||||
# usage:
|
||||
# check_arping -H hostname -I interface -T timeout
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2003 Kenny Root
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# Report bugs to: kenny@the-b.org, nagiosplug-help@lists.sf.net
|
||||
|
||||
use POSIX;
|
||||
use strict;
|
||||
use lib "/usr/lib/nagios/plugins" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
use Net::Arping;
|
||||
use Getopt::Long;
|
||||
|
||||
my $PROGNAME = "check_arping";
|
||||
|
||||
my($status, $state, $answer);
|
||||
my($opt_V, $opt_h, $opt_t, $opt_I, $opt_H);
|
||||
|
||||
|
||||
#Option checking
|
||||
$status = GetOptions(
|
||||
"V|version" => \$opt_V,
|
||||
"help" => \$opt_h,
|
||||
"I|interface=s" => \$opt_I,
|
||||
"H|host=s" => \$opt_H,
|
||||
"t|timeout=i" => \$opt_t);
|
||||
|
||||
if ($status == 0)
|
||||
{
|
||||
print_help() ;
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_t) {
|
||||
if ($opt_t ne int($opt_t)) {
|
||||
print "Timeout not in seconds!\n";
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
$opt_t = int($opt_t);
|
||||
} else {
|
||||
$opt_t = 3;
|
||||
}
|
||||
|
||||
if (! utils::is_hostname($opt_H)){
|
||||
usage();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
my $ping = Net::Arping->new();
|
||||
|
||||
my $reply = $ping->arping(Host => $opt_H, Interface => $opt_I, Timeout => $opt_t);
|
||||
|
||||
if ($reply eq "0") {
|
||||
$state = "CRITICAL";
|
||||
print "$state: no reply from $opt_H on interface $opt_I in $opt_t seconds.\n";
|
||||
exit $ERRORS{$state};
|
||||
} else {
|
||||
$state = "OK";
|
||||
$answer = "replied with MAC address $reply";
|
||||
}
|
||||
|
||||
print "ARPING $state - $answer\n";
|
||||
exit $ERRORS{$state};
|
||||
|
||||
|
||||
sub usage {
|
||||
print "\nMissing arguments!\n";
|
||||
print "\n";
|
||||
print "check_arping -I <interface> -H <host IP> [-t <timeout>]\n";
|
||||
print "\n\n";
|
||||
support();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
sub print_help {
|
||||
print "check_arping pings hosts that normally wouldn't allow\n";
|
||||
print "ICMP packets but are still on the local network.\n";
|
||||
print "\nUsage:\n";
|
||||
print " -H (--host) IP to query - (required)\n";
|
||||
print " -I (--interface) Interface to use.\n";
|
||||
print " -t (--timeout) Timeout in seconds.\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help \n\n";
|
||||
print_revision($PROGNAME, '$Revision: 1.1 $');
|
||||
|
||||
}
|
259
contrib/check_asterisk.pl
Normal file
259
contrib/check_asterisk.pl
Normal file
|
@ -0,0 +1,259 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
use Getopt::Long;
|
||||
$|=1;
|
||||
|
||||
my (
|
||||
$host, $username, $password, $verbose, $help, $command, $mode,
|
||||
$ipaddr, $respaddr, $sendto, $msg, $recvfrom,
|
||||
$version, $response, $message, $line,
|
||||
$sock, $port, $reply,
|
||||
$warning, $critical,
|
||||
%warnval, %critval,
|
||||
%channels,
|
||||
$runmode,
|
||||
$key,
|
||||
$s,
|
||||
);
|
||||
my $stop = 0;
|
||||
my $mgr_port = 5038;
|
||||
my $iax_port = 4569;
|
||||
my $exitcode = 0;
|
||||
my $cause = "";
|
||||
|
||||
my $iax_answer = 0;
|
||||
my $iax_maxlen = 1024;
|
||||
my $iax_timeout = 5;
|
||||
my $iax_src_call = "8000"; #8000 most siginificant bit is IAX packet type full ... required for a poke etc...
|
||||
my $iax_dst_call = "0000";
|
||||
my $iax_timestamp = "00000000";
|
||||
my $iax_outbound_seq = "00";
|
||||
my $iax_inbound_seq = "00";
|
||||
my $iax_type = "06"; #IAX_Control
|
||||
|
||||
sub ok {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "OK: $s\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sub warning {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "WARNING: $s\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub error {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "ERROR: $s\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
sub unknown {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "UNKNOWN: $s\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
sub syntax {
|
||||
$s = shift;
|
||||
unless ($s =~ m/Help:/) {
|
||||
$s = "Error: (".$s.")" or $s = 'Unknown';
|
||||
}
|
||||
print "$s\n" unless ($help);
|
||||
print "Syntax: $0 -m mgr -h <host> -u <username> -p <password> [-cwv]\n";
|
||||
print "Syntax: $0 -m iax -h <host> [-v]\n";
|
||||
print "* --host -h Host\n";
|
||||
print "* --mode -m Mode - eithr 'mgr' or 'iax'\n";
|
||||
print " --username -u Username\n";
|
||||
print " --password -p Password\n";
|
||||
print " --port -P n Port (if not using $mgr_port for manager or $iax_port for IAX)\n";
|
||||
print " --warning xxx=n Return warning if > n channels of type xxx.\n";
|
||||
print " --critical xxx=n Return critical if > n channels of type xxx.\n";
|
||||
print " --verbose -v Verbose\n";
|
||||
print " --help -h This help\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("p=s" => \$password, "password=s" => \$password,
|
||||
"u=s" => \$username, "username=s" => \$username,
|
||||
"h=s" => \$host, "host=s" => \$host,
|
||||
"P=i" => \$port, "port=i" => \$port,
|
||||
"H" => \$help, "help" => \$help,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"m=s" => \$mode, "mode=s" => \$mode,
|
||||
"critical=s" => \$critical, "warning=s" => \$warning);
|
||||
|
||||
syntax("Help:") if ($help);
|
||||
syntax("Missing host") unless (defined($host));
|
||||
syntax("Missing mode") unless (defined($mode));
|
||||
if ($mode =~ /^iax$/i) {
|
||||
print "Running in IAX mode\n" if ($verbose);
|
||||
$runmode = 1;
|
||||
} elsif ($mode =~ /^mgr$/i) {
|
||||
print "Running in Manager mode\n" if ($verbose);
|
||||
$runmode = 2;
|
||||
} else {
|
||||
syntax("Unknown mode $mode")
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
if ($runmode == 2) {
|
||||
$port = $mgr_port;
|
||||
syntax("Missing username") unless (defined($username));
|
||||
syntax("Missing password") unless (defined($password));
|
||||
if (defined($warning)) {
|
||||
foreach $s (split(/,/, $warning)) {
|
||||
syntax("Warning value given, $s, is invalid")
|
||||
unless ($s =~ /^(\w+)=(\d+)$/);
|
||||
$warnval{$1} = $2;
|
||||
print "Clear to give WARNING after $2 connections on $1\n" if ($verbose);
|
||||
}
|
||||
}
|
||||
if (defined($critical)) {
|
||||
foreach $s (split(/,/, $critical)) {
|
||||
syntax("Critical value given, $s, is invalid")
|
||||
unless ($s =~ /^(\w+)=(\d+)$/);
|
||||
$critval{$1} = $2;
|
||||
print "Clear to give CRITICAL after $2 connections on $1\n" if ($verbose);
|
||||
}
|
||||
}
|
||||
|
||||
print "Connecting to $host:$port\n" if ($verbose);
|
||||
unless ($sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, Proto => 'tcp')) {
|
||||
print("Could not connect to asterisk server ".$host.":".$port."\n");
|
||||
exit(2);
|
||||
}
|
||||
print "Connected to $host:$port\n" if ($verbose);
|
||||
$version = <$sock>;
|
||||
print $version if ($verbose);
|
||||
|
||||
print $sock "Action: Login\r\nUsername: $username\r\nSecret: $password\r\nEvents: off\r\n\r\n";
|
||||
print "Action: Login\r\nUsername: $username\r\nSecret: $password\r\n\r\n" if ($verbose);
|
||||
$response = <$sock>;
|
||||
$message = <$sock>;
|
||||
$s = <$sock>;
|
||||
print $response.$message if ($verbose);
|
||||
print $s if ($verbose);
|
||||
|
||||
exit(1) unless ($response =~ m/^Response:\s+(.*)$/i);
|
||||
exit(1) unless ($1 =~ m/Success/i);
|
||||
|
||||
print $sock "Action: Status\r\n\r\n";
|
||||
print "Action: Status\r\n\r\n" if ($verbose);
|
||||
|
||||
$response = <$sock>;
|
||||
$message = <$sock>;
|
||||
print $response.$message if ($verbose);
|
||||
|
||||
&unknown("Unknown answer $response (wanted Response: something)") unless ($response =~ m/^Response:\s+(.*)$/i);
|
||||
&unknown("$response didn't say Success") unless ($1 =~ m/Success/i);
|
||||
&unknown("Unknown answer $response (wanted Message: something)") unless ($message =~ m/^Message:\s+(.*)$/i);
|
||||
&unknown("didn't understand message $message") unless ($1 =~ m/Channel status will follow/i);
|
||||
|
||||
$stop=0;
|
||||
while (($stop == 0) && ($line = <$sock>)) {
|
||||
print "$line" if ($verbose);
|
||||
if ($line =~ m/Channel:\s+(\w+)\//) {
|
||||
$channels{$1}++;
|
||||
print "Found $1 channel\n" if ($verbose);
|
||||
}
|
||||
if ($line =~ m/Event:\s*StatusComplete/i) {
|
||||
$stop++;
|
||||
}
|
||||
}
|
||||
|
||||
# Log out
|
||||
print $sock "Action: Logoff\r\n\r\n";
|
||||
|
||||
undef($s);
|
||||
foreach $key (keys %channels) {
|
||||
$s .= " " . $key . " (" . $channels{$key} . ")";
|
||||
}
|
||||
|
||||
foreach $key (keys %critval) {
|
||||
print "key = $key\n" if ($verbose);
|
||||
if (defined($channels{$key}) && ($channels{$key} > $critval{$key})) {
|
||||
$exitcode = 2;
|
||||
$cause .= $channels{$key} . " $key channels detected. ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($exitcode < 2) {
|
||||
foreach $key (keys %warnval) {
|
||||
print "key = $key\n" if ($verbose);
|
||||
if (defined($channels{$key}) && ($channels{$key} > $warnval{$key})) {
|
||||
$exitcode = 1;
|
||||
$cause .= $channels{$key} . " $key channels detected. ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($exitcode == 0) {
|
||||
print "OK ";
|
||||
} elsif ($exitcode == 1) {
|
||||
print "WARNING ";
|
||||
} elsif ($exitcode == 2) {
|
||||
print "CRITICAL ";
|
||||
} elsif ($exitcode > 2) {
|
||||
print "UNKNOWN ";
|
||||
}
|
||||
if (defined($s)) {
|
||||
$cause .= " Channels:$s";
|
||||
} else {
|
||||
$cause .= " (idle)";
|
||||
}
|
||||
|
||||
print $cause;
|
||||
|
||||
print "\n" if ($verbose);
|
||||
|
||||
exit($exitcode);
|
||||
} elsif ($runmode == 1) {
|
||||
$port = $iax_port;
|
||||
|
||||
socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp"));
|
||||
|
||||
$msg = pack "H24", $iax_src_call . $iax_dst_call . $iax_timestamp .
|
||||
$iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_type;
|
||||
|
||||
$ipaddr = inet_aton($host);
|
||||
$sendto = sockaddr_in($port,$ipaddr);
|
||||
|
||||
send(PING, $msg, 0, $sendto) == length($msg) or die "cannot send to $host : $port : $!\n";
|
||||
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die("alarm time out"); };
|
||||
alarm $iax_timeout;
|
||||
|
||||
while (1) {
|
||||
$recvfrom = recv(PING, $msg, $iax_maxlen, 0) or die "recv: $!";
|
||||
($port, $ipaddr) = sockaddr_in($recvfrom);
|
||||
$respaddr = inet_ntoa($ipaddr);
|
||||
$iax_answer++;
|
||||
# print "Response from $respaddr : $port\n";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if ($iax_answer) {
|
||||
if ($iax_answer == 1) {
|
||||
$reply = "reply";
|
||||
} else {
|
||||
$reply = "replies";
|
||||
}
|
||||
&ok("Got $iax_answer $reply");
|
||||
} else {
|
||||
&error("Got no reply");
|
||||
}
|
||||
}
|
||||
|
93
contrib/check_axis.sh
Normal file
93
contrib/check_axis.sh
Normal file
|
@ -0,0 +1,93 @@
|
|||
#!/bin/sh
|
||||
|
||||
box=$1
|
||||
port=$2
|
||||
usr=$3
|
||||
pass=$4
|
||||
|
||||
if [ ! "$#" == "4" ]; then
|
||||
echo -e "\nYou did not supply enough command line arguments. \nUsage: ./check_axis.sh <host> <port> <username> <password> \n \nCheck_axis.sh checks the status of LPT ports on Axis print servers. \nIt was written by Tom De Blende (tom.deblende@village.uunet.be) in 2002. \n" && exit "3"
|
||||
fi
|
||||
|
||||
tempfile=/tmp/status-$box.tmp
|
||||
exit="3"
|
||||
|
||||
ftp -in $box &>/dev/null <<EOF
|
||||
user $usr $pass
|
||||
passive
|
||||
prompt off
|
||||
lcd /tmp
|
||||
ascii
|
||||
get status $tempfile
|
||||
EOF
|
||||
|
||||
if [ ! -e "$tempfile" ]; then
|
||||
stdio="Status file could not be transferred from the Axis box." && rm -f $tempfile && echo $stdio && exit 2;
|
||||
fi
|
||||
|
||||
lines=`cat $tempfile | grep -i $port`
|
||||
status=`echo $lines | awk '{ print $3 }'`
|
||||
if [ "$status" == "Printing" ]; then
|
||||
bytes=`echo $lines | awk '{ print $4 }'`;
|
||||
comments=`echo $lines | tr -d "
" | awk '{ print $5 " " $6 }'`;
|
||||
else
|
||||
comments=`echo $lines | tr -d "
" | awk '{ print $4 " " $5 }'`;
|
||||
fi
|
||||
|
||||
comma=`echo $comments | grep , | wc -l`
|
||||
if [ "$comma" -eq "1" ]; then
|
||||
comments=`echo $comments | cut -d, -f1`
|
||||
fi
|
||||
|
||||
|
||||
if [ "$status" == "Available" ]; then
|
||||
if [ "$comments" == "Paper out" ]; then
|
||||
exit="1" && stdio="WARNING - Out of paper.";
|
||||
elif [ "$comments" == " " ]; then
|
||||
exit="0" && stdio="OK - Printer is available but returns no comments.";
|
||||
elif [ "$comments" == "No error" ]; then
|
||||
exit="0" && stdio="OK - No error.";
|
||||
elif [ "$comments" == "Ready " ]; then
|
||||
exit="0" && stdio="OK - Ready.";
|
||||
elif [ "$comments" == "Off line" ]; then
|
||||
exit="1" && stdio="WARNING - Printer is off line.";
|
||||
elif [ "$comments" == "Out of" ]; then
|
||||
exit="1" && stdio="WARNING - Out of paper.";
|
||||
elif [ "$comments" == "Busy Out" ]; then
|
||||
exit="1" && stdio="WARNING - Busy, out of paper.";
|
||||
elif [ "$comments" == "Printer off-line" ]; then
|
||||
exit="1" && stdio="WARNING - Printer is off line.";
|
||||
elif [ "$comments" == "Printer fault" ]; then
|
||||
exit="2" && stdio="CRITICAL - Printer fault.";
|
||||
else
|
||||
exit="3" && stdio="Comments: $comments";
|
||||
fi
|
||||
elif [ "$status" == "Printing" ]; then
|
||||
if [ "$comments" == "Printer busy" ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "No error" ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Paper out" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Out of paper.";
|
||||
elif [ "$comments" == "Out of" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Out of paper. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Busy Out" ]; then
|
||||
exit="1" && stdio="WARNING - Busy, out of paper.";
|
||||
elif [ "$comments" == "Ready " ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Printer off-line" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Printer is off line.";
|
||||
elif [ "$comments" == "Busy " ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Busy. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Off line" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Printer is off line.";
|
||||
elif [ "$comments" == "Printer fault" ]; then
|
||||
exit="2" && stdio="CRITICAL - PRINTING. Printer fault. Bytes printed: $bytes.";
|
||||
else
|
||||
exit="3" && stdio="Comments: $comments.";
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f $tempfile
|
||||
echo $stdio
|
||||
exit $exit
|
114
contrib/check_backup.pl
Normal file
114
contrib/check_backup.pl
Normal file
|
@ -0,0 +1,114 @@
|
|||
#! /usr/bin/perl -wT
|
||||
|
||||
# (c)2001 Patrick Greenwell, Stealthgeeks, LLC. (patrick@stealthgeeks.net)
|
||||
# Licensed under the GNU GPL
|
||||
# http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
# check_backup: Checks a directory to see if at least one file was
|
||||
# created within a specified period of time that is of equal to or greater
|
||||
# than a given size.
|
||||
|
||||
# Version 1.0
|
||||
# Last Updated: 9/12/01
|
||||
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
require 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_H $opt_d $opt_s $opt_t $verbose $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support &is_error);
|
||||
|
||||
sub help ();
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub version ();
|
||||
sub display_res($$);
|
||||
my ($filesize, $answer) = ();
|
||||
my $state = $ERRORS{'UNKNOWN'};
|
||||
|
||||
# Directory to check.
|
||||
my $dir = "/backup/";
|
||||
|
||||
# Time period(in seconds)
|
||||
my $within = "3600";
|
||||
|
||||
# Minimum size of file (in bytes)
|
||||
my $minsize = "40000000";
|
||||
|
||||
delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$verbose,
|
||||
"d|directory=s" => \$opt_d,
|
||||
"s|minsize=s" => \$opt_s,
|
||||
"t|timeout=s" => \$opt_t,
|
||||
);
|
||||
|
||||
($opt_s) || ($opt_s = shift) || usage("Minimum File size not specified\n");
|
||||
usage("File size must be numeric value") unless ($opt_s =~ m/^[0-9]+$/);
|
||||
|
||||
(($opt_t) && ($TIMEOUT = $opt_t)) || ($TIMEOUT = 120);
|
||||
usage("TIMEOUT must be numeric value") unless ($TIMEOUT =~ m/^[0-9]+$/);
|
||||
|
||||
# Don't hang if there are timeout issues
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from ftp server (alarm)\n");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
# Do stuff
|
||||
|
||||
my $time = time;
|
||||
|
||||
opendir(THISDIR, "$dir") or die "Can't open directory! $!";
|
||||
my @allfiles = grep !/^\./, readdir THISDIR;
|
||||
closedir THISDIR;
|
||||
while (my $file = $dir . pop @allfiles){
|
||||
my ($size, $mtime) = (stat($file))[7,9];
|
||||
if (((my $a = ($time - $mtime)) <= $within) and ($size >= $opt_s)){
|
||||
display_res("OK: File $file is <= $within and >=$opt_s bytes.\n","OK");
|
||||
}
|
||||
}
|
||||
|
||||
# If we got here nothing matched....
|
||||
display_res("CRITICAL: No files in $dir are <= $within and >= $minsize.", "CRITICAL");
|
||||
|
||||
exit;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -s <minimum file size in bytes> -t <timeout> \n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$ Revision: 1.0 $ ');
|
||||
print_usage();
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$ Revision: 1.0 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub display_res ($$) {
|
||||
my ($answer, $state) = @_;
|
||||
print $answer;
|
||||
exit $ERRORS{$state};
|
||||
}
|
215
contrib/check_bgpstate.pl
Normal file
215
contrib/check_bgpstate.pl
Normal file
|
@ -0,0 +1,215 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_bgpstate.pl - nagios plugin
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# Report bugs to: ck@zet.net
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
# whois programm for RIPE database queries
|
||||
my $whois = '/usr/bin/whois';
|
||||
my $status;
|
||||
my $TIMEOUT = 30;
|
||||
|
||||
# critical bgp sessions
|
||||
my %uplinks = ( 1273, 'Uplink ECRC',
|
||||
1755, 'Uplink EBONE',
|
||||
3300, 'Uplink AUCS'
|
||||
);
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
my %bgpPeerState = (
|
||||
'1',"idle",
|
||||
'2',"connect",
|
||||
'3',"active",
|
||||
'4',"opensent",
|
||||
'5',"openconfirm",
|
||||
'6',"established"
|
||||
);
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
my $snmpbgpPeerState = '1.3.6.1.2.1.15.3.1.2';
|
||||
my $snmpbgpPeerLocalAddr = '1.3.6.1.2.1.15.3.1.5';
|
||||
my $snmpbgpPeerRemoteAddr = '1.3.6.1.2.1.15.3.1.7';
|
||||
my $snmpbgpPeerRemoteAs = '1.3.6.1.2.1.15.3.1.9';
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %bgpStatus;
|
||||
my $bgpestablished =0 ;
|
||||
my $bgpcritical =0;
|
||||
my $bgpdown =0;
|
||||
my $bgpidle =0;
|
||||
my $bgpmessage;
|
||||
my $asname;
|
||||
my $remoteas;
|
||||
my @output;
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl bgpstate plugin for Nagios\n";
|
||||
printf "monitors all BGP sessions\n";
|
||||
printf "usage: \n";
|
||||
printf "check_bgpstate.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>\n";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_bgpstate.pl comes with ABSOLUTELY NO WARRANTY\n";
|
||||
printf "This programm is licensed under the terms of the ";
|
||||
printf "GNU General Public License\n(check source code for details)\n";
|
||||
printf "\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No snmp response from $hostname (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
push(@snmpoids, $snmpbgpPeerState);
|
||||
push(@snmpoids, $snmpbgpPeerLocalAddr);
|
||||
push(@snmpoids, $snmpbgpPeerRemoteAddr);
|
||||
push(@snmpoids, $snmpbgpPeerRemoteAs);
|
||||
|
||||
foreach $snmpoid (@snmpoids) {
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_table($snmpoid))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$snmpkey");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
foreach $snmpkey (keys %{$response}) {
|
||||
$snmpkey =~ m/.*\.(\d+\.\d+\.\d+\.\d+$)/;
|
||||
$key = $1;
|
||||
# printf "debug: $snmpkey: $key -> $response->{$snmpkey}\n";
|
||||
$bgpStatus{$key}{$snmpoid} = $response->{$snmpkey};
|
||||
}
|
||||
$session->close;
|
||||
}
|
||||
|
||||
foreach $key (keys %bgpStatus) {
|
||||
if ($bgpStatus{$key}{$snmpbgpPeerState} == 6 ) {
|
||||
$bgpestablished++;
|
||||
}
|
||||
elsif ($bgpStatus{$key}{$snmpbgpPeerState} == 1 ) {
|
||||
$bgpidle++;
|
||||
}
|
||||
else {
|
||||
$bgpdown++ ;
|
||||
if (exists($uplinks{$bgpStatus{$key}{$snmpbgpPeerRemoteAs}}) ) {
|
||||
$bgpcritical++;
|
||||
}
|
||||
@output = `$whois -T aut-num AS$bgpStatus{$key}{$snmpbgpPeerRemoteAs}`;
|
||||
|
||||
$asname = "";
|
||||
foreach (@output) {
|
||||
if (m/as-name/) {
|
||||
$asname = $_;
|
||||
$asname =~ s/as-name://;
|
||||
last;
|
||||
}
|
||||
if ( $asname =~ "" && m/descr/ ) {
|
||||
$asname = $_;
|
||||
$asname =~ s/descr://;
|
||||
}
|
||||
}
|
||||
$asname =~ s/^\s*//;
|
||||
$asname =~ s/\s*$//;
|
||||
$bgpmessage .= sprintf("Peering with AS%s not established -> %s<BR>",
|
||||
$bgpStatus{$key}{$snmpbgpPeerRemoteAs},
|
||||
$asname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($bgpdown > 0) {
|
||||
if ($bgpcritical > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
else {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
$answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d<BR>",
|
||||
$hostname,
|
||||
$bgpestablished,
|
||||
$bgpdown, $bgpidle);
|
||||
$answer = $answer . $bgpmessage . "\n";
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
$answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d\n",
|
||||
$hostname,
|
||||
$bgpestablished,
|
||||
$bgpdown,$bgpidle);
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
22
contrib/check_breeze.pl
Normal file
22
contrib/check_breeze.pl
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Plugin to test signal strength on Breezecom wireless equipment
|
||||
# Contributed by Jeffrey Blank
|
||||
|
||||
$Host=$ARGV[0];
|
||||
$sig_crit=$ARGV[1];
|
||||
$sig_warn=$ARGV[2];
|
||||
$sig=0;
|
||||
$sig = `snmpget $Host public .1.3.6.1.4.1.710.3.2.3.1.3.0`;
|
||||
@test=split(/ /,$sig);
|
||||
$sig=@test[2];
|
||||
$sig=int($sig);
|
||||
if ($sig>100){$sig=100}
|
||||
|
||||
print "Signal Strength at: $sig%\n";
|
||||
if ($sig<$sig_crit)
|
||||
{exit(2)}
|
||||
if ($sig<$sig_warn)
|
||||
{exit(1)}
|
||||
|
||||
exit(0);
|
332
contrib/check_cluster.c
Normal file
332
contrib/check_cluster.c
Normal file
|
@ -0,0 +1,332 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* CHECK_CLUSTER.C - Host and Service Cluster Plugin for NetSaint
|
||||
*
|
||||
* Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)
|
||||
* License: GPL
|
||||
* Last Modified: 07-08-2000
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CHECK_SERVICES 1
|
||||
#define CHECK_HOSTS 2
|
||||
|
||||
#define MAX_INPUT_BUFFER 1024
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3
|
||||
|
||||
typedef struct clustermember_struct{
|
||||
char *host_name;
|
||||
char *svc_description;
|
||||
struct clustermember_struct *next;
|
||||
}clustermember;
|
||||
|
||||
|
||||
int check_cluster_status(void);
|
||||
int add_clustermember(char *,char *);
|
||||
void free_memory(void);
|
||||
|
||||
clustermember *clustermember_list=NULL;
|
||||
|
||||
int total_services_ok=0;
|
||||
int total_services_warning=0;
|
||||
int total_services_unknown=0;
|
||||
int total_services_critical=0;
|
||||
|
||||
int total_hosts_up=0;
|
||||
int total_hosts_down=0;
|
||||
int total_hosts_unreachable=0;
|
||||
|
||||
char status_log[MAX_INPUT_BUFFER]="";
|
||||
int warning_threshold=0;
|
||||
int critical_threshold=0;
|
||||
|
||||
int check_type=CHECK_SERVICES;
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *host_name;
|
||||
char *svc_description;
|
||||
int return_code=STATE_OK;
|
||||
int error=FALSE;
|
||||
|
||||
if(argc!=5){
|
||||
|
||||
printf("Invalid arguments supplied\n");
|
||||
printf("\n");
|
||||
|
||||
printf("Host/Service Cluster Plugin for NetSaint\n");
|
||||
printf("Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)\n");
|
||||
printf("Last Modified: 07-08-2000\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <--service | --host> <status_log> <warn_threshold> <crit_threshold>\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" --service = Check service cluster status\n");
|
||||
printf(" --host = Check host cluster status\n");
|
||||
printf(" <status_log> = This is the location of the NetSaint status log\n");
|
||||
printf(" <warn_threshold> = This is the number of hosts or services in\n");
|
||||
printf(" the cluster that must be in a non-OK state\n");
|
||||
printf(" in order to result in a warning status level\n");
|
||||
printf(" <crit_threshold> = This is the number of hosts or services in\n");
|
||||
printf(" the cluster that must be in a non-OK state\n");
|
||||
printf(" in order to result in a critical status level\n");
|
||||
printf("\n");
|
||||
printf("Notes:\n");
|
||||
printf("Members of the host or service cluster are read from STDIN.\n");
|
||||
printf("One host or service can be specified per line, services must\n");
|
||||
printf("be in the format of <host_name>;<svc_description>\n");
|
||||
printf("\n");
|
||||
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* see if we're checking a host or service clust */
|
||||
if(!strcmp(argv[1],"--host"))
|
||||
check_type=CHECK_HOSTS;
|
||||
else
|
||||
check_type=CHECK_SERVICES;
|
||||
|
||||
/* get the status log */
|
||||
strncpy(status_log,argv[2],sizeof(status_log)-1);
|
||||
status_log[sizeof(status_log)-1]='\x0';
|
||||
|
||||
/* get the warning and critical thresholds */
|
||||
warning_threshold=atoi(argv[3]);
|
||||
critical_threshold=atoi(argv[4]);
|
||||
|
||||
|
||||
/* read all data from STDIN until there isn't anymore */
|
||||
while(fgets(input_buffer,sizeof(input_buffer)-1,stdin)){
|
||||
|
||||
if(feof(stdin))
|
||||
break;
|
||||
|
||||
/*strip(input_buffer);*/
|
||||
|
||||
if(!strcmp(input_buffer,""))
|
||||
continue;
|
||||
|
||||
if(!strcmp(input_buffer,"\n"))
|
||||
continue;
|
||||
|
||||
/* get the host name */
|
||||
if(check_type==CHECK_SERVICES)
|
||||
host_name=(char *)strtok(input_buffer,";");
|
||||
else
|
||||
host_name=(char *)strtok(input_buffer,"\n");
|
||||
if(host_name==NULL || !strcmp(host_name,"")){
|
||||
printf("Error: Host name is NULL!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
|
||||
/* get the service description */
|
||||
svc_description=(char *)strtok(NULL,"\n");
|
||||
if(svc_description==NULL || !strcmp(svc_description,"")){
|
||||
printf("Error: Service description is NULL!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* add the cluster member to the list in memory */
|
||||
if(add_clustermember(host_name,svc_description)!=OK)
|
||||
printf("Error: Could not add cluster member\n");
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("Added cluster member\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* check the status of the cluster */
|
||||
if(check_cluster_status()==OK){
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
if((total_services_warning+total_services_unknown+total_services_critical) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_services_warning+total_services_unknown+total_services_critical) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
|
||||
printf("Service cluster %s: %d ok, %d warning, %d unknown, %d critical\n",(return_code==STATE_OK)?"ok":"problem",total_services_ok,total_services_warning,total_services_unknown,total_services_critical);
|
||||
}
|
||||
else{
|
||||
if((total_hosts_down+total_hosts_unreachable) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_hosts_down+total_hosts_unreachable) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
|
||||
printf("Host cluster %s: %d up, %d down, %d unreachable\n",(return_code==STATE_OK)?"ok":"problem",total_hosts_up,total_hosts_down,total_hosts_unreachable);
|
||||
}
|
||||
}
|
||||
else
|
||||
return_code=STATE_UNKNOWN;
|
||||
|
||||
free_memory();
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int add_clustermember(char *hst,char *svc){
|
||||
clustermember *new_clustermember;
|
||||
|
||||
new_clustermember=(clustermember *)malloc(sizeof(clustermember));
|
||||
if(new_clustermember==NULL)
|
||||
return ERROR;
|
||||
|
||||
new_clustermember->host_name=NULL;
|
||||
new_clustermember->svc_description=NULL;
|
||||
|
||||
if(hst!=NULL){
|
||||
new_clustermember->host_name=(char *)malloc(strlen(hst)+1);
|
||||
if(new_clustermember->host_name==NULL){
|
||||
free(new_clustermember);
|
||||
return ERROR;
|
||||
}
|
||||
strcpy(new_clustermember->host_name,hst);
|
||||
}
|
||||
|
||||
if(svc!=NULL){
|
||||
new_clustermember->svc_description=(char *)malloc(strlen(svc)+1);
|
||||
if(new_clustermember->svc_description==NULL){
|
||||
if(new_clustermember->host_name!=NULL)
|
||||
free(new_clustermember->host_name);
|
||||
free(new_clustermember);
|
||||
return ERROR;
|
||||
}
|
||||
strcpy(new_clustermember->svc_description,svc);
|
||||
}
|
||||
|
||||
new_clustermember->next=clustermember_list;
|
||||
clustermember_list=new_clustermember;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void free_memory(void){
|
||||
clustermember *this_clustermember;
|
||||
clustermember *next_clustermember;
|
||||
|
||||
for(this_clustermember=clustermember_list;this_clustermember!=NULL;this_clustermember=next_clustermember){
|
||||
next_clustermember=this_clustermember->next;
|
||||
if(this_clustermember->host_name!=NULL)
|
||||
free(this_clustermember->host_name);
|
||||
if(this_clustermember->svc_description!=NULL)
|
||||
free(this_clustermember->svc_description);
|
||||
free(this_clustermember);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int check_cluster_status(void){
|
||||
FILE *fp;
|
||||
clustermember *temp_clustermember;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char matching_entry[MAX_INPUT_BUFFER];
|
||||
|
||||
fp=fopen(status_log,"r");
|
||||
if(fp==NULL){
|
||||
printf("Error: Could not open status log '%s' for reading\n",status_log);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
if(check_type==CHECK_HOSTS)
|
||||
printf("Cluster member: '%s'\n",temp_clustermember->host_name);
|
||||
else
|
||||
printf("Cluster member: '%s'/'%s'\n",temp_clustermember->host_name,temp_clustermember->svc_description);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp);!feof(fp);fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
|
||||
/* this is a host entry */
|
||||
if(strstr(input_buffer,"] HOST;") && check_type==CHECK_HOSTS){
|
||||
|
||||
/* this this a match? */
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
|
||||
snprintf(matching_entry,sizeof(matching_entry)-1,";%s;",temp_clustermember->host_name);
|
||||
|
||||
if(strstr(input_buffer,matching_entry)){
|
||||
if(strstr(input_buffer,";DOWN;"))
|
||||
total_hosts_down++;
|
||||
else if(strstr(input_buffer,";UNREACHABLE;"))
|
||||
total_hosts_unreachable++;
|
||||
else if(strstr(input_buffer,";UP;"))
|
||||
total_hosts_up++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* this is a service entry */
|
||||
else if(strstr(input_buffer,"] SERVICE;") && check_type==CHECK_SERVICES){
|
||||
|
||||
/* this this a match? */
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
|
||||
snprintf(matching_entry,sizeof(matching_entry)-1,";%s;%s;",temp_clustermember->host_name,temp_clustermember->svc_description);
|
||||
|
||||
if(strstr(input_buffer,matching_entry)){
|
||||
if(strstr(input_buffer,";HOST DOWN;") || strstr(input_buffer,";UNREACHABLE;") || strstr(input_buffer,";CRITICAL;"))
|
||||
total_services_critical++;
|
||||
else if(strstr(input_buffer,";WARNING;"))
|
||||
total_services_warning++;
|
||||
else if(strstr(input_buffer,";UNKNOWN;"))
|
||||
total_services_unknown++;
|
||||
else if(strstr(input_buffer,";OK;") || strstr(input_buffer,";RECOVERY;"))
|
||||
total_services_ok++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return OK;
|
||||
}
|
232
contrib/check_cluster2.c
Normal file
232
contrib/check_cluster2.c
Normal file
|
@ -0,0 +1,232 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* CHECK_CLUSTER2.C - Host and Service Cluster Plugin for Nagios 2.x
|
||||
*
|
||||
* Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
|
||||
* License: GPL
|
||||
* Last Modified: 03-11-2004
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CHECK_SERVICES 1
|
||||
#define CHECK_HOSTS 2
|
||||
|
||||
#define MAX_INPUT_BUFFER 1024
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3
|
||||
|
||||
int total_services_ok=0;
|
||||
int total_services_warning=0;
|
||||
int total_services_unknown=0;
|
||||
int total_services_critical=0;
|
||||
|
||||
int total_hosts_up=0;
|
||||
int total_hosts_down=0;
|
||||
int total_hosts_unreachable=0;
|
||||
|
||||
int warning_threshold=1;
|
||||
int critical_threshold=1;
|
||||
|
||||
int check_type=CHECK_SERVICES;
|
||||
|
||||
char *data_vals=NULL;
|
||||
char *label=NULL;
|
||||
|
||||
|
||||
int process_arguments(int,char **);
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *ptr;
|
||||
int data_val;
|
||||
int return_code=STATE_OK;
|
||||
int error=FALSE;
|
||||
|
||||
if(process_arguments(argc,argv)==ERROR){
|
||||
|
||||
printf("Invalid arguments supplied\n");
|
||||
printf("\n");
|
||||
|
||||
printf("Host/Service Cluster Plugin for Nagios 2\n");
|
||||
printf("Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 03-11-2004\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s (-s | -h) [-l label] [-w threshold] [-c threshold] [-d val1,val2,...,valn]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" -s, --service = Check service cluster status\n");
|
||||
printf(" -h, --host = Check host cluster status\n");
|
||||
printf(" -l, --label = Optional prepended text output (i.e. \"Host cluster\")\n");
|
||||
printf(" -w, --warning = Specifies the number of hosts or services in cluster that must be in\n");
|
||||
printf(" a non-OK state in order to return a WARNING status level\n");
|
||||
printf(" -c, --critical = Specifies the number of hosts or services in cluster that must be in\n");
|
||||
printf(" a non-OK state in order to return a CRITICAL status level\n");
|
||||
printf(" -d, --data = The status codes of the hosts or services in the cluster, separated\n");
|
||||
printf(" by commas\n");
|
||||
printf("\n");
|
||||
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* check the data values */
|
||||
for(ptr=strtok(data_vals,",");ptr!=NULL;ptr=strtok(NULL,",")){
|
||||
|
||||
data_val=atoi(ptr);
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
switch(data_val){
|
||||
case 0:
|
||||
total_services_ok++;
|
||||
break;
|
||||
case 1:
|
||||
total_services_warning++;
|
||||
break;
|
||||
case 2:
|
||||
total_services_critical++;
|
||||
break;
|
||||
case 3:
|
||||
total_services_unknown++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch(data_val){
|
||||
case 0:
|
||||
total_hosts_up++;
|
||||
break;
|
||||
case 1:
|
||||
total_hosts_down++;
|
||||
break;
|
||||
case 2:
|
||||
total_hosts_unreachable++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* return the status of the cluster */
|
||||
if(check_type==CHECK_SERVICES){
|
||||
if((total_services_warning+total_services_unknown+total_services_critical) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_services_warning+total_services_unknown+total_services_critical) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
printf("%s %s: %d ok, %d warning, %d unknown, %d critical\n",(label==NULL)?"Service cluster":label,(return_code==STATE_OK)?"ok":"problem",total_services_ok,total_services_warning,total_services_unknown,total_services_critical);
|
||||
}
|
||||
else{
|
||||
if((total_hosts_down+total_hosts_unreachable) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_hosts_down+total_hosts_unreachable) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
printf("%s %s: %d up, %d down, %d unreachable\n",(label==NULL)?"Host cluster":label,(return_code==STATE_OK)?"ok":"problem",total_hosts_up,total_hosts_down,total_hosts_unreachable);
|
||||
}
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int process_arguments(int argc, char **argv){
|
||||
int c;
|
||||
int option=0;
|
||||
static struct option longopts[]={
|
||||
{"data", required_argument,0,'d'},
|
||||
{"warning", required_argument,0,'w'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
{"label", required_argument,0,'l'},
|
||||
{"host", no_argument, 0,'h'},
|
||||
{"service", no_argument, 0,'s'},
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
/* no options were supplied */
|
||||
if(argc<2)
|
||||
return ERROR;
|
||||
|
||||
while(1){
|
||||
|
||||
c=getopt_long(argc,argv,"hsw:c:d:l:",longopts,&option);
|
||||
|
||||
if(c==-1 || c==EOF || c==1)
|
||||
break;
|
||||
|
||||
switch(c){
|
||||
|
||||
case 'h': /* host cluster */
|
||||
check_type=CHECK_HOSTS;
|
||||
break;
|
||||
|
||||
case 's': /* service cluster */
|
||||
check_type=CHECK_SERVICES;
|
||||
break;
|
||||
|
||||
case 'w': /* warning threshold */
|
||||
warning_threshold=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'c': /* warning threshold */
|
||||
critical_threshold=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'd': /* data values */
|
||||
data_vals=(char *)strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* text label */
|
||||
label=(char *)strdup(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
return ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(data_vals==NULL)
|
||||
return ERROR;
|
||||
|
||||
return OK;
|
||||
}
|
296
contrib/check_compaq_insight.pl
Normal file
296
contrib/check_compaq_insight.pl
Normal file
|
@ -0,0 +1,296 @@
|
|||
From mm@elabnet.de Mon Nov 18 09:59:04 2002
|
||||
Date: Mon, 18 Nov 2002 12:19:04 +0100
|
||||
From: Michael Markstaller <mm@elabnet.de>
|
||||
To: nagiosplug-devel@lists.sourceforge.net
|
||||
Subject: [Nagiosplug-devel] Submission: check_insight / checking Compaq
|
||||
Insight Agent status
|
||||
|
||||
Hi,
|
||||
|
||||
I've been looking to check the status/health of Compaq Insight Agents on
|
||||
servers and found a spong plugin
|
||||
(http://spong.sourceforge.net/downloads/plugins/spong-network/check_insi
|
||||
ght) which I've slightly changed to work with Nagios.
|
||||
I have pretty no idea of perl at all, just wanted to make it work for
|
||||
me, so please don't shoot me for this copy-paste-code. I've tested some
|
||||
basic things, it seems to work at least to report a warning if smthg is
|
||||
degraded and OK of xcourse ;)
|
||||
I'm also quite unsure if this is the right way to submit, so I'll just
|
||||
try ;)
|
||||
There're some "unknown" components on all servers I've checked so far,
|
||||
if anybody has a documentation of what's exactly returned when getting
|
||||
the OID 1.3.6.1.4.1.232.11.2.10.1.0 (CPQHOST_MIB isn't very descriptive)
|
||||
I'd be happy to fix this.
|
||||
|
||||
--- cut ---
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# (c)2002 Michael Markstaller, Elaborated Networks GmbH
|
||||
# send bug reports to <mm@elabnet.de>
|
||||
#
|
||||
# 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 (or with Nagios); if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#
|
||||
# Check Comapq Insight Management Agents Systems Status by SNMP
|
||||
# based on the spong-plugin check_insight from:
|
||||
#
|
||||
http://spong.sourceforge.net/downloads/plugins/spong-network/check_insig
|
||||
ht
|
||||
#
|
||||
# Usage:
|
||||
# check_insight -H <host> -C community
|
||||
#
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
$version=0.01;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
#
|
||||
# some default values
|
||||
#
|
||||
$TIMEOUT=15;
|
||||
|
||||
#
|
||||
# get command line options the regular way
|
||||
#
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C);
|
||||
|
||||
#
|
||||
# handle the verbose stuff first
|
||||
#
|
||||
if ($opt_V) {
|
||||
print "\n";
|
||||
print "check_insight nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You
|
||||
may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General
|
||||
Public License.\n";
|
||||
print "For more information about these matters, see the file
|
||||
named COPYING.\n";
|
||||
print "\n";
|
||||
print "(c)2002 Michael Markstaller, Elaborated Networks GmbH\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#
|
||||
# now get options the weired way and set the defaults
|
||||
# if nothing else is provided
|
||||
#
|
||||
$opt_H = shift unless ($opt_H);
|
||||
print_usage() unless ($opt_H);
|
||||
|
||||
#
|
||||
# dont let us wait forever...
|
||||
#
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from server (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
#
|
||||
# now we set things up for the real work
|
||||
# and fire up the request
|
||||
#
|
||||
|
||||
########################################################################
|
||||
########
|
||||
my ($host) = ($opt_H);
|
||||
my ($color, $summary, $message ) = ( "green", "", "" );
|
||||
($opt_C) || ($opt_C = shift) || ($opt_C = "public");
|
||||
my ($community) = $opt_C;
|
||||
|
||||
# We use some look up tables for checking some config options.
|
||||
my (@State) = ("Not Available", "Other", "OK", "Degraded", "Failed");
|
||||
|
||||
my (@MIBName) = ("", "Std", "Unknown", "Array",
|
||||
"Netware", "SCSI", "Health","Unknown",
|
||||
"Store", "SM2", "Thresh", "OS", "UPS",
|
||||
"Unknown", "IDE", "Clusters", "Fibre",
|
||||
"MIB", "NIC");
|
||||
|
||||
# These are the positions within the table to actually look at.
|
||||
my (@MIBs) = (1, 2, 3, 5, 6, 10, 11, 14, 18);
|
||||
|
||||
my ($oid) = "1.3.6.1.4.1.232.11.2.10.1.0"; # SysArray
|
||||
|
||||
# Open the connection.
|
||||
my ($session, $error) = Net::SNMP->session(Hostname => $host,
|
||||
Community => $community);
|
||||
|
||||
# If we can't open a connection, just return red straight away.
|
||||
if (! defined $session) {
|
||||
print ("ERROR: Unable to contact server '$opt_H'\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
|
||||
$session->translate;
|
||||
my ($response) = $session->get_request($oid);
|
||||
|
||||
if (!defined $response) {
|
||||
# If there's no response, something screwy is going on, give up.
|
||||
$summary = $session->error;
|
||||
print ("ERROR: $summary\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
$session->close;
|
||||
} else {
|
||||
$session->close;
|
||||
|
||||
# I'm not convinced that this is the easiest way to go about this,
|
||||
this is
|
||||
# from some code which I've inherited and I've modified for use in
|
||||
here.
|
||||
# Hi George!
|
||||
%h = %$response;
|
||||
my ($d) = $h{$oid};
|
||||
|
||||
my (@list) = ();
|
||||
|
||||
# Gobble the first two char's.
|
||||
$d = substr $d,2;
|
||||
|
||||
while (length($d) > 0) {
|
||||
my ($v) = substr($d,0,2);
|
||||
$v = hex($v);
|
||||
$d = substr $d,2;
|
||||
push @list, $v;
|
||||
}
|
||||
|
||||
# Value in $MIBs[1] is the overall status of the machine...
|
||||
my ($cond) = $MIBs[1];
|
||||
$message .= "Status: $State[$cond] ";
|
||||
|
||||
foreach my $v (@MIBs) {
|
||||
$cond = $list[($v*4)+1]; # A little bit of magic.
|
||||
|
||||
# We only bother printing the status out if it's actually
|
||||
available,
|
||||
# as if it's N/A or Unknown then it's probably because the machine
|
||||
# isn't available.
|
||||
$message .= "$MIBName[$v]: $State[$cond] " if $cond > 1;
|
||||
next if $cond < 2;
|
||||
|
||||
# What follows is some trickery to try and not to override a
|
||||
previous
|
||||
# message at the same or lower color.
|
||||
if ($cond == 4) {
|
||||
if ($color ne 'red') {
|
||||
$color = 'red';
|
||||
$summary = "$MIBName[$v] is failed";
|
||||
}
|
||||
} elsif ($cond == 3) {
|
||||
if ($color ne 'red') {
|
||||
$color = 'yellow';
|
||||
$summary = "$MIBName[$v] is degraded" if $summary eq "";
|
||||
}
|
||||
} elsif ($cond < 2) {
|
||||
if ($color eq 'green') {
|
||||
$color = 'yellow';
|
||||
$summary = "$MIBName[$v] is unknown ($cond)" if $summary eq
|
||||
"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$summary = "Ok" if $summary eq "";
|
||||
|
||||
# return ($color, $summary, $message);
|
||||
|
||||
if ($color eq 'red') {
|
||||
print ("red Output: $message\n");
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
} elsif ($color eq 'yellow') {
|
||||
print ("$summary $message\n");
|
||||
exit $ERRORS{"WARNING"};
|
||||
} elsif ($color eq 'green') {
|
||||
print ("$message\n");
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $0 -H <host> -C <community> \n"; }
|
||||
|
||||
sub print_help () {
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "check_insight nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You
|
||||
may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General
|
||||
Public License.\n";
|
||||
print "For more information about these matters, see the file
|
||||
named COPYING.\n";
|
||||
print "\n";
|
||||
print "(c)2002 Michael Markstaller, Elaborated Networks GmbH\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "This plugin checks the Compaq Insight Management agents
|
||||
system status via SNMP on the specified host.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "Options:\n";
|
||||
print " -H, --hostname=ADDRESS\n";
|
||||
print " host name argument for server.\n";
|
||||
print " -C, --community=STRING\n";
|
||||
print " SNMP Read-community string.\n";
|
||||
print " -h, --help\n";
|
||||
print " print detailed help screen.\n";
|
||||
print " -V, --version\n";
|
||||
print " print version information.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
--- cut ---
|
||||
|
||||
Michael
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
This sf.net email is sponsored by: To learn the basics of securing
|
||||
your web site with SSL, click here to get a FREE TRIAL of a Thawte
|
||||
Server Certificate: http://www.gothawte.com/rd524.html
|
||||
_______________________________________________
|
||||
Nagiosplug-devel mailing list
|
||||
Nagiosplug-devel@lists.sourceforge.net
|
||||
https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
|
430
contrib/check_cpqarray.c
Normal file
430
contrib/check_cpqarray.c
Normal file
|
@ -0,0 +1,430 @@
|
|||
/*
|
||||
check_cpqarray, an extension for Netsaint / Nagios to check the
|
||||
status of a Compaq SmartArray controller from the commandline.
|
||||
Copyright (C) 2003 Guenther Mair
|
||||
|
||||
based on the work and using main parts of
|
||||
|
||||
CpqArray Deamon, a program to monitor and remotely configure a
|
||||
SmartArray controller.
|
||||
Copyright (C) 1999 Hugo Trippaers
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "/usr/src/linux/drivers/block/ida_ioctl.h"
|
||||
#include "/usr/src/linux/drivers/block/ida_cmd.h"
|
||||
#include "/usr/src/linux/drivers/block/cpqarray.h"
|
||||
|
||||
|
||||
const char *controllers[] =
|
||||
{
|
||||
"/dev/ida/c0d0",
|
||||
"/dev/ida/c1d0",
|
||||
"/dev/ida/c2d0",
|
||||
"/dev/ida/c3d0",
|
||||
"/dev/ida/c4d0",
|
||||
"/dev/ida/c5d0",
|
||||
"/dev/ida/c6d0",
|
||||
"/dev/ida/c7d0"
|
||||
};
|
||||
|
||||
const char *statusstr[] = {
|
||||
"Logical drive /dev/ida/c%dd%d: OK\n",
|
||||
"Logical drive /dev/ida/c%dd%d: FAILED\n",
|
||||
"Logical drive /dev/ida/c%dd%d: not configured.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: using interim recovery mode, %3.2f%% done.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: ready for recovery operation.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: is currently recovering, %3.2f%% done.\n",
|
||||
"Wrong physical drive was replaced.\n",
|
||||
"A physical drive is not properly connected.\n",
|
||||
"Hardware is overheating.\n",
|
||||
"Hardware has overheated.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: currently expanding, %3.2f%% done.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: not yet available.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: queued for expansion.\n",
|
||||
};
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
int ctrls_found_num;
|
||||
int exit_code = 0;
|
||||
struct controller ctrls_found[8];
|
||||
|
||||
#define DEBUG(x) fprintf(stderr, x)
|
||||
|
||||
struct opts
|
||||
{
|
||||
char debug;
|
||||
};
|
||||
|
||||
struct slog_disk
|
||||
{
|
||||
int status;
|
||||
float pvalue;
|
||||
};
|
||||
|
||||
struct controller
|
||||
{
|
||||
char ctrl_devicename[20];
|
||||
int num_logd_found;
|
||||
struct slog_disk log_disk[16];
|
||||
};
|
||||
|
||||
|
||||
|
||||
int status_check (struct opts opts)
|
||||
{
|
||||
int devicefd;
|
||||
int ctrl_cntr;
|
||||
int logd_cntr;
|
||||
ida_ioctl_t io, io2;
|
||||
int status, nr_blks, blks_tr;
|
||||
float pvalue;
|
||||
int counter;
|
||||
|
||||
for ( ctrl_cntr=0;
|
||||
ctrl_cntr < ctrls_found_num;
|
||||
ctrl_cntr++) {
|
||||
|
||||
devicefd = open (controllers[ctrl_cntr], O_RDONLY);
|
||||
|
||||
for ( logd_cntr=0;
|
||||
logd_cntr < ctrls_found[ctrl_cntr].num_logd_found;
|
||||
logd_cntr++) {
|
||||
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = SENSE_LOG_DRV_STAT;
|
||||
io.unit = logd_cntr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
perror ("SENSE_LOG_DRV_STAT ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
status=io.c.sense_log_drv_stat.status;
|
||||
|
||||
if ((status == 3) || (status == 5) || (status == 7)) {
|
||||
/* is a progress indicator required?
|
||||
*/
|
||||
memset (&io2, 0, sizeof (io));
|
||||
|
||||
io2.cmd = ID_LOG_DRV;
|
||||
io2.unit = logd_cntr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io2) < 0)
|
||||
{
|
||||
perror ("ID_LOG_DRV ioctl");
|
||||
/* return 0; no return this isn't fatal for now */
|
||||
}
|
||||
else
|
||||
{
|
||||
nr_blks = io2.c.id_log_drv.nr_blks;
|
||||
blks_tr = io.c.sense_log_drv_stat.blks_to_recover;
|
||||
|
||||
pvalue = ((float)(nr_blks - blks_tr)/(float)nr_blks) * 100;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pvalue = 0.0;
|
||||
}
|
||||
|
||||
if (opts.debug) {
|
||||
fprintf(stdout, "DEBUG: Status of controller %d unit %d is %d\n",
|
||||
ctrl_cntr, logd_cntr, status);
|
||||
fprintf(stdout, "DEBUG: ");
|
||||
fprintf(stdout, statusstr[status],
|
||||
ctrl_cntr, logd_cntr, pvalue);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
printf(statusstr[status], ctrl_cntr, logd_cntr, pvalue);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 6:
|
||||
case 7:
|
||||
case 9:
|
||||
/* CRITICAL */
|
||||
exit_code = 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 8:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
/* WARNING (only if not yet at CRITICAL LEVEL) */
|
||||
if (exit_code < 2) exit_code = 1;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
|
||||
ctrls_found[ctrl_cntr].log_disk[logd_cntr].pvalue = pvalue;
|
||||
ctrls_found[ctrl_cntr].log_disk[logd_cntr].status = status;
|
||||
}
|
||||
close (devicefd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int discover_controllers (struct opts opts)
|
||||
{
|
||||
int cntr;
|
||||
int foundone = 0;
|
||||
|
||||
for (cntr = 0; cntr < 8; cntr++)
|
||||
{
|
||||
/* does this device exist ? */
|
||||
if ((access (controllers[cntr], R_OK | F_OK)) == 0)
|
||||
{
|
||||
/* it does :) */
|
||||
if (interrogate_controller (opts, cntr))
|
||||
{
|
||||
foundone = 1;
|
||||
if (opts.debug)
|
||||
fprintf (stderr, "DEBUG: %s is a existing controller\n",
|
||||
controllers[cntr]);
|
||||
}
|
||||
}
|
||||
else if (opts.debug)
|
||||
{
|
||||
fprintf (stderr, "DEBUG: Device %s could not be opened\n", controllers[cntr]);
|
||||
perror ("DEBUG: reason");
|
||||
}
|
||||
}
|
||||
return foundone;
|
||||
}
|
||||
|
||||
void boardid2str (unsigned long board_id, char *name)
|
||||
{
|
||||
switch (board_id)
|
||||
{
|
||||
case 0x0040110E: /* IDA */
|
||||
strcpy (name, "Compaq IDA");
|
||||
break;
|
||||
case 0x0140110E: /* IDA-2 */
|
||||
strcpy (name, "Compaq IDA-2");
|
||||
break;
|
||||
case 0x1040110E: /* IAES */
|
||||
strcpy (name, "Compaq IAES");
|
||||
break;
|
||||
case 0x2040110E: /* SMART */
|
||||
strcpy (name, "Compaq SMART");
|
||||
break;
|
||||
case 0x3040110E: /* SMART-2/E */
|
||||
strcpy (name, "Compaq SMART-2/E");
|
||||
break;
|
||||
case 0x40300E11: /* SMART-2/P or SMART-2DH */
|
||||
strcpy (name, "Compaq SMART-2/P (2DH)");
|
||||
break;
|
||||
case 0x40310E11: /* SMART-2SL */
|
||||
strcpy (name, "Compaq SMART-2SL");
|
||||
break;
|
||||
case 0x40320E11: /* SMART-3200 */
|
||||
strcpy (name, "Compaq SMART-3200");
|
||||
break;
|
||||
case 0x40330E11: /* SMART-3100ES */
|
||||
strcpy (name, "Compaq SMART-3100ES");
|
||||
break;
|
||||
case 0x40340E11: /* SMART-221 */
|
||||
strcpy (name, "Compaq SMART-221");
|
||||
break;
|
||||
case 0x40400E11: /* Integrated Array */
|
||||
strcpy (name, "Compaq Integrated Array");
|
||||
break;
|
||||
case 0x40500E11: /* Smart Array 4200 */
|
||||
strcpy (name, "Compaq Smart Array 4200");
|
||||
break;
|
||||
case 0x40510E11: /* Smart Array 4250ES */
|
||||
strcpy (name, "Compaq Smart Array 4250ES");
|
||||
break;
|
||||
case 0x40580E11: /* Smart Array 431 */
|
||||
strcpy (name, "Compaq Smart Array 431");
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Well, its a SMART-2 or better, don't know which
|
||||
* kind.
|
||||
*/
|
||||
strcpy (name, "Unknown Controller Type");
|
||||
}
|
||||
}
|
||||
|
||||
int interrogate_controller (struct opts opts, int contrnum)
|
||||
{
|
||||
int devicefd;
|
||||
ida_ioctl_t io;
|
||||
char buffer[30];
|
||||
int foundone = 0;
|
||||
int cntr;
|
||||
|
||||
devicefd = open (controllers[contrnum], O_RDONLY);
|
||||
/* no checks, did that before */
|
||||
|
||||
/* clear io */
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = ID_CTLR;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
if (opts.debug) perror ("DEBUG: ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
boardid2str (io.c.id_ctlr.board_id, buffer);
|
||||
|
||||
strncpy (ctrls_found[ctrls_found_num].ctrl_devicename,
|
||||
buffer, 20);
|
||||
|
||||
ctrls_found[ctrls_found_num].num_logd_found = 0;
|
||||
|
||||
for (cntr = 0; cntr < io.c.id_ctlr.nr_drvs; cntr++)
|
||||
{
|
||||
if (interrogate_logical (opts, devicefd, cntr))
|
||||
{
|
||||
/* logical drive found, this could be used later one */
|
||||
foundone = 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (ctrls_found[ctrls_found_num].num_logd_found)
|
||||
{
|
||||
case 0:
|
||||
printf("Found a %s with no logical drives.\n", buffer);
|
||||
break;
|
||||
case 1:
|
||||
printf("Found a %s with one Logical drive.\n", buffer,
|
||||
ctrls_found[ctrls_found_num].num_logd_found);
|
||||
break;
|
||||
default:
|
||||
printf("Found a %s with %d Logical drives.\n", buffer,
|
||||
ctrls_found[ctrls_found_num].num_logd_found);
|
||||
break;
|
||||
}
|
||||
|
||||
ctrls_found_num++;
|
||||
|
||||
close (devicefd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int interrogate_logical (struct opts opts, int devicefd, int unit_nr)
|
||||
{
|
||||
ida_ioctl_t io;
|
||||
ida_ioctl_t io2;
|
||||
int nr_blks, blks_tr;
|
||||
|
||||
if (opts.debug) printf ("DEBUG: interrogating unit %d\n", unit_nr);
|
||||
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = ID_LOG_DRV;
|
||||
io.unit = unit_nr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
perror ("FATAL: ID_LOG_DRV ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (&io2, 0, sizeof (io2));
|
||||
|
||||
io2.cmd = SENSE_LOG_DRV_STAT;
|
||||
io2.unit = unit_nr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io2) < 0)
|
||||
{
|
||||
perror ("FATAL: SENSE_LOG_DRV_STAT ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctrls_found[ctrls_found_num].num_logd_found++;
|
||||
/* ctrls_found[ctrls_found_num].log_disk[unit_nr].status =
|
||||
* io2.c.sense_log_drv_stat.status;
|
||||
|
||||
* nr_blks = io2.c.id_log_drv.nr_blks;
|
||||
* blks_tr = io.c.sense_log_drv_stat.blks_to_recover;
|
||||
* ctrls_found[ctrls_found_num].log_disk[unit_nr].pvalue =
|
||||
* ((float)(nr_blks - blks_tr)/(float)nr_blks) * 100;
|
||||
*/
|
||||
ctrls_found[ctrls_found_num].log_disk[unit_nr].status = 0;
|
||||
ctrls_found[ctrls_found_num].log_disk[unit_nr].pvalue = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void print_usage()
|
||||
{
|
||||
printf("cpqarrayd [options]\n");
|
||||
printf(" -h prints this text\n");
|
||||
printf(" -d enables debugging\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char option;
|
||||
struct opts opts; /* commandline options */
|
||||
|
||||
memset(&opts, 0, sizeof(struct opts));
|
||||
|
||||
/* check options */
|
||||
while ((option = getopt (argc, argv, "dh:")) != EOF)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case 'd':
|
||||
opts.debug = 1;
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
print_usage();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for existance of array controllers */
|
||||
if (!discover_controllers(opts)) {
|
||||
printf("No array controller found!\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
status_check(opts);
|
||||
|
||||
return exit_code;
|
||||
}
|
252
contrib/check_digitemp.pl
Executable file
252
contrib/check_digitemp.pl
Executable file
|
@ -0,0 +1,252 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# check_digitemp.pl Copyright (C) 2002 by Brian C. Lane <bcl@brianlane.com>
|
||||
#
|
||||
# This is a NetSaint plugin script to check the temperature on a local
|
||||
# machine. Remote usage may be possible with SSH
|
||||
#
|
||||
# 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
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
#
|
||||
# ===========================================================================
|
||||
# Howto Install in NetSaint (tested with v0.0.7)
|
||||
#
|
||||
# 1. Copy this script to /usr/local/netsaint/libexec/ or wherever you have
|
||||
# placed your NetSaint plugins
|
||||
#
|
||||
# 2. Create a digitemp config file in /usr/local/netsaint/etc/
|
||||
# eg. digitemp -i -s/dev/ttyS0 -c /usr/local/netsaint/etc/digitemp.conf
|
||||
#
|
||||
# 3. Make sure that the webserver user has permission to access the serial
|
||||
# port being used.
|
||||
#
|
||||
# 4. Add a command to /usr/local/netsaint/etc/commands.cfg like this:
|
||||
# command[check-temp]=$USER1$/check_digitemp.pl -w $ARG1$ -c $ARG2$ \
|
||||
# -t $ARG3$ -f $ARG4$
|
||||
# (fold into one line)
|
||||
#
|
||||
# 5. Tell NetSaint to monitor the temperature by adding a service line like
|
||||
# this to your hosts.cfg file:
|
||||
# service[kermit]=Temperature;0;24x7;3;5;1;home-admins;120;24x7;1;1;1;; \
|
||||
# check-temp!65!75!1!/usr/local/netsaint/etc/digitemp.conf
|
||||
# (fold into one line)
|
||||
# 65 is the warning temperature
|
||||
# 75 is the critical temperature
|
||||
# 1 is the sensor # (as reported by digitemp -a) to monitor
|
||||
# digitemp.conf is the path to the config file
|
||||
#
|
||||
# 6. If you use Centigrade instead of Fahrenheit, change the commands.cfg
|
||||
# line to include the -C argument. You can then pass temperature limits in
|
||||
# Centigrade in the service line.
|
||||
#
|
||||
# ===========================================================================
|
||||
# Howto Install in Nagios (tested with v1.0b4)
|
||||
#
|
||||
# 1. Copy this script to /usr/local/nagios/libexec/ or wherever you have
|
||||
# placed your Nagios plugins
|
||||
#
|
||||
# 2. Create a digitemp config file in /usr/local/nagios/etc/
|
||||
# eg. digitemp -i -s/dev/ttyS0 -c /usr/local/nagios/etc/digitemp.conf
|
||||
#
|
||||
# 3. Make sure that the webserver user has permission to access the serial
|
||||
# port being used.
|
||||
#
|
||||
# 4. Add a command to /usr/local/nagios/etc/checkcommands.cfg like this:
|
||||
#
|
||||
# #DigiTemp temperature check command
|
||||
# define command{
|
||||
# command_name check_temperature
|
||||
# command_line $USER1$/check_digitemp.pl -w $ARG1$ -c $ARG2$ \
|
||||
# -t $ARG3$ -f $ARG4$
|
||||
# (fold above into one line)
|
||||
# }
|
||||
#
|
||||
# 5. Tell NetSaint to monitor the temperature by adding a service line like
|
||||
# this to your service.cfg file:
|
||||
#
|
||||
# #DigiTemp Temperature check Service definition
|
||||
# define service{
|
||||
# use generic-service
|
||||
# host_name kermit
|
||||
# service_description Temperature
|
||||
# is_volatile 0
|
||||
# check_period 24x7
|
||||
# max_check_attempts 3
|
||||
# normal_check_interval 5
|
||||
# retry_check_interval 2
|
||||
# contact_groups home-admins
|
||||
# notification_interval 240
|
||||
# notification_period 24x7
|
||||
# notification_options w,u,c,r
|
||||
# check_command check_temperature!65!75!1! \
|
||||
# /usr/local/nagios/etc/digitemp.conf
|
||||
# (fold into one line)
|
||||
# }
|
||||
#
|
||||
# 65 is the warning temperature
|
||||
# 75 is the critical temperature
|
||||
# 1 is the sensor # (as reported by digitemp -a) to monitor
|
||||
# digitemp.conf is the path to the config file
|
||||
#
|
||||
# 6. If you use Centigrade instead of Fahrenheit, change the checkcommands.cfg
|
||||
# line to include the -C argument. You can then pass temperature limits in
|
||||
# Centigrade in the service line.
|
||||
#
|
||||
# ===========================================================================
|
||||
|
||||
# Modules to use
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
# Define all our variable usage
|
||||
use vars qw($opt_c $opt_f $opt_t $opt_w $opt_F $opt_C
|
||||
$temperature $conf_file $sensor $temp_fmt
|
||||
$crit_level $warn_level $null
|
||||
%exit_codes
|
||||
$percent $fmt_pct
|
||||
$verb_err $command_line);
|
||||
|
||||
|
||||
# Predefined exit codes for NetSaint
|
||||
%exit_codes = ('UNKNOWN' ,-1,
|
||||
'OK' , 0,
|
||||
'WARNING' , 1,
|
||||
'CRITICAL', 2,);
|
||||
|
||||
# Default to Fahrenheit input and result (use -C to change this)
|
||||
$temp_fmt = 3;
|
||||
|
||||
|
||||
# Get the options
|
||||
if ($#ARGV le 0)
|
||||
{
|
||||
&usage;
|
||||
} else {
|
||||
getopts('f:t:FCc:w:');
|
||||
}
|
||||
|
||||
# Shortcircuit the switches
|
||||
if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0)
|
||||
{
|
||||
print "*** You must define WARN and CRITICAL levels!";
|
||||
&usage;
|
||||
}
|
||||
|
||||
# Check if levels are sane
|
||||
if ($opt_w >= $opt_c)
|
||||
{
|
||||
print "*** WARN level must not be greater than CRITICAL when checking temperature!";
|
||||
&usage;
|
||||
}
|
||||
|
||||
|
||||
$warn_level = $opt_w;
|
||||
$crit_level = $opt_c;
|
||||
|
||||
# Default sensor to read is #0
|
||||
if(!$opt_t)
|
||||
{
|
||||
$sensor = 0;
|
||||
} else {
|
||||
$sensor = $opt_t;
|
||||
}
|
||||
|
||||
# Default config file is /etc/digitemp.conf
|
||||
if(!$opt_f)
|
||||
{
|
||||
$conf_file = "/etc/digitemp.conf";
|
||||
} else {
|
||||
$conf_file = $opt_f;
|
||||
}
|
||||
|
||||
# Check for config file
|
||||
if( !-f $conf_file ) {
|
||||
print "*** You must have a digitemp.conf file\n";
|
||||
&usage;
|
||||
}
|
||||
|
||||
|
||||
if($opt_C)
|
||||
{
|
||||
$temp_fmt = 2;
|
||||
}
|
||||
|
||||
# Read the output from digitemp
|
||||
# Output in form 0\troom\tattic\tdrink
|
||||
open( DIGITEMP, "/usr/local/bin/digitemp -c $conf_file -t $sensor -q -o $temp_fmt |" );
|
||||
|
||||
# Process the output from the command
|
||||
while( <DIGITEMP> )
|
||||
{
|
||||
# print "$_\n";
|
||||
chomp;
|
||||
|
||||
if( $_ =~ /^nanosleep/i )
|
||||
{
|
||||
print "Error reading sensor #$sensor\n";
|
||||
close(DIGITEMP);
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
} else {
|
||||
# Check for an error from digitemp, and report it instead
|
||||
if( $_ =~ /^Error.*/i ) {
|
||||
print $_;
|
||||
close(DIGITEMP);
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
} else {
|
||||
($null,$temperature) = split(/\t/);
|
||||
}
|
||||
}
|
||||
}
|
||||
close( DIGITEMP );
|
||||
|
||||
if( $temperature and $temperature >= $crit_level )
|
||||
{
|
||||
print "Temperature CRITICAL - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
} elsif ($temperature and $temperature >= $warn_level ) {
|
||||
print "Temperature WARNING - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'WARNING'};
|
||||
} elsif( $temperature ) {
|
||||
print "Temperature OK - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'OK'};
|
||||
} else {
|
||||
print "Error parsing result for sensor #$sensor\n";
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
||||
|
||||
# Show usage
|
||||
sub usage()
|
||||
{
|
||||
print "\ncheck_digitemp.pl v1.0 - NetSaint Plugin\n";
|
||||
print "Copyright 2002 by Brian C. Lane <bcl\@brianlane.com>\n";
|
||||
print "See source for License\n";
|
||||
print "usage:\n";
|
||||
print " check_digitemp.pl -t <sensor> -f <config file> -w <warnlevel> -c <critlevel>\n\n";
|
||||
print "options:\n";
|
||||
print " -f DigiTemp Config File\n";
|
||||
print " -t DigiTemp Sensor #\n";
|
||||
print " -F Temperature in Fahrenheit\n";
|
||||
print " -C Temperature in Centigrade\n";
|
||||
print " -w temperature temperature >= to warn\n";
|
||||
print " -c temperature temperature >= when critical\n";
|
||||
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
221
contrib/check_dlswcircuit.pl
Executable file
221
contrib/check_dlswcircuit.pl
Executable file
|
@ -0,0 +1,221 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_dlswcircuit.pl - nagios plugin
|
||||
#
|
||||
# Checks if a Cisco Dlsw circuit is connected.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Carsten Foss & Christoph Kron
|
||||
#
|
||||
# Basically this is an adapted version of Christoph Kron's (ck@zet.net) check_ifoperstatus.pl plugin.
|
||||
# most of the thanks should go to him.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Arguments : -s <SourceMac> -d <DestMac> -c <READCOMMUNITY> -p <PORT> <HOSTNAME or IP-Addr>
|
||||
# -
|
||||
# Source & Dest Mac/Sap arguments must be given in Hex as this example : 40.00.01.37.45.01.ss (Where ss is the sap)
|
||||
#
|
||||
# Sample command line : check_dlswcircuit.pl -s 40.00.01.37.45.01.04 -d 40.00.02.37.45.02.04 -c secret 1.2.3.4
|
||||
#
|
||||
# Sample host.cfg entry :
|
||||
#service[Dlsw-xx]=NCP1-NCP2;0;24x7;3;5;1;router-admins;240;24x7;1;1;0;;check_dlswcircuit!-s 40.00.01.37.45.01.04!-d 40.00..01.37.45.02.04!-c secret!1.2.3.4
|
||||
# remember to add the service to commands.cfg , something like this:
|
||||
# command[check_dlswcircuit]=$USER1$/check_dlswcircuit.pl $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$
|
||||
#
|
||||
# Report bugs to: cfo@dmdata.dk
|
||||
#
|
||||
# 11.03.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 15;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
my %dlswCircuitStatus = (
|
||||
'1','disconnected',
|
||||
'2','circuitStart',
|
||||
'3','resolvePending',
|
||||
'4','circuitPending',
|
||||
'5','circuitEstablished',
|
||||
'6','connectPending',
|
||||
'7','contactPending',
|
||||
'8','connected',
|
||||
'9','disconnectPending',
|
||||
'10','haltPending',
|
||||
'11','haltPendingNoack',
|
||||
'13','circuitRestart',
|
||||
'14','restartPending');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $smac = "";
|
||||
my $dmac = "";
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
#Dlsw Circuit Oid enterprises.9.10.9.1.5.2.1.17.6.0.96.148.47.230.166.4.6.64.0.1.55.69.2.4 = 8
|
||||
my $enterpriseOid = "1.3.6.1.4.1";
|
||||
my $ciscoDlswCircuitOid = ".9.10.9.1.5.2.1.17.";
|
||||
my $unknownOid = "6.";
|
||||
my $smacOid = "";
|
||||
my $dmacOid = "";
|
||||
my $tmpOid = "";
|
||||
my @tmparg;
|
||||
my $snmpoid;
|
||||
my @snmpoids;
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my $p = "";
|
||||
my $q = "";
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check Cisco Dlsw Circuit State plugin for Nagios\n";
|
||||
printf "checks operational status of specified DLSW Circuit\n";
|
||||
printf "usage: \n";
|
||||
printf "check_dlswcircuit.pl -s <SourceMac> -d <DestMac> -c <READCOMMUNITY> -p <PORT> <HOSTNAME>";
|
||||
printf "\nCopyright (C) 2000 Carsten Foss\n";
|
||||
printf "check_dlswcircuit.pl comes with ABSOLUTELY NO WARRANTY\n";
|
||||
printf "This programm is licensed under the terms of the ";
|
||||
printf "GNU General Public License\n(check source code for details)\n";
|
||||
printf "\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No snmp response from $hostname (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
$status = GetOptions("sourcemac=s",\$smac,"destmac=s",\$dmac,
|
||||
"community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#
|
||||
#Convert Source Mac & Sap
|
||||
#
|
||||
@tmparg = split(/\./,$smac);
|
||||
#print "-$smac-\n";
|
||||
#print "@tmparg\n";
|
||||
#print "$#tmparg\n";
|
||||
if($#tmparg != 6)
|
||||
{
|
||||
print "SourceMac/Sap format $smac not valid\n";
|
||||
&usage;
|
||||
}
|
||||
while($p = shift @tmparg)
|
||||
{
|
||||
$q = hex($p);
|
||||
$smacOid = $smacOid.$q;
|
||||
$smacOid = $smacOid.'.';
|
||||
}
|
||||
|
||||
#print "@tmparg1\n";
|
||||
#print "$smacOid\n";
|
||||
|
||||
#
|
||||
#Convert Dest Mac & Sap
|
||||
#
|
||||
@tmparg = split(/\./,$dmac);
|
||||
#print "-$dmac-\n";
|
||||
#print "@tmparg\n";
|
||||
#print "$#tmparg\n";
|
||||
if($#tmparg != 6)
|
||||
{
|
||||
print "DestMac/Sap format $dmac not valid\n";
|
||||
&usage;
|
||||
}
|
||||
|
||||
while($p = shift @tmparg)
|
||||
{
|
||||
$q = hex($p);
|
||||
$dmacOid = $dmacOid.$q;
|
||||
$dmacOid = $dmacOid.'.';
|
||||
}
|
||||
# Remove Trailing Dot
|
||||
$dmacOid = substr($dmacOid,0,length($dmacOid)-1);
|
||||
|
||||
|
||||
#print "@tmparg1\n";
|
||||
#print "$dmacOid\n";
|
||||
#Build the Dlsw Oic to use
|
||||
$snmpoid = $enterpriseOid.$ciscoDlswCircuitOid.$unknownOid.$smacOid.$unknownOid.$dmacOid ;
|
||||
#print "$snmpoid\n";
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
push(@snmpoids,$snmpoid);
|
||||
#push(@snmpoids,$snmpLocIfDescr);
|
||||
|
||||
if (!defined($response = $session->get_request(@snmpoids))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community,$smac - $dmac");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
$answer = sprintf("dlsw circuit %s - %s at host '%s',is %s\n",
|
||||
$smac,
|
||||
$dmac,
|
||||
$hostname,
|
||||
$dlswCircuitStatus{$response->{$snmpoid}}
|
||||
);
|
||||
|
||||
$session->close;
|
||||
|
||||
if ( $response->{$snmpoid} == 8 ) {
|
||||
$state = 'OK';
|
||||
}
|
||||
else {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
74
contrib/check_dns_random.pl
Normal file
74
contrib/check_dns_random.pl
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/perl
|
||||
# ------------------------------------------------------------------------------
|
||||
# File Name: check_dns_random.pl
|
||||
# Author: Richard Mayhew - South Africa
|
||||
# Date: 2000/01/26
|
||||
# Version: 1.0
|
||||
# Description: This script will check to see if dns resolves hosts
|
||||
# randomly from a list using the check_dns plugin.
|
||||
# Email: netsaint@splash.co.za
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 1999 (c) Richard Mayhew
|
||||
# Credits go to Ethan Galstad for coding Nagios
|
||||
# If any changes are made to this script, please mail me a copy of the
|
||||
# changes :)
|
||||
# License GPL
|
||||
# ------------------------------------------------------------------------------
|
||||
# Date Author Reason
|
||||
# ---- ------ ------
|
||||
# 1999/09/26 RM Creation
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------[ Require ]--
|
||||
require 5.004;
|
||||
|
||||
# --------------------------------------------------------------------[ Uses ]--
|
||||
use Socket;
|
||||
use strict;
|
||||
|
||||
# --------------------------------------------------------------[ Enviroment ]--
|
||||
$ENV{PATH} = "/bin";
|
||||
$ENV{BASH_ENV} = "";
|
||||
$|=1;
|
||||
|
||||
my $host = shift || &usage;
|
||||
|
||||
my $domainfile = "/usr/local/nagios/etc/domains.list";
|
||||
my $wc = `/usr/bin/wc -l $domainfile`;
|
||||
my $check = "/usr/local/nagios/libexec/check_dns";
|
||||
my $x = 0;
|
||||
my $srv_file = "";
|
||||
my $z = "";
|
||||
my $y = "";
|
||||
|
||||
open(DOMAIN,"<$domainfile") or die "Error Opening $domainfile File!\n";
|
||||
while (<DOMAIN>) {
|
||||
$srv_file .= $_;
|
||||
}
|
||||
close(DOMAIN);
|
||||
my @data = split(/\n/,$srv_file);
|
||||
|
||||
chomp $wc;
|
||||
$wc =~ s/ //g;
|
||||
$wc =~ s/domains//g;
|
||||
|
||||
$x = rand $wc;
|
||||
($z,$y) = split(/\./,$x);
|
||||
|
||||
system($check, $data[$z], $host);
|
||||
exit ($? / 256);
|
||||
|
||||
sub usage
|
||||
{
|
||||
print "Minimum arguments not supplied!\n";
|
||||
print "\n";
|
||||
print "Perl Check Random DNS plugin for Nagios\n";
|
||||
print "Copyright (c) 2000 Richard Mayhew\n";
|
||||
print "\n";
|
||||
print "Usage: check_dns_random.pl <host>\n";
|
||||
print "\n";
|
||||
print "<host> = DNS server you would like to query.\n";
|
||||
exit -1;
|
||||
|
||||
}
|
||||
|
309
contrib/check_email_loop.pl
Normal file
309
contrib/check_email_loop.pl
Normal file
|
@ -0,0 +1,309 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_email_loop.pl,v 1.5 2005/11/29 23:21:06 harpermann Exp $
|
||||
#
|
||||
# (c)2000 Benjamin Schmid, blueshift@gmx.net (emergency use only ;-)
|
||||
# Copyleft by GNU GPL
|
||||
#
|
||||
#
|
||||
# check_email_loop Nagios Plugin
|
||||
#
|
||||
# This script sends a mail with a specific id in the subject via
|
||||
# an given smtp-server to a given email-adress. When the script
|
||||
# is run again, it checks for this Email (with its unique id) on
|
||||
# a given pop3 account and send another mail.
|
||||
#
|
||||
#
|
||||
# Example: check_email_loop.pl -poph=mypop -popu=user -pa=password
|
||||
# -smtph=mailer -from=returnadress@yoursite.com
|
||||
# -to=remaileradress@friend.com -pendc=2 -lostc=0
|
||||
#
|
||||
# This example will send eacht time this check is executed a new
|
||||
# mail to remaileradress@friend.com using the SMTP-Host mailer.
|
||||
# Then it looks for any back-forwarded mails in the POP3 host
|
||||
# mypop. In this Configuration CRITICAL state will be reached if
|
||||
# more than 2 Mails are pending (meaning that they did not came
|
||||
# back till now) or if a mails got lost (meaning a mail, that was
|
||||
# send later came back prior to another mail).
|
||||
#
|
||||
# Michael Markstaller, mm@elabnet.de various changes/additions
|
||||
# MM 021003: fixed some unquoted strings
|
||||
# MM 021116: fixed/added pendwarn/lostwarn
|
||||
# MM 030515: added deleting of orphaned check-emails
|
||||
# changed to use "top" instead of get to minimize traffic (required changing match-string from "Subject: Email-ping [" to "Email-Ping ["
|
||||
|
||||
use Net::POP3;
|
||||
use Net::SMTP;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
# ----------------------------------------
|
||||
|
||||
my $TIMEOUT = 120;
|
||||
my %ERRORS = ('OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
'UNKNOWN' , '3');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
|
||||
my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
|
||||
my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
|
||||
$debug = 0;
|
||||
|
||||
# Internal Vars
|
||||
my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
|
||||
my (%other_smtp_opts);
|
||||
my ($matchcount,$statfile) = (0,"check_email_loop.stat");
|
||||
|
||||
# Subs declaration
|
||||
sub usage;
|
||||
sub messagematchs;
|
||||
sub nsexit;
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: $0 Time-Out $TIMEOUT s \n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
# Evaluate Command Line Parameters
|
||||
my $status = GetOptions(
|
||||
"from=s",\$sender,
|
||||
"to=s",\$receiver,
|
||||
"debug", \$debug,
|
||||
"pophost=s",\$pophost,
|
||||
"popuser=s",\$popuser,
|
||||
"passwd=s",\$poppasswd,
|
||||
"poptimeout=i",\$poptimeout,
|
||||
"smtphost=s",\$smtphost,
|
||||
"smtptimeout=i",\$smtptimeout,
|
||||
"statfile=s",\$statfile,
|
||||
"interval=i",\$pinginterval,
|
||||
"lostwarn=i",\$lostwarn,
|
||||
"lostcrit=i",\$lostcrit,
|
||||
"pendwarn=i",\$pendwarn,
|
||||
"pendcrit=i",\$pendcrit,
|
||||
"maxmsg=i",\$maxmsg,
|
||||
"keeporphaned=s",\$keeporphaned,
|
||||
);
|
||||
usage() if ($status == 0 || ! ($pophost && $popuser && $poppasswd &&
|
||||
$smtphost && $receiver && $sender ));
|
||||
|
||||
# Try to read the ids of the last send emails out of statfile
|
||||
if (open STATF, "$statfile") {
|
||||
@messageids = <STATF>;
|
||||
chomp @messageids;
|
||||
close STATF;
|
||||
}
|
||||
|
||||
# Try to open statfile for writing
|
||||
if (!open STATF, ">$statfile") {
|
||||
nsexit("Failed to open mail-ID database $statfile for writing",'CRITICAL');
|
||||
}
|
||||
|
||||
# Ok - check if it's time to release another mail
|
||||
|
||||
# ...
|
||||
|
||||
# creating new serial id
|
||||
my $serial = time();
|
||||
$serial = "ID#" . $serial . "#$$";
|
||||
|
||||
|
||||
# sending new ping email
|
||||
%other_smtp_opts=();
|
||||
if ( $debug == 1 ) {
|
||||
$other_smtp_opts{'Debug'} = 1;
|
||||
}
|
||||
|
||||
my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts)
|
||||
|| nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
|
||||
($smtp->mail($sender) &&
|
||||
$smtp->to($receiver) &&
|
||||
$smtp->data() &&
|
||||
$smtp->datasend("To: $receiver\nSubject: E-Mail Ping [$serial]\n\n".
|
||||
"This is an automatically sent E-Mail.\n".
|
||||
"It is not intended for a human reader.\n\n".
|
||||
"Serial No: $serial\n") &&
|
||||
$smtp->dataend() &&
|
||||
$smtp->quit
|
||||
) || nsexit("Error delivering message",'CRITICAL');
|
||||
|
||||
# no the interessting part: let's if they are receiving ;-)
|
||||
|
||||
$pop = Net::POP3->new( $pophost,
|
||||
Timeout=>$poptimeout)
|
||||
|| nsexit("POP3 connect timeout (>$poptimeout s, host: $pophost)",'CRITICAL');
|
||||
|
||||
$msgcount=$pop->login($popuser,$poppasswd);
|
||||
|
||||
$statinfo="$msgcount mails on POP3";
|
||||
|
||||
nsexit("POP3 login failed (user:$popuser)",'CRITICAL') if (!defined($msgcount));
|
||||
|
||||
# Check if more than maxmsg mails in pop3-box
|
||||
nsexit(">$maxmsg Mails ($msgcount Mails on POP3); Please delete !",'WARNING') if ($msgcount > $maxmsg);
|
||||
|
||||
my ($mid, $nid);
|
||||
# Count messages, that we are looking 4:
|
||||
while ($msgcount > 0) {
|
||||
@msglines = @{$pop->top($msgcount,1)};
|
||||
for (my $i=0; $i < scalar @messageids; $i++) {
|
||||
if (messagematchsid(\@msglines,$messageids[$i])) {
|
||||
$matchcount++;
|
||||
# newest received mail than the others, ok remeber id.
|
||||
if (!defined $newestid) {
|
||||
$newestid = $messageids[$i];
|
||||
} else {
|
||||
$messageids[$i] =~ /\#(\d+)\#/;
|
||||
$mid = $1;
|
||||
$newestid =~ /\#(\d+)\#/;
|
||||
$nid = $1;
|
||||
if ($mid > $nid) {
|
||||
$newestid = $messageids[$i];
|
||||
}
|
||||
}
|
||||
$pop->delete($msgcount); # remove E-Mail from POP3 server
|
||||
splice @messageids, $i, 1;# remove id from List
|
||||
last; # stop looking in list
|
||||
}
|
||||
}
|
||||
# Delete orphaned Email-ping msg
|
||||
my @msgsubject = grep /^Subject/, @msglines;
|
||||
chomp @msgsubject;
|
||||
# Scan Subject if email is an Email-Ping. In fact we match and delete also successfully retrieved messages here again.
|
||||
if (!defined $keeporphaned && $msgsubject[0] =~ /E-Mail Ping \[/) {
|
||||
$pop->delete($msgcount); # remove E-Mail from POP3 server
|
||||
}
|
||||
|
||||
$msgcount--;
|
||||
}
|
||||
|
||||
$pop->quit(); # necessary for pop3 deletion!
|
||||
|
||||
# traverse through the message list and mark the lost mails
|
||||
# that mean mails that are older than the last received mail.
|
||||
if (defined $newestid) {
|
||||
$newestid =~ /\#(\d+)\#/;
|
||||
$newestid = $1;
|
||||
for (my $i=0; $i < scalar @messageids; $i++) {
|
||||
$messageids[$i] =~ /\#(\d+)\#/;
|
||||
my $akid = $1;
|
||||
if ($akid < $newestid) {
|
||||
$messageids[$i] =~ s/^ID/LI/; # mark lost
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Write list to id-Database
|
||||
foreach my $id (@messageids) {
|
||||
print STATF "$id\n";
|
||||
}
|
||||
print STATF "$serial\n"; # remember send mail of this session
|
||||
close STATF;
|
||||
|
||||
# ok - count lost and pending mails;
|
||||
my @tmp = grep /^ID/, @messageids;
|
||||
my $pendingm = scalar @tmp;
|
||||
@tmp = grep /^LI/, @messageids;
|
||||
my $lostm = scalar @tmp;
|
||||
|
||||
# Evaluate the Warnin/Crit-Levels
|
||||
if (defined $pendwarn && $pendingm > $pendwarn) { $state = 'WARNING'; }
|
||||
if (defined $lostwarn && $lostm > $lostwarn) { $state = 'WARNING'; }
|
||||
if (defined $pendcrit && $pendingm > $pendcrit) { $state = 'CRITICAL'; }
|
||||
if (defined $lostcrit && $lostm > $lostcrit) { $state = 'CRITICAL'; }
|
||||
|
||||
if ((defined $pendwarn || defined $pendcrit || defined $lostwarn
|
||||
|| defined $lostcrit) && ($state eq 'UNKNOWN')) {$state='OK';}
|
||||
|
||||
|
||||
# Append Status info
|
||||
$statinfo = $statinfo . ", $matchcount mail(s) came back,".
|
||||
" $pendingm pending, $lostm lost.";
|
||||
|
||||
# Exit in a Nagios-compliant way
|
||||
nsexit($statinfo);
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
sub usage {
|
||||
print "check_email_loop 1.1 Nagios Plugin - Real check of a E-Mail system\n";
|
||||
print "=" x 75,"\nERROR: Missing or wrong arguments!\n","=" x 75,"\n";
|
||||
print "This script sends a mail with a specific id in the subject via an given\n";
|
||||
print "smtp-server to a given email-adress. When the script is run again, it checks\n";
|
||||
print "for this Email (with its unique id) on a given pop3 account and sends \n";
|
||||
print "another mail.\n";
|
||||
print "\nThe following options are available:\n";
|
||||
print " -from=text email adress of send (for mail returnr on errors)\n";
|
||||
print " -to=text email adress to which the mails should send to\n";
|
||||
print " -pophost=text IP or name of the POP3-host to be checked\n";
|
||||
print " -popuser=text Username of the POP3-account\n";
|
||||
print " -passwd=text Password for the POP3-user\n";
|
||||
print " -poptimeout=num Timeout in seconds for the POP3-server\n";
|
||||
print " -smtphost=text IP oder name of the SMTP host\n";
|
||||
print " -smtptimeout=num Timeout in seconds for the SMTP-server\n";
|
||||
print " -statfile=text File to save ids of messages ($statfile)\n";
|
||||
print " -interval=num Time (in minutes) that must pass by before sending\n";
|
||||
print " another Ping-mail (gibe a new try);\n";
|
||||
print " -lostwarn=num WARNING-state if more than num lost emails\n";
|
||||
print " -lostcrit=num CRITICAL \n";
|
||||
print " -pendwarn=num WARNING-state if more than num pending emails\n";
|
||||
print " -pendcrit=num CRITICAL \n";
|
||||
print " -maxmsg=num WARNING if more than num emails on POP3 (default 50)\n";
|
||||
print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n";
|
||||
print " -debug send SMTP tranaction info to stderr\n\n";
|
||||
print " Options may abbreviated!\n";
|
||||
print " LOST mails are mails, being sent before the last mail arrived back.\n";
|
||||
print " PENDING mails are those, which are not. (supposed to be on the way)\n";
|
||||
print "\nExample: \n";
|
||||
print " $0 -poph=host -pa=pw -popu=popts -smtph=host -from=root\@me.com\n ";
|
||||
print " -to=remailer\@testxy.com -lostc=0 -pendc=2\n";
|
||||
print "\nCopyleft 19.10.2000, Benjamin Schmid / 2003 Michael Markstaller, mm\@elabnet.de\n";
|
||||
print "This script comes with ABSOLUTELY NO WARRANTY\n";
|
||||
print "This programm is licensed under the terms of the ";
|
||||
print "GNU General Public License\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
sub nsexit {
|
||||
my ($msg,$code) = @_;
|
||||
$code=$state if (!defined $code);
|
||||
print "$code: $msg\n" if (defined $msg);
|
||||
exit $ERRORS{$code};
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
sub messagematchsid {
|
||||
my ($mailref,$id) = (@_);
|
||||
my (@tmp);
|
||||
my $match = 0;
|
||||
|
||||
# ID
|
||||
$id =~ s/^LI/ID/; # evtl. remove lost mail mark
|
||||
@tmp = grep /E-Mail Ping \[/, @$mailref;
|
||||
chomp @tmp;
|
||||
if (($tmp[0] =~ /$id/))
|
||||
{ $match = 1; }
|
||||
|
||||
# Sender:
|
||||
# @tmp = grep /^From:\s+/, @$mailref;
|
||||
# if (@tmp && $sender ne "")
|
||||
# { $match = $match && ($tmp[0]=~/$sender/); }
|
||||
|
||||
# Receiver:
|
||||
# @tmp = grep /^To: /, @$mailref;
|
||||
# if (@tmp && $receiver ne "")
|
||||
# { $match = $match && ($tmp[0]=~/$receiver/); }
|
||||
|
||||
return $match;
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
133
contrib/check_fan_cpq_present
Normal file
133
contrib/check_fan_cpq_present
Normal file
|
@ -0,0 +1,133 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
#
|
||||
# check_most.pl -i <ip address> -p <port> -c community -o <oid> [warn] [critical]
|
||||
#
|
||||
# NetSaint host script to get the disk usage from NT snmp
|
||||
#
|
||||
# Changes and Modifications
|
||||
# =========================
|
||||
# 3-Aug-2000 - Xavier Dusart
|
||||
# Created
|
||||
# 2003 - Rainer Duffner
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
#use strict;
|
||||
use Getopt::Std ;
|
||||
use BER;
|
||||
require 'SNMP_Session.pm';
|
||||
use vars qw($opt_H $opt_p $opt_C $opt_f $opt_h $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support);
|
||||
use snmputil qw(%CPQ_LOCALE %CPQ_FAN_PRESENT %CPQ_FAN_OVERALL_COND %CPQ_FAN_SPEED);
|
||||
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
|
||||
|
||||
getopts('H:p:C:f:hV') ;
|
||||
|
||||
my $ip_address=undef ;
|
||||
|
||||
if ($opt_h) {&help();}
|
||||
|
||||
if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]*(\.[a-zA-Z][-a-zA
|
||||
-Z0-9]*)*)$/) {
|
||||
$ip_address = $opt_H ;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
print "IP-Address format wrong\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#if ($opt_p =~ m/^[0-9]
|
||||
|
||||
my $port = $opt_p;
|
||||
|
||||
my $community = $opt_C;
|
||||
|
||||
my $fan = $opt_f ;
|
||||
|
||||
#my $err_counter=0 ;
|
||||
#my $err_status="";
|
||||
|
||||
my $fan_locale_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,3,0,$fan );
|
||||
# not used for the moment - gives no usable output
|
||||
# if reused, enter at end of list to avoid renumbering !
|
||||
my $fan_present_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,4,0,$fan );
|
||||
my $fan_speed_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,6,0,$fan );
|
||||
my $fan_condition_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,9,0,$fan );
|
||||
my $count=1 ;
|
||||
my $label ;
|
||||
my @r_array=();
|
||||
my $q ;
|
||||
my $diff ;
|
||||
$warning=$warning/100 ;
|
||||
$crititcal=$critical/100 ;
|
||||
|
||||
|
||||
# get temperature, temperature_threshold bfore shutdown
|
||||
my $session=SNMP_Session->open ($ip_address, $community, $port) || die "couldn't open SNMP-session to host" ;
|
||||
|
||||
if ($session->get_request_response ($fan_present_oid, $fan_locale_oid, $fan_speed_oid, $fan_condition_oid )) {
|
||||
(my $bindings) = $session->decode_get_response ($session->{pdu_buffer});
|
||||
while ($bindings ne '') {
|
||||
($binding, $bindings) = &decode_sequence ($bindings) ;
|
||||
($oid,$value) = &decode_by_template ($binding,"%O%@");
|
||||
$r_array[$count]=&pretty_print($value);
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
print "No response from agent\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
$result_fan_present= $r_array[1];
|
||||
$result_fan_locale= $r_array[2];
|
||||
$result_fan_speed= $r_array[3];
|
||||
$result_fan_condition=$r_array[4];
|
||||
|
||||
|
||||
if ( $result_fan_present != 3 || $result_fan_speed !=2 ) {
|
||||
print "Fan ". $fan . " ".$CPQ_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - Critical: Fan ".$CPQ_FAN_PRESENT{$result_fan_present}.". Speed: ". $CPQ_FAN_SPEED{$result_fan_speed}.". Overall condition: ". $CPQ_FAN_OVERALL_COND{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'CRITICAL'} ;
|
||||
}
|
||||
else {
|
||||
print "Fan " .$fan . " ".$CPQ_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - OK: Fan ".$CPQ_FAN_PRESENT{$result_fan_present}.". Speed: ". $CPQ_FAN_SPEED{$result_fan_speed}.". Overall condition: ". $CPQ_FAN_OVERALL_COND{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -p <port> -C <community> -f <fannumber>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $\n ');
|
||||
print "Copyright (c) 2003 Rainer Duffner\n ";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<host> = IP-Address or DNS-Name of the W2K-Server\n";
|
||||
print "<port> = SNMP-Port (normaly 161)\n";
|
||||
print "<community> = SNMP v1 community\n";
|
||||
print "<fannumber> = Fannumber (1, 2, 3 etc.)\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
135
contrib/check_fan_fsc_present
Normal file
135
contrib/check_fan_fsc_present
Normal file
|
@ -0,0 +1,135 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
#
|
||||
# check_most.pl -i <ip address> -p <port> -c community -o <oid> [warn] [critical]
|
||||
#
|
||||
# NetSaint host script to get the disk usage from NT snmp
|
||||
#
|
||||
# Changes and Modifications
|
||||
# =========================
|
||||
# 3-Aug-2000 - Xavier Dusart
|
||||
# Created
|
||||
# 2003 - Rainer Duffner
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
#use strict;
|
||||
use Getopt::Std ;
|
||||
use BER;
|
||||
require 'SNMP_Session.pm';
|
||||
use vars qw($opt_H $opt_p $opt_C $opt_f $opt_h $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support);
|
||||
use snmputil qw(%FSC_LOCALE %FSC_FAN_STATUS);
|
||||
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
|
||||
|
||||
getopts('H:p:C:f:hV') ;
|
||||
|
||||
my $ip_address=undef ;
|
||||
|
||||
if ($opt_h) {&help();}
|
||||
|
||||
if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]*(\.[a-zA-Z][-a-zA
|
||||
-Z0-9]*)*)$/) {
|
||||
$ip_address = $opt_H ;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
print "IP-Address format wrong\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#if ($opt_p =~ m/^[0-9]
|
||||
|
||||
my $port = $opt_p;
|
||||
|
||||
my $community = $opt_C;
|
||||
|
||||
my $fan = $opt_f ;
|
||||
|
||||
#my $err_counter=0 ;
|
||||
#my $err_status="";
|
||||
|
||||
my $fan_locale_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,4,0,$fan-1 );
|
||||
# not used for the moment - gives no usable output
|
||||
# if reused, enter at end of list to avoid renumbering !
|
||||
my $fan_cur_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,8,0,$fan-1 );
|
||||
my $fan_nom_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,9,0,$fan-1 );
|
||||
my $fan_cur_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,10,0,$fan-1 );
|
||||
my $fan_condition_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,3,0,$fan-1 );
|
||||
my $count=1 ;
|
||||
my $label ;
|
||||
my @r_array=();
|
||||
my $q ;
|
||||
my $diff ;
|
||||
$warning=$warning/100 ;
|
||||
$crititcal=$critical/100 ;
|
||||
|
||||
|
||||
# get temperature, temperature_threshold bfore shutdown
|
||||
my $session=SNMP_Session->open ($ip_address, $community, $port) || die "couldn't open SNMP-session to host" ;
|
||||
|
||||
if ($session->get_request_response ($fan_locale_oid, $fan_cur_speed_oid, $fan_nom_max_speed_oid, $fan_cur_max_speed_oid, $fan_condition_oid )) {
|
||||
(my $bindings) = $session->decode_get_response ($session->{pdu_buffer});
|
||||
while ($bindings ne '') {
|
||||
($binding, $bindings) = &decode_sequence ($bindings) ;
|
||||
($oid,$value) = &decode_by_template ($binding,"%O%@");
|
||||
$r_array[$count]=&pretty_print($value);
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
print "No response from agent\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
$result_fan_locale= $r_array[1];
|
||||
$result_fan_cur_speed= $r_array[2];
|
||||
$result_fan_nom_max_speed= $r_array[3];
|
||||
$result_fan_cur_max_speed= $r_array[4];
|
||||
$result_fan_condition=$r_array[5];
|
||||
|
||||
|
||||
if ( $result_fan_condition != "3" ) {
|
||||
print "Fan ". $fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - Critical: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'CRITICAL'} ;
|
||||
}
|
||||
else {
|
||||
print "Fan " .$fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - OK: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -p <port> -C <community> -f <fannumber>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $\n ');
|
||||
print "Copyright (c) 2003 Rainer Duffner\n ";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<host> = IP-Address or DNS-Name of the W2K-Server\n";
|
||||
print "<port> = SNMP-Port (normaly 161)\n";
|
||||
print "<community> = SNMP v1 community\n";
|
||||
print "<fannumber> = Fannumber (1, 2, 3 etc.)\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
82
contrib/check_flexlm.pl
Normal file
82
contrib/check_flexlm.pl
Normal file
|
@ -0,0 +1,82 @@
|
|||
#!/usr/local/bin/perl
|
||||
#
|
||||
# usage:
|
||||
# check_flexlm.pl license_file
|
||||
#
|
||||
# Check available flexlm license managers.
|
||||
# Use lmstat to check the status of the license server
|
||||
# described by the license file given as argument.
|
||||
# Check and interpret the output of lmstat
|
||||
# and create returncodes and output.
|
||||
#
|
||||
# Contrary to the nagios concept, this script takes
|
||||
# a file, not a hostname as an argument and returns
|
||||
# the status of hosts and services described in that
|
||||
# file. Use these hosts.cfg entries as an example
|
||||
#
|
||||
#host[anchor]=any host will do;some.address.com;;check-host-alive;3;120;24x7;1;1;1;
|
||||
#service[anchor]=yodel;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yodel_lic
|
||||
#service[anchor]=yeehaw;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yeehaw_lic
|
||||
#command[check_flexlm]=/some/path/libexec/check_flexlm.pl $ARG1$
|
||||
#
|
||||
# Notes:
|
||||
# - you need the lmstat utility which comes with flexlm.
|
||||
# - set the correct path in the variable $lmstat.
|
||||
#
|
||||
# initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com
|
||||
# current status: looks like working
|
||||
#
|
||||
# Copyright Notice: Do as you please, credit me, but don't blame me
|
||||
#
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No Answer from Client\n";
|
||||
exit 2;
|
||||
};
|
||||
alarm(20);
|
||||
|
||||
$lmstat = "/opt/lic/sw/cadadm/default/bin/lmstat";
|
||||
|
||||
$licfile = shift;
|
||||
|
||||
#print "$licfile \n";
|
||||
|
||||
open CMD,"$lmstat -c $licfile |";
|
||||
|
||||
$serverup = 0;
|
||||
|
||||
while ( <CMD> ) {
|
||||
if ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*)/ ) {
|
||||
$ls1 = $1;
|
||||
$ls2 = $2;
|
||||
$ls3 = $3;
|
||||
$lf1 = $lf2 = $lf3 = 0;
|
||||
$servers = 3;
|
||||
} elsif ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*)/ ) {
|
||||
$ls1 = $1;
|
||||
$ls2 = $ls3 = "";
|
||||
$lf1 = $lf2 = $lf3 = 0;
|
||||
$servers = 1;
|
||||
} elsif ( / *$ls1: license server UP/ ) {
|
||||
print "$ls1 UP, ";
|
||||
$lf1 = 1
|
||||
} elsif ( / *$ls2: license server UP/ ) {
|
||||
print "$ls2 UP, ";
|
||||
$lf2 = 1
|
||||
} elsif ( / *$ls3: license server UP/ ) {
|
||||
print "$ls3 UP, ";
|
||||
$lf3 = 1
|
||||
} elsif ( / *([^:]*: UP .*)/ ) {
|
||||
print " license server for $1\n";
|
||||
$serverup = 1;
|
||||
}
|
||||
}
|
||||
if ( $serverup == 0 ) {
|
||||
print " license server not running\n";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
exit 0 if ( $servers == $lf1 + $lf2 + $lf3 );
|
||||
exit 1 if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );
|
||||
exit 2;
|
151
contrib/check_frontpage
Normal file
151
contrib/check_frontpage
Normal file
|
@ -0,0 +1,151 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_frontpage,v 1.1 2005/01/27 04:45:00 stanleyhopcroft Exp $
|
||||
#
|
||||
# Check that FrontPage extensions appear to be working on a specified host.
|
||||
# Currently only checks that the hit counter is not returning an error.
|
||||
#
|
||||
# Probably not a good idea to use this on a host that someone's counting
|
||||
# the hits on, so create a separate vhost for frontpage extensions testing,
|
||||
# or just install the extensions on the default/root host for your server, and
|
||||
# point it against that hostname, running it against all vhosts on a server is
|
||||
# probably rather wasteful.
|
||||
#
|
||||
# Kev Green, oRe Net (http://www.orenet.co.uk/).
|
||||
|
||||
|
||||
use strict;
|
||||
use lib "/usr/lib/nagios/plugins";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use LWP;
|
||||
use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H);
|
||||
my ($tt,$url,$response,$stime, $etime,$warning,$critical,$mimetype,$failtype,$temp,$message);
|
||||
my $rt = 0;
|
||||
|
||||
$PROGNAME = "check_frontpage";
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
$ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $'); #'
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
$opt_H = shift unless ($opt_H);
|
||||
print_usage() unless $opt_H;
|
||||
my $host = $1 if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*)$/);
|
||||
print_usage() unless $host;
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = 120);
|
||||
if ($opt_c =~ /([0-9]+)/) {
|
||||
$critical = $1;
|
||||
} else {
|
||||
$critical = 10;
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = 60);
|
||||
if ($opt_w =~ /([0-9]+)/) {
|
||||
$warning = $1;
|
||||
} else {
|
||||
$warning = 5;
|
||||
}
|
||||
|
||||
# Guts go here, once we're through argument parsing and have warning and
|
||||
# critical thresholds.
|
||||
my $browser = LWP::UserAgent->new;
|
||||
|
||||
my @urls = (
|
||||
# This is the "Hit Counter", which continues to work if frontpage extensions
|
||||
# are 'uninstall'ed from the site, but not when they are 'fulluninstall'ed.
|
||||
{
|
||||
url => "_vti_bin/fpcount.exe?Page=_borders/right.htm|Image=4",
|
||||
mimetype => "image/gif",
|
||||
message => "None, or broken frontpage extensions on server, or virtual site 'fulluninstall'ed?",
|
||||
failtype => "CRITICAL"
|
||||
},
|
||||
# This is the "FrontPage Configuration Information" file, which is removed
|
||||
# when you 'uninstall' the extensions from a site.
|
||||
{
|
||||
url => "_vti_inf.html",
|
||||
mimetype => "text/html",
|
||||
message => "Someone 'uninstall'ed extensions on virtual site?",
|
||||
failtype => "WARNING"
|
||||
}
|
||||
);
|
||||
|
||||
print "FRONTPAGE: ";
|
||||
|
||||
foreach $temp (@urls) {
|
||||
$url = $temp->{'url'};
|
||||
$mimetype = $temp->{'mimetype'};
|
||||
$failtype = $temp->{'failtype'};
|
||||
$message = $temp->{'message'};
|
||||
$stime = time();
|
||||
$response=$browser->get("http://".$host."/".$url);
|
||||
$etime = time();
|
||||
$tt = $etime - $stime;
|
||||
|
||||
# If we got a server error, or unknown output type, report back as critical.
|
||||
if ($response->status_line !~ "^200") {
|
||||
print $message." (".$response->status_line.")\r\n";
|
||||
exit $ERRORS{$failtype};
|
||||
} elsif ($response->content_type !~ $mimetype) {
|
||||
print $message." (Wrong Content-type: ".$response->content_type.")\r\n";
|
||||
exit $ERRORS{$failtype};
|
||||
} else {
|
||||
# Because we're dealing with multiple URL's
|
||||
$rt += $tt;
|
||||
}
|
||||
|
||||
# Decide if the response time was critical or not.
|
||||
#
|
||||
if ($rt > $critical) {
|
||||
print "Response time ".$rt." over critical threshold ".$critical."\r\n";
|
||||
exit($ERRORS{'CRITICAL'});
|
||||
} elsif ($rt > $warning) {
|
||||
print "Response time ".$rt." over warning threshold ".$warning."\r\n";
|
||||
exit($ERRORS{'WARNING'});
|
||||
}
|
||||
}
|
||||
printf(" %s - %s second response time, ",$response->status_line, $rt);
|
||||
|
||||
# If all the required URL's give the right responses quick enough, then we
|
||||
# should be okay.
|
||||
exit($ERRORS{'OK'});
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $');
|
||||
print "Copyright (c) 2003 Kev Green\n";
|
||||
print "\n";
|
||||
print "FrontPage remains a copyright/trademark of Microsoft Corporation.\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<warn> = Unknown.\n";
|
||||
print "<crit> = Server error from FrontPage extensions.\n\n";
|
||||
support();
|
||||
}
|
209
contrib/check_hltherm.c
Normal file
209
contrib/check_hltherm.c
Normal file
|
@ -0,0 +1,209 @@
|
|||
/******************************************************************************************
|
||||
*
|
||||
* CHECK_HLTHERM.C
|
||||
*
|
||||
* Program: Hot Little Therm temperature plugin for Nagios
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: 02-28-2002
|
||||
*
|
||||
* Command line: check_hltherm <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This plugin checks the temperature of a given temperature probe on a
|
||||
* Hot Little Therm digital thermometer. The plugin uses the 'therm' utility
|
||||
* that is included with the HLT software to check the probe temperature. Both
|
||||
* the HLT digital thermometer and software are produced by Spiderplant. See
|
||||
* their website at http://www.spiderplant.com/hlt for more information.
|
||||
*
|
||||
*****************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "popen.h"
|
||||
|
||||
#define DEFAULT_TIMEOUT 10 /* default timeout in seconds */
|
||||
|
||||
#define HLTHERM_COMMAND "/usr/local/bin/therm" /* this should be moved out to the configure script */
|
||||
|
||||
|
||||
static void timeout_alarm_handler(int); /* author must provide */
|
||||
int process_arguments(int, char **);
|
||||
|
||||
int timeout_interval=DEFAULT_TIMEOUT;
|
||||
|
||||
double wtemp=0.0L;
|
||||
double ctemp=0.0L;
|
||||
|
||||
int check_lower_temps=FALSE;
|
||||
|
||||
char probe[MAX_INPUT_BUFFER]="";
|
||||
char label[MAX_INPUT_BUFFER]="Temperature";
|
||||
char scale[MAX_INPUT_BUFFER]="Degrees";
|
||||
|
||||
FILE *fp;
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int result=STATE_OK;
|
||||
char command[MAX_INPUT_BUFFER];
|
||||
double temp=0.0L;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
int found=0;
|
||||
|
||||
/* process command line arguments */
|
||||
result=process_arguments(argc,argv);
|
||||
|
||||
/* display usage if there was a problem */
|
||||
if(result==ERROR){
|
||||
printf("Incorrect arguments supplied\n");
|
||||
printf("\n");
|
||||
printf("Hot Little Therm temperature plugin for Nagios\n");
|
||||
printf("Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 02-28-2002\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" <wtemp> = Temperature necessary to result in a WARNING state\n");
|
||||
printf(" <ctemp> = Temperature necessary to result in a CRITICAL state\n");
|
||||
printf(" [label] = A descriptive label for the probe. Example: \"Outside Temp\"\n");
|
||||
printf(" [scale] = A descriptive label for the temperature scale. Example: \"Celsius\"\n");
|
||||
printf(" [-lower] = Evaluate temperatures with lower values being more critical\n");
|
||||
printf("\n");
|
||||
printf("This plugin checks the temperature of a given temperature probe on a\n");
|
||||
printf("Hot Little Therm digital thermometer. The plugin uses the 'therm' utility\n");
|
||||
printf("included with the HLT software to check the probe temperature. Both the\n");
|
||||
printf("HLT digital thermometer and software are produced by Spiderplant. See\n");
|
||||
printf("their website at http://www.spiderplant.com/hlt for more information.\n");
|
||||
printf("\n");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
result=STATE_OK;
|
||||
|
||||
/* Set signal handling and alarm */
|
||||
if(signal(SIGALRM,timeout_alarm_handler)==SIG_ERR){
|
||||
printf("Cannot catch SIGALRM");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* handle timeouts gracefully */
|
||||
alarm(timeout_interval);
|
||||
|
||||
/* create the command line we're going to use */
|
||||
snprintf(command,sizeof(command),"%s %s",HLTHERM_COMMAND,probe);
|
||||
command[sizeof(command)-1]='\x0';
|
||||
|
||||
/* run the command to check the temperature on the probe */
|
||||
fp=spopen(command);
|
||||
if(fp==NULL){
|
||||
printf("Could not open pipe: %s\n",command);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
if(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
found=1;
|
||||
temp=(double)atof(input_buffer);
|
||||
}
|
||||
|
||||
/* close the pipe */
|
||||
spclose(fp);
|
||||
|
||||
if(result==STATE_OK){
|
||||
|
||||
if(found==0){
|
||||
printf("Therm problem - Could not read program output\n");
|
||||
result=STATE_CRITICAL;
|
||||
}
|
||||
else{
|
||||
if(check_lower_temps==TRUE){
|
||||
if(temp<=ctemp)
|
||||
result=STATE_CRITICAL;
|
||||
else if(temp<=wtemp)
|
||||
result=STATE_WARNING;
|
||||
}
|
||||
else{
|
||||
if(temp>=ctemp)
|
||||
result=STATE_CRITICAL;
|
||||
else if(temp>=wtemp)
|
||||
result=STATE_WARNING;
|
||||
}
|
||||
|
||||
printf("Therm %s: %s = %2.1f %s\n",(result==STATE_OK)?"ok":"problem",label,temp,scale);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int process_arguments(int argc, char **argv){
|
||||
int x;
|
||||
|
||||
/* not enough options were supplied */
|
||||
if(argc<4)
|
||||
return ERROR;
|
||||
|
||||
/* first option is always the probe name */
|
||||
strncpy(probe,argv[1],sizeof(probe)-1);
|
||||
probe[sizeof(probe)-1]='\x0';
|
||||
|
||||
/* 2nd and 3rd options are temperature thresholds */
|
||||
wtemp=(double)atof(argv[2]);
|
||||
ctemp=(double)atof(argv[3]);
|
||||
|
||||
/* process all remaining arguments */
|
||||
for(x=5;x<=argc;x++){
|
||||
|
||||
/* we got the lower temperature option */
|
||||
if(!strcmp(argv[x-1],"-lower"))
|
||||
check_lower_temps=TRUE;
|
||||
|
||||
/* we got the label */
|
||||
else if(!strcmp(argv[x-1],"-l")){
|
||||
if(x<argc){
|
||||
strncpy(label,argv[x],sizeof(label));
|
||||
label[sizeof(label)-1]='\x0';
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* we got the scale */
|
||||
else if(!strcmp(argv[x-1],"-s")){
|
||||
if(x<argc){
|
||||
strncpy(scale,argv[x],sizeof(scale));
|
||||
scale[sizeof(scale)-1]='\x0';
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* else we got something else... */
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* handle timeouts gracefully... */
|
||||
static void timeout_alarm_handler(int signo){
|
||||
|
||||
if(signo==SIGALRM){
|
||||
|
||||
kill(childpid[fileno(fp)],SIGKILL);
|
||||
printf("Therm problem - Check timed out after %d seconds\n",timeout_interval);
|
||||
exit(STATE_CRITICAL);
|
||||
}
|
||||
}
|
221
contrib/check_hprsc.pl
Executable file
221
contrib/check_hprsc.pl
Executable file
|
@ -0,0 +1,221 @@
|
|||
#!/usr/bin/perl -wT
|
||||
#
|
||||
# Copyright (c) 2000 Hugo Gayosso
|
||||
#
|
||||
# Description:
|
||||
# Nagios plug-in that monitors the resources on an HP-UX machine
|
||||
# by querying the SNMP daemon
|
||||
#
|
||||
# License: General Public License (GPL)
|
||||
# http://www.gnu.org/copyleft/gpl.txt
|
||||
#
|
||||
# ChangeLog
|
||||
#
|
||||
|
||||
# Requirements: Perl 5.005 or higher
|
||||
|
||||
# Variable initialization
|
||||
$ENV{'PATH'}="";
|
||||
$ENV{'ENV'}="";
|
||||
$ENV{'BASH_ENV'}="";
|
||||
|
||||
|
||||
if (-e "/usr/bin/snmpwalk") {
|
||||
$snmpwalk = "/usr/bin/snmpwalk";
|
||||
} elsif (-e "/usr/local/bin/snmpwalk") {
|
||||
$snmpwalk = "/usr/local/bin/snmpwalk";
|
||||
}
|
||||
|
||||
|
||||
# HP-UX SNMP OIDs
|
||||
$filesystemID1_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.1";
|
||||
$mounted_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.3";
|
||||
$totalspace_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.4";
|
||||
$freespace_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.6";
|
||||
$path_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.10";
|
||||
$cpu_5min_OID = ".1.3.6.1.4.1.11.2.3.1.1.4";
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
GetOptions( "check-filesystem" => \$chk_fs,
|
||||
"show-filesystems" => \$show_fs,
|
||||
"check-filesystemID" => \$chk_fsid,
|
||||
"check-cpu" => \$chk_cpu,
|
||||
"host=s" => \$target_host,
|
||||
"community=s" => \$target_community,
|
||||
"filesystemID1=i" => \$fsid1_opt,
|
||||
"filesystem=s" => \$fs_opt,
|
||||
"protocol:s" => \$proto_opt,
|
||||
"warning=i" => \$warning_opt,
|
||||
"critical=i" => \$critical_opt);
|
||||
|
||||
$proto_opt = 1
|
||||
unless $proto_opt == 1 ||
|
||||
$proto_opt == '2c' ||
|
||||
$proto_opt == 3;
|
||||
|
||||
if ($chk_fs) {
|
||||
walk_data($snmpwalk, $target_host, $target_community, $mounted_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $totalspace_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $freespace_OID,$proto_opt ); check_filesystem($fs_opt, $warning_opt, $critical_opt);
|
||||
} elsif ($show_fs) {
|
||||
walk_data($snmpwalk, $target_host, $target_community, $filesystemID1_OID,$proto_opt);
|
||||
walk_data($snmpwalk, $target_host, $target_community, $mounted_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $path_OID,$proto_opt);
|
||||
show_filesystem();
|
||||
} elsif ($chk_fsid){
|
||||
$totalspace_fsID_OID = "$totalspace_OID.$fsid1_opt";
|
||||
$freespace_fsID_OID = "$freespace_OID.$fsid1_opt";
|
||||
walk_data($snmpwalk, $target_host, $target_community, $totalspace_fsID_OID,$proto_opt);
|
||||
walk_data($snmpwalk, $target_host, $target_community, $freespace_fsID_OID,$proto_opt);
|
||||
check_filesystemID1($fsid1_opt, $warning_opt, $critical_opt);
|
||||
} elsif ($chk_cpu) {
|
||||
get_cpu_load($snmpwalk, $target_host, $target_community, $cpu_5min_OID,$proto_opt);
|
||||
check_cpu_5min($cpu, $warning_opt, $critical_opt);
|
||||
} else {
|
||||
print "\n\nUsage:\n";
|
||||
print "Checking 5-min CPU Load:\n";
|
||||
print " $0 --check-cpu -warning <threshold> --critical <threshold> --host <yourhost> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking local filesystem mounted on a host:\n";
|
||||
print " $0 --show-filesystems --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking by filesystem name:\n";
|
||||
print " $0 --check-filesystem --filesystem </dev/vg00/lvol1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking by filesystem ID:\n";
|
||||
print " $0 --check-filesystemID --filesystemID <filesystemID1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
}
|
||||
|
||||
sub get_cpu_load {
|
||||
my ($snmpwalk, $target_host, $target_community, $OID,$vers) = @_;
|
||||
die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
|
||||
|
||||
if ($pid) { # parent
|
||||
while (<SNMPWALK>) {
|
||||
my @snmpdata = split(/:/,$_);
|
||||
$cpu = $snmpdata[1]/100;
|
||||
}
|
||||
close(SNMPWALK) or warn "kid exited $?";
|
||||
} else { # child
|
||||
exec($snmpwalk,'-c',$target_community,'-v',$vers,$target_host,$OID) or die "can't exec program: $!";
|
||||
}
|
||||
}
|
||||
|
||||
sub walk_data {
|
||||
#This function queries the SNMP daemon for the specific OID
|
||||
my ($snmpwalk, $target_host, $target_community, $OID,$vers) = @_;
|
||||
|
||||
die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
|
||||
|
||||
if ($pid) { # parent
|
||||
while (<SNMPWALK>) {
|
||||
$output = $_;
|
||||
sort_walk_data($output);
|
||||
}
|
||||
close(SNMPWALK) or warn "kid exited $?";
|
||||
} else { # child
|
||||
exec($snmpwalk,'-c',$target_community,'-v',$vers,$target_host,$OID) or die "can't exec program: $!";
|
||||
}
|
||||
}
|
||||
|
||||
sub sort_walk_data {
|
||||
my ($snmp_data) = @_;
|
||||
@fields = split(/\./,$snmp_data);
|
||||
$item = $fields[8];
|
||||
$filesystemID1 = $fields[9];
|
||||
@fields2 = split(/=/,$fields[10]);
|
||||
# $filesystemID2 = $fields2[0];
|
||||
$value = $fields2[1];
|
||||
chomp($value);
|
||||
if ($value =~ /"/) {
|
||||
@fields3 = split(/"/,$value);
|
||||
$value = $fields3[1];
|
||||
}
|
||||
if ($item == 3) {
|
||||
$mounted{$filesystemID1} = "$value";
|
||||
} elsif ($item == 4) {
|
||||
$totalspace{$filesystemID1} = "$value";
|
||||
} elsif ($item == 6) {
|
||||
$freespace{$filesystemID1} = "$value";
|
||||
} elsif ($item == 10) {
|
||||
$filesystempath{$filesystemID1} = "$value";
|
||||
}
|
||||
}
|
||||
|
||||
sub show_filesystem {
|
||||
print "\n\nfilesystemID1\tmounted filesystem\tfilesystem path\n";
|
||||
foreach $element (keys %mounted) {
|
||||
print "$element\t$mounted{$element}\t\t$filesystempath{$element}\n";
|
||||
}
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
sub check_filesystem {
|
||||
|
||||
# Warning = percentage of used space >= $warning and < $critical
|
||||
# Critical = percentage of used space > $warning and >= $critical
|
||||
# OK = percentage of used space < $warning and < $critical
|
||||
|
||||
my ($mounted_filesystem, $warning, $critical) = @_;
|
||||
foreach $element (keys %mounted) {
|
||||
if ($mounted{$element} eq $mounted_filesystem) {
|
||||
my $warning_result = $totalspace{$element}*(100-$warning)/100;
|
||||
my $critical_result = $totalspace{$element}*(100-$critical)/100;
|
||||
my $result_percent = $freespace{$element}*100/$totalspace{$element};
|
||||
if (($freespace{$element} <= $warning_result) && ($freespace{$element} > $critical_result)) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 1;
|
||||
} elsif ($freespace{$element} <= $critical_result) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 2;
|
||||
} else {
|
||||
printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$mounted_filesystem doesn't exist in $target_host\n\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
sub check_filesystemID1{
|
||||
# Warning = percentage of used space >= $warning and < $critical
|
||||
# Critical = percentage of used space > $warning and >= $critical
|
||||
# OK = percentage of used space < $warning and < $critical
|
||||
|
||||
my ($fsid1, $warning, $critical) = @_;
|
||||
foreach $element (keys %totalspace) {
|
||||
if ($element eq $fsid1) {
|
||||
my $warning_result = $totalspace{$element}*(100-$warning)/100;
|
||||
my $critical_result = $totalspace{$element}*(100-$critical)/100;
|
||||
my $result_percent = $freespace{$element}*100/$totalspace{$element};
|
||||
if (($freespace{$element} <= $warning_result) && ($freespace{$element} >= $critical_result)) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 1;
|
||||
} elsif ($freespace{$element} <= $critical_result) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 2;
|
||||
} else {
|
||||
printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$fsid1 doesn't exist in $target_host\n\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
sub check_cpu_5min {
|
||||
my ($cpu, $warn, $crit) = @_;
|
||||
if ($cpu >= $crit) {
|
||||
print "Critical- 5-min load: $cpu\n";
|
||||
exit 2;
|
||||
} elsif ($cpu >= $warn) {
|
||||
print "Warning - 5-min load: $cpu\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "Load ok - 5-min load: $cpu\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
1567
contrib/check_http-with-client-certificate.c
Normal file
1567
contrib/check_http-with-client-certificate.c
Normal file
File diff suppressed because it is too large
Load diff
66
contrib/check_hw.sh
Normal file
66
contrib/check_hw.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Tested on SuSE 9.1 Professional with the hwinfo-8.62-0.2 package installed.
|
||||
#
|
||||
# Before you can run this plugin, you must do:
|
||||
# /usr/sbin/hwinfo --short > /etc/hw.original
|
||||
# add to cron job:
|
||||
# /usr/sbin/hwinfo --short > /etc/hw.current
|
||||
# /usr/bin/diff /etc/hw.original /etc/hw.current > /tmp/hw.check
|
||||
#
|
||||
#
|
||||
# Rok Debevc -- rok.debevc@agenda.si
|
||||
#
|
||||
#
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||
REVISION=`echo '$Revision: 1.1 $' | sed -e 's/[^0-9.]//g'`
|
||||
|
||||
. $PROGPATH/utils.sh
|
||||
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $PROGNAME"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
print_revision $PROGNAME $REVISION
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "This plugin checks hardware changes."
|
||||
echo ""
|
||||
support
|
||||
exit 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
-h)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
-V)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
if `du /tmp/hw.check | cut -c 1|grep "^[0]" > /dev/null` ; then
|
||||
echo No hardware is changed
|
||||
exit 0
|
||||
else
|
||||
echo ***hardware is changed*** look into /tmp/hw.check
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
229
contrib/check_ica_master_browser.pl
Executable file
229
contrib/check_ica_master_browser.pl
Executable file
|
@ -0,0 +1,229 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id: check_ica_master_browser.pl,v 1.1 2005/01/25 09:09:33 stanleyhopcroft Exp $
|
||||
|
||||
# $Log: check_ica_master_browser.pl,v $
|
||||
# Revision 1.1 2005/01/25 09:09:33 stanleyhopcroft
|
||||
# New plugin - checks that ICA master browser is what it should be (important for firewalled dialup)
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Getopt::Long ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw(%ERRORS &print_revision &support &usage);
|
||||
use packet_utils qw(&pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_ica_master_browser' ;
|
||||
|
||||
# You might have to change this...
|
||||
|
||||
my $PACKET_TIMEOUT = 1;
|
||||
# Number of seconds to wait for further UDP packets
|
||||
my $TEST_COUNT = 2;
|
||||
# Number of datagrams sent without reply
|
||||
my $BUFFER_SIZE = 1500;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $ICA_PORT = 1604;
|
||||
# what port ICA runs on. Unlikely to change.
|
||||
|
||||
# End user config.
|
||||
|
||||
my ($debug, $preferred_master, $bcast_addr, $ica_browser, $timeout) ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$debug,
|
||||
"B|broadcast_addr:s" => \$bcast_addr,
|
||||
"I|ica_browser:s" => \$ica_browser,
|
||||
"P|preferred_master:s" => \$preferred_master,
|
||||
"T|Packet_timeout:i" => \$timeout,
|
||||
) ;
|
||||
|
||||
|
||||
my $broadcast_addr = $1 if $bcast_addr and $bcast_addr =~ m#(\d+\.\d+\.\d+\.\d+)# ;
|
||||
usage("Invalid broadcast address: $bcast_addr")
|
||||
if $bcast_addr and not defined($broadcast_addr) ;
|
||||
|
||||
usage("You must provide either the name of an ICA browser or the broadcast address of the subnet containing them\n")
|
||||
unless ($ica_browser or $broadcast_addr) ;
|
||||
|
||||
usage("You must provide the name or address of a preferred ICA master browser\n")
|
||||
unless ($preferred_master) ;
|
||||
|
||||
my $preferred_master_n = $preferred_master =~ m#(\d+\.\d+\.\d+\.\d+)#
|
||||
? $preferred_master
|
||||
: inet_ntoa(scalar gethostbyname($preferred_master)) ;
|
||||
|
||||
my $Timeout = $timeout || $PACKET_TIMEOUT ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# this info was gathered with tcpdump whilst trying to use an ICA client,
|
||||
# so I'm not 100% sure of what each value is.
|
||||
|
||||
my $bcast_helo = &tethereal(<<'End_of_Tethereal_trace', '1e') ;
|
||||
0020 ff ff 04 d6 06 44 00 26 4a 76 1e 00 01 30 02 fd .....D.&Jv...0..
|
||||
0030 a8 e3 00 02 f5 95 9f f5 30 07 00 00 00 00 00 00 ........0.......
|
||||
0040 00 00 00 00 00 00 01 00 ........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_helo = &tethereal(<<'End_of_Tethereal_trace', '20') ;
|
||||
0020 64 17 05 0f 06 44 00 28 ab b5 20 00 01 30 02 fd d....D.(.. ..0..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 00 00 00 00 ........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $Udp = IO::Socket::INET->new( Proto => 'udp' )
|
||||
|| die "Socket failure: $!";
|
||||
|
||||
# select is here to allow us to set timeouts on the connections. Otherwise they
|
||||
# just 'stop' until a server appears.
|
||||
|
||||
my $select = IO::Select->new($Udp)
|
||||
|| die "Select failure: $!";
|
||||
|
||||
$Udp->sockopt(SO_BROADCAST, 1 );
|
||||
|
||||
my ($remote_host, $buff, $destination, $raddr, $rport, $rhost, @remote_response);
|
||||
my ($query_message, $send_addr, $this_test) ;
|
||||
|
||||
$buff = '';
|
||||
$this_test = 0;
|
||||
|
||||
# If there is no response to the first helo packet it will be resent
|
||||
# up to $TEST_COUNT (see at the top).
|
||||
|
||||
$query_message = $broadcast_addr ? $bcast_helo : $direct_helo ;
|
||||
$destination = $broadcast_addr ? $broadcast_addr: $ica_browser ;
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($destination) ) ;
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
|
||||
print "Sending helo datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
|
||||
print "Querying $destination for master browser\n"
|
||||
if $debug ;
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr );
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
}
|
||||
|
||||
last
|
||||
if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
|
||||
# Ok we've looped several times, looking for a response. If we don't have one
|
||||
# yet, we simply mark the whole lot as being unavailable.
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to helo datagram (master browser query) from $destination.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
($rport, $raddr) = sockaddr_in( $remote_host );
|
||||
$rhost = gethostbyaddr( $raddr, AF_INET );
|
||||
my @tmpbuf = unpack('C*', $buff );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded with: ",length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
# Now we have a response, then we need to figure out the master browser, and
|
||||
# query it for published applications...
|
||||
|
||||
my $master_browser = join '.', @tmpbuf[32..35] ;
|
||||
my ($master_browser_a) = gethostbyaddr(inet_aton($master_browser), AF_INET) =~ /^(\w+?)\./ ;
|
||||
|
||||
# Ok should probably error check this, because it's remotely possible
|
||||
# that a server response might be completely wrong...
|
||||
|
||||
print "Master browser = $master_browser_a/$master_browser\n"
|
||||
if $debug ;
|
||||
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($master_browser));
|
||||
|
||||
my $subject_clause = $bcast_addr ? "of the \"$destination\" subnet" : "known to ICA server \"$destination\"" ;
|
||||
|
||||
if ( $master_browser eq $preferred_master_n ) {
|
||||
print "Preferred master browser \"$preferred_master\" __is__ the master browser (\"$master_browser_a/$master_browser\") $subject_clause.\n" ;
|
||||
exit $ERRORS{OK} ;
|
||||
} else {
|
||||
print "\"\u$preferred_master\" is __not__ the master browser (\"$master_browser_a/$master_browser\") $subject_clause: remote clients (dialup) may not find Published applications from Master Browser.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
close $Udp;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME (-B <broadcast_address>| -I <citrix_server>) - P <preferred_master_browser>" ;
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
print "Copyright (c) 2002 Ed Rolison/Tom De Blende/S Hopcroft
|
||||
|
||||
Perl Check Citrix Master Browser plugin for Nagios.
|
||||
|
||||
Returns OK if the Citrix master browser is that given by the -P option.
|
||||
|
||||
The plugin works by
|
||||
If the -B option is specified, sends a broadcast helo to find the address of the Citrix master browser in the specified subnet.
|
||||
return critical if there is no reply;
|
||||
Else if the -I option is specified
|
||||
send a direct helo to the specified server until there is a response (containing the address of the Citrix master browser)
|
||||
|
||||
|
||||
return Critical if the response does not contain the address of the 'preferred master browser' (-P option).
|
||||
return OK
|
||||
|
||||
How ICA Clients Use the Master ICA Browser.
|
||||
|
||||
Citrix ICA Clients must locate the master browser to get the address of a server or published application.
|
||||
|
||||
The Citrix ICA Client can locate the master browser by sending out broadcast packets, or,
|
||||
if the address of a Citrix server is specified in the Citrix ICA Client or in an ICA file,
|
||||
the ICA Client locates the master browser by sending directed packets to the specified address.
|
||||
The ICA Client requests the address of the ICA master browser from the Citrix server.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-B, --broadcast_address:STRING
|
||||
The broadcast address that should contain Citrix master browser. This option takes precedence over -I.
|
||||
-I, --ica_browser:STRING
|
||||
Optional name or address of an ICA server that could be the master browser (used when broadcast not possible).
|
||||
-P, --preferred_master:STRING
|
||||
Name or address of the ICA server that _should_ be the master browser.
|
||||
Required.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for UDP packets (default 1 sec).
|
||||
-v, --verbose
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
382
contrib/check_ica_metaframe_pub_apps.pl
Executable file
382
contrib/check_ica_metaframe_pub_apps.pl
Executable file
|
@ -0,0 +1,382 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id: check_ica_metaframe_pub_apps.pl,v 1.1 2005/01/25 09:07:39 stanleyhopcroft Exp $
|
||||
|
||||
# $Log: check_ica_metaframe_pub_apps.pl,v $
|
||||
# Revision 1.1 2005/01/25 09:07:39 stanleyhopcroft
|
||||
# Replacement (structured name mainly) for check_citrix: check of ICA browse service
|
||||
#
|
||||
# Revision 1.1 2005-01-25 17:00:24+11 anwsmh
|
||||
# Initial revision
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Getopt::Long ;
|
||||
|
||||
my ($bcast_addr, $timeout, $debug, @citrix_servers, $crit_pub_apps, $warn_pub_apps, $long_list) ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw(%ERRORS &print_revision &support &usage) ;
|
||||
use packet_utils qw(&pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_ica_metaframe_pub_apps' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
# You might have to change this...
|
||||
|
||||
my $PACKET_TIMEOUT = 1;
|
||||
# Number of seconds to wait for further UDP packets
|
||||
my $TEST_COUNT = 2;
|
||||
# Number of datagrams sent without reply
|
||||
my $BUFFER_SIZE = 1500;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $LONG_LIST = 0 ;
|
||||
# this is for if you have many published applications.
|
||||
# if you set it, it won't do any harm, but may slow the test
|
||||
# down a little. (Since it does a 'recv' twice instead of
|
||||
# once and therefore may have to wait for a timeout).
|
||||
my $ICA_PORT = 1604;
|
||||
# what port ICA runs on. Unlikely to change.
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$debug,
|
||||
"B|broadcast_addr:s" => \$bcast_addr,
|
||||
"C|citrix_servers:s" => \@citrix_servers,
|
||||
"L|long_list" => \$long_list,
|
||||
"P|crit_pub_apps:s" => \$crit_pub_apps,
|
||||
"T|Packet_timeout:i" => \$timeout,
|
||||
"W|warn_pub_apps:s" => \$warn_pub_apps,
|
||||
) ;
|
||||
|
||||
|
||||
my $broadcast_addr = $1 if $bcast_addr and $bcast_addr =~ m#(\d+\.\d+\.\d+\.\d+)# ;
|
||||
usage("Invalid broadcast address: $bcast_addr\n")
|
||||
if $bcast_addr and not defined($broadcast_addr) ;
|
||||
|
||||
usage("You must provide either the names of citrix servers or the broadcast address of the subnet containing them\n")
|
||||
unless (@citrix_servers or $broadcast_addr) ;
|
||||
|
||||
my @target = defined $broadcast_addr ? ($broadcast_addr) : @citrix_servers ;
|
||||
|
||||
usage("You must provide the names of the published applications that the Citrix browser should be advertising\n")
|
||||
unless $crit_pub_apps or $warn_pub_apps ;
|
||||
|
||||
my $Timeout = $timeout
|
||||
if defined $timeout ;
|
||||
$Timeout = $PACKET_TIMEOUT
|
||||
unless defined $Timeout ;
|
||||
$long_list = $LONG_LIST
|
||||
unless defined $long_list ;
|
||||
|
||||
my @crit_pub_apps = $crit_pub_apps ? split(/,/, $crit_pub_apps) : () ;
|
||||
my @warn_pub_apps = $warn_pub_apps ? split(/,/, $warn_pub_apps) : () ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# this info was gathered with tcpdump whilst trying to use an ICA client,
|
||||
# so I'm not 100% sure of what each value is.
|
||||
|
||||
my $bcast_helo = &tethereal(<<'End_of_Tethereal_trace', '1e') ;
|
||||
0020 ff ff 04 d6 06 44 00 26 4a 76 1e 00 01 30 02 fd .....D.&Jv...0..
|
||||
0030 a8 e3 00 02 f5 95 9f f5 30 07 00 00 00 00 00 00 ........0.......
|
||||
0040 00 00 00 00 00 00 01 00 .......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $bcast_query_app = &tethereal(<<'End_of_Tethereal_trace', '24') ;
|
||||
0020 64 17 04 50 06 44 00 2c 85 6a 24 00 01 32 02 fd d..P.D.,.j$..2..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 21 00 02 00 00 00 00 00 ......!......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_helo = &tethereal(<<'End_of_Tethereal_trace', '20') ;
|
||||
0020 64 17 05 0f 06 44 00 28 ab b5 20 00 01 30 02 fd d....D.(.. ..0..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 00 00 00 00 .........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_query_app = &tethereal(<<'End_of_Tethereal_trace', '2c') ;
|
||||
0020 64 17 05 10 06 44 00 34 7a 9a 2c 00 02 32 02 fd d....D.4z.,..2..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 21 00 02 00 01 00 00 00 00 00 ......!.........
|
||||
0050 00 00 00 00 00 00 ......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $Udp = IO::Socket::INET->new( Proto => 'udp' )
|
||||
|| die "Socket failure: $!";
|
||||
|
||||
# Select is here to allow us to set timeouts on the connections.
|
||||
# Otherwise they just 'stop' until a server appears.
|
||||
|
||||
my $select = IO::Select->new($Udp)
|
||||
|| die "Select failure: $!";
|
||||
# Helo needs to be broadcastt, but query does not.
|
||||
$Udp->sockopt(SO_BROADCAST, 1 );
|
||||
|
||||
my ($remote_host, $buff, $buff2, $raddr, $rport, $rhost, @remote_response);
|
||||
my ($query_message, $send_addr, $this_test) ;
|
||||
|
||||
$buff = $buff2 = '';
|
||||
$this_test = 0;
|
||||
|
||||
# If there is no response to the first helo packet it will be resent
|
||||
# up to TEST_COUNT (see at the top).
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
|
||||
print "Sending helo datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
|
||||
# If we have multiple targets, we probe each of them until we get a
|
||||
# response...
|
||||
|
||||
foreach my $destination (@target) {
|
||||
$query_message = $broadcast_addr ? $bcast_helo : $direct_helo ;
|
||||
print "Querying $destination for master browser\n"
|
||||
if $debug ;
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($destination) );
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr );
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
}
|
||||
|
||||
last
|
||||
if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# Ok we've looped several times, looking for a response. If we don't have one
|
||||
# yet, we simply mark the whole lot as being unavailable.
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to helo datagram (master browser query) from ", $broadcast_addr ? $broadcast_addr : "@citrix_servers", ".\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
($rport, $raddr) = sockaddr_in( $remote_host );
|
||||
$rhost = gethostbyaddr( $raddr, AF_INET );
|
||||
my @tmpbuf = unpack('C*', $buff );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded with: ", length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
# Now we have a response, then we need to figure out the master browser, and
|
||||
# query it for published applications...
|
||||
|
||||
my $master_browser = join '.', @tmpbuf[32..35] ;
|
||||
|
||||
# Ok should probably error check this, because it's remotely possible
|
||||
# that a server response might be completely wrong...
|
||||
|
||||
print "Master browser = $master_browser\n"
|
||||
if $debug ;
|
||||
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($master_browser));
|
||||
|
||||
if ( $broadcast_addr ) {
|
||||
print "using broadcast query\n"
|
||||
if $debug ;
|
||||
$query_message = $bcast_query_app;
|
||||
} else {
|
||||
print "using directed query\n"
|
||||
if $debug ;
|
||||
$query_message = $direct_query_app;
|
||||
}
|
||||
|
||||
# Now we send the appropriate query string, to the master browser we've found.
|
||||
|
||||
$buff = '';
|
||||
$this_test = 0 ;
|
||||
|
||||
print "Querying master browser for published application list\n"
|
||||
if $debug ;
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
print "Sending application query datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr);
|
||||
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
# $buff = substr($buff, 32) ;
|
||||
# Hope that ICA preamble is first 32 bytes
|
||||
}
|
||||
|
||||
# Long application lists are delivered in multiple packets
|
||||
|
||||
my $buff2 = '' ;
|
||||
while ( $long_list && $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff2, $BUFFER_SIZE, 0);
|
||||
$buff .= $buff2
|
||||
if $buff2 ;
|
||||
# $buff .= substr($buff2, 32) if $buff2 ;
|
||||
# Hope that ICA preamble is first 32 bytes
|
||||
}
|
||||
|
||||
last if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to application query datagram from ", $master_browser, ".\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
# we got a response from a couple of retries of the app query
|
||||
|
||||
($rport, $raddr) = sockaddr_in ( $remote_host );
|
||||
$rhost = gethostbyaddr ( $raddr, AF_INET );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded to app query with: ", length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
my $app_list = $buff ;
|
||||
# delete nulls in unicode
|
||||
# but only if there is unicode (usually from
|
||||
# broadcast query)
|
||||
|
||||
$app_list =~ s/(?:(\w| |-)\x00)/$1/g
|
||||
if $app_list =~ /(?:(?:(?:\w| |-)\x00){3,})/ ;
|
||||
# FIXME an application name is
|
||||
# 3 or more unicoded characters
|
||||
|
||||
# FIXME locale
|
||||
# extract null terminated strings
|
||||
|
||||
my (@clean_app_list, $clean_app_list) ;
|
||||
$clean_app_list = join(',', @clean_app_list = $app_list =~ m#([A-Za-z](?:\w| |-|[ÄÖÜäöüß])+?(?=\x00))#g ) ;
|
||||
|
||||
# patch for German umlauts et al from Herr Mike Gerber.
|
||||
|
||||
# $clean_app_list = join(',', @clean_app_list = $app_list =~ m#([A-Z](?:\w| |-)+?(?=\x00))#g ) ;
|
||||
|
||||
# FIXME everyones apps don't start with caps
|
||||
|
||||
print qq(Received list of applications: "$clean_app_list".\n)
|
||||
if $debug ;
|
||||
|
||||
if ( scalar @crit_pub_apps and my @missing = &simple_diff(\@clean_app_list, \@crit_pub_apps) ) {
|
||||
print qq(Failed. "@missing" not found in list of published applications),
|
||||
qq(" $clean_app_list" from master browser "$master_browser".\n) ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
if ( my @missing = &simple_diff(\@clean_app_list, \@warn_pub_apps) ) {
|
||||
print qq(Warning. "@missing" not found in list of published applications),
|
||||
qq(" $clean_app_list" from master browser "$master_browser".\n) ;
|
||||
exit $ERRORS{WARNING} ;
|
||||
}
|
||||
|
||||
my @x = (@crit_pub_apps, @warn_pub_apps) ;
|
||||
my $blah = ( scalar(@x) == 1
|
||||
? 'the published application "' . join(',', @x) . '" is available'
|
||||
: 'the published applications "' . join(',', @x) . '" are available' ) ;
|
||||
|
||||
print qq(Ok. Citrix master browser "$master_browser" reported that $blah.\n) ;
|
||||
exit $ERRORS{OK} ;
|
||||
|
||||
# sleep $Timeout;
|
||||
# because otherwise we can get responses from
|
||||
# the WRONG servers. DOH
|
||||
close $Udp;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME (-B <broadcast_address>| -C <citrix_server>..) -W <pub_app1,pub_app2..> -P <pub_app1,pub_app2,>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
print "Copyright (c) 2002 Ed Rolison/Tom De Blende/S Hopcroft
|
||||
|
||||
Perl Check Citrix plugin for Nagios.
|
||||
|
||||
Returns OK if the Citrix master browser returns a 'published application' list that contain names specified by the -W or -P options
|
||||
|
||||
The plugin works by
|
||||
If the -B option is specified, sending a broadcast helo to find the address of the Citrix master browser in the specified subnet.
|
||||
return critical if there is no reply;
|
||||
Else if the -C option is specified
|
||||
send a direct helo to the specified server until there is a response (containing the address of the Citrix master browser)
|
||||
|
||||
Query the master browser (using a 'broadcast published applications query ' if -B) and compare the published applications returned
|
||||
to those specified by -W and -P options
|
||||
|
||||
return Critical if the published applications specified by -P is not a subset of the query responses;
|
||||
return Warning if the published applications specified by -W is not a subset of the query responses;
|
||||
return OK
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-B, --broadcast_address=STRING
|
||||
The broadcast address that should contain Citrix master browser. This option takes precedence over -C.
|
||||
-C, --citrix_server:STRING
|
||||
Optional __name(s)__ of Citrix servers that could be the master browser (used when broadcast not possible).
|
||||
-L, --long_list
|
||||
Set this if you have heaps of published applications (ie more than will fit in _one_ UDP packet)
|
||||
-P, --crit_published_app=STRING
|
||||
Optional comma separated list of published application that must be in the response from the master browser.
|
||||
Check returns critical otherwise.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for UDP packets (default 1 sec).
|
||||
-W, --warn_published_app=STRING
|
||||
Optional comma separated list of published application that should be in the response from the master browser.
|
||||
Check returns warning otherwise.
|
||||
-v, --verbose
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
sub simple_diff {
|
||||
|
||||
my ( $a_list, $b_list) = @_ ;
|
||||
|
||||
# simple set difference 'Recipe 4.7 Perl Cookbook', Christiansen and Torkington
|
||||
|
||||
my (%seen, @missing) ;
|
||||
|
||||
@seen{@$a_list} = () ;
|
||||
|
||||
foreach my $item (@$b_list) {
|
||||
push @missing, $item
|
||||
unless exists $seen{$item} ;
|
||||
}
|
||||
|
||||
@missing ;
|
||||
}
|
||||
|
||||
|
||||
|
619
contrib/check_ica_program_neigbourhood.pl
Executable file
619
contrib/check_ica_program_neigbourhood.pl
Executable file
|
@ -0,0 +1,619 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id: check_ica_program_neigbourhood.pl,v 1.1 2005/01/25 09:05:53 stanleyhopcroft Exp $
|
||||
|
||||
# $Log: check_ica_program_neigbourhood.pl,v $
|
||||
# Revision 1.1 2005/01/25 09:05:53 stanleyhopcroft
|
||||
# New plugin to check Citrix Metaframe XP "Program Neighbourhood"
|
||||
#
|
||||
# Revision 1.1 2005-01-25 16:50:30+11 anwsmh
|
||||
# Initial revision
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use LWP 5.65 ;
|
||||
use XML::Parser ;
|
||||
|
||||
my $PROGNAME = 'check_program_neigbourhood' ;
|
||||
my ($debug, $xml_debug, $pn_server, $pub_apps, $app_servers, $server_farm, $usage) ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case') ;
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"A|published_app:s" => \$pub_apps,
|
||||
"h|help" => \&help,
|
||||
'usage|?' => \&usage,
|
||||
"F|server_farm=s" => \$server_farm,
|
||||
"P|pn_server=s" => \$pn_server,
|
||||
"S|app_server=s" => \$app_servers,
|
||||
"v|verbose" => \$debug,
|
||||
"x|xml_debug" => \$xml_debug,
|
||||
) ;
|
||||
|
||||
$pn_server || do {
|
||||
print "Name or IP Address of _one_ Program Neighbourhood server is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
$pub_apps ||= 'Word 2003' ;
|
||||
$pub_apps =~ s/["']//g ;
|
||||
my @pub_apps = split /,\s*/, $pub_apps ;
|
||||
|
||||
my @app_servers = split /,\s*/, $app_servers ;
|
||||
|
||||
@app_servers || do {
|
||||
print "IP Address of _each_ Application server in the Metaframe Citrix XP server farm is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
my @non_ip_addresses = grep ! /\d+\.\d+\.\d+\.\d+/, @app_servers ;
|
||||
|
||||
scalar(@non_ip_addresses) && do {
|
||||
print qq(Application servers must be specified by IP Address (not name): "@non_ip_addresses".\n) ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
$server_farm || do {
|
||||
print "Name of Citrix Metaframe XP server farm is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
my %xml_tag = () ;
|
||||
my @tag_stack = () ;
|
||||
|
||||
my $xml_p = new XML::Parser(Handlers => {Start => \&handle_start,
|
||||
End => sub { pop @tag_stack },
|
||||
Char => \&handle_char}) ;
|
||||
|
||||
# values required by Metaframe XP that don't appear to matter too much
|
||||
|
||||
my $client_host = 'Nagios server (http://www.Nagios.ORG)' ;
|
||||
my $user_name = 'nagios' ;
|
||||
my $domain = 'Nagios_Uber_Alles' ;
|
||||
|
||||
# end values required by Metaframe XP
|
||||
|
||||
my $nilpotent_req = <<'EOR' ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd"><NFuseProtocol version="1.1">
|
||||
<RequestProtocolInfo>
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
</RequestProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $server_farm_req = <<'EOR' ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestServerFarmData>
|
||||
<Nil />
|
||||
</RequestServerFarmData>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $spec_server_farm_req = <<EOR ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>
|
||||
<Name>
|
||||
<UnspecifiedName>$server_farm*</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>$client_host</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>$user_name</UserName>
|
||||
<Domain>$domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $app_req = <<EOR ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>
|
||||
<Name>
|
||||
<UnspecifiedName>PUBLISHED_APP_ENCODED</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>Nagios_Service_Check</ClientName>
|
||||
<ClientAddress addresstype="dns-port"/>
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>$PROGNAME</UserName>
|
||||
<Domain>$domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $ua = LWP::UserAgent->new ;
|
||||
my $req = HTTP::Request->new('POST', "http://$pn_server/scripts/WPnBr.dll") ;
|
||||
$req->content_type('text/xml') ;
|
||||
|
||||
my $svr ;
|
||||
|
||||
my @pubapp_encoded = map { my $x = $_ ; $x =~ s/(\W)/'&#' . ord($1) . ';'/eg; $x } @pub_apps ;
|
||||
|
||||
my $error_tag_cr = sub { ! exists($xml_tag{ErrorId}) } ;
|
||||
|
||||
my @app_reqs = (
|
||||
# { Content => url, Ok => ok_condition, Seq => \d+ }
|
||||
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 0 },
|
||||
{ Content => $server_farm_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerFarmName}) &&
|
||||
defined($xml_tag{ServerFarmName}) &&
|
||||
$xml_tag{ServerFarmName} eq $server_farm
|
||||
}, Seq => 2 },
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 4 },
|
||||
{ Content => $spec_server_farm_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerAddress}) &&
|
||||
defined($xml_tag{ServerAddress}) &&
|
||||
$xml_tag{ServerAddress} =~ /\d+\.\d+\.\d+\.\d+:\d+/
|
||||
}, Seq => 6 },
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 8 },
|
||||
{ Content => $app_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerAddress}) &&
|
||||
defined($xml_tag{ServerAddress}) &&
|
||||
(($svr) = split(/:/, $xml_tag{ServerAddress})) &&
|
||||
defined($svr) &&
|
||||
scalar(grep $_ eq $svr, @app_servers)
|
||||
}, Seq => 10 }
|
||||
) ;
|
||||
|
||||
my $app_location ;
|
||||
|
||||
foreach my $pub_app (@pub_apps) {
|
||||
|
||||
my $pubapp_enc = shift @pubapp_encoded ;
|
||||
my $app_req_tmp = $app_reqs[5]{Content} ;
|
||||
$app_reqs[5]{Content} =~ s/PUBLISHED_APP_ENCODED/$pubapp_enc/ ;
|
||||
|
||||
foreach (@app_reqs) {
|
||||
|
||||
$req->content($_->{Content}) ;
|
||||
|
||||
$debug && print STDERR "App: $pub_app Seq: $_->{Seq}\n", $req->as_string, "\n" ;
|
||||
|
||||
my $resp = $ua->request($req) ;
|
||||
|
||||
$debug && print STDERR "App: $pub_app Seq: ", $_->{Seq} + 1, "\n", $resp->as_string, "\n" ;
|
||||
|
||||
$resp->is_error && do {
|
||||
my $err = $resp->as_string ;
|
||||
$err =~ s/\n//g ;
|
||||
&outahere(qq(Failed. HTTP error finding $pub_app at seq $_->{Seq}: "$err")) ;
|
||||
} ;
|
||||
my $xml = $resp->content ;
|
||||
|
||||
my $xml_disp ;
|
||||
($xml_disp = $xml) =~ s/\n//g ;
|
||||
$xml_disp =~ s/ \s+/ /g ;
|
||||
|
||||
&outahere($resp->as_string)
|
||||
unless $xml ;
|
||||
|
||||
my ($xml_ok, $whine) = &valid_xml($xml_p, $xml) ;
|
||||
|
||||
$xml_ok || &outahere(qq(Failed. Bad XML finding $pub_app at eq $_->{Seq} in "$xml_disp".)) ;
|
||||
|
||||
&{$_->{Ok}} || &outahere(qq(Failed. \"\&\$_->{Ok}\" false finding $pub_app at seq $_->{Seq} in "$xml_disp".)) ;
|
||||
|
||||
# Ugly but alternative is $_->{Ok}->().
|
||||
# eval $_->{Ok} where $_->{Ok} is an
|
||||
# expression returning a bool is possible. but
|
||||
# sub { } prevent recompilation.
|
||||
|
||||
}
|
||||
|
||||
$app_reqs[5]{Content} = $app_req_tmp ;
|
||||
|
||||
$app_location .= qq("$pub_app" => $svr, ) ;
|
||||
|
||||
}
|
||||
|
||||
substr($app_location, -2, 2) = '' ;
|
||||
print qq(Ok. Citrix XML service located all published apps $app_location.\n) ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
|
||||
sub outahere {
|
||||
print "Citrix XML service $_[0]\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
sub valid_xml {
|
||||
my ($p, $input) = @_ ;
|
||||
|
||||
%xml_tag = () ;
|
||||
@tag_stack = () ;
|
||||
|
||||
eval {
|
||||
$p->parse($input)
|
||||
} ;
|
||||
|
||||
return (0, qq(XML::Parser->parse failed: Bad XML in "$input".!))
|
||||
if $@ ;
|
||||
|
||||
if ( $xml_debug ) {
|
||||
print STDERR pack('A4 A30 A40', ' ', $_, qq(-> "$xml_tag{$_}")), "\n"
|
||||
foreach (keys %xml_tag)
|
||||
}
|
||||
|
||||
return (1, 'valid xml')
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub handle_start {
|
||||
push @tag_stack, $_[1] ;
|
||||
|
||||
$xml_debug && print STDERR pack('A8 A30 A40', ' ', 'handle_start - tag', " -> '$_[1]'"), "\n" ;
|
||||
$xml_debug && print STDERR pack('A8 A30 A60', ' ', 'handle_start - @tag_stack', " -> (@tag_stack)"), "\n" ;
|
||||
}
|
||||
|
||||
sub handle_char {
|
||||
my $text = $_[1] ;
|
||||
|
||||
!($text =~ /\S/ || $text =~ /^[ \t]$/) && return ;
|
||||
|
||||
$text =~ s/\n//g ;
|
||||
|
||||
my $tag = $tag_stack[-1] ;
|
||||
|
||||
$xml_debug && print STDERR pack('A8 A30 A30', ' ', 'handle_char - tag', " -> '$tag'"), "\n" ;
|
||||
$xml_debug && print STDERR pack('A8 A30 A40', ' ', 'handle_char - text', " -> '$text'"), "\n" ;
|
||||
|
||||
$xml_tag{$tag} .= $text ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub print_help() {
|
||||
|
||||
# 1 2 3 4 5 6 7 8
|
||||
#12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
|
||||
my $help = <<EOHELP ;
|
||||
Copyright (c) 2004 Karl DeBisschop/S Hopcroft
|
||||
|
||||
$PROGNAME -P <pn_server> -S <svr1,svr2,..> -A <app1,app2,..>
|
||||
-F <Farm> [-v -x -h -V]
|
||||
|
||||
Check the Citrix Metaframe XP service by completing an HTTP dialogue with a Program
|
||||
Neigbourhood server (pn_server) that returns an ICA server in the named Server farm
|
||||
hosting the specified applications (an ICA server in a farm which runs some MS app).
|
||||
EOHELP
|
||||
|
||||
print $help ;
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
support();
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
|
||||
# 1 2 3 4 5 6 7 8
|
||||
#12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
my $usage = <<EOUSAGE ;
|
||||
$PROGNAME
|
||||
[-P | --pn_server] The name or address of the Citrix Metaframe XP
|
||||
Program Neigbourhood server (required).
|
||||
[-A | --pub_apps] The name or names of an application published by the
|
||||
server farm (default 'Word 2003').
|
||||
[-F | --server_farm] The name of a Citrix Metaframe XP server farm. (required)
|
||||
[-S | --app_servers] The _IP addresses_ of _all_ of the Farms ICA servers expected
|
||||
to host the published application.
|
||||
Enter as a comma separated string eg 'Srv1, Svr2, ..,Srvn'.
|
||||
Since the PN servers round-robin the app servers to the clients,
|
||||
_all_ the server farm addresses must be specified or the check
|
||||
will fail (required).
|
||||
[-v | --verbose]
|
||||
[-h | --help]
|
||||
[-x | --xml_debug]
|
||||
[-V | --version]
|
||||
EOUSAGE
|
||||
|
||||
print $usage ;
|
||||
|
||||
}
|
||||
|
||||
sub usage {
|
||||
&print_usage ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
=begin comment
|
||||
|
||||
This is the set of requests and responses transmitted between a Citrix Metaframe XP Program Neigbourhood (PN) client and a PN server.
|
||||
|
||||
This dialogue was captured by and reconstructed from tcpdump.
|
||||
|
||||
Citrix are not well known for documenting their protocols although the DTD may be informative. Note that the pair(s) 0 and 1, 4 and 5, ...
|
||||
do not appear to do anything.
|
||||
|
||||
req 0
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
|
||||
|
||||
resp 1
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 2
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 191
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestServerFarmData><Nil /></RequestServerFarmData></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
|
||||
|
||||
resp 3
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 293
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseServerFarmData>
|
||||
<ServerFarmData>
|
||||
<ServerFarmName>FOOFARM01</ServerFarmName>
|
||||
</ServerFarmData>
|
||||
</ResponseServerFarmData>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 4
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:55 GMT
|
||||
|
||||
|
||||
resp 5
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:55 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 6
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 442
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress><Name>i
|
||||
<UnspecifiedName>FOOFARM01*</UnspecifiedName>
|
||||
</Name><ClientName>WS09535</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>foo-user</UserName>
|
||||
<Domain>some-domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:56 GMT
|
||||
|
||||
|
||||
resp 7
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:56 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 507
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ServerAddress addresstype="dot-port">10.1.2.2:1494</ServerAddress>
|
||||
<ServerType>win32</ServerType>
|
||||
<ConnectionType>tcp</ConnectionType>
|
||||
<ClientType>ica30</ClientType>
|
||||
<TicketTag>10.1.2.2</TicketTag>
|
||||
<SSLRelayAddress addresstype="dns-port">ica_svr01.some.domain:443</SSLRelayAddress>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 8
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
|
||||
|
||||
resp 9
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 10
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 446
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>i
|
||||
<Name>
|
||||
<UnspecifiedName>EXCEL#32;2003</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>WS09535</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials><UserName>foo-user</UserName>
|
||||
<Domain>some-domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>i
|
||||
</NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
|
||||
|
||||
resp 11
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 509
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ServerAddress addresstype="dot-port">10.1.2.14:1494</ServerAddress>
|
||||
<ServerType>win32</ServerType>
|
||||
<ConnectionType>tcp</ConnectionType>
|
||||
<ClientType>ica30</ClientType>
|
||||
<TicketTag>10.1.2.14</TicketTag>
|
||||
<SSLRelayAddress addresstype="dns-port">ica_svr02.some.domain:443</SSLRelayAddress>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
** One sees this XML on an error (there may well be other error XML also, but I haven't seen it) **
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ErrorId>unspecified</ErrorId>
|
||||
<BrowserError>0x0000000E</BrowserError>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
# You never know when you may be embedded ...
|
||||
|
||||
|
127
contrib/check_inodes-freebsd.pl
Normal file
127
contrib/check_inodes-freebsd.pl
Normal file
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# check_inodes.pl for FreeBSD
|
||||
# Designed on FreeBSD 4.6 (although this should not matter)
|
||||
# parses df output, splits, and then takes variables
|
||||
# df.pl -f mountpoint -w warningnumber -c critical number
|
||||
# USE NUMBERS AND NOT PERCENTS FOR wanring and critical values
|
||||
# -h is help
|
||||
# -v is version
|
||||
# Mountpoints:
|
||||
# like / or /usr or /var (whatever you mount drives NOT the device names)
|
||||
# Andrew Ryder - 20020804 - atr@mrcoffee.org
|
||||
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_f $verbose $PROGNAME);
|
||||
use lib "/usr/local/libexec/nagios" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
my $df = "/bin/df";
|
||||
my $grep = "/usr/bin/grep";
|
||||
|
||||
$PROGNAME="df.pl";
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
|
||||
|
||||
$ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"f=s" => \$opt_f, "filesystem=s" => \$opt_f);
|
||||
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = 50);
|
||||
my $warning = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = 75);
|
||||
my $critical = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
|
||||
if ($opt_c < $opt_w) {
|
||||
print "Critical offset should be larger than warning offset\n";
|
||||
print_usage();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
($opt_f) || ($opt_f = "/");
|
||||
|
||||
|
||||
unless (-e $df) {
|
||||
print "UNKNOWN: $df is not where df is\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
unless (-e $grep) {
|
||||
print "UNKNOWN: $grep is not where grep is\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
unless (-d $opt_f) {
|
||||
print "UNKNOWN: $opt_f is not a mount point\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
|
||||
my $state = $ERRORS{'UNKNOWN'};
|
||||
my $answer;
|
||||
|
||||
open(DF, "$df -i $opt_f| $grep -v Filesystem |");
|
||||
|
||||
while (<DF>) {
|
||||
|
||||
my ($fs,$onek,$used,$avail,$capacity,$iused,$ifree,$ipercent,$mounted) = split;
|
||||
$ipercent =~ s/%//s;
|
||||
|
||||
if ($ipercent > $opt_w) {
|
||||
$state = $ERRORS{'WARNING'};
|
||||
$answer = "WARNING: $ipercent percent inodes free on $opt_f\n";
|
||||
} elsif ($ipercent > $opt_w) {
|
||||
$state = $ERRORS{'CRITCAL'};
|
||||
$answer = "CRITICAL: $ipercent percent inodes free on $opt_f\n";
|
||||
} elsif ($ipercent < $opt_w) {
|
||||
$state = $ERRORS{'OK'};
|
||||
$answer = "OK: $ipercent percent inodes free on $opt_f\n";
|
||||
}
|
||||
}
|
||||
|
||||
close(DF);
|
||||
|
||||
print "$answer";
|
||||
exit $state;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME <filesystem> [-w <warn>] [-c <crit>]\n";
|
||||
print "Example: $PROGNAME /dev/ad0s1a -w 50 -c 75\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $');
|
||||
print "Copyright (c) 2002 Andrew Ryder\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<warn> = Inode Percent at which a warning message is returned. Defaults to 50.\n";
|
||||
print "<crit> = Inode Percent at which a critical message is returned..\n Defaults to 75.\n\n";
|
||||
support();
|
||||
}
|
||||
|
||||
|
69
contrib/check_inodes.pl
Executable file
69
contrib/check_inodes.pl
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/perl
|
||||
##############################################################################
|
||||
# This plugin uses df to gather filesystem statistics and check the percent #
|
||||
# used of inodes. I've put a switch in here since i've got both aix and #
|
||||
# linux systems...adjust for your syntax's results. #
|
||||
# Note: the percentages passed in MUST NOT have % after them #
|
||||
# No warranty is either implied, nor expressed herein. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
$filesystem = $ARGV[0];
|
||||
$warnpercent = $ARGV[1];
|
||||
$critpercent = $ARGV[2];
|
||||
|
||||
#------Find out what kind of syntax to expect
|
||||
$systype=`uname`;
|
||||
chomp($systype);
|
||||
|
||||
#------Make sure we got called with the right number of arguments
|
||||
#------you could also put a check in here to make sure critical level is
|
||||
#------greater than warning...but what the heck.
|
||||
die "Usage: check_inodes filesystem warnpercent critpercent" unless @ARGV;
|
||||
|
||||
if ($#ARGV < 2) {
|
||||
die "Usage: check_inodes filesystem warnpercent critpercent";
|
||||
}#end if
|
||||
|
||||
#------This gets the data from the df command
|
||||
$inputline = `df -i $filesystem|grep -v "Filesystem"`;
|
||||
|
||||
#------replaces all spaces with a single :, that way we can use split
|
||||
$inputline =~ y/ /:/s;
|
||||
|
||||
#------different oses give back different sets of columns from the df -i
|
||||
#------(at least mine do). This way I can use this plugin on all my hosts
|
||||
#------if neither of these work, add your own in, or if you've got one that
|
||||
#------just flat out reports something different...well...perl is your friend.
|
||||
SWITCH: {
|
||||
if ($systype eq "Linux") {
|
||||
($fs,$inodes,$iused,$ifree,$ipercent,$mntpt) = split(/:/,$inputline);
|
||||
last SWITCH;
|
||||
}#end if
|
||||
if ($systype eq "AIX") {
|
||||
($fs,$blks,$free,$percentused,$iused,$ipercent,$mntpt) = split(/:/,$inputline);
|
||||
last SWITCH;
|
||||
}#end if
|
||||
}#end switch
|
||||
|
||||
#------First we check for critical, since that is, by definition and convention
|
||||
#------going to exceed the warning threshold
|
||||
$ipercent =~ y/%//ds;
|
||||
|
||||
if ($ipercent > $critpercent) {
|
||||
print "CRITICAL: $filesystem inode use exceeds critical threshold $critpercent ($ipercent)";
|
||||
exit 1;
|
||||
}# end if
|
||||
|
||||
#------Next we check the warning threshold
|
||||
if ($ipercent > $warnpercent) {
|
||||
print "WARNING: $filesystem inode use exceeds warning threshold $warnpercent ($ipercent)";
|
||||
exit 2;
|
||||
}# end if
|
||||
|
||||
|
||||
#------thanks to the magic of procedural programming, we figure if we got here,
|
||||
#------everything MUST be fine.
|
||||
print "$filesystem inode use within limits ($ipercent)";
|
||||
exit 0;
|
||||
|
201
contrib/check_ipxping.c
Normal file
201
contrib/check_ipxping.c
Normal file
|
@ -0,0 +1,201 @@
|
|||
/******************************************************************************************
|
||||
*
|
||||
* CHECK_IPXPING.C
|
||||
*
|
||||
* Program: IPX ping plugin for Nagios
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: 09-24-1999
|
||||
*
|
||||
* Command line: CHECK_IPXPING <dest_network> <dest_address> <wrtt> <crtt>
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This plugin will use the /usr/bin/ipxping command to ping the specified host using the
|
||||
* IPX protocol. Note: Linux users must have IPX support compiled into the kernerl and
|
||||
* must have IPX configured correctly in order for this plugin to work.
|
||||
* If the round trip time value is above the <wrtt> level, a STATE_WARNING is
|
||||
* returned. If it exceeds the <crtt> level, a STATE_CRITICAL is returned.
|
||||
*
|
||||
*
|
||||
*
|
||||
* IMPORTANT!!
|
||||
*
|
||||
* This plugin will only work with the ipxping command that has been ported to Linux.
|
||||
* The version for Sun takes different command line arguments and differs in its output.
|
||||
*
|
||||
*****************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "popen.h"
|
||||
|
||||
/* this should be moved out to the configure script! */
|
||||
#define IPXPING_COMMAND "/tmp/ipxping/ipxping"
|
||||
|
||||
/* these should be moved to the common header file */
|
||||
#define MAX_IPXNET_ADDRESS_LENGTH 12
|
||||
#define MAX_IPXHOST_ADDRESS_LENGTH 18
|
||||
|
||||
int socket_timeout=DEFAULT_SOCKET_TIMEOUT;
|
||||
char dest_network[MAX_IPXNET_ADDRESS_LENGTH];
|
||||
char dest_address[MAX_IPXHOST_ADDRESS_LENGTH];
|
||||
int wrtt;
|
||||
int crtt;
|
||||
|
||||
int process_arguments(int,char **);
|
||||
|
||||
FILE * spopen(const char *);
|
||||
int spclose(FILE *);
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char command_line[MAX_INPUT_BUFFER];
|
||||
int rtt;
|
||||
int bytes_returned;
|
||||
int result=STATE_OK;
|
||||
FILE *fp;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *substr;
|
||||
int current_line;
|
||||
|
||||
if(process_arguments(argc,argv)!=OK){
|
||||
printf("Incorrect arguments supplied\n");
|
||||
printf("\n");
|
||||
printf("IPX ping plugin for Nagios\n");
|
||||
printf("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 09-24-1999\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <dest_network> <dest_address> <wrtt> <crtt> [-to to_sec]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" <dest_network> = IPX network that the remote host lies on. (Hex Format - 00:00:00:00)\n");
|
||||
printf(" <dest_address> = MAC address of the remote host. (Hex Format - 00:00:00:00:00:00)\n");
|
||||
printf(" <wrtt> = Round trip time in milliseconds necessary to result in a WARNING state\n");
|
||||
printf(" <crtt> = Round trip time in milliseconds necessary to result in a CRITICAL state\n");
|
||||
printf(" [to_sec] = Seconds before we should timeout waiting for ping result. Default = %d sec\n",DEFAULT_SOCKET_TIMEOUT);
|
||||
printf("\n");
|
||||
printf("Notes:\n");
|
||||
printf("This plugin will use the /usr/bin/ipxping command to ping the specified host using\n");
|
||||
printf("the IPX protocol. IPX support must be compiled into the kernel and your host must\n");
|
||||
printf("be correctly configured to use IPX before this plugin will work! An RPM package of\n");
|
||||
printf("the ipxping binary can be found at...\n");
|
||||
printf("http://www.rpmfind.net/linux/RPM/contrib/libc5/i386/ipxping-0.0-2.i386.shtml\n");
|
||||
printf("\n");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* create the command line to use... */
|
||||
sprintf(command_line,"%s %s %s",IPXPING_COMMAND,dest_network,dest_address);
|
||||
|
||||
/* initialize alarm signal handling */
|
||||
signal(SIGALRM,socket_timeout_alarm_handler);
|
||||
|
||||
/* set socket timeout */
|
||||
alarm(socket_timeout);
|
||||
|
||||
/* run the command */
|
||||
fp = spopen(command_line);
|
||||
if(fp==NULL){
|
||||
printf("Unable to open pipe: %s",command_line);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
current_line=0;
|
||||
while(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
|
||||
current_line++;
|
||||
|
||||
/* skip the first line of the output */
|
||||
if(current_line==1)
|
||||
continue;
|
||||
|
||||
/* we didn't get the "is alive" */
|
||||
if(current_line==2 && !strstr(input_buffer,"is alive"))
|
||||
result=STATE_CRITICAL;
|
||||
|
||||
/* get the round trip time */
|
||||
if(current_line==3){
|
||||
substr=strtok(input_buffer,":");
|
||||
substr=strtok(NULL,"\n");
|
||||
rtt=atoi(substr);
|
||||
}
|
||||
|
||||
/* get the number of bytes returned */
|
||||
if(current_line==4 && strstr(input_buffer,"bytes returned")){
|
||||
bytes_returned=atoi(input_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* close the pipe */
|
||||
spclose(fp);
|
||||
|
||||
/* reset the alarm */
|
||||
alarm(0);
|
||||
|
||||
if(current_line==1 || result==STATE_CRITICAL)
|
||||
printf("IPX Ping problem - No response from host\n");
|
||||
else{
|
||||
|
||||
if(rtt>crtt)
|
||||
result=STATE_CRITICAL;
|
||||
else if(rtt>wrtt)
|
||||
result=STATE_WARNING;
|
||||
|
||||
printf("IPX Ping %s - RTT = %d ms, %d bytes returned from %s %s\n",(result==STATE_OK)?"ok":"problem",rtt,bytes_returned,dest_network,dest_address);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* process all arguments passed on the command line */
|
||||
int process_arguments(int argc, char **argv){
|
||||
int x;
|
||||
|
||||
/* no options were supplied */
|
||||
if(argc<5)
|
||||
return ERROR;
|
||||
|
||||
/* get the destination network address */
|
||||
strncpy(dest_network,argv[1],sizeof(dest_network)-1);
|
||||
dest_network[sizeof(dest_network)-1]='\x0';
|
||||
|
||||
/* get the destination host address */
|
||||
strncpy(dest_address,argv[2],sizeof(dest_address)-1);
|
||||
dest_address[sizeof(dest_address)-1]='\x0';
|
||||
|
||||
/* get the round trip time variables */
|
||||
wrtt=atoi(argv[3]);
|
||||
crtt=atoi(argv[4]);
|
||||
|
||||
/* process remaining arguments */
|
||||
for(x=6;x<=argc;x++){
|
||||
|
||||
/* we got the timeout to use */
|
||||
if(!strcmp(argv[x-1],"-to")){
|
||||
if(x<argc){
|
||||
socket_timeout=atoi(argv[x]);
|
||||
if(socket_timeout<=0)
|
||||
return ERROR;
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* else we got something else... */
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
278
contrib/check_javaproc.pl
Normal file
278
contrib/check_javaproc.pl
Normal file
|
@ -0,0 +1,278 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
#
|
||||
# Author: Wim Rijnders, 17-10-2002
|
||||
#
|
||||
# Description:
|
||||
# -----------
|
||||
#
|
||||
# Nagios host script to check if any specified java processes are running.
|
||||
#
|
||||
# Implementation Notes:
|
||||
# ---------------------
|
||||
#
|
||||
# check_disk_smb was used as a starting point, since it was written in perl.
|
||||
#
|
||||
# This script has been created and tested on Linux RH 7.1.
|
||||
#
|
||||
# I tried OS-X Darwin (BSD), but the ps command works differently.
|
||||
# Notably, you can't get a combined list of child processes. The best approach
|
||||
# appears to be to use 'ps -wwaxo command' combined with 'ps -M' (or suchlike)
|
||||
#
|
||||
########################################################################
|
||||
####
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_w $opt_c $verbose $classname);
|
||||
use vars qw($PROGNAME);
|
||||
use lib "utils.pm" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
|
||||
$PROGNAME="check_javaprocs";
|
||||
sub getJavaList ();
|
||||
sub check_ranges ($ $ $ $);
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$verbose,
|
||||
"w|warning=s" => \$opt_w,
|
||||
"c|critical=s" => \$opt_c,
|
||||
"n|name=s" => \$classname
|
||||
);
|
||||
|
||||
|
||||
my $state = 'OK';
|
||||
my $min_warn = undef
|
||||
my $max_warn = undef;
|
||||
my $min_crit = undef;
|
||||
my $max_crit = undef;
|
||||
|
||||
|
||||
($opt_w) || ($opt_w = shift);
|
||||
check_ranges($opt_w,\$min_warn, \$max_warn, "warning");
|
||||
($opt_c) || ($opt_c = shift);
|
||||
check_ranges($opt_c,\$min_crit, \$max_crit, "critical");
|
||||
|
||||
|
||||
#
|
||||
# Determine # of running processes for the java programs that interest us.
|
||||
#
|
||||
my @javalist = getJavaList();
|
||||
|
||||
my $total = 0;
|
||||
my $msgout = "";
|
||||
my @fields;
|
||||
|
||||
if ( defined $classname ) {
|
||||
|
||||
#filter out a single java process based on class name
|
||||
foreach (@javalist) {
|
||||
@fields = split(/\s+/, $_);
|
||||
$total = $fields[-1] and last if $classname eq $fields[0];
|
||||
}
|
||||
$msgout .= "$total processes for $classname\n";
|
||||
} else {
|
||||
#Handle all java processes
|
||||
$msgout .= "\n";
|
||||
foreach (@javalist) {
|
||||
@fields = split(/\s+/, $_);
|
||||
|
||||
$total += $fields[-1];
|
||||
$msgout .= " $fields[-1] processes for ";
|
||||
$msgout .= (scalar @fields > 1)? $fields[0] : "unknown" ;
|
||||
$msgout .= "\n";
|
||||
}
|
||||
my $msgtotal = "$total java processes for ". scalar @javalist . " applications";
|
||||
|
||||
if ( defined $verbose ) {
|
||||
$msgout = $msgtotal . $msgout;
|
||||
} else {
|
||||
$msgout = $msgtotal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Set the state with the data we now have accumulated
|
||||
# Note that due to the order of testing, warnings have precedence over
|
||||
# criticals. This is logical, since you should be able to create a criticals
|
||||
# range which encompasses a warning range. eg. following should be possible:
|
||||
#
|
||||
# check_javaproc -w 5:10 -c 3:12
|
||||
# proper specification of the ranges is the responsibility of the script user.
|
||||
#
|
||||
$state = 'CRITICAL' if (defined $min_crit && $total < $min_crit);
|
||||
$state = 'CRITICAL' if (defined $max_crit && $total > $max_crit);
|
||||
$state = 'CRITICAL' if (!defined $min_crit && !defined $max_crit && $total==0 );
|
||||
$state = 'WARNING' if (defined $min_warn && $total < $min_warn);
|
||||
$state = 'WARNING' if (defined $max_warn && $total > $max_warn);
|
||||
|
||||
print $msgout;
|
||||
print "$state\n" if ($verbose);
|
||||
exit $ERRORS{$state};
|
||||
|
||||
###################################
|
||||
# Support routines for Nagios
|
||||
###################################
|
||||
sub check_ranges($$$$) {
|
||||
my ($opt, $min, $max, $rangename) = @_;
|
||||
|
||||
if ( defined $opt ) {
|
||||
if ( $opt =~ /^([0-9]*)\:([0-9]*)$/) {
|
||||
$$min = $1 if $1 > 0;
|
||||
$$max= $2 if $2 > 0;
|
||||
} else {
|
||||
usage("Invalid $rangename range: $opt\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined $$min && defined $$max ) {
|
||||
usage("Min value of $rangename range larger than max value: $opt\n") if ( $$min > $$max);
|
||||
}
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME [-v] [-w <min:max>] [-c <min:max>] [ -n <classname>]\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
revision();
|
||||
print "Copyright (c) 2002 by Wim Rijnders
|
||||
|
||||
Perl Check java processes plugin for Nagios
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print "
|
||||
-v, --verbose
|
||||
Return additional information.
|
||||
Intended as a command-line aid, not recommended for Nagios script usage.
|
||||
|
||||
-w, --warning=INTEGER:INTEGER
|
||||
Minimum and maximum number of processes outside of which a warning will be
|
||||
generated. If omitted, no warning is generated.
|
||||
|
||||
-c, --critical=INTEGER:INTEGER
|
||||
Minimum and maximum number of processes outside of which a critical will be
|
||||
generated. If omitted, a critical is generated if no processes are running.
|
||||
|
||||
-n, --name=STRING
|
||||
Name of class specified on the java command line (from which main() is run).
|
||||
If omitted, all java processes are taken into account.
|
||||
|
||||
";
|
||||
support();
|
||||
}
|
||||
|
||||
sub revision() {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
}
|
||||
|
||||
sub version () {
|
||||
revision();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
###################################
|
||||
# Routines for delivering the data
|
||||
###################################
|
||||
|
||||
#
|
||||
# Generate a formatted list of running java processes.
|
||||
#
|
||||
# Returns an array of strings having the following syntax:
|
||||
#
|
||||
# <java class running as main> <parameters if any> <#processes for this class>
|
||||
#
|
||||
sub getJavaList() {
|
||||
|
||||
my @output;
|
||||
|
||||
# Untaint
|
||||
local $ENV{'PATH'} = '/bin:/usr/bin';
|
||||
local $ENV{'BASH_ENV'} = '~/.bashrc';
|
||||
|
||||
# We are only interested in the full command line
|
||||
# The -H opstion is important for the order of the processes;
|
||||
# this option ensures that all child processes are listed under
|
||||
# their parents
|
||||
@output=`ps -AHo \"\%a\" -ww`;
|
||||
|
||||
#remove preceding whitespace and final EOL
|
||||
foreach (@output) {
|
||||
s/^\s*//;
|
||||
chop;
|
||||
}
|
||||
|
||||
#Combine any consecutive processes with exactly the same command line
|
||||
#into a single item
|
||||
@output = checkSameLine(@output);
|
||||
|
||||
#Filter out all java processes
|
||||
my @javalist;
|
||||
for (my $i = 0; $i < scalar @output; ++$i) {
|
||||
push @javalist, $output[$i] if $output[$i] =~ /^\S*java/;
|
||||
}
|
||||
|
||||
foreach (@javalist) {
|
||||
#The java statement at the beginning is redundant; remove it
|
||||
s/^\S*java//;
|
||||
|
||||
#remove all defines
|
||||
s/\-D\S+//g;
|
||||
|
||||
#remove classpath
|
||||
s/\-(classpath|cp)\s+\S+//g;
|
||||
|
||||
#remove any other parameters we don't want to see
|
||||
s/\-server\s+//g;
|
||||
s/\-X\S*\s+//g;
|
||||
|
||||
#remove any redundant whitespaces at the beginning
|
||||
s/^\s+//;
|
||||
|
||||
}
|
||||
|
||||
@javalist;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Combine all consecutive lines with an identical command line
|
||||
# to a signle line with a count at the end
|
||||
#
|
||||
sub checkSameLine {
|
||||
my @input = @_;
|
||||
my @output;
|
||||
my $prevline= "";
|
||||
my $prevcount = 0;
|
||||
|
||||
foreach my $a (@input) {
|
||||
if ( $prevline eq $a) {
|
||||
++$prevcount;
|
||||
} else {
|
||||
push @output, $prevline . " " . ($prevcount + 1);
|
||||
$prevcount = 0;
|
||||
}
|
||||
$prevline = $a;
|
||||
}
|
||||
|
||||
#don't forget the last item!
|
||||
if ( $prevcount > 0 ) {
|
||||
push @output, $prevline . " " . ($prevcount + 1);
|
||||
}
|
||||
|
||||
@output;
|
||||
}
|
||||
|
||||
#======= end check_javaproc =====
|
69
contrib/check_joy.sh
Executable file
69
contrib/check_joy.sh
Executable file
|
@ -0,0 +1,69 @@
|
|||
#! /bin/sh
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
PROGNAME=`basename $0`
|
||||
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||
REVISION=`echo '$Revision: 1.1.1.1 $' | sed -e 's/[^0-9.]//g'`
|
||||
STATUS=""
|
||||
|
||||
. $PROGPATH/utils.sh
|
||||
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $PROGNAME /dev/js<#> <button #>"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
print_revision $PROGNAME $REVISION
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "This plugin checks a joystick button status using the "
|
||||
echo "joyreadbutton utility from the joyd package."
|
||||
echo ""
|
||||
support
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
-h)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
-V)
|
||||
print_revision $PROGNAME $REVISION
|
||||
exit 0
|
||||
;;
|
||||
/dev/js*)
|
||||
joyreadbutton $1 $2 1>&1 1>/dev/null
|
||||
STATUS=$?
|
||||
if [ "$STATUS" -eq 0 ]; then
|
||||
echo OK
|
||||
exit 0
|
||||
elif [ "$STATUS" -eq 1 ];then
|
||||
echo CRITICAL
|
||||
exit 2
|
||||
else
|
||||
echo UNKNOWN
|
||||
exit -1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
108
contrib/check_linux_raid.pl
Normal file
108
contrib/check_linux_raid.pl
Normal file
|
@ -0,0 +1,108 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Copyright (c) 2002 ISOMEDIA, Inc.
|
||||
# originally written by Steve Milton
|
||||
# later updates by sean finney <seanius@seanius.net>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Usage: check_raid [raid-name]
|
||||
# Example: check_raid md0
|
||||
# WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
|
||||
|
||||
use strict;
|
||||
use lib utils.pm;
|
||||
use utils qw(%ERRORS);
|
||||
|
||||
# die with an error if we're not on Linux
|
||||
if ($^O ne 'linux') {
|
||||
print "This plugin only applicable on Linux.\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
sub max_state($$){
|
||||
my ($a, $b) = @_;
|
||||
if ($a eq "CRITICAL" || $b eq "CRITICAL") { return "CRITICAL"; }
|
||||
elsif ($a eq "WARNING" || $b eq "WARNING") { return "WARNING"; }
|
||||
elsif ($a eq "OK" || $b eq "OK") { return "OK"; }
|
||||
elsif ($a eq "UNKNOWN" || $b eq "UNKNOWN") { return "UNKNOWN"; }
|
||||
elsif ($a eq "DEPENDENT" || $b eq "DEPENDENT") { return "DEPENDENT"; }
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
my $nextdev;
|
||||
if(defined $ARGV[0]) { $nextdev = shift; }
|
||||
else { $nextdev = "md[0-9]"; }
|
||||
|
||||
my $code = "UNKNOWN";
|
||||
my $msg = "";
|
||||
my %status;
|
||||
my %recovery;
|
||||
my %finish;
|
||||
my %active;
|
||||
my %devices;
|
||||
|
||||
while(defined $nextdev){
|
||||
open (MDSTAT, "< /proc/mdstat") or die "Failed to open /proc/mdstat";
|
||||
my $device = undef;
|
||||
while(<MDSTAT>) {
|
||||
if (defined $device) {
|
||||
if (/(\[[_U]+\])/) {
|
||||
$status{$device} = $1;
|
||||
} elsif (/recovery = (.*?)\s/) {
|
||||
$recovery{$device} = $1;
|
||||
($finish{$device}) = /finish=(.*?min)/;
|
||||
} elsif (/^\s*$/) {
|
||||
$device=undef;
|
||||
}
|
||||
} elsif (/^($nextdev)\s*:/) {
|
||||
$device=$1;
|
||||
$devices{$device}=$device;
|
||||
if (/active/) {
|
||||
$active{$device} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$nextdev = shift;
|
||||
}
|
||||
|
||||
foreach my $k (sort keys %devices){
|
||||
if ($status{$k} =~ /_/) {
|
||||
if (defined $recovery{$k}) {
|
||||
$msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
|
||||
$devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
|
||||
$code = max_state($code, "WARNING");
|
||||
} else {
|
||||
$msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k};
|
||||
$code = max_state($code, "CRITICAL");
|
||||
}
|
||||
} elsif ($status{$k} =~ /U+/) {
|
||||
$msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k};
|
||||
$code = max_state($code, "OK");
|
||||
} else {
|
||||
if ($active{$k}) {
|
||||
$msg .= sprintf " %s active with no status information.\n",
|
||||
$devices{$k};
|
||||
$code = max_state($code, "OK");
|
||||
} else {
|
||||
$msg .= sprintf " %s does not exist.\n", $devices{$k};
|
||||
$code = max_state($code, "CRITICAL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print $code, $msg, "\n";
|
||||
exit ($ERRORS{$code});
|
||||
|
19
contrib/check_lmmon.pl
Normal file
19
contrib/check_lmmon.pl
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
# NetSaint Temp warning script
|
||||
# Written by: Nathan LeSueur
|
||||
|
||||
if ($#ARGV < 1) {
|
||||
print "Usage: $0 <critical temp> <warning temp> <normal temp>\n";
|
||||
exit; } $crit = shift; $warn = shift; $norm = shift; if ($warn >
|
||||
$crit) { print "Warning level cannot be greater than critical
|
||||
level!\n"; exit; } @b = qx{/usr/local/bin/lmmon -s}; foreach(@b) { @c
|
||||
= split(/ \/ /, $_); $d = $c[1]; } @e = split(/F/, $d); $f = $e[0];
|
||||
|
||||
$status = "$f degrees F\n";
|
||||
|
||||
if($f >= $crit) {print "CRITICAL - $status"; exit 2;}
|
||||
if($f >= $warn) {print "WARNING - $status"; exit 1;}
|
||||
if($f <= $norm && $f != 0) {print "OK - $status"; exit 0;}
|
||||
else{print "UNKNOWN - unable to access smb\n"; exit (-1);}
|
||||
|
||||
|
202
contrib/check_log2.pl
Normal file
202
contrib/check_log2.pl
Normal file
|
@ -0,0 +1,202 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: check_log2.pl,v 1.2 2005/12/16 18:41:45 harpermann Exp $
|
||||
#
|
||||
# Log file regular expression detector for Nagios.
|
||||
# Written by Aaron Bostick (abostick@mydoconline.com)
|
||||
# Last modified: 05-02-2002
|
||||
#
|
||||
# Thanks and acknowledgements to Ethan Galstad for Nagios and the check_log
|
||||
# plugin this is modeled after.
|
||||
#
|
||||
# Usage: check_log2 -l <log_file> -s <seek_file> -p <pattern> [-n <negpattern>]
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# This plugin will scan arbitrary text files looking for regular expression
|
||||
# matches. The text file to scan is specified with <log_file>.
|
||||
# <log_seek_file> is a temporary file used to store the seek byte position
|
||||
# of the last scan. This file will be created automatically on the first
|
||||
# scan. <pattern> can be any RE pattern that perl's s/// syntax accepte. Be
|
||||
# forewarned that a bad pattern will send this script into never never land!
|
||||
#
|
||||
# Output:
|
||||
#
|
||||
# This plugin returns OK when a file is successfully scanned and no pattern
|
||||
# matches are found. WARNING is returned when 1 or more patterns are found
|
||||
# along with the pattern count and the line of the last pattern matched.
|
||||
# CRITICAL is returned when an error occurs, such as file not found, etc.
|
||||
#
|
||||
# Notes (paraphrased from check_log's notes):
|
||||
#
|
||||
# 1. The "max_attempts" value for the service should be 1, as this
|
||||
# will prevent Nagios from retrying the service check (the
|
||||
# next time the check is run it will not produce the same results).
|
||||
#
|
||||
# 2. The "notify_recovery" value for the service should be 0, so that
|
||||
# Nagios does not notify you of "recoveries" for the check. Since
|
||||
# pattern matches in the log file will only be reported once and not
|
||||
# the next time, there will always be "recoveries" for the service, even
|
||||
# though recoveries really don't apply to this type of check.
|
||||
#
|
||||
# 3. You *must* supply a different <log_Seek_file> for each service that
|
||||
# you define to use this plugin script - even if the different services
|
||||
# check the same <log_file> for pattern matches. This is necessary
|
||||
# because of the way the script operates.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# Check for error notices in messages
|
||||
# check_log2 -l /var/log/messages -s ./check_log2.messages.seek -p 'err'
|
||||
#
|
||||
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ s/^(.*?)[\/\\]([^\/\\]+)$//) {
|
||||
$prog_dir = $1;
|
||||
$prog_name = $2;
|
||||
}
|
||||
}
|
||||
|
||||
require 5.004;
|
||||
|
||||
use lib $main::prog_dir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
use Getopt::Long;
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks);
|
||||
|
||||
sub print_usage ();
|
||||
sub print_version ();
|
||||
sub print_help ();
|
||||
|
||||
# Initialize strings
|
||||
$log_file = '';
|
||||
$seek_file = '';
|
||||
$critical = '';
|
||||
$re_pattern = '';
|
||||
$neg_re_pattern = '';
|
||||
$pattern_count = 0;
|
||||
$pattern_line = '';
|
||||
$plugin_revision = '$Revision: 1.2 $ ';
|
||||
|
||||
# Grab options from command line
|
||||
GetOptions
|
||||
("l|logfile=s" => \$log_file,
|
||||
"s|seekfile=s" => \$seek_file,
|
||||
"c|critical" => \$critical,
|
||||
"p|pattern=s" => \$re_pattern,
|
||||
"n|negpattern:s" => \$neg_re_pattern,
|
||||
"v|version" => \$version,
|
||||
"h|help" => \$help);
|
||||
|
||||
!($version) || print_version ();
|
||||
!($help) || print_help ();
|
||||
|
||||
# Make sure log file is specified
|
||||
($log_file) || usage("Log file not specified.\n");
|
||||
# Make sure seek file is specified
|
||||
($seek_file) || usage("Seek file not specified.\n");
|
||||
# Make sure re pattern is specified
|
||||
($re_pattern) || usage("Regular expression not specified.\n");
|
||||
|
||||
# Open log file
|
||||
open (LOG_FILE, $log_file) || die "Unable to open log file $log_file: $!";
|
||||
|
||||
# Try to open log seek file. If open fails, we seek from beginning of
|
||||
# file by default.
|
||||
if (open(SEEK_FILE, $seek_file)) {
|
||||
chomp(@seek_pos = <SEEK_FILE>);
|
||||
close(SEEK_FILE);
|
||||
|
||||
# If file is empty, no need to seek...
|
||||
if ($seek_pos[0] != 0) {
|
||||
|
||||
# Compare seek position to actual file size.
|
||||
# If file size is smaller
|
||||
# then we just start from beginning i.e. file was rotated, etc.
|
||||
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(LOG_FILE);
|
||||
|
||||
if ($seek_pos[0] <= $size) {
|
||||
seek(LOG_FILE, $seek_pos[0], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Loop through every line of log file and check for pattern matches.
|
||||
# Count the number of pattern matches and remember the full line of
|
||||
# the most recent match.
|
||||
while (<LOG_FILE>) {
|
||||
if ($neg_re_pattern) {
|
||||
if ((/$re_pattern/) && !(/$neg_re_pattern/)) {
|
||||
$pattern_count += 1;
|
||||
$pattern_line = $_;
|
||||
}
|
||||
} elsif (/$re_pattern/) {
|
||||
$pattern_count += 1;
|
||||
$pattern_line = $_;
|
||||
}
|
||||
}
|
||||
|
||||
# Overwrite log seek file and print the byte position we have seeked to.
|
||||
open(SEEK_FILE, "> $seek_file") || die "Unable to open seek count file $seek_file: $!";
|
||||
print SEEK_FILE tell(LOG_FILE);
|
||||
|
||||
# Close seek file.
|
||||
close(SEEK_FILE);
|
||||
# Close the log file.
|
||||
close(LOG_FILE);
|
||||
|
||||
# Print result and return exit code.
|
||||
if ($pattern_count) {
|
||||
if ($critical) {
|
||||
print "CRITICAL: ";
|
||||
} else {
|
||||
print "WARNING: ";
|
||||
}
|
||||
print "($pattern_count): $pattern_line";
|
||||
if ($critical) {
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} else {
|
||||
exit $ERRORS{'WARNING'};
|
||||
}
|
||||
} else {
|
||||
print "OK - No matches found.\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
#
|
||||
# Subroutines
|
||||
#
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $prog_name -l <log_file> -s <log_seek_file> -p <pattern> [-n <negpattern>] -c | --critical\n";
|
||||
print "Usage: $prog_name [ -v | --version ]\n";
|
||||
print "Usage: $prog_name [ -h | --help ]\n";
|
||||
}
|
||||
|
||||
sub print_version () {
|
||||
print_revision($prog_name, $plugin_revision);
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($prog_name, $plugin_revision);
|
||||
print "\n";
|
||||
print "Scan arbitrary log files for regular expression matches.\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "-l, --logfile=<logfile>\n";
|
||||
print " The log file to be scanned\n";
|
||||
print "-s, --seekfile=<seekfile>\n";
|
||||
print " The temporary file to store the seek position of the last scan\n";
|
||||
print "-p, --pattern=<pattern>\n";
|
||||
print " The regular expression to scan for in the log file\n";
|
||||
print "-n, --negpattern=<negpattern>\n";
|
||||
print " The regular expression to skip in the log file\n";
|
||||
print "-c, --critical\n";
|
||||
print " Return critical instead of warning on error\n";
|
||||
print "\n";
|
||||
support();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
261
contrib/check_lotus.pl
Executable file
261
contrib/check_lotus.pl
Executable file
|
@ -0,0 +1,261 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id: check_lotus.pl,v 1.1 2005/01/25 09:04:26 stanleyhopcroft Exp $
|
||||
|
||||
# $Log: check_lotus.pl,v $
|
||||
# Revision 1.1 2005/01/25 09:04:26 stanleyhopcroft
|
||||
# New plugin to check responsiveness of Louts Notes (v5 at least) servers
|
||||
#
|
||||
# Revision 1.10 2005-01-25 15:44:07+11 anwsmh
|
||||
# 1 use packet_utils instead of hard coding subroutines (pdump and tethereal)
|
||||
# 2 redo indentation using tabs (set at 4 spaces)
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use Getopt::Long ;
|
||||
|
||||
my ($timeout, $debug, $lotus_host, $server, $indiv_dn, $packet_debug) ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage) ;
|
||||
use packet_utils qw(pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_lotus_notes' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
my $TEST_COUNT = 2 ;
|
||||
# Number of Lotus client hellos sent without reply
|
||||
my $BUFFER_SIZE = 1500 ;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $LOTUS_PORT = 1352 ;
|
||||
|
||||
Getopt::Long::Configure('no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|debug" => \$debug,
|
||||
"vv|i_packet_debug" => \$packet_debug,
|
||||
"H|lotus_host=s"=> \$lotus_host,
|
||||
# "I|indivual_dn:s" => \$indiv_dn,
|
||||
"S|server:s" => \$server,
|
||||
"T|t_timeout:i" => \$timeout,
|
||||
) ;
|
||||
|
||||
usage("You must provide the DNS name or IP (v4) address of the Lotus server to be checked.\n")
|
||||
unless $lotus_host and (
|
||||
$lotus_host =~ m#^\d+\.\d+\.\d+\.\d+$# or
|
||||
$lotus_host =~ m#^[\w\._-]+$#
|
||||
) ;
|
||||
|
||||
$server ||= $lotus_host
|
||||
if $lotus_host =~ m#^[\w-]+$# ;
|
||||
|
||||
usage("You must provide a server option unless the lotus_host option looks like an unqualified host name.\n")
|
||||
unless $server ;
|
||||
|
||||
$timeout ||= $TIMEOUT ;
|
||||
$debug = 1
|
||||
if $packet_debug ;
|
||||
|
||||
my $server_dn = "CN=\U$server" . '(?:/\w+=[\w -]+)*' ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# This info was gathered with tcpdump while using a Lotus Notes 5 client,
|
||||
# so I'm not sure of what each value is.
|
||||
|
||||
my $lotus_client_hello = &tethereal(<<'End_of_Tethereal_trace', '82') ;
|
||||
0030 ff ff dc c5 00 00 82 00 00 00 77 00 00 00 02 00 ..........w.....
|
||||
0040 00 40 02 0f 00 07 00 39 05 9e 45 54 ad ad 03 00 .@.....9..ET....
|
||||
0050 00 00 00 02 00 2f 00 00 00 00 00 00 00 00 00 40 ...../.........@
|
||||
0060 1f a0 af 19 d8 92 da 37 78 c9 ce 60 5e 35 b8 f7 .......7x..`^5..
|
||||
0070 4e 05 00 10 00 0d 00 00 00 00 00 00 00 00 00 00 N...............
|
||||
0080 00 00 00 00 00 02 00 08 00 9c dc 22 00 7c 6f 25 ...........".|o%
|
||||
0090 4a 08 00 10 00 00 00 00 00 00 00 00 00 00 00 00 J...............
|
||||
00a0 00 00 00 00 00 04 00 10 00 ba ac 8c 49 67 ee a1 ............Ig..
|
||||
00b0 22 6f 63 bb 04 b4 75 0b 8f 00 "oc...u...
|
||||
End_of_Tethereal_trace
|
||||
|
||||
# XXXX
|
||||
# Notes 5 accepts this
|
||||
# _wrongly_ encoded DN
|
||||
# but in general the
|
||||
# server will reset
|
||||
# the connection if
|
||||
# it receives malformed
|
||||
# packets.
|
||||
|
||||
my $lotus_client_m1 = &tethereal(<<'End_of_Tethereal_trace', 'de') ;
|
||||
0000 de 00 00 00 d4 00 00 00 13 00 00 40 01 00 9e 45 ...........@...E
|
||||
0010 54 ad ad 03 00 00 00 00 02 00 29 13 23 00 b9 68 T.........).#..h
|
||||
0020 25 00 9f 87 27 00 8f f4 25 00 00 00 88 00 24 00 %...'...%.....$.
|
||||
0030 28 00 00 00 42 56 04 00 31 2e 30 00 42 43 01 00 (...BV..1.0.BC..
|
||||
0040 03 42 41 01 00 30 42 4c 02 00 76 02 4e 4e 50 00 .BA..0BL..v.NNP.
|
||||
0050 cf ee 9d 19 99 ca e0 bf 97 d3 59 a1 c5 78 16 82 ..........Y..x..
|
||||
0060 76 09 8c 2c 96 ae 5a c1 15 bd 4e e9 b7 0f a9 d4 v..,..Z...N.....
|
||||
0070 5a 03 d9 0d bc e4 7d 4f e0 f2 79 89 cf cd 23 19 Z.....}O..y...#.
|
||||
0080 40 55 98 81 98 be d9 17 8d 69 8e 09 de c8 e8 92 @U.......i......
|
||||
0090 24 86 6f 5a 09 81 1f 71 be 29 b7 47 78 8c 2e 00 $.oZ...q.).Gx...
|
||||
00a0 45 4e 04 00 95 63 00 00 4d 41 08 00 64 a1 b4 b3 EN...c..MA..d...
|
||||
00b0 a1 01 45 c2 80 00 50 55 52 53 41 46 22 00 43 4e ..E...PURSAF".CN
|
||||
00c0 3d 4d 72 20 46 6f 6f 2f 4f 55 3d 42 61 72 20 68 =Mr Foo/OU=Bar h
|
||||
00d0 6f 74 65 6c 2f 4f 3d 42 61 7a 20 4a 75 6e 63 74 otel/O=Baz Junct
|
||||
00e0 69 6f 6e ion
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $buff = '';
|
||||
|
||||
my $valid_resp_cr = sub {
|
||||
my ($resp, $dn, $err_ind_sr) = @_ ;
|
||||
if ( $resp =~ /($dn)/ ) {
|
||||
return $1
|
||||
} else {
|
||||
($$err_ind_sr) = $resp =~ m#(CN=[\w -]+(?:/\w+=[\w -]+)*)# ;
|
||||
return 0 ;
|
||||
}
|
||||
} ;
|
||||
|
||||
my @send = (
|
||||
{ Msg => 'Helo', Send => $lotus_client_hello, Ok => $valid_resp_cr },
|
||||
{ Msg => 'm1', Send => $lotus_client_m1, Ok => $valid_resp_cr },
|
||||
) ;
|
||||
|
||||
my $tcp ;
|
||||
|
||||
eval {
|
||||
|
||||
$tcp = IO::Socket::INET->new(Proto => 'tcp', PeerAddr => $lotus_host, PeerPort => $LOTUS_PORT, Timeout => $timeout)
|
||||
# Some versions (eg 1.1603) croak on a connect failure ..
|
||||
} ;
|
||||
|
||||
&outahere("Connect to $lotus_host:$LOTUS_PORT failed:", $@)
|
||||
if $@ || ! defined($tcp) ;
|
||||
|
||||
my $found = '' ;
|
||||
|
||||
foreach (@send) {
|
||||
|
||||
print STDERR "Sending Lotus client $_->{Msg} to $lotus_host.\n"
|
||||
if $debug ;
|
||||
|
||||
&pdump($_->{Send})
|
||||
if $packet_debug ;
|
||||
|
||||
eval {
|
||||
|
||||
local $SIG{"ALRM"} = sub { die 'Alarm clock restart' } ;
|
||||
|
||||
alarm($timeout) ;
|
||||
|
||||
$tcp->send($_->{Send}, 0) ||
|
||||
&outahere("Send to $lotus_host failed: $!") ;
|
||||
|
||||
defined( $tcp->recv($buff, $BUFFER_SIZE, 0 ) ) ||
|
||||
&outahere("Recv from $lotus_host failed: $!")
|
||||
|
||||
} ;
|
||||
|
||||
alarm(0) ;
|
||||
|
||||
&outahere('Unexpected exception raised by eval:', $@)
|
||||
if $@ and $@ !~ /Alarm clock restart/ ;
|
||||
|
||||
&outahere("Timeout after $timeout secs - no response from $lotus_host")
|
||||
if $@ and $@ =~ /Alarm clock restart/ ;
|
||||
|
||||
&outahere("Lotus server $lotus_host reset connection - client protocol (malformed packet sent) error", $@)
|
||||
if $@ and $@ =~ /reset/ ;
|
||||
|
||||
&outahere("Empty recv buff after sending client $_->{Msg} and waiting $timeout secs. NB _no_ timeout exception.")
|
||||
unless $buff ;
|
||||
|
||||
&pdump($buff)
|
||||
if $packet_debug ;
|
||||
|
||||
my $err = '' ;
|
||||
|
||||
&outahere(qq(Response from $lotus_host failed to match CN=$server/.. got "$err") )
|
||||
unless $found = $_->{Ok}->($buff, $server_dn, \$err) ;
|
||||
|
||||
print STDERR "Received Ok reply from $lotus_host - found DN $found in response.\n"
|
||||
if $debug ;
|
||||
|
||||
}
|
||||
|
||||
close $tcp;
|
||||
|
||||
print "Ok. Lotus server $lotus_host responded with $found after ", scalar @send, " packet dialogue.\n" ;
|
||||
exit $ERRORS{OK} ;
|
||||
|
||||
=begin comment
|
||||
|
||||
Normal response from Lotus Notes 5 server
|
||||
|
||||
0000 74 00 00 00 69 00 00 00 03 00 00 40 02 0f 00 05 t...i......@....
|
||||
0010 00 3d 05 60 f0 3a 38 03 03 00 00 00 00 02 00 2f .=.`.:8......../
|
||||
0020 00 26 00 00 00 00 00 00 00 40 1f 3d 73 76 0e 57 .&.......@.=sv.W
|
||||
0030 e0 d7 67 cd a3 50 10 e0 99 24 b4 43 4e 3d 43 42 ..g..P...$.CN=CB
|
||||
0040 52 4e 4f 54 45 53 30 31 2f 4f 55 3d 53 45 52 56 RNOTES01/OU=SERV
|
||||
0050 45 52 53 2f 4f 3d 49 50 41 75 73 74 72 61 6c 69 ERS/O=IPAustrali
|
||||
0060 61 05 00 10 00 09 00 00 00 00 00 00 00 00 00 00 a...............
|
||||
0070 00 00 00 00 00 00
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
sub outahere {
|
||||
print "Failed. @_.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <lotus_host (name _or_ address)>..) [-S <lotus_server name> -T <timeout> -v ]\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
print "Copyright (c) 2004 Ed Rolison/S Hopcroft
|
||||
|
||||
Perl Check Lotus Notes plugin for Nagios.
|
||||
|
||||
Returns OK if the named server responds with its name.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-H, --lotus_host:STRING
|
||||
Name or IP Address of Lotus server to be checked.
|
||||
-I, --individual_dn:NOT IMPLEMENTED
|
||||
String of form CN=\w+(?:/OU=\w+)?/O=\w+
|
||||
-S, --server:STRING
|
||||
Alpha numeric string specifying the Lotus server name (the CN by which the server is known by
|
||||
in the Domino directory). Defaults to host name if the host name does not look like an IP address.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for TCP dialogue to complete = send + rcv times (default Nagios timeout [$TIMEOUT sec]).
|
||||
-v, --debug
|
||||
Debugging output.
|
||||
-vv, --packet_debug
|
||||
Packet dump. Please post to Nag users in the event of trouble with this plugin.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
231
contrib/check_maxchannels.pl
Normal file
231
contrib/check_maxchannels.pl
Normal file
|
@ -0,0 +1,231 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_maxchannels.pl - nagios plugin
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# Report bugs to: ck@zet.net
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 15;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
# free channels
|
||||
my $snmpWanAvailableChannels = '1.3.6.1.4.1.529.4.23.0';
|
||||
# maximum channels
|
||||
my $snmpWanSwitchedChannels = '1.3.6.1.4.1.529.4.24.0';
|
||||
my $snmpWanDisabledChannels = '1.3.6.1.4.1.529.4.25.0';
|
||||
my $snmpWanActiveChannels = '1.3.6.1.4.1.529.4.26.0';
|
||||
my $snmpWanNailedChannels = '1.3.6.1.4.1.529.4.27.0';
|
||||
my $snmpWanOutOfServiceChannels = '1.3.6.1.4.1.529.4.28.0';
|
||||
my $snmpEventCurrentActiveSessions = '1.3.6.1.4.1.529.10.6.0';
|
||||
# since startup
|
||||
my $snmpEventTotalNoModems = '1.3.6.1.4.1.529.10.15.0';
|
||||
# lan modem
|
||||
my $snmpDeadLanModem = '1.3.6.1.4.1.529.15.7.0';
|
||||
my $snmpDisabledLanModem = '1.3.6.1.4.1.529.15.5.0';
|
||||
my $snmpSuspectLanModem = '1.3.6.1.4.1.529.15.3.0';
|
||||
my $snmpAvailLanModem = '1.3.6.1.4.1.529.15.1.0';
|
||||
my $snmpBusyLanModem = '1.3.6.1.4.1.529.15.9.0';
|
||||
# max modems
|
||||
my $snmpMdmNumber = '1.3.6.1.2.1.38.1.1.0';
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %wanStatus;
|
||||
|
||||
|
||||
my $WanAvailableChannels;
|
||||
my $WanSwitchedChannels;
|
||||
my $WanDisabledChannels;
|
||||
my $WanActiveChannels;
|
||||
my $WanNailedChannels;
|
||||
my $WanOutOfServiceChannels;
|
||||
my $EventCurrentActiveSessions;
|
||||
my $EventTotalNoModems;
|
||||
my $DeadLanModem;
|
||||
my $DisabledLanModem;
|
||||
my $SuspectLanModem;
|
||||
my $AvailLanModem;
|
||||
my $BusyLanModem;
|
||||
my $MdmNumber;
|
||||
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check maxchannels plugin for Nagios\n";
|
||||
printf "monitors ISDN lines and modems on Ascend MAX 2000/4000/6000/TNT\n";
|
||||
printf "usage: \n";
|
||||
printf "check_maxchannel.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>\n";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_maxchannels.pl comes with ABSOLUTELY NO WARRANTY\n";
|
||||
printf "This programm is licensed under the terms of the ";
|
||||
printf "GNU General Public License\n(check source code for details)\n";
|
||||
printf "\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No snmp response from $hostname (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
|
||||
push(@snmpoids,$snmpWanAvailableChannels);
|
||||
push(@snmpoids,$snmpWanSwitchedChannels);
|
||||
push(@snmpoids,$snmpWanDisabledChannels);
|
||||
push(@snmpoids,$snmpWanActiveChannels);
|
||||
push(@snmpoids,$snmpWanNailedChannels);
|
||||
push(@snmpoids,$snmpWanOutOfServiceChannels);
|
||||
|
||||
push(@snmpoids,$snmpEventCurrentActiveSessions);
|
||||
|
||||
push(@snmpoids,$snmpEventTotalNoModems);
|
||||
push(@snmpoids,$snmpDeadLanModem);
|
||||
push(@snmpoids,$snmpDisabledLanModem);
|
||||
push(@snmpoids,$snmpSuspectLanModem);
|
||||
push(@snmpoids,$snmpAvailLanModem);
|
||||
push(@snmpoids,$snmpBusyLanModem);
|
||||
push(@snmpoids,$snmpMdmNumber);
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_request(@snmpoids))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
|
||||
$WanAvailableChannels = $response->{$snmpWanAvailableChannels};
|
||||
$WanSwitchedChannels = $response->{$snmpWanSwitchedChannels};
|
||||
$WanDisabledChannels = $response->{$snmpWanDisabledChannels};
|
||||
$WanActiveChannels = $response->{$snmpWanActiveChannels};
|
||||
$WanNailedChannels = $response->{$snmpWanNailedChannels};
|
||||
$WanOutOfServiceChannels = $response->{$snmpWanOutOfServiceChannels};
|
||||
$EventCurrentActiveSessions = $response->{$snmpEventCurrentActiveSessions};
|
||||
$EventTotalNoModems = $response->{$snmpEventTotalNoModems};
|
||||
$DeadLanModem = $response->{$snmpDeadLanModem};
|
||||
$DisabledLanModem = $response->{$snmpDisabledLanModem};
|
||||
$SuspectLanModem = $response->{$snmpSuspectLanModem};
|
||||
$AvailLanModem = $response->{$snmpAvailLanModem};
|
||||
$BusyLanModem = $response->{$snmpBusyLanModem};
|
||||
$MdmNumber = $response->{$snmpMdmNumber};
|
||||
|
||||
# less than 50% -> WARNING
|
||||
if ( 0 < $WanOutOfServiceChannels
|
||||
&& $WanOutOfServiceChannels < ($snmpWanSwitchedChannels * 0.5) ) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
elsif ($WanOutOfServiceChannels > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
elsif ($DeadLanModem > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
elsif ($SuspectLanModem > 0) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
elsif ($AvailLanModem == 0) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
}
|
||||
|
||||
|
||||
$answer = sprintf("active sessions: %d (%d), active modems: %d (%d)<BR>",
|
||||
$EventCurrentActiveSessions,
|
||||
$WanSwitchedChannels,
|
||||
$BusyLanModem,
|
||||
$MdmNumber);
|
||||
|
||||
$answer .= sprintf("channels available: %d, disabled: %d",
|
||||
$WanAvailableChannels,
|
||||
$WanDisabledChannels);
|
||||
|
||||
$answer .= sprintf(", out of service: %d, nailed: %d<BR>",
|
||||
$WanOutOfServiceChannels,
|
||||
$WanNailedChannels);
|
||||
|
||||
$answer .= sprintf("modems avail.: %d, disabled: %d, suspect: %d, dead: %d<BR>",
|
||||
$AvailLanModem,
|
||||
$DisabledLanModem,
|
||||
$SuspectLanModem,
|
||||
$DeadLanModem);
|
||||
|
||||
$answer .= sprintf("unserviced modem calls: %d (since startup)\n",
|
||||
$EventTotalNoModems);
|
||||
|
||||
$session->close;
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
201
contrib/check_maxwanstate.pl
Normal file
201
contrib/check_maxwanstate.pl
Normal file
|
@ -0,0 +1,201 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_maxwanstate.pl - nagios plugin
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# Report bugs to: ck@zet.net
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 1500;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
my %wanLineState = (
|
||||
1,'ls-unknown',
|
||||
2,'ls-does-not-exist',
|
||||
3,'ls-disabled',
|
||||
4,'ls-no-physical',
|
||||
5,'ls-no-logical',
|
||||
6,'ls-point-to-point',
|
||||
7,'ls-multipoint-1',
|
||||
8,'ls-multipoint-2',
|
||||
9,'ls-loss-of-sync',
|
||||
10,'ls-yellow-alarm',
|
||||
11,'ls-ais-receive',
|
||||
12,'ls-no-d-channel',
|
||||
13,'ls-active',
|
||||
14,'ls-maintenance');
|
||||
|
||||
my %wanLineType = (
|
||||
'1.3.6.1.4.1.529.4.1','Any',
|
||||
'1.3.6.1.4.1.529.4.2','T1',
|
||||
'1.3.6.1.4.1.529.4.3','E1',
|
||||
'1.3.6.1.4.1.529.4.4','Dpnss',
|
||||
'1.3.6.1.4.1.529.4.5','Bri',
|
||||
'1.3.6.1.4.1.529.4.6','S562',
|
||||
'1.3.6.1.4.1.529.4.7','S564',
|
||||
'1.3.6.1.4.1.529.4.8','Sdsl',
|
||||
'1.3.6.1.4.1.529.4.9','AdslCap');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
my $snmpWanLineName = '1.3.6.1.4.1.529.4.21.1.2';
|
||||
my $snmpWanLineType = '1.3.6.1.4.1.529.4.21.1.3';
|
||||
my $snmpWanLineState = '1.3.6.1.4.1.529.4.21.1.5';
|
||||
my $snmpWanLineUsage = '1.3.6.1.4.1.529.4.21.1.8';
|
||||
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %wanStatus;
|
||||
my $ifup =0 ;
|
||||
my $ifdown =0;
|
||||
my $ifdormant = 0;
|
||||
my $ifmessage;
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check maxwanstate plugin for Nagios\n";
|
||||
printf "monitors E1/T1 interface status\n";
|
||||
printf "usage: \n";
|
||||
printf "check_maxwanstate.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_maxwanstate.pl comes with ABSOLUTELY NO WARRANTY\n";
|
||||
printf "This programm is licensed under the terms of the ";
|
||||
printf "GNU General Public License\n(check source code for details)\n";
|
||||
printf "\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No snmp response from $hostname (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
|
||||
push(@snmpoids,$snmpWanLineUsage);
|
||||
push(@snmpoids,$snmpWanLineState);
|
||||
push(@snmpoids,$snmpWanLineName);
|
||||
push(@snmpoids,$snmpWanLineType);
|
||||
|
||||
foreach $snmpoid (@snmpoids) {
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_table($snmpoid))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community,$snmpkey");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
foreach $snmpkey (keys %{$response}) {
|
||||
$snmpkey =~ /.*\.(\d+)$/;
|
||||
$key = $1;
|
||||
$wanStatus{$key}{$snmpoid} = $response->{$snmpkey};
|
||||
}
|
||||
$session->close;
|
||||
}
|
||||
|
||||
foreach $key (keys %wanStatus) {
|
||||
# look only at active Interfaces lu-trunk(5)
|
||||
if ($wanStatus{$key}{$snmpWanLineUsage} == 5 ) {
|
||||
|
||||
# 13 -> active
|
||||
if ($wanStatus{$key}{$snmpWanLineState} == 13 ) {
|
||||
$ifup++;
|
||||
}
|
||||
else {
|
||||
$ifdown++ ;
|
||||
$ifmessage .= sprintf("%s interface status : %s (%s)<BR>",
|
||||
$wanLineType{$wanStatus{$key}{$snmpWanLineType}},
|
||||
$wanLineState{$wanStatus{$key}{$snmpWanLineState}},
|
||||
$wanStatus{$key}{$snmpWanLineName});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($ifdown > 0) {
|
||||
$state = 'CRITICAL';
|
||||
$answer = sprintf("host '%s', interfaces up: %d, down: %d<BR>",
|
||||
$hostname,
|
||||
$ifup,
|
||||
$ifdown);
|
||||
$answer = $answer . $ifmessage . "\n";
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
$answer = sprintf("host '%s', interfaces up: %d, down: %d\n",
|
||||
$hostname,
|
||||
$ifup,
|
||||
$ifdown);
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
146
contrib/check_mem.pl
Normal file
146
contrib/check_mem.pl
Normal file
|
@ -0,0 +1,146 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: check_mem.pl,v 1.1.1.1 2002/02/28 06:42:54 egalstad Exp $
|
||||
|
||||
# check_mem.pl Copyright (C) 2000 Dan Larsson <dl@tyfon.net>
|
||||
#
|
||||
# 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 (or with Nagios); if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA
|
||||
|
||||
# Tell Perl what we need to use
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
use vars qw($opt_c $opt_f $opt_u $opt_w
|
||||
$free_memory $used_memory $total_memory
|
||||
$crit_level $warn_level
|
||||
%exit_codes @memlist
|
||||
$percent $fmt_pct
|
||||
$verb_err $command_line);
|
||||
|
||||
# Predefined exit codes for Nagios
|
||||
%exit_codes = ('UNKNOWN' ,-1,
|
||||
'OK' , 0,
|
||||
'WARNING' , 1,
|
||||
'CRITICAL', 2,);
|
||||
|
||||
# Turn this to 1 to see reason for parameter errors (if any)
|
||||
$verb_err = 0;
|
||||
|
||||
# This the unix command string that brings Perl the data
|
||||
$command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`;
|
||||
|
||||
chomp $command_line;
|
||||
@memlist = split(/ /, $command_line);
|
||||
|
||||
# Define the calculating scalars
|
||||
$used_memory = $memlist[0];
|
||||
$free_memory = $memlist[1];
|
||||
$total_memory = $used_memory + $free_memory;
|
||||
|
||||
# Get the options
|
||||
if ($#ARGV le 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
else
|
||||
{
|
||||
getopts('c:fuw:');
|
||||
}
|
||||
|
||||
# Shortcircuit the switches
|
||||
if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0)
|
||||
{
|
||||
print "*** You must define WARN and CRITICAL levels!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
elsif (!$opt_f and !$opt_u)
|
||||
{
|
||||
print "*** You must select to monitor either USED or FREE memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
|
||||
# Check if levels are sane
|
||||
if ($opt_w <= $opt_c and $opt_f)
|
||||
{
|
||||
print "*** WARN level must not be less than CRITICAL when checking FREE memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
elsif ($opt_w >= $opt_c and $opt_u)
|
||||
{
|
||||
print "*** WARN level must not be greater than CRITICAL when checking USED memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
|
||||
$warn_level = $opt_w;
|
||||
$crit_level = $opt_c;
|
||||
|
||||
if ($opt_f)
|
||||
{
|
||||
$percent = $free_memory / $total_memory * 100;
|
||||
$fmt_pct = sprintf "%.1f", $percent;
|
||||
if ($percent <= $crit_level)
|
||||
{
|
||||
print "Memory CRITICAL - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
}
|
||||
elsif ($percent <= $warn_level)
|
||||
{
|
||||
print "Memory WARNING - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'WARNING'};
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Memory OK - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'OK'};
|
||||
}
|
||||
}
|
||||
elsif ($opt_u)
|
||||
{
|
||||
$percent = $used_memory / $total_memory * 100;
|
||||
$fmt_pct = sprintf "%.1f", $percent;
|
||||
if ($percent >= $crit_level)
|
||||
{
|
||||
print "Memory CRITICAL - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
}
|
||||
elsif ($percent >= $warn_level)
|
||||
{
|
||||
print "Memory WARNING - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'WARNING'};
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Memory OK - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'OK'};
|
||||
}
|
||||
}
|
||||
|
||||
# Show usage
|
||||
sub usage()
|
||||
{
|
||||
print "\ncheck_mem.pl v1.0 - Nagios Plugin\n\n";
|
||||
print "usage:\n";
|
||||
print " check_mem.pl -<f|u> -w <warnlevel> -c <critlevel>\n\n";
|
||||
print "options:\n";
|
||||
print " -f Check FREE memory\n";
|
||||
print " -u Check USED memory\n";
|
||||
print " -w PERCENT Percent free/used when to warn\n";
|
||||
print " -c PERCENT Percent free/used when critical\n";
|
||||
print "\nCopyright (C) 2000 Dan Larsson <dl\@tyfon.net>\n";
|
||||
print "check_mem.pl comes with absolutely NO WARRANTY either implied or explicit\n";
|
||||
print "This program is licensed under the terms of the\n";
|
||||
print "GNU General Public License (check source code for details)\n";
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
325
contrib/check_ms_spooler.pl
Executable file
325
contrib/check_ms_spooler.pl
Executable file
|
@ -0,0 +1,325 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id: check_ms_spooler.pl,v 1.1 2002/07/16 00:04:42 stanleyhopcroft Exp $
|
||||
|
||||
# $Log: check_ms_spooler.pl,v $
|
||||
# Revision 1.1 2002/07/16 00:04:42 stanleyhopcroft
|
||||
# Primitive and in need of refinement test of MS spooler (with smbclient)
|
||||
#
|
||||
# Revision 2.5 2002-02-13 07:36:08+11 anwsmh
|
||||
# Correct 'apostrophe' disaster.
|
||||
# Apostrophes in plugin output cause Netsaint notification commands
|
||||
# ( sh echo 'yada $PLUGINOUTPUT$ ..') to fail, usually mysteriously
|
||||
# eg notify OK works but notify CRITICAL does not.
|
||||
# Replace '$var' in print "output" with \"$var\".
|
||||
#
|
||||
# Revision 2.4 2001-11-21 21:36:05+11 anwsmh
|
||||
# Minor corrections
|
||||
# . replace 'die' by print .. exit $ERRORS{CRITICAL}
|
||||
# . change concluding message to list the queues (sorted) if there are no enqueued docs.
|
||||
#
|
||||
# Revision 2.3 2001-11-20 11:00:58+11 anwsmh
|
||||
# Major corrections.
|
||||
# 1. to sub AUTOLOAD: coderef parms must be @_ (ie the parm when the new sub is called)
|
||||
# 2. to processing of queue report (no inspection of $last_line; entire $queue_report is
|
||||
# checked for errors)
|
||||
# 3. cosmetic and debug changes in many places.
|
||||
#
|
||||
# Revision 2.2 2001-11-17 23:30:34+11 anwsmh
|
||||
# After adapting two different queue reports resulting from
|
||||
# different name resolution methods.
|
||||
#
|
||||
# Revision 2.1 2001-11-17 13:21:54+11 anwsmh
|
||||
# Adapt to Netsaint ('use utils, Getopt::Long, and standard switch processing).
|
||||
# Fix many peculiarities.
|
||||
#
|
||||
|
||||
|
||||
use strict ;
|
||||
|
||||
use Getopt::Long ;
|
||||
use utils ;
|
||||
|
||||
use vars qw($opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $debug);
|
||||
use vars '$AUTOLOAD' ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
|
||||
my $PROGNAME = 'check_ms_spooler' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
||||
|
||||
use constant SMBCLIENT_PATH => '/usr/local/samba/bin/smbclient' ;
|
||||
use constant MAX_QUEUES_TO_CHECK => 20 ; # So that the check doesn't take longer than $TIMEOUT
|
||||
|
||||
use constant SMBCLIENT_SVC => sub { return `${\SMBCLIENT_PATH} -L //$_[0] -U $_[1]%$_[2]` } ;
|
||||
use constant SMBCLIENT_QUEUE => sub { return `${\SMBCLIENT_PATH} //$_[0]/$_[1] -U $_[2]%$_[3] -c 'queue; quit' 2>/dev/null` } ;
|
||||
|
||||
# The queue results depend on the name resolution method.
|
||||
|
||||
# Forcing 'wins' or 'bcat' name resolution makes the queue results the
|
||||
# same for all spoolers (those that are resolved with WINS have an extra line
|
||||
# 'Got a positive name query response from <ip address of WINS> ..)
|
||||
# but would fail if there is no WINS and when miscreant spoolers
|
||||
# don't respond to broadcasts.
|
||||
|
||||
use constant MIN => sub { my $min = $_[0] ; foreach (@_) { $min = $_ if $_ <= $min; } return $min ; } ;
|
||||
|
||||
$SIG{"ALRM"} = sub { die "Alarm clock restart" } ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"d|debug" => \$debug,
|
||||
"p|password=s" => \$opt_p,
|
||||
"u|username=s" => \$opt_u,
|
||||
"H|hostname=s" => \$opt_H);
|
||||
|
||||
|
||||
|
||||
($opt_H) || usage("MS Spooler name not specified\n");
|
||||
my $spooler = $1 if $opt_H =~ m#(\w+)# ; # MS host names allow __any__ characters (more than \w)
|
||||
($spooler) || usage("Invalid MS spooler name: $opt_H\n");
|
||||
|
||||
($opt_u) || ($opt_u = 'guest');
|
||||
my $user = $1 if $opt_u =~ m#(\w+)# ;
|
||||
($user) || usage("Invalid user: $opt_u\n");
|
||||
|
||||
($opt_p) || ($opt_p = 'guest');
|
||||
my $pass = $1 if ($opt_p =~ /(.*)/);
|
||||
($pass) || usage("Invalid password: $opt_p\n");
|
||||
|
||||
my ($printer, $queue, @queues, $ms_spooler_status, @results, %junk) ;
|
||||
my (@fault_messages, @queue_contents, @services, @prandom_queue_indices) ;
|
||||
my ($queue_contents, $number_of_queues, $state, $queue_report) ;
|
||||
|
||||
$state = "getting service list (${\SMBCLIENT_PATH} -L $spooler -U $user%$pass) from spooler\n" ;
|
||||
|
||||
eval {
|
||||
alarm($TIMEOUT) ;
|
||||
@services = SMBCLIENT_SVC->( $spooler, $user, $pass ) ;
|
||||
} ;
|
||||
alarm(0) ;
|
||||
|
||||
if ($@ and $@ !~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME failed $state. Got \"$@\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
if ($@ and $@ =~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME timed out $state. Got \"@services\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
# tsitc> /usr/local/samba/bin/smbclient //ipaprint1/tt03 -U blah%blah -P -c 'queue; quit'
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Connection to ipaprint1 failed
|
||||
|
||||
# tsitc> /usr/local/samba/bin/smbclient -L sna_spl1 -U blah%blah | & more
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Got a positive name query response from 10.0.100.29 ( 10.0.6.20 )
|
||||
# session setup failed: ERRDOS - ERRnoaccess (Access denied.)
|
||||
|
||||
if ( grep /Connection to $spooler failed|ERR/, @services ) {
|
||||
print "Failed. $PROGNAME failed $state. Got \"@services\"\n" ;
|
||||
# print "Failed. Request for services list to $spooler failed. Got \"@services\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
# tsitc# /usr/local/samba/bin/smbclient -L ipaprint -U blah%blah
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
#
|
||||
# Sharename Type Comment
|
||||
# --------- ---- -------
|
||||
# TH02 Printer TH02
|
||||
# ADMIN$ Disk Remote Admin
|
||||
# IPC$ IPC Remote IPC
|
||||
# S431 Printer S431
|
||||
# S402 Printer S402
|
||||
# S401 Printer S401
|
||||
# C$ Disk Default share
|
||||
# BW01 Printer BW01
|
||||
# BW02 Printer BW02
|
||||
# TL11 Printer TL11
|
||||
# TL07 Printer TL07
|
||||
# S225 Printer Discovery South - 2nd Floor - HP CLJ4500
|
||||
# S224 Printer S224
|
||||
# S223 Printer Discovery South 2nd Floor Trademarks Training
|
||||
# S222 Printer S222
|
||||
# S203 Printer S203
|
||||
# S202 Printer S202
|
||||
|
||||
my @printers = map { my @junk = split; $junk[0] }
|
||||
grep { my @junk = split; defined $junk[1] and $junk[1] eq 'Printer' } @services ;
|
||||
# don't check IPC$, ADMIN$ etc.
|
||||
|
||||
$ms_spooler_status = 0 ;
|
||||
$number_of_queues = MIN->(MAX_QUEUES_TO_CHECK, (scalar(@services) >> 3) + 1) ;
|
||||
|
||||
$state = "checking queues on $spooler" ;
|
||||
|
||||
eval {
|
||||
# foreach queues to check
|
||||
# generate a pseudo-random int in 0 .. $#printers
|
||||
# drop it if the index has already been generated ;
|
||||
|
||||
%junk = () ;
|
||||
@prandom_queue_indices = grep { ! $junk{$_}++ }
|
||||
map { int( rand($#printers) ) } ( 1 .. $number_of_queues ) ;
|
||||
|
||||
@queues = @printers[@prandom_queue_indices] ;
|
||||
|
||||
# @queues = @printers[ map { int( rand($#printers) ) } ( 1 .. $number_of_queues ) ] ;
|
||||
|
||||
alarm($TIMEOUT) ;
|
||||
|
||||
@queue_contents = @fault_messages = () ;
|
||||
|
||||
foreach $printer (sort @queues) {
|
||||
|
||||
# Expect 3 lines from a queue report.
|
||||
# If queue is empty, last line is null otherwise
|
||||
# it will contain a queue report or an SMB error
|
||||
|
||||
# Empty Queue.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
|
||||
# Queue command from a spooler with a DNS name.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
# 65 16307 Microsoft Word - Servicesweoffer2.doc
|
||||
# 68 10410 Microsoft Word - Servicesweoffer.doc
|
||||
# 143 24997 Microsoft Word - Miss Samantha Anne Craig.doc
|
||||
# 182 15635 Microsoft Word - services we provide.doc
|
||||
|
||||
# Error.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
# tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)
|
||||
|
||||
# Can't connect error.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Connection to sna_spl2 failed
|
||||
|
||||
|
||||
# Empty Queue from a spooler with no DNS name, NetBIOS name resolved by WINS.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Got a positive name query response from 10.0.100.29 ( 10.0.6.20 )
|
||||
# Domain=[SNA_PRINT] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
|
||||
# There are 3 lines of output from smbclient for those spoolers whose names are
|
||||
# resolved by WINS (because those names are NetBIOS and therefore not in DNS);
|
||||
# 4 lines for errors or enqueued jobs
|
||||
|
||||
print STDERR "${\SMBCLIENT_PATH} //$spooler/$printer -U $user%$pass -c 'queue; quit' ==>\n" if $debug ;
|
||||
|
||||
@results = SMBCLIENT_QUEUE->( $spooler, $printer, $user, $pass ) ;
|
||||
|
||||
print STDERR "\"@results\"\n" if $debug ;
|
||||
|
||||
# set $ms_spooler_status somehow
|
||||
|
||||
chomp( @results ) ;
|
||||
$queue_report = queue_report->(@results) ;
|
||||
print STDERR '$queue_report for $printer ', "$printer: \"$queue_report\"\n\n" if $debug ;
|
||||
|
||||
if ( defined $queue_report and ($queue_report !~ /ERR/ && $queue_report !~ /failed/) ) {
|
||||
$ms_spooler_status = 1 ;
|
||||
push @queue_contents, "$printer: $queue_report" if $queue_report ;
|
||||
} else {
|
||||
push @fault_messages, "$printer: $queue_report" ;
|
||||
}
|
||||
}
|
||||
alarm(0) ;
|
||||
} ;
|
||||
|
||||
if ($@ and $@ !~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME failed at $state. Got \"$@\"\n" ;
|
||||
exit $ERRORS{"CRITCAL"} ;
|
||||
}
|
||||
|
||||
if ($@ and $@ =~ /Alarm clock restart/) {
|
||||
my $i ;
|
||||
foreach (@queues) { $i++ ; last if $_ eq $printer }
|
||||
print "Failed. Timed out connecting to $printer ($i of $number_of_queues) on //$spooler after $TIMEOUT secs. Got \"@fault_messages\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
if (! $ms_spooler_status) {
|
||||
print "Failed. Couldn't connect to @queues on //$spooler as user $user. Got \"@fault_messages\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
$queue_contents = ( @queue_contents != 0 ? join(" ", (@queue_contents == 1 ? "Queue" : "Queues"), @queue_contents) :
|
||||
"All Queues empty" ) ;
|
||||
|
||||
print "Ok. Connected to ", $queue_contents =~ /empty$/ ? "@{[sort @queues]}" : scalar @queues, " queues on //$spooler. $queue_contents\n" ;
|
||||
exit $ERRORS{"OK"} ;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <spooler> -u <user> -p <password>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
print "Copyright (c) 2001 Karl DeBisschop/S Hopcroft
|
||||
|
||||
Perl Check MS Spooler plugin for NetSaint. Display a subset of the queues on an SMB (Samba or MS) print spooler.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-H, --hostname=STRING
|
||||
NetBIOS name of the SMB Print spooler (Either Samba or MS spooler)
|
||||
-u, --user=STRING
|
||||
Username to log in to server. (Default: "guest")
|
||||
-p, --password=STRING
|
||||
Password to log in to server. (Default: "guest")
|
||||
-d, --debug
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub AUTOLOAD {
|
||||
|
||||
my @queue_rep = @_ ;
|
||||
|
||||
# 'Object Oriented Perl', D Conway, p 95
|
||||
|
||||
no strict 'refs' ;
|
||||
|
||||
if ( $AUTOLOAD =~ /.*::queue_report/ ) {
|
||||
|
||||
if ( grep /Got a positive name query response from/, @queue_rep ){
|
||||
*{$AUTOLOAD} = sub { return join ' ', splice(@_, 3) } ;
|
||||
return join '', splice(@queue_rep, 3) ;
|
||||
} else {
|
||||
*{$AUTOLOAD} = sub { return join ' ',splice(@_, 2) } ;
|
||||
return join '', splice(@queue_rep, 2) ;
|
||||
}
|
||||
} else {
|
||||
die "No such subroutine: $AUTOLOAD" ;
|
||||
}
|
||||
}
|
||||
|
104
contrib/check_mssql.sh
Executable file
104
contrib/check_mssql.sh
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/bin/sh
|
||||
# This script is designed to be used by Nagios. It checks for the availability of both Microsoft SQL Server 7 and 2000.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# FreeTDS 6.0+ (http://www.freetds.org/)
|
||||
#
|
||||
# It was written by Tom De Blende (tom.deblende@village.uunet.be) in 2003.
|
||||
#
|
||||
# Version 1.0.
|
||||
# Version 1.1: Rewritten the initial script so that it not only works from the CLI but also from within Nagios. Always helpful...
|
||||
# Version 1.2: Grouped output so things look a bit better.
|
||||
# Version 2.0: Rewritten the plugin to support version 6.0+ of FreeTDS.
|
||||
# Removed sqsh requirement as version 6.0+ of FreeTDS now offers its own CLI client: tsql.
|
||||
# Older versions of FreeTDS are no longer supported.
|
||||
#
|
||||
#
|
||||
# You might want to change these values:
|
||||
|
||||
tsqlcmd=`which tsql`
|
||||
catcmd=`which cat`
|
||||
grepcmd=`which grep`
|
||||
rmcmd=`which rm`
|
||||
mktempcmd=`which mktemp`
|
||||
wccmd=`which wc`
|
||||
sedcmd=`which sed`
|
||||
trcmd=`which tr`
|
||||
uniqcmd=`which uniq`
|
||||
|
||||
###################################################################################################################
|
||||
|
||||
hostname=$1
|
||||
usr=$2
|
||||
pswd=$3
|
||||
srv=$4
|
||||
|
||||
|
||||
if [ ! "$#" == "4" ]; then
|
||||
echo -e "\nYou did not supply enough arguments. \nUsage: $0 <host> <username> <password> <version> \n \n$0 checks Microsoft SQL Server connectivity. It works with versions 7 and 2000.\n\nYou need a working version of FreeTDS (http://www.freetds.org/) and tsql (included in FreeTDS 6.0+) to connect to the SQL server. \nIt was written by Tom De Blende (tom.deblende@village.uunet.be) in 2003. \n\nExample:\n $0 dbserver sa f00bar 2000\n" && exit "3"
|
||||
|
||||
elif [ $tsqlcmd == "" ]; then
|
||||
echo -e "tsql not found! Please verify you have a working version of tsql (included in the FreeTDS version 6.0+) and enter the full path in the script." && exit "3"
|
||||
|
||||
fi
|
||||
|
||||
exit="3"
|
||||
|
||||
|
||||
# Creating the command file that contains the sql statement that has to be run on the SQL server.
|
||||
|
||||
tmpfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
|
||||
if [ $srv == "7" ]; then
|
||||
spid=7
|
||||
elif [ $srv == "2000" ]; then
|
||||
spid=50
|
||||
else
|
||||
echo -e "$srv is not a supported MS SQL Server version!" && exit "3"
|
||||
fi
|
||||
|
||||
echo -e "select loginame from sysprocesses where spid > $spid order by loginame asc\ngo" > $tmpfile
|
||||
|
||||
|
||||
# Running tsql to get the results back.
|
||||
|
||||
resultfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
errorfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
$tsqlcmd -S $hostname -U $usr -P $pswd < $tmpfile 2>$errorfile > $resultfile
|
||||
|
||||
$grepcmd -q "Login failed for user" $errorfile
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. Login failed.;
|
||||
exit 2;
|
||||
fi
|
||||
|
||||
$grepcmd -q "There was a problem connecting to the server" $errorfile
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. Incorrect server name or SQL service not running.;
|
||||
exit 2;
|
||||
fi
|
||||
|
||||
resultfileln=`$catcmd $resultfile | $wccmd -l | $sedcmd 's/ //g'`
|
||||
|
||||
if [ "$resultfileln" == "2" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. No data received from host.;
|
||||
exit 2;
|
||||
else
|
||||
nmbr=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $wccmd -l | sed 's/ //g'`
|
||||
users=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $uniqcmd -c | $trcmd \\\n , | $sedcmd 's/,$/./g' | $sedcmd 's/,/, /g' | $sedcmd 's/ //g' | $trcmd \\\t " " | $sedcmd 's/ \./\./g' | $sedcmd 's/ ,/,/g'`
|
||||
$rmcmd -f $tmpfile $resultfile;
|
||||
echo "OK - MS SQL Server $srv has $nmbr user(s) connected: $users" | sed 's/: $/./g';
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# Cleaning up.
|
||||
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile
|
||||
echo $stdio
|
||||
exit $exit
|
48
contrib/check_nagios.pl
Normal file
48
contrib/check_nagios.pl
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
# denao - denao@uol.com.br - Systems Engineering
|
||||
# Universo Online - http://www.uol.com.br
|
||||
use DBI;
|
||||
use Time::Local;
|
||||
|
||||
my $t_lambuja = 5; # (expire_minutes)
|
||||
my $databasename = ""; # The name of nagios database (i.e.: nagios)
|
||||
my $table = "programstatus";
|
||||
my $where = "localhost"; # The machine where the database
|
||||
my $port = "3306";
|
||||
my $base = "DBI:mysql:$databasename:$where:$port";
|
||||
my $user = ""; # the user to connect to the database
|
||||
# (needs permission to "select at programstatus table only"
|
||||
my $password = ""; # the password (if any)
|
||||
my %results;
|
||||
my @fields = qw( last_update );
|
||||
my $dbh = DBI->connect($base,$user,$password);
|
||||
my $fields = join(', ', @fields);
|
||||
my $query = "SELECT $fields FROM $table";
|
||||
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute();
|
||||
|
||||
@results{@fields} = ();
|
||||
$sth->bind_columns(map { \$results{$_} } @fields);
|
||||
|
||||
$sth->fetch();
|
||||
$sth->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
check_update();
|
||||
|
||||
sub check_update {
|
||||
($yea,$mon,$day,$hou,$min,$sec)=($results{last_update}=~/(\d+)\-(\d+)\-(\d+)\s(\d+)\:(\d+)\:(\d+)/);
|
||||
($sec_now, $min_now, $hou_now, $day_now, $mon_now, $yea_now) = (localtime(time))[0,1,2,3,4,5];
|
||||
$mon_now+=1; $yea_now+=1900;
|
||||
$unixdate=timelocal($sec,$min,$hou,$day,$mon,$yea);
|
||||
$unixdate_now=timelocal($sec_now,$min_now,$hou_now,$day_now,$mon_now,$yea_now);
|
||||
if (scalar($unixdate_now - $unixdate) > scalar($t_lambuja * 60)) {
|
||||
print "Nagios problem: nagios is down, for at least " . scalar($t_lambuja) . " minutes.\n";
|
||||
exit(1);
|
||||
} else {
|
||||
print "Nagios ok: status data updated " . scalar($unixdate_now - $unixdate) . " seconds ago\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
89
contrib/check_nagios_db.pl
Normal file
89
contrib/check_nagios_db.pl
Normal file
|
@ -0,0 +1,89 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
use strict;
|
||||
$|++;
|
||||
|
||||
use vars qw/$opt_e $opt_c/;
|
||||
|
||||
$ENV{"PATH"} = "/usr/bin:/usr/sbin:/bin";
|
||||
|
||||
use Getopt::Std;
|
||||
use DBI;
|
||||
|
||||
my $driver = "mysql";
|
||||
|
||||
my $CFG_DEF = "/opt/nagios/etc/cgi.cfg";
|
||||
my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
|
||||
my $EXPIRE_DEF = 5; ## expressed in minutes
|
||||
my $PROCCNT = 0;
|
||||
|
||||
use constant OK => 1;
|
||||
use constant WARN => 2;
|
||||
|
||||
my $STAT = WARN;
|
||||
|
||||
sub usage {
|
||||
print STDERR "\n";
|
||||
print STDERR "$0 -F -e <expire time in minutes> -C <process string>\n";
|
||||
print STDERR "\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
getopt("e:c:");
|
||||
|
||||
my $EXPIRE = $opt_e || $EXPIRE_DEF;
|
||||
my $CFG = $opt_c || $CFG_DEF;
|
||||
|
||||
( -f $CFG ) or die "Can't open config file '$CFG': $!\n";
|
||||
|
||||
my ($dbhost, $dbport, $dbuser, $dbpass, $dbname);
|
||||
|
||||
open(F, "< $CFG");
|
||||
while ( <F> ) {
|
||||
if (/^xsddb_host=(.+)/) { $dbhost = $1; next; };
|
||||
if (/^xsddb_port=(.+)/) { $dbport = $1; next; };
|
||||
if (/^xsddb_database=(.+)/) { $dbname = $1; next; };
|
||||
if (/^xsddb_username=(.+)/) { $dbuser = $1; next; };
|
||||
if (/^xsddb_password=(.+)/) { $dbpass = $1; next; };
|
||||
}
|
||||
close(F);
|
||||
|
||||
# print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
|
||||
|
||||
my $dsn = "DBI:$driver:database=$dbname;host=$dbhost;port=$dbport";
|
||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
|
||||
|
||||
my $sth = $dbh->prepare($QUERY);
|
||||
if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
|
||||
$sth->execute;
|
||||
if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; }
|
||||
|
||||
my %status = ();
|
||||
|
||||
my $names = $sth->{'NAME'};
|
||||
my $numFields = $sth->{'NUM_OF_FIELDS'};
|
||||
my $ref = $sth->fetchrow_arrayref;
|
||||
for (my $i = 0; $i < $numFields; $i++) {
|
||||
$status{"$$names[$i]"} = $$ref[$i];
|
||||
}
|
||||
|
||||
#foreach (keys(%status)) {
|
||||
# print "$_: $status{$_}\n";
|
||||
#}
|
||||
|
||||
my $lastupdated = time() - $status{"ut"};
|
||||
if ( $lastupdated < ($EXPIRE*60) ) { ## convert $EXPIRE to seconds
|
||||
$STAT = OK;
|
||||
}
|
||||
|
||||
open(PS, "ps -eaf | grep $status{nagios_pid} | grep -v grep | ");
|
||||
$PROCCNT = 0;
|
||||
while(<PS>) {
|
||||
$PROCCNT++;
|
||||
}
|
||||
close(PS);
|
||||
|
||||
if ( $STAT == OK ) {
|
||||
print "Nagios OK: located $PROCCNT processes, program status updated $lastupdated seconds ago\n";
|
||||
}
|
||||
|
91
contrib/check_nagios_db_pg.pl
Normal file
91
contrib/check_nagios_db_pg.pl
Normal file
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
$|++;
|
||||
|
||||
use vars qw/$opt_e $opt_c/;
|
||||
|
||||
$ENV{"PATH"} = "/usr/bin:/usr/sbin:/bin";
|
||||
|
||||
use Getopt::Std;
|
||||
use DBI;
|
||||
|
||||
my $driver = "Pg";
|
||||
|
||||
my $CFG_DEF = "/etc/nagios/cgi.cfg";
|
||||
# this works only in mysql
|
||||
# my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
|
||||
# the following is the same for postgres
|
||||
my $QUERY = "select *, round(date_part('epoch',last_update)) as ut from programstatus;";
|
||||
my $EXPIRE_DEF = 5; ## expressed in minutes
|
||||
my $PROCCNT = 0;
|
||||
|
||||
use constant OK => 1;
|
||||
use constant WARN => 2;
|
||||
|
||||
my $STAT = WARN;
|
||||
|
||||
sub usage {
|
||||
print STDERR "\n";
|
||||
print STDERR "$0 -F -e <expire time in minutes> -C <process string>\n";
|
||||
print STDERR "\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
getopt("e:c:");
|
||||
|
||||
my $EXPIRE = $opt_e || $EXPIRE_DEF;
|
||||
my $CFG = $opt_c || $CFG_DEF;
|
||||
|
||||
( -f $CFG ) or die "Can't open config file '$CFG': $!\n";
|
||||
|
||||
my ($dbhost, $dbport, $dbuser, $dbpass, $dbname);
|
||||
|
||||
open(F, "< $CFG");
|
||||
while ( <F> ) {
|
||||
if (/^xsddb_host=(.+)/) { $dbhost = $1; next; };
|
||||
if (/^xsddb_port=(.+)/) { $dbport = $1; next; };
|
||||
if (/^xsddb_database=(.+)/) { $dbname = $1; next; };
|
||||
if (/^xsddb_username=(.+)/) { $dbuser = $1; next; };
|
||||
if (/^xsddb_password=(.+)/) { $dbpass = $1; next; };
|
||||
}
|
||||
close(F);
|
||||
|
||||
#print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
|
||||
|
||||
my $dsn = "DBI:$driver:dbname=$dbname;host=$dbhost;port=$dbport";
|
||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
|
||||
|
||||
my $sth = $dbh->prepare($QUERY);
|
||||
if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
|
||||
$sth->execute;
|
||||
if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; }
|
||||
|
||||
my %status = ();
|
||||
|
||||
my $names = $sth->{'NAME'};
|
||||
my $numFields = $sth->{'NUM_OF_FIELDS'};
|
||||
my $ref = $sth->fetchrow_arrayref;
|
||||
for (my $i = 0; $i < $numFields; $i++) {
|
||||
$status{"$$names[$i]"} = $$ref[$i];
|
||||
}
|
||||
|
||||
#foreach (keys(%status)) {
|
||||
# print "$_: $status{$_}\n";
|
||||
#}
|
||||
|
||||
my $lastupdated = time() - $status{"ut"};
|
||||
if ( $lastupdated < ($EXPIRE*60) ) { ## convert $EXPIRE to seconds
|
||||
$STAT = OK;
|
||||
}
|
||||
|
||||
open(PS, "ps -eaf | grep $status{nagios_pid} | grep -v grep | ");
|
||||
$PROCCNT = 0;
|
||||
while(<PS>) {
|
||||
$PROCCNT++;
|
||||
}
|
||||
close(PS);
|
||||
|
||||
if ( $STAT == OK ) {
|
||||
print "Nagios OK: located $PROCCNT processes, program status updated $lastupdated seconds ago\n";
|
||||
}
|
178
contrib/check_netapp.pl
Executable file
178
contrib/check_netapp.pl
Executable file
|
@ -0,0 +1,178 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# check_netapp
|
||||
#
|
||||
# Copyright (C) 2000 Leland E. Vandervort <leland@mmania.com>
|
||||
#
|
||||
# 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 (or with Nagios); if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA
|
||||
####################################
|
||||
# checks for overtemperature, fans, psu, and nfs operations/second on
|
||||
# Network Appliance Filers.
|
||||
# Returns:
|
||||
# OK if temp, fans, psu OK and Ops/Sec below warning and critical
|
||||
# Thresholds (default is warning=3500, critical=5000)
|
||||
# ** Note: See the specifications for your Filer model for
|
||||
# the thresholds !
|
||||
# Returns Warning if NFS Ops/Sec is above warning threshold
|
||||
# (default 3500, or specified by -o command line option)
|
||||
# Returns Critical if NFS Ops/Sec is above critical threshold
|
||||
# ( -m option, or default 5000), or if overtem, psufault, or
|
||||
# fanfault detected.
|
||||
#
|
||||
####################################
|
||||
# Notes on operational limits for NetApp Filers:
|
||||
# Platform Maximum Ops/Second (recommended)
|
||||
# -------------------------------------------------------------
|
||||
# F230 1000
|
||||
# F740 5500
|
||||
# F760 9000
|
||||
####################################
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
my $status;
|
||||
my $response = "";
|
||||
my $TIMEOUT = 10;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my $opsthresh = "3500";
|
||||
my $critical = "5000";
|
||||
|
||||
my $status_string = "";
|
||||
|
||||
my %OIDLIST = (
|
||||
overtemp => '1.3.6.1.4.1.789.1.2.4.1.0',
|
||||
failedfan => '1.3.6.1.4.1.789.1.2.4.2.0',
|
||||
failedpsu => '1.3.6.1.4.1.789.1.2.4.4.0',
|
||||
nfsops => '1.3.6.1.4.1.789.1.2.2.1.0'
|
||||
);
|
||||
|
||||
|
||||
|
||||
my %STATUSCODE = ( 'UNKNOWN' => '-1',
|
||||
'OK' => '0',
|
||||
'WARNING' => '1',
|
||||
'CRITICAL' => '2');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "ERROR: No snmp response from $hostname (sigALRM)\n";
|
||||
exit($STATUSCODE{"UNKNOWN"});
|
||||
};
|
||||
|
||||
alarm($TIMEOUT);
|
||||
|
||||
sub get_nfsops {
|
||||
my $nfsops_start = &SNMPGET($OIDLIST{nfsops});
|
||||
sleep(1);
|
||||
my $nfsops_end = &SNMPGET($OIDLIST{nfsops});
|
||||
my $nfsopspersec = $nfsops_end - $nfsops_start;
|
||||
return($nfsopspersec);
|
||||
}
|
||||
|
||||
|
||||
sub show_help {
|
||||
printf("\nPerl NetApp filer plugin for Nagios\n");
|
||||
printf("Usage:\n");
|
||||
printf("
|
||||
check_netapp [options] <hostname>
|
||||
Options:
|
||||
-c snmp-community
|
||||
-p snmp-port
|
||||
-o Operations per second warning threshold
|
||||
-m Operations per second critical threshold
|
||||
|
||||
");
|
||||
printf("Copyright (C)2000 Leland E. Vandervort\n");
|
||||
printf("check_netapp comes with absolutely NO WARRANTY either implied or explicit\n");
|
||||
printf("This program is licensed under the terms of the\n");
|
||||
printf("GNU General Public License\n(check source code for details)\n\n\n");
|
||||
exit($STATUSCODE{"UNKNOWN"});
|
||||
}
|
||||
|
||||
|
||||
$status = GetOptions( "community=s", \$community,
|
||||
"port=i", \$port,
|
||||
"opsthresh=i", \$opsthresh,
|
||||
"maxops=i", \$critical );
|
||||
|
||||
if($status == 0) {
|
||||
&show_help;
|
||||
}
|
||||
|
||||
sub SNMPGET {
|
||||
$OID = shift;
|
||||
($session,$error) = Net::SNMP->session(
|
||||
Hostname => $hostname,
|
||||
Community => $community,
|
||||
Port => $port
|
||||
);
|
||||
if(!defined($session)) {
|
||||
printf("$state %s\n", $error);
|
||||
exit($STATUSCODE{$state});
|
||||
}
|
||||
if(!defined($response = $session->get_request($OID))) {
|
||||
printf("$state %s\n", $session->error());
|
||||
$session->close();
|
||||
exit($STATUSCODE{$state});
|
||||
}
|
||||
$session->close();
|
||||
return($response->{$OID});
|
||||
}
|
||||
|
||||
$hostname = shift || &show_help;
|
||||
|
||||
my $tempcheck = &SNMPGET($OIDLIST{overtemp});
|
||||
if($tempcheck == 1) {
|
||||
$state = "OK";
|
||||
$status_string .= "Temp OK ";
|
||||
}
|
||||
else {
|
||||
$state = "CRITICAL";
|
||||
$status_string .= "Temp CRIT";
|
||||
}
|
||||
|
||||
foreach $element ('failedfan','failedpsu') {
|
||||
my $my_return = &SNMPGET($OIDLIST{$element});
|
||||
if(($my_return =~ /no/) || ($my_return == 0)) {
|
||||
$status_string .= "$element = $my_return ";
|
||||
$state = "OK";
|
||||
}
|
||||
else {
|
||||
$status_string .= "$element = $my_return ";
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
}
|
||||
|
||||
my $tmp_opssec = &get_nfsops();
|
||||
|
||||
if ($tmp_opssec >= $critical) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ($tmp_opssec >= $opsthresh) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
else {
|
||||
$state = "OK";
|
||||
}
|
||||
|
||||
$status_string .= "Ops\/Sec = $tmp_opssec ";
|
||||
|
||||
print "$state $status_string\n";
|
||||
exit($STATUSCODE{$state});
|
442
contrib/check_nmap.py
Normal file
442
contrib/check_nmap.py
Normal file
|
@ -0,0 +1,442 @@
|
|||
#!/usr/bin/python
|
||||
# Change the above line if python is somewhere else
|
||||
|
||||
#
|
||||
# check_nmap
|
||||
#
|
||||
# Program: nmap plugin for Nagios
|
||||
# License: GPL
|
||||
# Copyright (c) 2000 Jacob Lundqvist (jaclu@galdrion.com)
|
||||
#
|
||||
_version_ = '1.21'
|
||||
#
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# Does a nmap scan, compares open ports to those given on command-line
|
||||
# Reports warning for closed that should be open and error for
|
||||
# open that should be closed.
|
||||
# If optional ports are given, no warning is given if they are closed
|
||||
# and they are included in the list of valid ports.
|
||||
#
|
||||
# Requirements:
|
||||
# python
|
||||
# nmap
|
||||
#
|
||||
# History
|
||||
# -------
|
||||
# 1.21 2004-07-23 rippeld@hillsboroughcounty.org Updated parsing of nmap output to correctly identify closed ports
|
||||
# 1.20 2000-07-15 jaclu Updated params to correctly comply to plugin-standard
|
||||
# moved support classes to utils.py
|
||||
# 1.16 2000-07-14 jaclu made options and return codes more compatible with
|
||||
# the plugin developer-guidelines
|
||||
# 1.15 2000-07-14 jaclu added random string to temp-file name
|
||||
# 1.14 2000-07-14 jaclu added check for error from subproc
|
||||
# 1.10 2000-07-14 jaclu converted main part to class
|
||||
# 1.08 2000-07-13 jaclu better param parsing
|
||||
# 1.07 2000-07-13 jaclu changed nmap param to -P0
|
||||
# 1.06 2000-07-13 jaclu make sure tmp file is deleted on errors
|
||||
# 1.05 2000-07-12 jaclu in debug mode, show exit code
|
||||
# 1.03 2000-07-12 jaclu error handling on nmap output
|
||||
# 1.01 2000-07-12 jaclu added license
|
||||
# 1.00 2000-07-12 jaclu implemented timeout handling
|
||||
# 0.20 2000-07-10 jaclu Initial release
|
||||
|
||||
|
||||
import sys, os, string, whrandom
|
||||
|
||||
import tempfile
|
||||
from getopt import getopt
|
||||
|
||||
#
|
||||
# import generic Nagios-plugin stuff
|
||||
#
|
||||
import utils
|
||||
|
||||
# Where temp files should be placed
|
||||
tempfile.tempdir='/usr/local/nagios/var'
|
||||
|
||||
# Base name for tempfile
|
||||
tempfile.template='check_nmap_tmp.'
|
||||
|
||||
# location and possibly params for nmap
|
||||
nmap_cmd='/usr/bin/nmap -P0'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# the class that does all the real work in this plugin...
|
||||
#
|
||||
#
|
||||
class CheckNmap:
|
||||
|
||||
# Retcodes, so we are compatible with nagios
|
||||
#ERROR= -1
|
||||
UNKNOWN= -1
|
||||
OK= 0
|
||||
WARNING= 1
|
||||
CRITICAL= 2
|
||||
|
||||
|
||||
def __init__(self,cmd_line=[]):
|
||||
"""Constructor.
|
||||
arguments:
|
||||
cmd_line: normaly sys.argv[1:] if called as standalone program
|
||||
"""
|
||||
self.tmp_file=''
|
||||
self.host='' # host to check
|
||||
self.timeout=10
|
||||
self.debug=0 # 1= show debug info
|
||||
self.ports=[] # list of mandatory ports
|
||||
self.opt_ports=[] # list of optional ports
|
||||
self.ranges='' # port ranges for nmap
|
||||
self.exit_code=0 # numerical exit-code
|
||||
self.exit_msg='' # message to caller
|
||||
|
||||
self.ParseCmdLine(cmd_line)
|
||||
|
||||
def Run(self):
|
||||
"""Actually run the process.
|
||||
This method should be called exactly once.
|
||||
"""
|
||||
|
||||
#
|
||||
# Only call check_host if cmd line was accepted earlier
|
||||
#
|
||||
if self.exit_code==0:
|
||||
self.CheckHost()
|
||||
|
||||
self.CleanUp()
|
||||
return self.exit_code,self.exit_msg
|
||||
|
||||
def Version(self):
|
||||
return 'check_nmap %s' % _version_
|
||||
|
||||
#-----------------------------------------
|
||||
#
|
||||
# class internal stuff below...
|
||||
#
|
||||
#-----------------------------------------
|
||||
|
||||
#
|
||||
# Param checks
|
||||
#
|
||||
def param2int_list(self,s):
|
||||
lst=string.split(string.replace(s,',',' '))
|
||||
try:
|
||||
for i in range(len(lst)):
|
||||
lst[i]=int(lst[i])
|
||||
except:
|
||||
lst=[]
|
||||
return lst
|
||||
|
||||
def ParseCmdLine(self,cmd_line):
|
||||
try:
|
||||
opt_list=getopt(cmd_line,'vH:ho:p:r:t:V',['debug','host=','help',
|
||||
'optional=','port=','range=','timeout','version'])
|
||||
for opt in opt_list[0]:
|
||||
if opt[0]=='-v' or opt[0]=='--debug':
|
||||
self.debug=1
|
||||
elif opt[0]=='-H' or opt[0]=='--host':
|
||||
self.host=opt[1]
|
||||
elif opt[0]=='-h' or opt[0]=='--help':
|
||||
doc_help()
|
||||
self.exit_code=1 # request termination
|
||||
break
|
||||
elif opt[0]=='-o' or opt[0]=='--optional':
|
||||
self.opt_ports=self.param2int_list(opt[1])
|
||||
elif opt[0]=='-p' or opt[0]=='--port':
|
||||
self.ports=self.param2int_list(opt[1])
|
||||
elif opt[0]=='-r' or opt[0]=='--range':
|
||||
r=string.replace(opt[1],':','-')
|
||||
self.ranges=r
|
||||
elif opt[0]=='-t' or opt[0]=='--timeout':
|
||||
self.timeout=opt[1]
|
||||
elif opt[0]=='-V' or opt[0]=='--version':
|
||||
print self.Version()
|
||||
self.exit_code=1 # request termination
|
||||
break
|
||||
else:
|
||||
self.host=''
|
||||
break
|
||||
|
||||
except:
|
||||
# unknown param
|
||||
self.host=''
|
||||
|
||||
if self.debug:
|
||||
print 'Params:'
|
||||
print '-------'
|
||||
print 'host = %s' % self.host
|
||||
print 'timeout = %s' % self.timeout
|
||||
print 'ports = %s' % self.ports
|
||||
print 'optional ports = %s' % self.opt_ports
|
||||
print 'ranges = %s' % self.ranges
|
||||
print
|
||||
|
||||
#
|
||||
# a option that wishes us to terminate now has been given...
|
||||
#
|
||||
# This way, you can test params in debug mode and see what this
|
||||
# program recognised by suplying a version param at the end of
|
||||
# the cmd-line
|
||||
#
|
||||
if self.exit_code<>0:
|
||||
sys.exit(self.UNKNOWN)
|
||||
|
||||
if self.host=='':
|
||||
doc_syntax()
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='UNKNOWN: bad params, try running without any params for syntax'
|
||||
|
||||
|
||||
def CheckHost(self):
|
||||
'Check one host using nmap.'
|
||||
#
|
||||
# Create a tmp file for storing nmap output
|
||||
#
|
||||
# The tempfile module from python 1.5.2 is stupid
|
||||
# two processes runing at aprox the same time gets
|
||||
# the same tempfile...
|
||||
# For this reason I use a random suffix for the tmp-file
|
||||
# Still not 100% safe, but reduces the risk significally
|
||||
# I also inserted checks at various places, so that
|
||||
# _if_ two processes in deed get the same tmp-file
|
||||
# the only result is a normal error message to nagios
|
||||
#
|
||||
r=whrandom.whrandom()
|
||||
self.tmp_file=tempfile.mktemp('.%s')%r.randint(0,100000)
|
||||
if self.debug:
|
||||
print 'Tmpfile is: %s'%self.tmp_file
|
||||
#
|
||||
# If a range is given, only run nmap on this range
|
||||
#
|
||||
if self.ranges<>'':
|
||||
global nmap_cmd # needed, to avoid error on next line
|
||||
# since we assigns to nmap_cmd :)
|
||||
nmap_cmd='%s -p %s' %(nmap_cmd,self.ranges)
|
||||
#
|
||||
# Prepare a task
|
||||
#
|
||||
t=utils.Task('%s %s' %(nmap_cmd,self.host))
|
||||
#
|
||||
# Configure a time-out handler
|
||||
#
|
||||
th=utils.TimeoutHandler(t.Kill, time_to_live=self.timeout,
|
||||
debug=self.debug)
|
||||
#
|
||||
# Fork of nmap cmd
|
||||
#
|
||||
t.Run(detach=0, stdout=self.tmp_file,stderr='/dev/null')
|
||||
#
|
||||
# Wait for completition, error or timeout
|
||||
#
|
||||
nmap_exit_code=t.Wait(idlefunc=th.Check, interval=1)
|
||||
#
|
||||
# Check for timeout
|
||||
#
|
||||
if th.WasTimeOut():
|
||||
self.exit_code=self.CRITICAL
|
||||
self.exit_msg='CRITICAL - Plugin timed out after %s seconds' % self.timeout
|
||||
return
|
||||
#
|
||||
# Check for exit status of subprocess
|
||||
# Must do this after check for timeout, since the subprocess
|
||||
# also returns error if aborted.
|
||||
#
|
||||
if nmap_exit_code <> 0:
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='nmap program failed with code %s' % nmap_exit_code
|
||||
return
|
||||
#
|
||||
# Read output
|
||||
#
|
||||
try:
|
||||
f = open(self.tmp_file, 'r')
|
||||
output=f.readlines()
|
||||
f.close()
|
||||
except:
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='Unable to get output from nmap'
|
||||
return
|
||||
|
||||
#
|
||||
# Store open ports in list
|
||||
# scans for lines where first word contains '/'
|
||||
# and stores part before '/'
|
||||
#
|
||||
self.active_ports=[]
|
||||
try:
|
||||
for l in output:
|
||||
if len(l)<2:
|
||||
continue
|
||||
s=string.split(l)[0]
|
||||
if string.find(s,'/')<1:
|
||||
continue
|
||||
p=string.split(s,'/')[0]
|
||||
if string.find(l,'open')>1:
|
||||
self.active_ports.append(int(p))
|
||||
except:
|
||||
# failure due to strange output...
|
||||
pass
|
||||
|
||||
if self.debug:
|
||||
print 'Ports found by nmap: ',self.active_ports
|
||||
#
|
||||
# Filter out optional ports, we don't check status for them...
|
||||
#
|
||||
try:
|
||||
for p in self.opt_ports:
|
||||
self.active_ports.remove(p)
|
||||
|
||||
if self.debug and len(self.opt_ports)>0:
|
||||
print 'optional ports removed:',self.active_ports
|
||||
except:
|
||||
# under extreame loads the remove(p) above failed for me
|
||||
# a few times, this exception hanlder handles
|
||||
# this bug-alike situation...
|
||||
pass
|
||||
|
||||
opened=self.CheckOpen()
|
||||
closed=self.CheckClosed()
|
||||
|
||||
if opened <>'':
|
||||
self.exit_code=self.CRITICAL
|
||||
self.exit_msg='PORTS CRITICAL - Open:%s Closed:%s'%(opened,closed)
|
||||
elif closed <>'':
|
||||
self.exit_code=self.WARNING
|
||||
self.exit_msg='PORTS WARNING - Closed:%s'%closed
|
||||
else:
|
||||
self.exit_code=self.OK
|
||||
self.exit_msg='PORTS ok - Only defined ports open'
|
||||
|
||||
|
||||
#
|
||||
# Compares requested ports on with actually open ports
|
||||
# returns all open that should be closed
|
||||
#
|
||||
def CheckOpen(self):
|
||||
opened=''
|
||||
for p in self.active_ports:
|
||||
if p not in self.ports:
|
||||
opened='%s %s' %(opened,p)
|
||||
return opened
|
||||
|
||||
#
|
||||
# Compares requested ports with actually open ports
|
||||
# returns all ports that are should be open
|
||||
#
|
||||
def CheckClosed(self):
|
||||
closed=''
|
||||
for p in self.ports:
|
||||
if p not in self.active_ports:
|
||||
closed='%s %s' % (closed,p)
|
||||
return closed
|
||||
|
||||
|
||||
def CleanUp(self):
|
||||
#
|
||||
# If temp file exists, get rid of it
|
||||
#
|
||||
if self.tmp_file<>'' and os.path.isfile(self.tmp_file):
|
||||
try:
|
||||
os.remove(self.tmp_file)
|
||||
except:
|
||||
# temp-file colition, some other process already
|
||||
# removed the same file...
|
||||
pass
|
||||
|
||||
#
|
||||
# Show numerical exits as string in debug mode
|
||||
#
|
||||
if self.debug:
|
||||
print 'Exitcode:',self.exit_code,
|
||||
if self.exit_code==self.UNKNOWN:
|
||||
print 'UNKNOWN'
|
||||
elif self.exit_code==self.OK:
|
||||
print 'OK'
|
||||
elif self.exit_code==self.WARNING:
|
||||
print 'WARNING'
|
||||
elif self.exit_code==self.CRITICAL:
|
||||
print 'CRITICAL'
|
||||
else:
|
||||
print 'undefined'
|
||||
#
|
||||
# Check if invalid exit code
|
||||
#
|
||||
if self.exit_code<-1 or self.exit_code>2:
|
||||
self.exit_msg=self.exit_msg+' - undefined exit code (%s)' % self.exit_code
|
||||
self.exit_code=self.UNKNOWN
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Help texts
|
||||
#
|
||||
def doc_head():
|
||||
print """
|
||||
check_nmap plugin for Nagios
|
||||
Copyright (c) 2000 Jacob Lundqvist (jaclu@galdrion.com)
|
||||
License: GPL
|
||||
Version: %s""" % _version_
|
||||
|
||||
|
||||
def doc_syntax():
|
||||
print """
|
||||
Usage: check_ports [-v|--debug] [-H|--host host] [-V|--version] [-h|--help]
|
||||
[-o|--optional port1,port2,port3 ...] [-r|--range range]
|
||||
[-p|--port port1,port2,port3 ...] [-t|--timeout timeout]"""
|
||||
|
||||
|
||||
def doc_help():
|
||||
'Help is displayed if run without params.'
|
||||
doc_head()
|
||||
doc_syntax()
|
||||
print """
|
||||
Options:
|
||||
-h = help (this screen ;-)
|
||||
-v = debug mode, show some extra output
|
||||
-H host = host to check (name or IP#)
|
||||
-o ports = optional ports that can be open (one or more),
|
||||
no warning is given if optional port is closed
|
||||
-p ports = ports that should be open (one or more)
|
||||
-r range = port range to feed to nmap. Example: :1024,2049,3000:7000
|
||||
-t timeout = timeout in seconds, default 10
|
||||
-V = Version info
|
||||
|
||||
This plugin attempts to verify open ports on the specified host.
|
||||
|
||||
If all specified ports are open, OK is returned.
|
||||
If any of them are closed, WARNING is returned (except for optional ports)
|
||||
If other ports are open, CRITICAL is returned
|
||||
|
||||
If possible, supply an IP address for the host address,
|
||||
as this will bypass the DNS lookup.
|
||||
"""
|
||||
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
|
||||
if len (sys.argv) < 2:
|
||||
#
|
||||
# No params given, show syntax and exit
|
||||
#
|
||||
doc_syntax()
|
||||
sys.exit(-1)
|
||||
|
||||
nmap=CheckNmap(sys.argv[1:])
|
||||
exit_code,exit_msg=nmap.Run()
|
||||
|
||||
#
|
||||
# Give Nagios a msg and a code
|
||||
#
|
||||
print exit_msg
|
||||
sys.exit(exit_code)
|
82
contrib/check_ora_table_space.pl
Normal file
82
contrib/check_ora_table_space.pl
Normal file
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Program check_ora_table_space
|
||||
# Written by: Erwan Arzur (erwan@netvalue.com)
|
||||
# License: GPL
|
||||
#
|
||||
# Last Modified: $Date: 2002/02/28 06:42:54 $
|
||||
# Revisiin: $Revision: 1.1.1.1 $
|
||||
#
|
||||
# "check_ora_table_space.pl" plugin to check the state of Oracle
|
||||
# table spaces. Scarce documentation.
|
||||
#
|
||||
# you need DBD-Oracle-1.03.tar.gz and DBI-1.13.tar.gz from CPAN.org as
|
||||
# well as some Oracle client stuff to use it.
|
||||
#
|
||||
# The SQL request comes from www.dbasupport.com
|
||||
#
|
||||
|
||||
use DBI;
|
||||
$ENV{"ORACLE_HOME"}="/intranet/apps/oracle";
|
||||
|
||||
my $host = shift || &usage ("no host specified");
|
||||
my $sid = shift || &usage ("no sid specified");
|
||||
my $port = shift || &usage ("no port specified");
|
||||
my $dbuser = shift || &usage ("no user specified");
|
||||
my $dbpass = shift || &usage ("no password specified");
|
||||
my $tablespace = shift || &usage ("no table space specified");
|
||||
|
||||
my $alertpct = int(shift) || &usage ("no warning state percentage specified");
|
||||
my $critpct = int(shift) || &usage ("no critical state percentage specified");
|
||||
|
||||
my $dbh = DBI->connect( "dbi:Oracle:host=$host;port=$port;sid=$sid", $dbuser, $dbpass, { PrintError => 0, AutoCommit => 1, RaiseError => 0 } )
|
||||
|| &error ("cannot connect to $dbname: $DBI::errstr\n");
|
||||
|
||||
#$sth = $dbh->prepare(q{SELECT tablespace_name, SUM(BYTES)/1024/1024 FreeSpace FROM dba_free_space group by tablespace_name})
|
||||
my $exit_code = -1;
|
||||
$sth = $dbh->prepare(<<EOF
|
||||
select a.TABLESPACE_NAME, a.total,nvl(b.used,0) USED,
|
||||
nvl((b.used/a.total)*100,0) PCT_USED
|
||||
from (select TABLESPACE_NAME, sum(bytes)/(1024*1024) total
|
||||
from sys.dba_data_files group by TABLESPACE_NAME) a,
|
||||
(select TABLESPACE_NAME,bytes/(1024*1024) used from sys.SM\$TS_USED) b
|
||||
where a.TABLESPACE_NAME='$tablespace' and
|
||||
a.TABLESPACE_NAME=b.TABLESPACE_NAME(+)
|
||||
EOF
|
||||
)
|
||||
|| &error("Cannot prepare request : $DBI::errstr\n");
|
||||
$sth->execute
|
||||
|| &error("Cannot execute request : $DBI::errstr\n");
|
||||
|
||||
while (($tbname, $total, $used, $pct_used) = $sth->fetchrow)
|
||||
{
|
||||
$pct_used=int($pct_used);
|
||||
print STDOUT "size: " . $total . " MB Used:" . int($used) . " MB (" . int($pct_used) . "%)\n";
|
||||
#print "table space $answer\n";
|
||||
if ($pct_used > $alertpct) {
|
||||
if ($pct_used > $critpct) {
|
||||
$exit_code = 2
|
||||
} else {
|
||||
$exit_code = 1;
|
||||
}
|
||||
} else {
|
||||
$exit_code = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$rc = $dbh->disconnect
|
||||
|| &error ("Cannot disconnect from database : $dbh->errstr\n");
|
||||
|
||||
exit ($exit_code);
|
||||
|
||||
sub usage {
|
||||
print "@_\n" if @_;
|
||||
print "usage : check_ora_table_space.pl <host> <sid> <port> <user> <passwd> <tablespace> <pctwarn> <pctcrit>\n";
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
sub error {
|
||||
print "@_\n" if @_;
|
||||
exit (2);
|
||||
}
|
||||
|
470
contrib/check_oracle_instance.pl
Normal file
470
contrib/check_oracle_instance.pl
Normal file
|
@ -0,0 +1,470 @@
|
|||
#!/usr/bin/perl
|
||||
# $Id: check_oracle_instance.pl,v 1.1 2002/04/03 02:58:47 sghosh Exp $
|
||||
|
||||
# Copyright (c) 2002 Sven Dolderer
|
||||
# some pieces of Code adopted from Adam vonNieda's oracletool.pl
|
||||
# (http://www.oracletool.com)
|
||||
#
|
||||
# You may distribute under the terms of either the GNU General Public
|
||||
# License or the Artistic License, as specified in the Perl README file,
|
||||
# with the exception that it cannot be placed on a CD-ROM or similar media
|
||||
# for commercial distribution without the prior approval of the author.
|
||||
|
||||
# This software is provided without warranty of any kind.
|
||||
|
||||
require 5.003;
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
# We need the DBI and DBD-Oracle Perl modules:
|
||||
require DBI || die "It appears that the DBI module is not installed! aborting...\n";
|
||||
require DBD::Oracle || die "It appears that the DBD::Oracle module is not installed! aborting...\n";
|
||||
|
||||
use vars qw($VERSION $PROGNAME $logfile $debug $state $dbh $database $username $password $message $sql $cursor $opt_asession $opt_nsession $opt_tablespace $opt_nextents $opt_fextents $opt_aextents $privsok $warn $critical);
|
||||
|
||||
'$Revision: 1.1 $' =~ /^.*(\d+.\d+) \$$/; # Use The Revision from RCS/CVS
|
||||
$VERSION = $1;
|
||||
$0 =~ m!^.*/([^/]+)$!;
|
||||
$PROGNAME = $1;
|
||||
#$debug="true";
|
||||
$logfile = "/tmp/check_oracle_instance.log";
|
||||
my %ERRORS = (UNKNOWN => -1, OK => 0, WARNING => 1, CRITICAL => 2);
|
||||
|
||||
# Read cmdline opts:
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions (
|
||||
"V|version" => \&version,
|
||||
"h|help" => \&usage,
|
||||
"u|user=s" => \$username,
|
||||
"p|passwd=s" => \$password,
|
||||
"c|connect=s" => \$database,
|
||||
"a|active-sessions:s" => \$opt_asession,
|
||||
"s|num-sessions:s" => \$opt_nsession,
|
||||
"t|tablespaces:s" => \$opt_tablespace,
|
||||
"n|num-extents:s" => \$opt_nextents,
|
||||
"f|free-extents:s" => \$opt_fextents,
|
||||
"x|allocate-extents" => \$opt_aextents
|
||||
);
|
||||
($database && $username && $password) || die "mandatory parameters missing (try -h)\n";
|
||||
logit(" \$opt_asession = \"$opt_asession\"");
|
||||
logit(" \$opt_nsession = \"$opt_nsession\"");
|
||||
logit(" \$opt_tablespace = \"$opt_tablespace\"");
|
||||
logit(" \$opt_nextents = \"$opt_nextents\"");
|
||||
logit(" \$opt_fextents = \"$opt_fextents\"");
|
||||
logit(" \$opt_aextents = \"$opt_aextents\"");
|
||||
|
||||
# so let's connect to the instance...
|
||||
$dbh = dbConnect($database,$username,$password);
|
||||
|
||||
$message="$database: ";
|
||||
check_sessions($opt_nsession) if ($opt_nsession && $privsok);
|
||||
check_sessions($opt_asession,"active") if ($opt_asession && $privsok);
|
||||
check_tablespaces($opt_tablespace) if ($opt_tablespace && $privsok);
|
||||
check_nextents($opt_nextents) if ($opt_nextents && $privsok);
|
||||
check_fextents($opt_fextents) if ($opt_fextents && $privsok);
|
||||
check_aextents() if ($opt_aextents && $privsok);
|
||||
|
||||
$message=$message . "ok. " . getDbVersion($dbh) unless ($state);
|
||||
print "$message\n";
|
||||
exit $state;
|
||||
|
||||
|
||||
sub usage {
|
||||
copyright();
|
||||
print "
|
||||
This plugin will check various things of an oracle database instance.
|
||||
|
||||
Prerequisties are: a local oracle client,
|
||||
perl > v5.003, and DBI and DBD::Oracle perl modules.
|
||||
|
||||
Usage: $PROGNAME -u <user> -p <passwd> -c <connectstring>
|
||||
[-a <w>/<c>] [-s <w>/<c>] [-t <w>/<c>] [-n <w>/<c>] [-f <w>/<c>] [-x]
|
||||
$PROGNAME [-V|--version]
|
||||
$PROGNAME [-h|--help]
|
||||
";
|
||||
print "
|
||||
Options:
|
||||
-u, --user=STRING
|
||||
the oracle user
|
||||
-p, --passwd=STRING
|
||||
the oracle password
|
||||
-c, --connect=STRING
|
||||
the oracle connectstring as defined in tnsnames.ora
|
||||
-a, --active-sessions=WARN/CRITICAL
|
||||
check the number of active (user-)sessions
|
||||
WARN(Integer): number of sessions to result in warning status,
|
||||
CRITICAL(Integer): number of sessions to result in critical status
|
||||
-s, --num-sessions=WARN/CRITICAL
|
||||
check the total number of (user-)sessions
|
||||
WARN(Integer): number of sessions to result in warning status,
|
||||
CRITICAL(Integer): number of sessions to result in critical status
|
||||
-t, --tablespaces=WARN/CRITICAL
|
||||
check the percent of used space in every tablespace
|
||||
WARN(Integer): percentage to result in warning status,
|
||||
CRITICAL(Integer): percentage to result in critical status
|
||||
-n, --num-extents=WARN/CRITICAL
|
||||
check the number of extents of every object (excluding SYS schema)
|
||||
WARN(Integer): number of extents to result in warning status,
|
||||
CRITICAL(Integer): number of extents to result in critical status
|
||||
-f, --free-extents=WARN/CRITICAL
|
||||
check the number of free extents of every object: max_extents - #extents
|
||||
WARN(Integer): number of free extents to result in warning status,
|
||||
CRITICAL(Integer): number of free extents to result in critical status
|
||||
-x, --allocate-extents
|
||||
warn if an object cannot allocate a next extent.
|
||||
";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
|
||||
sub version {
|
||||
copyright();
|
||||
print "
|
||||
$PROGNAME $VERSION
|
||||
";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
|
||||
sub copyright {
|
||||
print "The netsaint plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
|
||||
copies of the plugins under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the file named COPYING.
|
||||
Copyright (c) 2002 Sven Dolderer\n";
|
||||
}
|
||||
|
||||
|
||||
sub logit {
|
||||
my $text = shift;
|
||||
if ($debug) {
|
||||
open (LOG,">>$logfile") || die "Cannot open log file \"$logfile\"!";
|
||||
print LOG "$text\n";
|
||||
close (LOG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub dbConnect {
|
||||
logit("Enter subroutine dbConnect");
|
||||
|
||||
my $database = shift;
|
||||
my $username = shift;
|
||||
my $password = shift;
|
||||
|
||||
# Attempt to make connection to the database..
|
||||
my $data_source = "dbi:Oracle:$database";
|
||||
$dbh = DBI->connect($data_source,$username,$password,{PrintError=>0});
|
||||
|
||||
# Show an error message for these errors.
|
||||
# ORA-12224 - "The connection request could not be completed because the listener is not running."
|
||||
# ORA-01034 - "Oracle was not started up."
|
||||
# ORA-01090 - "Shutdown in progress - connection is not permitted""
|
||||
# ORA-12154 - "The service name specified is not defined correctly in the TNSNAMES.ORA file."
|
||||
# ORA-12505 - "TNS:listener could not resolve SID given in connect descriptor."
|
||||
# ORA-12545 - "TNS:name lookup failure."
|
||||
|
||||
unless ($dbh) {
|
||||
logit(" Error message is ~$DBI::errstr~");
|
||||
if ( $DBI::errstr =~ /ORA-01017|ORA-1017|ORA-01004|ORA-01005/ ) {
|
||||
$message="Login error: ~$DBI::errstr~";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-12224/ ) {
|
||||
$message= "You received an ORA-12224, which usually means the listener is down, or your connection definition in your tnsnames.ora file is incorrect. Check both of these things and try again.";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-01034/ ) {
|
||||
$message= "You received an ORA-01034, which usually means the database is down. Check to be sure the database is up and try again.";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-01090/ ) {
|
||||
$message= "You received an ORA-01090, which means the database is in the process of coming down.";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-12154/ ) {
|
||||
$message= "You received an ORA-12154, which probably means you have a mistake in your TNSNAMES.ORA file for the database that you chose.";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-12505/ ) {
|
||||
$message= "You received an ORA-12505, which probably means you have a mistake in your TNSNAMES.ORA file for the database that you chose, or the database you are trying to connect to is not defined to the listener that is running on that node.";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
} elsif ( $DBI::errstr =~ /ORA-12545/ ) {
|
||||
$message= "You received an ORA-12545, which probably means you have a mistake in your TNSNAMES.ORA file for the database that you chose. (Possibly the node name).";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
} else {
|
||||
$message="Unable to connect to Oracle ($DBI::errstr)\n";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
} else {
|
||||
logit(" Login OK.");
|
||||
|
||||
# check to be sure this user has "SELECT ANY TABLE" privilege.
|
||||
logit(" checking for \"SELECT ANY TABLE\" privilege");
|
||||
if (checkPriv("SELECT ANY TABLE") < 1) {
|
||||
$message="user $username needs \"SELECT ANY TABLE\" privilege.";
|
||||
$state=$ERRORS{"UNKNOWN"};
|
||||
} else {
|
||||
$privsok="yep";
|
||||
$state=$ERRORS{"OK"};
|
||||
}
|
||||
}
|
||||
return ($dbh);
|
||||
}
|
||||
|
||||
|
||||
sub getDbVersion {
|
||||
|
||||
logit("Enter subroutine getDbVersion");
|
||||
|
||||
my $dbh = shift;
|
||||
my $oraversion;
|
||||
|
||||
# Find out if we are dealing with Oracle7 or Oracle8
|
||||
logit(" Getting Oracle version");
|
||||
$sql = "select banner from v\$version where rownum=1";
|
||||
|
||||
$cursor = $dbh->prepare($sql) or logit("Error: $DBI::errstr");
|
||||
$cursor->execute;
|
||||
(($oraversion) = $cursor->fetchrow_array);
|
||||
$cursor->finish;
|
||||
logit(" Oracle version = $oraversion");
|
||||
return $oraversion;
|
||||
}
|
||||
|
||||
|
||||
sub checkPriv {
|
||||
logit("Enter subroutine checkPriv");
|
||||
my ($privilege,$yesno);
|
||||
$privilege = shift;
|
||||
logit(" Checking for privilege \"$privilege\"");
|
||||
|
||||
$sql = "SELECT COUNT(*) FROM SESSION_PRIVS WHERE PRIVILEGE = '$privilege'";
|
||||
$cursor=$dbh->prepare($sql);
|
||||
$cursor->execute; $yesno = $cursor->fetchrow_array;
|
||||
$cursor->finish;
|
||||
|
||||
return($yesno);
|
||||
}
|
||||
|
||||
|
||||
sub get_values {
|
||||
logit("Enter subroutine get_values");
|
||||
my ($args, $inverse, $abort);
|
||||
$args = shift;
|
||||
$inverse = shift;
|
||||
if ($args =~ m!^(\d+)/(\d+)$!) {
|
||||
$warn = $1;
|
||||
$critical = $2;
|
||||
|
||||
# TODO: check for positive numbers!
|
||||
|
||||
if (! $inverse && $warn >= $critical) {
|
||||
print "\"$args\": warning threshold must be less than critical threshold. aborting...\n";
|
||||
$abort="yep";
|
||||
}
|
||||
if ($inverse && $warn <= $critical) {
|
||||
print "\"$args\": warning threshold must be greater than critical threshold. aborting...\n";
|
||||
$abort="yep";
|
||||
}
|
||||
} else {
|
||||
print "\"$args\": invalid warn/critical thresholds. aborting...\n";
|
||||
$abort="yep";
|
||||
}
|
||||
exit $ERRORS{"UNKNOWN"} if $abort;
|
||||
logit (" args=$args, warn=$warn, critical=$critical");
|
||||
}
|
||||
|
||||
|
||||
sub check_sessions {
|
||||
logit("Enter subroutine check_sessions");
|
||||
my ($args, $add, $sqladd, $count);
|
||||
$args = shift;
|
||||
$add = shift || '#'; # Default: Number of sessions
|
||||
$sqladd = "AND STATUS = 'ACTIVE'" if ($add eq "active");
|
||||
|
||||
get_values($args);
|
||||
|
||||
$sql = "SELECT COUNT(*) FROM V\$SESSION WHERE TYPE <> 'BACKGROUND' $sqladd";
|
||||
$cursor=$dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
$count = $cursor->fetchrow_array;
|
||||
$cursor->finish;
|
||||
logit (" $add sessions is $count");
|
||||
|
||||
if ($count >= $critical) {
|
||||
$message = $message . "$add sessions critical ($count) ";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ($count >= $warn) {
|
||||
$message = $message . "$add sessions warning ($count) ";
|
||||
$state=$ERRORS{"WARNING"} if $state < $ERRORS{"WARNING"};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub check_tablespaces {
|
||||
logit("Enter subroutine check_tablespaces");
|
||||
my ($args, $tablespace, $pctused, $mymsg, $mywarn, $mycritical);
|
||||
$args = shift;
|
||||
$mymsg = "Tablespace usage ";
|
||||
|
||||
get_values($args);
|
||||
|
||||
$sql = "SELECT
|
||||
DF.TABLESPACE_NAME \"Tablespace name\",
|
||||
NVL(ROUND((DF.BYTES-SUM(FS.BYTES))*100/DF.BYTES),100) \"Percent used\"
|
||||
FROM DBA_FREE_SPACE FS,
|
||||
(SELECT TABLESPACE_NAME, SUM(BYTES) BYTES FROM DBA_DATA_FILES GROUP BY
|
||||
TABLESPACE_NAME ) DF
|
||||
WHERE FS.TABLESPACE_NAME (+) = DF.TABLESPACE_NAME
|
||||
GROUP BY DF.TABLESPACE_NAME, DF.BYTES
|
||||
ORDER BY 2 DESC";
|
||||
|
||||
$cursor=$dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
while (($tablespace, $pctused) = $cursor->fetchrow_array) {
|
||||
logit (" $tablespace - $pctused% used");
|
||||
if ($pctused >= $critical) {
|
||||
unless ($mycritical) {
|
||||
$mymsg = $mymsg . "critical: ";
|
||||
$mycritical="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$tablespace ($pctused%) ";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ($pctused >= $warn) {
|
||||
unless ($mywarn) {
|
||||
$mymsg = $mymsg . "warning: ";
|
||||
$mywarn="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$tablespace ($pctused%) ";
|
||||
$state=$ERRORS{"WARNING"} if $state < $ERRORS{"WARNING"};
|
||||
}
|
||||
}
|
||||
$cursor->finish;
|
||||
$message = $message . $mymsg . " " if ($mycritical || $mywarn);
|
||||
}
|
||||
|
||||
|
||||
sub check_nextents {
|
||||
logit("Enter subroutine check_nextents");
|
||||
my ($args, $owner, $objname, $objtype, $extents, $mymsg, $mywarn, $mycritical);
|
||||
$args = shift;
|
||||
$mymsg = "#Extents ";
|
||||
|
||||
get_values($args);
|
||||
|
||||
$sql = "SELECT
|
||||
OWNER \"Owner\",
|
||||
SEGMENT_NAME \"Object name\",
|
||||
SEGMENT_TYPE \"Object type\",
|
||||
COUNT(*) \"Extents\"
|
||||
FROM DBA_EXTENTS WHERE OWNER <> 'SYS'
|
||||
GROUP BY SEGMENT_TYPE, SEGMENT_NAME, TABLESPACE_NAME, OWNER
|
||||
HAVING COUNT(*) >= $warn
|
||||
ORDER BY 4 DESC";
|
||||
|
||||
$cursor=$dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
while (($owner, $objname, $objtype, $extents) = $cursor->fetchrow_array) {
|
||||
if ($extents >= $critical) {
|
||||
unless ($mycritical) {
|
||||
$mymsg = $mymsg . "critical: ";
|
||||
$mycritical="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$owner.$objname($objtype)=$extents ";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ($extents >= $warn) {
|
||||
unless ($mywarn) {
|
||||
$mymsg = $mymsg . "warning: ";
|
||||
$mywarn="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$owner.$objname($objtype)=$extents ";
|
||||
$state=$ERRORS{"WARNING"} if $state < $ERRORS{"WARNING"};
|
||||
}
|
||||
}
|
||||
$cursor->finish;
|
||||
$message = $message . $mymsg . " " if ($mycritical || $mywarn);
|
||||
}
|
||||
|
||||
|
||||
sub check_fextents {
|
||||
logit("Enter subroutine check_fextents");
|
||||
my ($args, $owner, $objname, $objtype, $extents, $maxextents, $freextents, $mymsg, $mywarn, $mycritical);
|
||||
$args = shift;
|
||||
$mymsg = "Free extents ";
|
||||
|
||||
get_values($args, "inverse");
|
||||
|
||||
$sql = "SELECT
|
||||
OWNER \"Owner\",
|
||||
SEGMENT_NAME \"Object name\",
|
||||
SEGMENT_TYPE \"Object type\",
|
||||
EXTENTS \"Extents\",
|
||||
MAX_EXTENTS \"Max extents\",
|
||||
MAX_EXTENTS - EXTENTS \"Free extents\"
|
||||
FROM DBA_SEGMENTS
|
||||
WHERE (EXTENTS + $warn) >= MAX_EXTENTS
|
||||
AND SEGMENT_TYPE != 'CACHE'
|
||||
ORDER BY 6";
|
||||
|
||||
$cursor=$dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
while (($owner, $objname, $objtype, $extents, $maxextents, $freextents) = $cursor->fetchrow_array) {
|
||||
if ($freextents <= $critical) {
|
||||
unless ($mycritical) {
|
||||
$mymsg = $mymsg . "critical: ";
|
||||
$mycritical="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$owner.$objname($objtype)=$extents ";
|
||||
$state=$ERRORS{"CRITICAL"};
|
||||
} elsif ($freextents <= $warn) {
|
||||
unless ($mywarn) {
|
||||
$mymsg = $mymsg . "warning: ";
|
||||
$mywarn="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$owner.$objname($objtype)=$extents/$maxextents ";
|
||||
$state=$ERRORS{"WARNING"} if $state < $ERRORS{"WARNING"};
|
||||
}
|
||||
}
|
||||
$cursor->finish;
|
||||
$message = $message . $mymsg . " " if ($mycritical || $mywarn);
|
||||
}
|
||||
|
||||
|
||||
sub check_aextents {
|
||||
logit("Enter subroutine check_aextents");
|
||||
my ($args, $owner, $objname, $objtype, $tablespace_name, $mymsg, $mywarn);
|
||||
my (@tablespaces);
|
||||
|
||||
# Get a list of all tablespaces
|
||||
$sql = "SELECT TABLESPACE_NAME
|
||||
FROM DBA_TABLESPACES ORDER BY TABLESPACE_NAME";
|
||||
$cursor = $dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
while ($tablespace_name = $cursor->fetchrow_array) {
|
||||
push @tablespaces, $tablespace_name;
|
||||
}
|
||||
$cursor->finish;
|
||||
|
||||
# Search every tablespace for objects which cannot allocate a next extent.
|
||||
foreach $tablespace_name(@tablespaces) {
|
||||
logit (" checking tablespace $tablespace_name");
|
||||
$sql = "SELECT
|
||||
OWNER \"Owner\",
|
||||
SEGMENT_NAME \"Object name\",
|
||||
SEGMENT_TYPE \"Object type\"
|
||||
FROM DBA_SEGMENTS
|
||||
WHERE TABLESPACE_NAME = '$tablespace_name'
|
||||
AND NEXT_EXTENT > (SELECT NVL(MAX(BYTES),'0') FROM DBA_FREE_SPACE
|
||||
WHERE TABLESPACE_NAME = '$tablespace_name')";
|
||||
$cursor = $dbh->prepare($sql);
|
||||
$cursor->execute;
|
||||
while (($owner, $objname, $objtype) = $cursor->fetchrow_array) {
|
||||
logit (" found: $owner.$objname($objtype)");
|
||||
unless ($mywarn) {
|
||||
$mymsg = $mymsg . "warning: ";
|
||||
$mywarn="yep";
|
||||
}
|
||||
$mymsg = $mymsg . "$owner.$objname($objtype) ";
|
||||
$state=$ERRORS{"WARNING"} if $state < $ERRORS{"WARNING"};
|
||||
}
|
||||
$cursor->finish;
|
||||
}
|
||||
$message = $message . $mymsg . "cannot allocate a next extent. " if $mywarn;
|
||||
}
|
218
contrib/check_oracle_tbs
Normal file
218
contrib/check_oracle_tbs
Normal file
|
@ -0,0 +1,218 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
# (c)2004 John Koyle, RFP Depot, LLC.
|
||||
# This is free software use it however you would like.
|
||||
|
||||
use strict;
|
||||
use DBI;
|
||||
use Getopt::Long 2.16;
|
||||
use lib "/usr/local/nagios/libexec";
|
||||
use utils qw(%ERRORS);
|
||||
|
||||
|
||||
#*******************************************************************************
|
||||
# Set user configureable options here.
|
||||
#
|
||||
# Global Oracle info set here rather than command line to avoid output in ps -ef
|
||||
# Make sure this script is mode 700 and owner of the nrpe user
|
||||
#
|
||||
#*******************************************************************************
|
||||
my $orasid = "";
|
||||
my $orauser = "";
|
||||
my $orapwd = "";
|
||||
|
||||
|
||||
if (!$ENV{ORACLE_HOME}) {
|
||||
$ENV{ORACLE_HOME} = '/u01/app/oracle/product/9.2';
|
||||
}
|
||||
|
||||
#*******************************************************************************
|
||||
my $state = $ERRORS{'UNKNOWN'};
|
||||
my $answer = undef;
|
||||
|
||||
my ($MAJOR_VERSION, $MINOR_VERSION) = q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
|
||||
my $VERSION = sprintf("%d.%02d", $MAJOR_VERSION - 1, $MINOR_VERSION);
|
||||
|
||||
my $opt_debug; # -d|--debug
|
||||
my $opt_help; # -h|--help
|
||||
my $opt_version; # -V|--version
|
||||
my $opt_warn_space; # -w|--warn-space
|
||||
my $opt_crit_space; # -c|--crit-space
|
||||
|
||||
|
||||
|
||||
my $help = <<MARK; # help statement
|
||||
|
||||
check_oracle_tbs v$VERSION
|
||||
|
||||
Checks the tablespaces in an Oracle database for available free space.
|
||||
Usage: check_oracle_tbs [-w <warn>] [-c <crit>]
|
||||
|
||||
-d, --debug Output debug to screen.
|
||||
-h, --help Displays this help and exits.
|
||||
-w, --warn-space=... Warning threshold % free (default 15)
|
||||
-c, --crit-space=... Critical threshold % free (default 10)
|
||||
-V, --version Output version information and exit.
|
||||
|
||||
MARK
|
||||
|
||||
## We want exact matches to the switches
|
||||
|
||||
Getopt::Long::config('no_auto_abbrev', 'no_ignore_case');
|
||||
|
||||
|
||||
my $rc = GetOptions(
|
||||
"debug|d" => \$opt_debug,
|
||||
"help|h" => \$opt_help,
|
||||
"w|warn-space=s" => \$opt_warn_space,
|
||||
"c|crit-space=s" => \$opt_crit_space,
|
||||
"V|version" => \$opt_version,
|
||||
);
|
||||
|
||||
|
||||
#***********************************************************************
|
||||
# Process command-line switches
|
||||
#***********************************************************************
|
||||
|
||||
if (! $rc || defined $opt_help)
|
||||
{
|
||||
print STDERR $help;
|
||||
exit (defined $opt_help ? 0 : 1);
|
||||
}
|
||||
|
||||
if (defined $opt_version)
|
||||
{
|
||||
print STDERR "check_oracle_tbs v$VERSION\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (! defined $opt_warn_space)
|
||||
{
|
||||
if(defined $opt_debug) {
|
||||
print STDOUT "Warn space not defined, using 80%\n\n";
|
||||
}
|
||||
$opt_warn_space = 15;
|
||||
}
|
||||
|
||||
if (! defined $opt_crit_space)
|
||||
{
|
||||
if(defined $opt_debug) {
|
||||
print STDOUT "Crit space not defined, using 90%\n\n";
|
||||
}
|
||||
$opt_crit_space = 10;
|
||||
}
|
||||
|
||||
my $array_ref = executeSQL();
|
||||
|
||||
# Don't match certain tablespaces.
|
||||
foreach my $row (@$array_ref) {
|
||||
my ( $tbs_name, $free_mb, $tot_mb, $free_pct) = @$row;
|
||||
if ($opt_debug) { print STDOUT "Output: $tbs_name\t$tot_mb\t$free_mb\t$free_pct\n\n"; }
|
||||
if ($free_pct < $opt_crit_space && $tbs_name !~ /RBS/ && $tbs_name !~ /PERFSTAT/ && $tbs_name !~ /UNDOTBS/) {
|
||||
$state = $ERRORS{'CRITICAL'};
|
||||
$answer .= "Critical: $tbs_name = $free_pct\% ";
|
||||
last;
|
||||
}
|
||||
if ($free_pct < $opt_warn_space && $tbs_name !~ /RBS/ && $tbs_name !~ /PERFSTAT/ && $tbs_name !~ /UNDOTBS/) {
|
||||
$state = $ERRORS{'WARNING'};
|
||||
$answer .= "Warning: $tbs_name = $free_pct\% ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($state != $ERRORS{'CRITICAL'} && $state != $ERRORS{'WARNING'}) {
|
||||
$state = $ERRORS{'OK'};
|
||||
$answer = "All Tablespaces OK";
|
||||
}
|
||||
|
||||
if ($opt_debug && $state != $ERRORS{'OK'}) { print STDOUT "The following tablespaces are in question: $answer\n\n"; }
|
||||
|
||||
foreach my $key (keys %ERRORS) {
|
||||
if ($state==$ERRORS{$key}) {
|
||||
print ("$key: $answer");
|
||||
last;
|
||||
}
|
||||
}
|
||||
exit $state;
|
||||
|
||||
#------------------SUBS-------------------------------------------------------
|
||||
sub executeSQL
|
||||
{
|
||||
my ($dbh, $sth, $results);
|
||||
|
||||
$dbh = openOracle();
|
||||
|
||||
eval {
|
||||
$dbh->{RaiseError} = 1;
|
||||
$sth = $dbh->prepare(q{
|
||||
select ts.tablespace_name,
|
||||
trunc(sum(ts.free_b)/1024/1024) free,
|
||||
trunc(sum(ts.max_b)/1024/1024) total,
|
||||
trunc( sum(ts.free_b)/sum(ts.max_b)*1000) / 10 as pct_free
|
||||
from
|
||||
(select a.file_id,
|
||||
a.tablespace_name,
|
||||
decode(a.autoextensible,'YES',a.maxsize-a.bytes+b.free,'NO',b.free) free_b,
|
||||
a.maxsize max_b
|
||||
from (select file_id,
|
||||
tablespace_name,
|
||||
autoextensible,
|
||||
bytes,
|
||||
decode(autoextensible,'YES',maxbytes,bytes) maxsize
|
||||
from dba_data_files) a,
|
||||
(select file_id,
|
||||
tablespace_name,
|
||||
sum(bytes) free
|
||||
from dba_free_space
|
||||
group by file_id, tablespace_name) b
|
||||
where a.file_id=b.file_id(+)) ts
|
||||
group by tablespace_name
|
||||
});
|
||||
|
||||
$sth->execute();
|
||||
$results = $sth->fetchall_arrayref();
|
||||
$sth->finish;
|
||||
$dbh->{RaiseError} = 0;
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
closeOracle($dbh);
|
||||
if($opt_debug) { print STDOUT "DB Failed Query: $@\n"; }
|
||||
CleanupAndExit($ERRORS{'UNKNOWN'});
|
||||
}
|
||||
|
||||
closeOracle($dbh);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
#------ Open the connection to the database and return the handle
|
||||
sub openOracle
|
||||
{
|
||||
my ($dbh);
|
||||
|
||||
$dbh = DBI->connect("$orasid", "$orauser", "$orapwd", "Oracle");
|
||||
|
||||
if (!$dbh) {
|
||||
if ($opt_debug) { print "ERROR: Could not connect to Oracle!\n\n"; }
|
||||
CleanupAndExit($ERRORS{'UNKNOWN'});
|
||||
}
|
||||
if ($opt_debug) { print "Connected to Oracle SID $orasid\n\n"; }
|
||||
return $dbh;
|
||||
}
|
||||
|
||||
#------- Close the database connection
|
||||
sub closeOracle()
|
||||
{
|
||||
my ($dbh) = @_;
|
||||
|
||||
$dbh->disconnect;
|
||||
}
|
||||
|
||||
#------ Exit with the current return code
|
||||
sub CleanupAndExit
|
||||
{
|
||||
my ($rc) = @_;
|
||||
|
||||
exit($rc);
|
||||
}
|
||||
|
106
contrib/check_pcpmetric.py
Normal file
106
contrib/check_pcpmetric.py
Normal file
|
@ -0,0 +1,106 @@
|
|||
#! /usr/bin/env python
|
||||
#
|
||||
# Nagios client for checking Performance Co-Pilot metrics
|
||||
#
|
||||
#
|
||||
|
||||
from sys import argv,exit
|
||||
import popen2, getopt, string, types
|
||||
|
||||
DEBUG=0
|
||||
|
||||
nagios_pcpclient_version = 0.01
|
||||
PMVAL='/usr/bin/pmval'
|
||||
COMMANDLINE=PMVAL + " -s 1"
|
||||
METRIC='undefined'
|
||||
CRITICAL=0
|
||||
WARNING=0
|
||||
|
||||
def usage():
|
||||
print "Usage:", argv[0], "[options]"
|
||||
print "Options:"
|
||||
print "\t[-H host]\tHostname to contact"
|
||||
print "\t[-m metric]\tPCP metric to check"
|
||||
print "\t[-i instance]\tPCP metric instance"
|
||||
print "\t[-w warn]\tIssue warning alert if value is larger than this"
|
||||
print "\t[-c critical]\tIssue critical alert value is larger than this"
|
||||
print "\t[-V]\t\tProgram version"
|
||||
print "\t[-h]\t\tThis helptext"
|
||||
print ""
|
||||
print "F.ex. to check 5 minute loadaverage, warn if the load is above 2,"
|
||||
print "and give critical warning if it's above 10:"
|
||||
print "\n\t%", argv[0], " -i 5 -m kernel.all.load -w 2 -c 10"
|
||||
print ""
|
||||
print "A list of all PCP metrics can be found with the command 'pminfo'."
|
||||
print "A list of all instances within a metric can be found with 'pminfo -f metric'."
|
||||
print "F.ex. to see all available instances of 'filesys.full' execute:"
|
||||
print "\n\t% pminfo -f filesys.full"
|
||||
print "\tfilesys.full"
|
||||
print """\t\tinst [0 or "/dev/root"] value 45.35514044640914"""
|
||||
print """\t\tinst [1 or "/dev/sda1"] value 46.74285959344712"""
|
||||
print """\t\tinst [2 or "/dev/sdb1"] value 0.807766570678168"""
|
||||
print ""
|
||||
print "And the command to have nagios monitor the /dev/sda1 filesystem would be:"
|
||||
print "\n\t", argv[0], " -i /dev/sda1 -m filesys.full -w 70 -c 90"
|
||||
|
||||
|
||||
opts, args = getopt.getopt(argv[1:],'hH:c:w:m:i:V')
|
||||
for opt in opts:
|
||||
key,value = opt
|
||||
if key == '-H':
|
||||
COMMANDLINE = COMMANDLINE + " -h " + value
|
||||
elif key == '-m':
|
||||
METRIC=value
|
||||
elif key == '-i':
|
||||
COMMANDLINE = COMMANDLINE + " -i " + value
|
||||
elif key == '-c':
|
||||
CRITICAL = value
|
||||
elif key == '-w':
|
||||
WARNING = value
|
||||
elif key == '-h':
|
||||
usage()
|
||||
exit(0)
|
||||
elif key == '-V':
|
||||
print "Nagios Performance CoPilot client v%.2f" % nagios_pcpclient_version
|
||||
print "Written by Jan-Frode Myklebust <janfrode@parallab.uib.no>"
|
||||
exit(0)
|
||||
|
||||
if METRIC == 'undefined':
|
||||
usage()
|
||||
exit(3)
|
||||
|
||||
COMMANDLINE = COMMANDLINE + " " + METRIC
|
||||
if DEBUG: print COMMANDLINE
|
||||
p=popen2.Popen4(COMMANDLINE)
|
||||
exitcode=p.wait()
|
||||
|
||||
# Get the last line of output from 'pmval':
|
||||
buffer = p.fromchild.readline()
|
||||
while (buffer != ''):
|
||||
output=buffer
|
||||
buffer = p.fromchild.readline()
|
||||
|
||||
returndata = string.split(output)[0]
|
||||
|
||||
|
||||
# Confirm that we have gotten a float, and not
|
||||
# some errormessage in the returndata. If not,
|
||||
# print the error, and give the UNKNOWN exit code:
|
||||
|
||||
try:
|
||||
retval = string.atof(returndata)
|
||||
except ValueError, e:
|
||||
print e
|
||||
exit(3)
|
||||
|
||||
if (retval < WARNING):
|
||||
EXITCODE=0
|
||||
elif (retval > CRITICAL):
|
||||
EXITCODE=2
|
||||
elif (retval > WARNING):
|
||||
EXITCODE=1
|
||||
else:
|
||||
EXITCODE=3
|
||||
|
||||
print retval
|
||||
exit(EXITCODE)
|
75
contrib/check_pfstate
Normal file
75
contrib/check_pfstate
Normal file
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_P $opt_H $opt_w $opt_c $PROGNAME);
|
||||
use lib "/usr/local/nagios/libexec" ;
|
||||
use utils qw(%ERRORS &print_revision &support &usage);
|
||||
|
||||
my $remote_user = "root";
|
||||
my $path_to_ssh = "/usr/bin/ssh";
|
||||
my $path_to_grep = "/usr/bin/grep";
|
||||
my $path_to_awk = "/usr/bin/awk";
|
||||
my $warn = 50000;
|
||||
my $crit = 60000;
|
||||
|
||||
$PROGNAME = "check_pfstate";
|
||||
$ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
if ($opt_w) {
|
||||
if ($opt_w =~ /(\d+)/) {
|
||||
$warn = $1;
|
||||
} else {
|
||||
usage("Invalid values: $opt_w\n");
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
}
|
||||
if ($opt_c) {
|
||||
if ($opt_c =~ /(\d+)/) {
|
||||
$crit = $1;
|
||||
} else {
|
||||
usage("Invalid values: $opt_c\n");
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
}
|
||||
($opt_H) || usage("Host name/address not specified\n");
|
||||
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
|
||||
($host) || usage("Invalid host: $opt_H\n");
|
||||
|
||||
my $result = `$path_to_ssh -l $remote_user $host '/sbin/pfctl -s info' | $path_to_grep entries`;
|
||||
chomp $result;
|
||||
$result =~ /(\d+)/;
|
||||
$result = $1;
|
||||
|
||||
print "$result PF state entries\n";
|
||||
|
||||
exit $ERRORS{'CRITICAL'} if ($result >= $crit);
|
||||
exit $ERRORS{'WARNING'} if ($result >= $warn);
|
||||
exit $ERRORS{'OK'};
|
||||
|
||||
|
||||
sub print_help {
|
||||
print_revision($PROGNAME,'$Revision: 1.1 $');
|
||||
print "Copyright (c) 2002 Jason Dixon\n\nThis plugin checks the number of state table entries on a PF-enabled OpenBSD system.\n\n";
|
||||
print "Usage:\t-H, --hostname=<HOST> [-w, --warning=<WARNING>] [-c, --critical=<CRITICAL>]\n\n\tDefault warning is 50000 and critical is 60000.\n\n";
|
||||
support();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue