Adding check_nwc_health

This commit is contained in:
Jan Wagner 2014-08-24 22:14:08 +02:00
parent d441fe0ee5
commit e95e2a8f9a
191 changed files with 31997 additions and 1 deletions

16
check_nwc_health/Makefile Normal file
View file

@ -0,0 +1,16 @@
PLUGIN := check_nwc_health
CLEANFILES := check_nwc_health
include ../common.mk
check_nwc_health:
set -e; for i in guess sub; do if [ ! -e src/config.$$i.bak ]; then cp src/config.$$i src/config.$$i.bak; fi; done
cp /usr/share/misc/config.* src
cd src && ./configure --prefix=/usr --with-nagios-user=nagios --with-nagios-group=nagios
make -C src
sed 's,^# nagios: +epn$,# nagios: -epn\n,' src/plugins-scripts/check_nwc_health > $@
#cp src/plugins-scripts/check_nwc_health $@
clean::
[ ! -f src/Makefile ] || make -C src distclean
set -e; for i in guess sub; do if [ -e src/config.$$i.bak ]; then mv src/config.$$i.bak src/config.$$i; fi; done

View file

@ -0,0 +1 @@
Gerhard Lausser <gerhard.lausser@consol.de>

View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,301 @@
############################################
# Changelog of the check_nwc_health plugin #
############################################
2014-08-22 3.0.3.5
- bugfix in glplugin/uptime because of buggy snmpengineuptime
2014-08-21 3.0.3.4
- bugfix in glplugin/uptime thresholds
2014-08-21 3.0.3.3
- add a hack with --name2 which allows shortening of stupid interface names (make dmz1 from Adaptive Security Appliance 'dmz1' interface)
2014-08-20 3.0.3.2
- update GLPluginSNMP (timeout handling)
2014-08-20 3.0.3.1
- fix interfaces which seem to be 64bit but have no counters
2014-08-19 3.0.3
- bugfix in offline mode
- update GLPlugin
- update GLPluginSNMP
2014-08-15 3.0.2.2
- bugfix in ios memory criticalx/warningx thresholds
2014-08-14 3.0.2.1
- update GLPluginSNMP
2014-08-14 3.0.2
- improve interface-usage performance data
- detect more brocade models
2014-08-13 3.0.1
- bugfix in interface-usage temp-files
2014-08.01 3.0
- jetzt langts mit der ridiseignerei
2014-03-17 3.0x
- massive rewriting of the plugins structure and modules
- repair malformed data returned by Net::SNMP
- add interface-nat-rejects and interface-nat-session-count for IOS
- add hardware-health for cisco asa
- bugfix for old brocade devices and missing cpu/memory oids
- bugfix in Cisco Call Manager
- bugfix in IOS Memory for ASR 9000 image and reserved pool
- bugfix in cisco wlc status
- add hardware-health for cisco pix
- add mode supportedmibs
- last fallback alarm-mib for ios without envmon-mib
- bugfix in timeticks for hp
- bugfix in Nexus sensor thresholds (Thanks Marcel Fischer)
- bugfix in snmp-bulk-gets, more secure fallbacks to get-next
- bugfix in 64bit-interfaces
- GLPlugin update & cleanup
- get uptime from the FRAMEWORK-MIB to prevent rollovers
2014-02-07 2.6.5.2
- add another cisco unified communication model
2014-01-31 2.6.5.1
- handle a missing brocade fabric watch license in cpu-load & memory-usage
- add CISCO-ENHANCED-MEMPOOL-MIB
2014-01-24 2.6.5
- add mode --check-config, which finds unsaved (cisco only) configs (Thanks Simon Meggle)
2014-01-18 2.6.4.3
- bugfix in uptime (Thanks Finn Christiansen)
2014-01-15 2.6.4.2
- add http connection checks for bluecoat sg
2014-01-14 2.6.4
- add cisco ccm
2014-01-11 2.6.3.1
- support more SecureOS devices (i bought Juniper SSG5)
- bugfix in upnp-detection
2013-12-21 2.6.3
- output number of sessions for f5 bigip load balancer pools
- deal with obviously wrong values from devices (20000% cpu usage)
- foundry server load balancing
- bugfix in interface-* for Juniper IVE
- filter hsrp groups by name
2013-11-08
- added support for role based login for Fritz Boxes (available since
FRITZ!OS 5.50). Use --community for password, --username for username if
role based security is switched on.
2013-11-09
- bugfix for fritzbox
2013-11-08 2.6.1
- hardware-health for Checkpoint Firewall-1
2013-11-07 2.6
- finished bgp-peer-status (focus on as numbers with --name2)
- admin down with --interface-status can have any level with --mitigation
2013-10-31 2.5.4.1
- add Fujitsu Intelligent Blade Panel 30/12
2013-10-30 2.5.4
- add bgp
2013-10-01 2.5.3
- detect more brocade devices
2013-09-26 2.5.2.1
- supress double output for html f5 pool members
2013-09-25 2.5.2
- add html output for f5 pool members
2013-09-18 2.5.1.2
- removed a leftover Data::Dumper (Thanks Frank Belau)
2013-09-17 2.5.1.1
- bugfix in lsmpi_io memory pools of Cisco ASR (100% even with --warning/--critical)
2013-09-11 2.5.1
- set a 100% threshold for lsmpi_io memory pools of Cisco ASR (Thanks James Clark & Perun)
2013-09-10 2.5
- implemented offline mode with --snmpwalk & --offline
2013-09-03 2.4
- add Cisco IronPort AsyncOS
2013-08-27 2.3
- add Juniper IVE (ex. Pulse-Gateway MAG4610)
- add count-connections for cisco asa
2013-07-11 2.2
- add memory-usage for checkpoint
- add detection for cpx
2013-07-09 2.1.1
- skip non-interface files in /sys/class/net for servertype linuxlocal (Thanks Sven Nierlein)
- better error handling on unwritable statefiles/dirs
2013-06-12 2.1
- added "--servertype ifmib" so you can use "--mode interface*" with every kind of ifmib-capable device
2013-06-01 2.0
- added support for AVM FRITZ!DECT 200 smart plug
2013-05-27 1.9.8.1
- bugfix for the bugfix in commandline options (Thanks webspace Mario)
2013-05-23 1.9.8
- add Brocade Communications Systems, Inc. ICX6610-24-HPOE, IronWare
- bugfix in commandline options (Thanks TheCry)
2013-05-17 1.9.7.4
- added another fallback for snmp-get_entries
- fixed a bug in uptime (only first minute after reboot)
2013-04-20 1.9.7.3
- fixed a bug in snmpwalk simulation and savestate
2013-04-08 1.9.7.2
- bugfix, interfaces were shown twice in list-interfaces
2013-03-26 1.9.7.1
- set automatic thresholds for link-aggregation-availability
2013-03-25 1.9.7
- added link-aggregation-availability
2013-03-19 1.9.6
- fixed a bug in interface-*
- speedup in interface-* (with --name and 64bit)
- added a hostname/community hash to statefiles
2013-02-13 1.9.5.1
- fixed a bug deep inside snmp bulkwalks and lots of interfaces (Thanks Uestuen Oender)
2013-02-24 1.9.5
- add interface-availability
2013-02-11 1.9.4
- add Cisco Wireless LAN Controller 5500
2013-02-11 1.9.3.1
- fixed a bug in statefiles with uppercase directory names. (Thanks Matthias Gallinger)
2013-02-10 1.9.3
- add blue coat sg600
2013-02-02 1.9.2
- removed my static ip from FRITZ!BOX interface-usage (Thanks Stef)
2013-01- 1.9.1
- fixed a bug in FFritz!BOX uptime (Thanks Lars Urban)
3013-01 1.9
- add uptime and interface-usage for AVM FRITZ!Box 7390
- add cpu-load and memory-usage for AVM FRITZ!Box 7390
2013-01-13 1.8
-add cpu&memory check for juniper netscreen
2013-01-12 1.7.1
- add a name caching mechanism for f5 bigip pools
2013-01-08 1.7
- add f5 bigip pool completeness
- add member info for failed f5 pools
2012-12-10 1.6
- add checkpoint firewall-1
2012-11-23 1.5
- add 64bit interfaces
2012-09-26 1.4.9.1
- fix a bug in uptime calculation
2012-09-24 1.4.9
- add hp procurve cpu-load and memory-usage
- fix a bug in cisco memory perfdata
2012-08-28 1.4.8
- add hp procurve hardware
2012-08-21 1.4.7.1
- fix a bug in servertype locallinux, interfaces and --name (Thanks Simon Meggle)
2012-08-21 1.4.7
- add f5 bigip
- bugfix in mode uptime
2012-08-10 1.4.6
- add mode uptime
2012-08-10 1.4.5.2
- fix a bug in statefilesdir creation under omd
2012-08-02 1.4.5.1
- add more hardware info for EMC-DS24M2 (McData Sphereon 4500)
2012-07-31 1.4.5
- add UCD-MIB for SecureOS (McAfee Sidewinder)
2012-07-31 1.4.4
- add fibre alliance mib sensor table for MeOS/DS-4700M
2012-07-20 1.4.3.1
- add the index to interface names, if interfaces all have the same name
- first experiments with MeOS
2012-07-12 1.4.3
- fix a bug in the role parameter for hsrp
- fix a temperature index where ios doesn't set the counter itself
- add mib2-interface-modes to brocade fabos
2012-07-05 1.4.2
- add mode encode for interface names with ' or "
2012-07-05 1.4.1
- add --ifspeedin, --ifspeedout, --ifspeed (used for asymmetric mpls)
2012-06-22 1.4
- add linux local interfaces (interface-usage/errors only) with --servertype linuxlocal
- add mode walk
- rename brocade300 -> fabos
2012-04-23 1.3
- add mode list-interfaces-detail (Cisco only)
- add brocade300 (hardware-health,memory-usage,cpu-load only)
2012-03-29 1.2
- add support for Cisco Nexus (cpu, mem, )
- add Nexus sensors
- add Allied Telesyn (only interfaces so far)
2012-03-19 1.1.1.1
- bugfix in list-hsrp-groups
- --units KBi/MBi/GBi for interface-usage
2012-02-22 1.1.1
- add mode hsrp-failover (Thanks Munich)
2012-02-22 1.1
- add mode hsrp-state (Thanks Munich)
2012-01-05
- some more debug messages
2012-01-04 1.0
- Nortel devices are recognized. (only interfaces can be queried by now)
- no official changes yet

View file

@ -0,0 +1,240 @@
Copyright (C) Gerhard Lausser, gerhard.lausser@consol.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; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View file

@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = plugins-scripts
dist-hook:
make

View file

@ -0,0 +1,750 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 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@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) COPYING THANKS \
TODO config.guess config.sub install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CELSIUS = @CELSIUS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXTENDEDINFO = @EXTENDEDINFO@
HWINFO = @HWINFO@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_OPTS = @INSTALL_OPTS@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NOINSTLEVEL = @NOINSTLEVEL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERFDATA = @PERFDATA@
PERL = @PERL@
RELEASE = @RELEASE@
SET_MAKE = @SET_MAKE@
SH = @SH@
SHELL = @SHELL@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
VERSION = @VERSION@
WARRANTY = @WARRANTY@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
with_nagios_group = @with_nagios_group@
with_nagios_user = @with_nagios_user@
SUBDIRS = plugins-scripts
all: all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__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)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
# 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.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
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; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
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 || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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 \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(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__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_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) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
&& $(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 \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-generic distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-am uninstall uninstall-am
dist-hook:
make
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,106 @@
check_nwc_health Nagios Plugin README
---------------------
This plugin checks the hardware health and various interface metrics
of network components like switches and routers.
Copyright (C) Gerhard Lausser, gerhard.lausser@consol.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; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* For instructions on installing this plugin for use with Nagios,
see below. In addition, generic instructions for the GNU toolchain
can be found in the INSTALL file.
* For major changes between releases, read the CHANGES file.
* For information on detailed changes that have been made,
read the Changelog file.
* This plugin is self-documenting. All plugins that comply with
the basic guidelines for development will provide detailed help when
invoked with the '-h' or '--help' options.
You can check for the latest plugin at:
http://labs.consol.de/nagios/check_nwc_health
Send mail to gerhard.lausser@consol.de 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.
How to "compile" the check_nwc_health script.
--------------------------------------------------------
1) Run the configure script to initialize variables and create a Makefile, etc.
./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-perl=PATH_TO_PERL
a) Replace BASEDIRECTORY with the path of the directory under which Nagios
is installed (default is '/usr/local/nagios')
b) Replace SOMEUSER with the name of a user on your system that will be
assigned permissions to the installed plugins (default is 'nagios')
c) Replace SOMEGRP with the name of a group on your system that will be
assigned permissions to the installed plugins (default is 'nagios')
d) Replace PATH_TO_PERL with the path where a perl binary can be found.
Besides the system wide perl you might have installed a private perl
just for the nagios plugins (default is the perl in your path).
2) "Compile" the plugin with the following command:
make
This will produce a "check_nwc_health" script. You will also find
a "check_nwc_health.pl" which you better ignore. It is the base for
the compilation filled with placeholders. These will be replaced during
the make process.
3) Install the compiled plugin script with the following command:
make install
The installation procedure will attempt to place the plugin in a
'libexec/' subdirectory in the base directory you specified with
the --prefix argument to the configure script.
4) Verify that your configuration files for Nagios contains
the correct paths to the new plugin.
Command line parameters
-----------------------
You'll find the command line parameters on the website mentioned above.
If it does not exist or is not up to date, this means that i hadn't the
time to write/update it yet. I am aware of it, so please don't send me
mails. Just accept it.
Sample data from real machines
------------------------------
If you think check_nwc_health is not working correctly, send me the output of snmpwalk
snmpwalk .... 1.3.6.1.4.1.232
--
Gerhard Lausser <gerhard.lausser@consol.de>

View file

@ -0,0 +1,2 @@
A big THANK YOU to Francois Mikus for pointing me to genDevConfig, where i found lots of useful oids.

View file

@ -0,0 +1,6 @@
- interface up down, operstatus
- traffic, in, out, 2xthresholds?
- errors
- cpu
- mem
- load

View 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)"])

View file

@ -0,0 +1,755 @@
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.14'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.14.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.14.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])
[_AM_PROG_CC_C_O
])
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated.])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])],
[m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES([CXX])],
[m4_define([AC_PROG_CXX],
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES([OBJC])],
[m4_define([AC_PROG_OBJC],
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it is modern enough.
# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
AC_MSG_WARN(['missing' script is too old or missing])
fi
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
AC_CACHE_CHECK([whether $am_make supports nested variables],
[am_cv_make_support_nested_variables],
[if AS_ECHO([['TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the 'STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1],
[ustar],
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
# There is notably a 21 bits limit for the UID and the GID. In fact,
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
# and bug#13588).
am_max_uid=2097151 # 2^21 - 1
am_max_gid=$am_max_uid
# The $UID and $GID variables are not portable, so we need to resort
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
# below are definitely unexpected, so allow the users to see them
# (that is, avoid stderr redirection).
am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
fi],
[pax],
[],
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Go ahead even if we have the value already cached. We do so because we
# need to set the values for the 'am__tar' and 'am__untar' variables.
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
for _am_tool in $_am_tools; do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar; do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works.
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
AM_RUN_LOG([cat conftest.dir/file])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([acinclude.m4])

View file

@ -0,0 +1,58 @@
<?php
#
# This is a template for the visualisation addon PNP (http://www.pnp4nagios.org)
#
# Plugin: check_nwc_health - https://labs.consol.de/nagios/check_nwc_health/
# Release 1.0 2013-07-18
#
$def[1] = "";
$opt[1] = "";
$_WARNRULE = '#FFFF00';
$_CRITRULE = '#FF0000';
$num = 1;
foreach ($DS as $i=>$VAL) {
# eth0_usage_in / out
if(preg_match('/^(.*?)_usage_in/', $NAME[$i])) {
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
$ds_name[$num] = $interface.' usage';
$opt[$num] = "--vertical-label \"Usage\" -l 0 -u 100 --title \"Interface Usage for $hostname - ".$interface."\" ";
$def[$num] = "DEF:percin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
$def[$num] .= "DEF:percout=".$RRDFILE[$i+1].":".$DS[$i+1].":AVERAGE ";
$def[$num] .= "LINE2:percin#00e060:\"in\t\" ";
$def[$num] .= "GPRINT:percin:LAST:\"%10.1lf %% last\" ";
$def[$num] .= "GPRINT:percin:AVERAGE:\"%7.1lf %% avg\" ";
$def[$num] .= "GPRINT:percin:MAX:\"%7.1lf %% max\\n\" ";
$def[$num] .= "LINE2:percout#0080e0:\"out\t\" ";
$def[$num] .= "GPRINT:percout:LAST:\"%10.1lf %% last\" ";
$def[$num] .= "GPRINT:percout:AVERAGE:\"%7.1lf %% avg\" ";
$def[$num] .= "GPRINT:percout:MAX:\"%7.1lf %% max\"\\n ";
$def[$num] .= "HRULE:$WARN[$num]$_WARNRULE ";
$def[$num] .= "HRULE:$CRIT[$num]$_CRITRULE ";
$num++;
}
# eth0_traffic_in / out
if(preg_match('/^(.*?)_traffic_in/', $NAME[$i])) {
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
$ds_name[$num] = $interface.' traffic';
$opt[$num] = "--vertical-label \"Traffic\" -b 1024 --title \"Interface Traffic for $hostname - $interface\" ";
$def[$num] = "DEF:bitsin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
$def[$num] .= "DEF:bitsout=".$RRDFILE[$i+1].":".$DS[$i+1].":AVERAGE ";
$def[$num] .= "AREA:bitsin#00e060:\"in\t\" ";
$def[$num] .= "GPRINT:bitsin:LAST:\"%10.1lf %Sb/s last\" ";
$def[$num] .= "GPRINT:bitsin:AVERAGE:\"%7.1lf %Sb/s avg\" ";
$def[$num] .= "GPRINT:bitsin:MAX:\"%7.1lf %Sb/s max\\n\" ";
$def[$num] .= "CDEF:bitsminusout=0,bitsout,- ";
$def[$num] .= "AREA:bitsminusout#0080e0:\"out\t\" ";
$def[$num] .= "GPRINT:bitsout:LAST:\"%10.1lf %Sb/s last\" ";
$def[$num] .= "GPRINT:bitsout:AVERAGE:\"%7.1lf %Sb/s avg\" ";
$def[$num] .= "GPRINT:bitsout:MAX:\"%7.1lf %Sb/s max\\n\" ";
}
}
?>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,115 @@
dnl Process this file with autoconf to produce a configure script.
AC_REVISION ($Revision: 1.150 $)
AC_PREREQ(2.58)
AC_INIT(check_nwc_health,3.0.3.5)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AC_CANONICAL_HOST
RELEASE=1
AC_SUBST(RELEASE)
AC_PREFIX_DEFAULT(/usr/local/nagios)
dnl Figure out how to invoke "install" and what install options to use.
AC_PROG_INSTALL
AC_SUBST(INSTALL)
AC_PROG_MAKE_SET
AC_PROG_AWK
WARRANTY="This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
AC_SUBST(WARRANTY)
SUPPORT="Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
AC_SUBST(SUPPORT)
AC_ARG_WITH(nagios_user,
ACX_HELP_STRING([--with-nagios-user=USER],
[set user name to run nagios]),
with_nagios_user=$withval,
with_nagios_user=nagios)
AC_ARG_WITH(nagios_group,
ACX_HELP_STRING([--with-nagios-group=GROUP],
[set group name to run nagios]),
with_nagios_group=$withval,
with_nagios_group=nagios)
AC_SUBST(with_nagios_user)
AC_SUBST(with_nagios_group)
INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
AC_SUBST(INSTALL_OPTS)
AC_ARG_WITH(noinst_level,
ACX_HELP_STRING([--with-noinst-level=LEVEL],
[error level if nwc_health is not installed]),
with_noinst_level=$withval,
with_noinst_level=unknown)
AC_SUBST(NOINSTLEVEL, $with_noinst_level)
AC_ARG_WITH(degrees,
ACX_HELP_STRING([--with-degrees=UNIT],
[which temperature unit to use. (celsius or fahrenheit)]),
with_degrees=$withval,
with_degrees=unknown)
case "$with_degrees" in
fahrenheit)
AC_SUBST(CELSIUS, 0)
;;
*)
AC_SUBST(CELSIUS, 1)
;;
esac
AC_ARG_ENABLE([perfdata],
[ --enable-perfdata wether to output perfdata (default=no)], ,enable_perfdata=no)
if test x"$enable_perfdata" = xyes ; then
AC_SUBST(PERFDATA, 1)
else
AC_SUBST(PERFDATA, 0)
fi
AC_ARG_ENABLE([extendedinfo],
[ --enable-extendedinfo wether to output extended info (default=no)], ,enable_extendedinfo=no)
if test x"$enable_extendedinfo" = xyes ; then
AC_SUBST(EXTENDEDINFO, 1)
else
AC_SUBST(EXTENDEDINFO, 0)
fi
AC_ARG_ENABLE([hwinfo],
[ --disable-hwinfo wether to output model desc., serial no., bios version (default=yes)], ,enable_hwinfo=yes)
if test x"$enable_hwinfo" = xyes ; then
AC_SUBST(HWINFO, 1)
else
AC_SUBST(HWINFO, 0)
fi
case "$host_os" in
*hp*)
defaulttrustedpath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/contrib/bin
;;
*)
defaulttrustedpath=/bin:/sbin:/usr/bin:/usr/sbin
;;
esac
EXTRAS=
dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
dnl Checks for programs.
AC_PATH_PROG(SH,sh)
AC_PATH_PROG(PERL,perl)
dnl allow them to override the path of perl
AC_ARG_WITH(perl,
ACX_HELP_STRING([--with-perl=PATH],
[sets path to perl executable]),
with_perl=$withval,with_perl=$PERL)
AC_SUBST(PERL, $with_perl)
AC_OUTPUT(Makefile plugins-scripts/Makefile plugins-scripts/subst)
ACX_FEATURE([with],[perl])
ACX_FEATURE([with],[nagios-user])
ACX_FEATURE([with],[nagios-group])
ACX_FEATURE([with],[noinst-level])
ACX_FEATURE([with],[degrees])
ACX_FEATURE([enable],[perfdata])
ACX_FEATURE([enable],[extendedinfo])
ACX_FEATURE([enable],[hwinfo])

View file

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View file

@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2012-06-26.16; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'automa4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View file

@ -0,0 +1,22 @@
package Classes::AVOS;
our @ISA = qw(Classes::Bluecoat);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::AVOS::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::AVOS::Component::MemSubsystem");
} elsif ($self->mode =~ /device::licenses::/) {
$self->analyze_and_check_key_subsystem("Classes::AVOS::Component::KeySubsystem");
} elsif ($self->mode =~ /device::connections/) {
$self->analyze_and_check_connection_subsystem("Classes::AVOS::Component::ConnectionSubsystem");
} elsif ($self->mode =~ /device::security/) {
$self->analyze_and_check_security_subsystem("Classes::AVOS::Component::SecuritySubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,22 @@
package Classes::AVOS::Component::ConnectionSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('BLUECOAT-AV-MIB', (qw(
avSlowICAPConnections)));
}
sub check {
my $self = shift;
$self->add_info(sprintf '%d slow ICAP connections',
$self->{avSlowICAPConnections});
$self->set_thresholds(warning => 100, critical => 100);
$self->add_message($self->check_thresholds($self->{avSlowICAPConnections}));
$self->add_perfdata(
label => 'slow_connections',
value => $self->{avSlowICAPConnections},
);
}

View file

@ -0,0 +1,56 @@
package Classes::AVOS::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my %params = @_;
# With AVOS version 5.5.4.1, 5.4.6.1 and 6.1.2.1, the SNMP MIB has been extended to support multiple CPU cores.
# The new OID is defined as a table 1.3.6.1.4.1.3417.2.11.2.4.1 in the BLUECOAT-SG-PROXY-MIB file with the following sub-OIDs.
# https://kb.bluecoat.com/index?page=content&id=FAQ1244&actp=search&viewlocale=en_US&searchid=1360452047002
$self->get_snmp_tables('BLUECOAT-SG-PROXY-MIB', [
['cpus', 'sgProxyCpuCoreTable', 'Classes::AVOS::Component::CpuSubsystem::Cpu'],
]);
if (scalar (@{$self->{cpus}}) == 0) {
$self->get_snmp_tables('USAGE-MIB', [
['cpus', 'deviceUsageTable', 'Classes::AVOS::Component::CpuSubsystem::DevCpu', sub { return shift->{deviceUsageName} =~ /CPU/ }],
]);
}
}
package Classes::AVOS::Component::CpuSubsystem::Cpu;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu %s usage is %.2f%%',
$self->{sgProxyCpuCoreIndex}, $self->{sgProxyCpuCoreBusyPerCent});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{sgProxyCpuCoreBusyPerCent}));
$self->add_perfdata(
label => 'cpu_'.$self->{sgProxyCpuCoreIndex}.'_usage',
value => $self->{sgProxyCpuCoreBusyPerCent},
uom => '%',
);
}
package Classes::AVOS::Component::CpuSubsystem::DevCpu;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu %s usage is %.2f%%',
$self->{deviceUsageIndex}, $self->{deviceUsagePercent});
$self->set_thresholds(warning => $self->{deviceUsageHigh} - 10, critical => $self->{deviceUsageHigh});
$self->add_message($self->check_thresholds($self->{deviceUsagePercent}));
$self->add_perfdata(
label => 'cpu_'.$self->{deviceUsageIndex}.'_usage',
value => $self->{deviceUsagePercent},
uom => '%',
);
}

View file

@ -0,0 +1,24 @@
package Classes::AVOS::Component::KeySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('BLUECOAT-AV-MIB', (qw(
avLicenseDaysRemaining avVendorName)));
}
sub check {
my $self = shift;
$self->add_info(sprintf 'license %s expires in %d days',
$self->{avVendorName},
$self->{avLicenseDaysRemaining});
$self->set_thresholds(warning => '14:', critical => '7:');
$self->add_message($self->check_thresholds($self->{avLicenseDaysRemaining}));
$self->add_perfdata(
label => sprintf('lifetime_%s', $self->{avVendorName}),
value => $self->{avLicenseDaysRemaining},
);
}

View file

@ -0,0 +1,52 @@
package Classes::AVOS::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
# https://kb.bluecoat.com/index?page=content&id=KB3069
# Memory pressure simply is the percentage of physical memory less free and reclaimable memory, of total memory. So, for example, if there is no free or reclaimable memory in the system, then memory pressure is at 100%.
# The event logs start reporting memory pressure when it is over 75%.
# There's two separate OIDs to obtain memory pressure value for AVOSV4 and AVOSV5;
# AVOSV4: memPressureValue - OIDs: 1.3.6.1.4.1.3417.2.8.2.3 (systemResourceMIB)
# AVOSV5: sgProxyMemoryPressure - OIDs: 1.3.6.1.4.1.3417.2.11.2.3.4 (bluecoatSGProxyMIB)
my $self = shift;
$self->get_snmp_objects('BLUECOAT-SG-PROXY-MIB', (qw(
sgProxyMemPressure sgProxyMemAvailable sgProxyMemCacheUsage sgProxyMemSysUsage)));
if (! defined $self->{sgProxyMemPressure}) {
$self->get_snmp_objects('SYSTEM-RESOURCES-MIB', (qw(
memPressureValue memWarningThreshold memCriticalThreshold memCurrentState)));
}
if (! defined $self->{memPressureValue}) {
foreach ($self->get_snmp_table_objects(
'USAGE-MIB', 'deviceUsageTable')) {
next if $_->{deviceUsageName} !~ /Memory/;
$self->{deviceUsageName} = $_->{deviceUsageName};
$self->{deviceUsagePercent} = $_->{deviceUsagePercent};
$self->{deviceUsageHigh} = $_->{deviceUsageHigh};
$self->{deviceUsageStatus} = $_->{deviceUsageStatus};
$self->{deviceUsageTime} = $_->{deviceUsageTime};
}
bless $self, 'Classes::AVOS::Component::MemSubsystem::AVOS3';
}
}
package Classes::AVOS::Component::MemSubsystem::AVOS3;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub check {
my $self = shift;
my $errorfound = 0;
$self->add_info('checking memory');
$self->add_info(sprintf 'memory usage is %.2f%%',
$self->{deviceUsagePercent});
$self->set_thresholds(warning => $self->{deviceUsageHigh} - 10, critical => $self->{deviceUsageHigh});
$self->add_message($self->check_thresholds($self->{deviceUsagePercent}));
$self->add_perfdata(
label => 'memory_usage',
value => $self->{deviceUsagePercent},
uom => '%',
);
}

View file

@ -0,0 +1,22 @@
package Classes::AVOS::Component::SecuritySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('BLUECOAT-AV-MIB', (qw(
avVirusesDetected)));
}
sub check {
my $self = shift;
$self->add_info(sprintf '%d viruses detected',
$self->{avVirusesDetected});
$self->set_thresholds(warning => 1500, critical => 1500);
$self->add_message($self->check_thresholds($self->{avVirusesDetected}));
$self->add_perfdata(
label => 'viruses',
value => $self->{avVirusesDetected},
);
}

View file

@ -0,0 +1,20 @@
package Classes::AlliedTelesyn;
our @ISA = qw(Classes::Device);
use strict;
sub init {
my $self = shift;
$self->no_such_mode();
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::AlliedTelesyn::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::AlliedTelesyn::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::AlliedTelesyn::Component::MemSubsystem");
} elsif ($self->mode =~ /device::hsrp/) {
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,4 @@
package Classes::BGP;
our @ISA = qw(Classes::Device);
use strict;

View file

@ -0,0 +1,209 @@
package Classes::BGP::Component::PeerSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
our $errorcodes = {
0 => {
0 => 'No Error',
},
1 => {
0 => 'MESSAGE Header Error',
1 => 'Connection Not Synchronized',
2 => 'Bad Message Length',
3 => 'Bad Message Type',
},
2 => {
0 => 'OPEN Message Error',
1 => 'Unsupported Version Number',
2 => 'Bad Peer AS',
3 => 'Bad BGP Identifier',
4 => 'Unsupported Optional Parameter',
5 => '[Deprecated => see Appendix A]',
6 => 'Unacceptable Hold Time',
},
3 => {
0 => 'UPDATE Message Error',
1 => 'Malformed Attribute List',
2 => 'Unrecognized Well-known Attribute',
3 => 'Missing Well-known Attribute',
4 => 'Attribute Flags Error',
5 => 'Attribute Length Error',
6 => 'Invalid ORIGIN Attribute',
7 => '[Deprecated => see Appendix A]',
8 => 'Invalid NEXT_HOP Attribute',
9 => 'Optional Attribute Error',
10 => 'Invalid Network Field',
11 => 'Malformed AS_PATH',
},
4 => {
0 => 'Hold Timer Expired',
},
5 => {
0 => 'Finite State Machine Error',
},
6 => {
0 => 'Cease',
1 => 'Maximum Number of Prefixes Reached',
2 => 'Administrative Shutdown',
3 => 'Peer De-configured',
4 => 'Administrative Reset',
5 => 'Connection Rejected',
6 => 'Other Configuration Change',
7 => 'Connection Collision Resolution',
8 => 'Out of Resources',
},
};
sub init {
my $self = shift;
$self->{peers} = [];
if ($self->mode =~ /device::bgp::peer::list/) {
$self->update_entry_cache(1, 'BGP4-MIB', 'bgpPeerTable', 'bgpPeerRemoteAddr');
}
foreach ($self->get_snmp_table_objects_with_cache(
'BGP4-MIB', 'bgpPeerTable', 'bgpPeerRemoteAddr')) {
if ($self->filter_name($_->{bgpPeerRemoteAddr})) {
push(@{$self->{peers}},
Classes::BGP::Component::PeerSubsystem::Peer->new(%{$_}));
}
}
}
sub check {
my $self = shift;
my $errorfound = 0;
$self->add_info('checking bgp peers');
if (scalar(@{$self->{peers}}) == 0) {
$self->add_unknown('no peers');
return;
}
if ($self->mode =~ /peer::list/) {
foreach (sort {$a->{bgpPeerRemoteAddr} cmp $b->{bgpPeerRemoteAddr}} @{$self->{peers}}) {
printf "%s\n", $_->{bgpPeerRemoteAddr};
#$_->list();
}
} else {
# es gibt
# kleine installation: 1 peer zu 1 as, evt 2. as als fallback
# grosse installation: n peer zu 1 as, alternative routen zum provider
# n peer zu m as, mehrere provider, mehrere alternativrouten
# 1 ausfall on 4 peers zu as ist egal
my $as_numbers = {};
foreach (@{$self->{peers}}) {
$_->check();
if (! exists $as_numbers->{$_->{bgpPeerRemoteAs}}->{peers}) {
$as_numbers->{$_->{bgpPeerRemoteAs}}->{peers} = [];
$as_numbers->{$_->{bgpPeerRemoteAs}}->{availability} = 100;
}
push(@{$as_numbers->{$_->{bgpPeerRemoteAs}}->{peers}}, $_);
}
if ($self->opts->name2) {
$self->clear_ok();
$self->clear_critical();
if ($self->opts->name2 eq "_ALL_") {
$self->opts->override_opt("name2", join(",", keys %{$as_numbers}));
}
foreach my $as (split(",", $self->opts->name2)) {
my $asname = "";
if ($as =~ /(\d+)=(\w+)/) {
$as = $1;
$asname = $2;
}
if (exists $as_numbers->{$as}) {
my $num_peers = scalar(@{$as_numbers->{$as}->{peers}});
my $num_ok_peers = scalar(grep { $_->{bgpPeerFaulty} == 0 } @{$as_numbers->{$as}->{peers}});
$as_numbers->{$as}->{availability} = 100 * $num_ok_peers / $num_peers;
$self->set_thresholds(warning => "100:", critical => "50:");
$self->add_message($self->check_thresholds($as_numbers->{$as}->{availability}),
sprintf "%d from %d connections to %s are up (%.2f%%)",
$num_ok_peers, $num_peers, $asname ? $asname : "AS".$as,
$as_numbers->{$as}->{availability});
} else {
$self->add_critical(sprintf 'found no peer for %s', $asname ? $asname : "AS".$as);
}
}
}
if ($self->opts->report eq "short") {
$self->clear_ok();
$self->add_ok('no problems') if ! $self->check_messages();
}
}
}
package Classes::BGP::Component::PeerSubsystem::Peer;
our @ISA = qw(Classes::BGP::Component::PeerSubsystem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub new {
my $class = shift;
my %params = @_;
my $self = {};
foreach(keys %params) {
$self->{$_} = $params{$_};
}
bless $self, $class;
$self->{bgpPeerLastError} |= "00 00";
my $errorcode = 0;
my $subcode = 0;
if (lc $self->{bgpPeerLastError} =~ /([0-9a-f]+)\s+([0-9a-f]+)/) {
$errorcode = hex($1) * 1;
$subcode = hex($2) * 1;
}
$self->{bgpPeerLastError} = $Classes::BGP::Component::PeerSubsystem::errorcodes->{$errorcode}->{$subcode};
$self->{bgpPeerRemoteAsName} = "";
$self->{bgpPeerRemoteAsImportant} = 0; # if named in --name2
$self->{bgpPeerFaulty} = 0;
my @parts = gmtime($self->{bgpPeerFsmEstablishedTime});
$self->{bgpPeerFsmEstablishedTime} = sprintf ("%dd, %dh, %dm, %ds",@parts[7,2,1,0]);
return $self;
}
sub check {
my $self = shift;
if ($self->opts->name2) {
foreach my $as (split(",", $self->opts->name2)) {
if ($as =~ /(\d+)=(\w+)/) {
$as = $1;
$self->{bgpPeerRemoteAsName} = ", ".$2;
} else {
$self->{bgpPeerRemoteAsName} = "";
}
if ($as eq "_ALL_" || $as == $self->{bgpPeerRemoteAs}) {
$self->{bgpPeerRemoteAsImportant} = 1;
}
}
} else {
$self->{bgpPeerRemoteAsImportant} = 1;
}
if ($self->{bgpPeerState} eq "established" || $self->{bgpPeerState} eq "idle") {
$self->add_ok(sprintf "peer %s (AS%s) state is %s since %s",
$self->{bgpPeerRemoteAddr},
$self->{bgpPeerRemoteAs}.$self->{bgpPeerRemoteAsName},
$self->{bgpPeerState},
$self->{bgpPeerFsmEstablishedTime}
);
} elsif ($self->{bgpPeerAdminStatus} eq "stop") {
$self->add_message($self->{bgpPeerRemoteAsImportant} ? WARNING : OK,
sprintf "peer %s (AS%s) state is %s (is admin down)",
$self->{bgpPeerRemoteAddr},
$self->{bgpPeerRemoteAs}.$self->{bgpPeerRemoteAsName},
$self->{bgpPeerState}
);
$self->{bgpPeerFaulty} = $self->{bgpPeerRemoteAsImportant} ? 1 : 0;
} else {
$self->add_message($self->{bgpPeerRemoteAsImportant} ? CRITICAL : OK,
sprintf "peer %s (AS%s) state is %s (last error: %s)",
$self->{bgpPeerRemoteAddr},
$self->{bgpPeerRemoteAs}.$self->{bgpPeerRemoteAsName},
$self->{bgpPeerState},
$self->{bgpPeerLastError}
);
$self->{bgpPeerFaulty} = $self->{bgpPeerRemoteAsImportant} ? 1 : 0;
}
}

View file

@ -0,0 +1,60 @@
package Classes::Bluecoat;
our @ISA = qw(Classes::Device);
use strict;
use constant trees => (
'1.3.6.1.2.1.1', # RFC1213-MIB
'1.3.6.1.2.1.10.33', # RS-232-MIB
'1.3.6.1.2.1.22.1.1', # SNMP-REPEATER-MIB
'1.3.6.1.2.1.25.1', # HOST-RESOURCES-MIB
'1.3.6.1.2.1.30', # IANAifType-MIB
'1.3.6.1.2.1.31', # IF-MIB
'1.3.6.1.2.1.65', # WWW-MIB
'1.3.6.1.3.25.17', # PROXY-MIB
'1.3.6.1.4.1.3417', # BLUECOAT-MIB
'1.3.6.1.4.1.3417', # BLUECOAT-MIB
'1.3.6.1.4.1.3417', # BLUECOAT-MIB
'1.3.6.1.4.1.3417.2.1', # SENSOR-MIB
'1.3.6.1.4.1.3417.2.10', # BLUECOAT-AV-MIB
'1.3.6.1.4.1.3417.2.2', # DISK-MIB
'1.3.6.1.4.1.3417.2.3', # ATTACK-MIB
'1.3.6.1.4.1.3417.2.4', # USAGE-MIB
'1.3.6.1.4.1.3417.2.5', # WCCP-MIB
'1.3.6.1.4.1.3417.2.6', # POLICY-MIB
'1.3.6.1.4.1.3417.2.8', # SYSTEM-RESOURCES-MIB
'1.3.6.1.4.1.3417.2.9', # BLUECOAT-HOST-RESOURCES-MIB
'1.3.6.1.4.1.99.12.33', # SR-COMMUNITY-MIB
'1.3.6.1.4.1.99.12.35', # USM-TARGET-TAG-MIB
'1.3.6.1.4.1.99.12.36', # TGT-ADDRESS-MASK-MIB
'1.3.6.1.4.1.99.42', # MLM-MIB
'1.3.6.1.6.3.1', # SNMPv2-MIB
'1.3.6.1.6.3.10', # SNMP-FRAMEWORK-MIB
'1.3.6.1.6.3.11', # SNMP-MPD-MIB
'1.3.6.1.6.3.1133', # COMMUNITY-MIB
'1.3.6.1.6.3.1134', # V2ADMIN-MIB
'1.3.6.1.6.3.1135', # USEC-MIB
'1.3.6.1.6.3.12', # SNMP-TARGET-MIB
'1.3.6.1.6.3.13', # SNMP-NOTIFICATION-MIB
'1.3.6.1.6.3.14', # SNMP-PROXY-MIB
'1.3.6.1.6.3.15', # SNMP-USER-BASED-SM-MIB
'1.3.6.1.6.3.16', # SNMP-VIEW-BASED-ACM-MIB
'1.3.6.1.6.3.18', # SNMP-COMMUNITY-MIB
);
sub init {
my $self = shift;
if ($self->{productname} =~ /Blue.*Coat.*SG\d+/i) {
# product ProxySG Blue Coat SG600
# iso.3.6.1.4.1.3417.2.11.1.3.0 = STRING: "Version: SGOS 5.5.8.1, Release id: 78642 Proxy Edition"
bless $self, 'Classes::SGOS';
$self->debug('using Classes::SGOS');
} elsif ($self->{productname} =~ /Blue.*Coat.*AV\d+/i) {
# product Blue Coat AV510 Series, ProxyAV Version: 3.5.1.1, Release id: 111017
bless $self, 'Classes::AVOS';
$self->debug('using Classes::AVOS');
}
if (ref($self) ne "Classes::Bluecoat") {
$self->init();
}
}

View file

@ -0,0 +1,39 @@
package Classes::Brocade;
our @ISA = qw(Classes::Device);
use strict;
sub init {
my $self = shift;
foreach ($self->get_snmp_table_objects(
'ENTITY-MIB', 'entPhysicalTable')) {
if ($_->{entPhysicalDescr} =~ /Brocade/) {
$self->{productname} = "FabOS";
}
}
my $swFirmwareVersion = $self->get_snmp_object('SW-MIB', 'swFirmwareVersion');
if ($swFirmwareVersion && $swFirmwareVersion =~ /^v6/) {
$self->{productname} = "FabOS"
}
if ($self->{productname} =~ /EMC\s*DS.*4700M/i) {
bless $self, 'Classes::MEOS';
$self->debug('using Classes::MEOS');
} elsif ($self->{productname} =~ /EMC\s*DS-24M2/i) {
bless $self, 'Classes::MEOS';
$self->debug('using Classes::MEOS');
} elsif ($self->{productname} =~ /FabOS/i) {
bless $self, 'Classes::FabOS';
$self->debug('using Classes::FabOS');
} elsif ($self->{productname} =~ /ICX6|FastIron/i) {
bless $self, 'Classes::Foundry';
$self->debug('using Classes::Foundry');
} elsif ($self->implements_mib('SW-MIB')) {
bless $self, 'Classes::FabOS';
$self->debug('using Classes::FabOS');
}
if (ref($self) ne "Classes::Brocade") {
$self->init();
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,19 @@
package Classes::CheckPoint;
our @ISA = qw(Classes::Device);
use strict;
use constant trees => (
'1.3.6.1.4.1.2620', # CHECKPOINT-MIB
);
sub init {
my $self = shift;
if ($self->{productname} =~ /(FireWall\-1\s)|(cpx86_64)|(Linux.*\dcp )/i) {
bless $self, 'Classes::CheckPoint::Firewall1';
$self->debug('using Classes::CheckPoint::Firewall1');
}
if (ref($self) ne "Classes::CheckPoint") {
$self->init();
}
}

View file

@ -0,0 +1,26 @@
package Classes::CheckPoint::Firewall1;
our @ISA = qw(Classes::CheckPoint);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::CheckPoint::Firewall1::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::CheckPoint::Firewall1::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::CheckPoint::Firewall1::Component::MemSubsystem");
} elsif ($self->mode =~ /device::ha::/) {
$self->analyze_and_check_ha_subsystem("Classes::CheckPoint::Firewall1::Component::HaSubsystem");
} elsif ($self->mode =~ /device::fw::/) {
$self->analyze_and_check_fw_subsystem("Classes::CheckPoint::Firewall1::Component::FwSubsystem");
} elsif ($self->mode =~ /device::svn::/) {
$self->analyze_and_check_svn_subsystem("Classes::CheckPoint::Firewall1::Component::SvnSubsystem");
} elsif ($self->mode =~ /device::mngmt::/) {
# not sure if this works fa25239716cb74c672f8dd390430dc4056caffa7
$self->analyze_and_check_mngmt_subsystem("Classes::CheckPoint::Firewall1::Component::MngmtSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,31 @@
package Classes::CheckPoint::Firewall1::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
procUsage)));
$self->{procQueue} = $self->valid_response('CHECKPOINT-MIB', 'procQueue');
}
sub check {
my $self = shift;
$self->add_info('checking cpus');
$self->add_info(sprintf 'cpu usage is %.2f%%', $self->{procUsage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{procUsage}));
$self->add_perfdata(
label => 'cpu_usage',
value => $self->{procUsage},
uom => '%',
);
if (defined $self->{procQueue}) {
$self->add_perfdata(
label => 'cpu_queue_length',
value => $self->{procQueue},
thresholds => 0,
);
}
}

View file

@ -0,0 +1,80 @@
package Classes::CheckPoint::Firewall1::Component::DiskSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('HOST-RESOURCES-MIB', [
['storages', 'hrStorageTable', 'Classes::HOSTRESOURCESMIB::Component::DiskSubsystem::Storage', sub { return shift->{hrStorageType} eq 'hrStorageFixedDisk'}],
]);
$self->get_snmp_tables('CHECKPOINT-MIB', [
['volumes', 'volumesTable', 'Classes::CheckPoint::Firewall1::Component::DiskSubsystem::Volume'],
['disks', 'disksTable', 'Classes::CheckPoint::Firewall1::Component::DiskSubsystem::Disk'],
]);
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
diskPercent diskPercent)));
}
sub check {
my $self = shift;
$self->add_info('checking disks');
if (scalar (@{$self->{storages}}) == 0) {
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
diskPercent diskPercent)));
my $free = 100 - $self->{diskPercent};
$self->add_info(sprintf 'disk has %.2f%% free space left', $free);
$self->set_thresholds(warning => '10:', critical => '5:');
$self->add_message($self->check_thresholds($free));
$self->add_perfdata(
label => 'disk_free',
value => $free,
uom => '%',
);
} else {
foreach (@{$self->{storages}}) {
$_->check();
}
}
foreach (@{$self->{volumes}}) {
$_->check();
}
foreach (@{$self->{disks}}) {
$_->check();
}
}
package Classes::CheckPoint::Firewall1::Component::DiskSubsystem::Volume;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'volume %s with %d disks is %s',
$self->{volumesVolumeID},
$self->{volumesNumberOfDisks},
$self->{volumesVolumeState});
if ($self->{volumesVolumeState} eq 'degraded') {
$self->add_warning();
} elsif ($self->{volumesVolumeState} eq 'failed') {
$self->add_critical();
} else {
$self->add_ok();
}
}
package Classes::CheckPoint::Firewall1::Component::DiskSubsystem::Disk;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'disk %s (vol %s) is %s',
$self->{disksIndex},
$self->{disksVolumeID},
$self->{disksState});
# warning/critical comes from the volume
}

View file

@ -0,0 +1,36 @@
package Classes::CheckPoint::Firewall1::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->{disk_subsystem} =
Classes::CheckPoint::Firewall1::Component::DiskSubsystem->new();
$self->{temperature_subsystem} =
Classes::CheckPoint::Firewall1::Component::TemperatureSubsystem->new();
$self->{fan_subsystem} =
Classes::CheckPoint::Firewall1::Component::FanSubsystem->new();
$self->{voltage_subsystem} =
Classes::CheckPoint::Firewall1::Component::VoltageSubsystem->new();
}
sub check {
my $self = shift;
$self->{disk_subsystem}->check();
$self->{temperature_subsystem}->check();
$self->{fan_subsystem}->check();
$self->{voltage_subsystem}->check();
if (! $self->check_messages()) {
$self->clear_ok(); # too much noise
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
$self->{disk_subsystem}->dump();
$self->{temperature_subsystem}->dump();
$self->{fan_subsystem}->dump();
$self->{voltage_subsystem}->dump();
}

View file

@ -0,0 +1,42 @@
package Classes::CheckPoint::Firewall1::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CHECKPOINT-MIB', [
['fans', 'sensorsFanTable', 'Classes::CheckPoint::Firewall1::Component::FanSubsystem::Fan'],
]);
}
sub check {
my $self = shift;
foreach (@{$self->{fans}}) {
$_->check();
}
}
package Classes::CheckPoint::Firewall1::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'fan %s is %s (%d %s)',
$self->{sensorsFanName}, $self->{sensorsFanStatus},
$self->{sensorsFanValue}, $self->{sensorsFanUOM});
if ($self->{sensorsFanStatus} eq 'normal') {
$self->add_ok();
} elsif ($self->{sensorsFanStatus} eq 'abnormal') {
$self->add_critical();
} else {
$self->add_unknown();
}
$self->set_thresholds(warning => 60, critical => 70);
$self->add_perfdata(
label => 'fan'.$self->{sensorsFanName}.'_rpm',
value => $self->{sensorsFanValue},
);
}

View file

@ -0,0 +1,39 @@
package Classes::CheckPoint::Firewall1::Component::FwSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
fwModuleState fwPolicyName fwNumConn)));
if ($self->mode =~ /device::fw::policy::installed/) {
} elsif ($self->mode =~ /device::fw::policy::connections/) {
}
}
sub check {
my $self = shift;
$self->add_info('checking fw module');
if ($self->{fwModuleState} ne 'Installed') {
$self->add_critical(sprintf 'fw module is %s', $self->{fwPolicyName});
} elsif ($self->mode =~ /device::fw::policy::installed/) {
if (! $self->opts->name()) {
$self->add_unknown('please specify a policy with --name');
} elsif ($self->{fwPolicyName} eq $self->opts->name()) {
$self->add_ok(sprintf 'fw policy is %s', $self->{fwPolicyName});
} else {
$self->add_critical(sprintf 'fw policy is %s, expected %s',
$self->{fwPolicyName}, $self->opts->name());
}
} elsif ($self->mode =~ /device::fw::policy::connections/) {
$self->set_thresholds(warning => 20000, critical => 23000);
$self->add_message($self->check_thresholds($self->{fwNumConn}),
sprintf 'policy %s has %s open connections',
$self->{fwPolicyName}, $self->{fwNumConn});
$self->add_perfdata(
label => 'fw_policy_numconn',
value => $self->{fwNumConn},
);
}
}

View file

@ -0,0 +1,44 @@
package Classes::CheckPoint::Firewall1::Component::HaSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub init {
my $self = shift;
if ($self->mode =~ /device::ha::role/) {
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
haStarted haState haStatShort)));
if (! $self->opts->role()) {
$self->opts->override_opt('role', 'active');
}
}
}
sub check {
my $self = shift;
$self->add_info('checking ha');
$self->add_info(sprintf 'ha %sstarted, role is %s, status is %s',
$self->{haStarted} eq 'yes' ? '' : 'not ',
$self->{haState}, $self->{haStatShort});
if ($self->{haStarted} eq 'yes') {
if ($self->{haStatShort} ne 'OK') {
$self->add_message(
defined $self->opts->mitigation() ? $self->opts->mitigation() : CRITICAL,
$self->{info});
} elsif ($self->{haState} ne $self->opts->role()) {
$self->add_message(
defined $self->opts->mitigation() ? $self->opts->mitigation() : WARNING,
$self->{info});
$self->add_message(
defined $self->opts->mitigation() ? $self->opts->mitigation() : WARNING,
sprintf "expected role %s", $self->opts->role())
} else {
$self->add_ok();
}
} else {
$self->add_message(
defined $self->opts->mitigation() ? $self->opts->mitigation() : WARNING,
'ha was not started');
}
}

View file

@ -0,0 +1,24 @@
package Classes::CheckPoint::Firewall1::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
memTotalReal64 memFreeReal64)));
$self->{memory_usage} = $self->{memFreeReal64} ?
( ($self->{memTotalReal64} - $self->{memFreeReal64}) / $self->{memTotalReal64} * 100) : 100;
}
sub check {
my $self = shift;
$self->add_info(sprintf 'memory usage is %.2f%%', $self->{memory_usage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{memory_usage}));
$self->add_perfdata(
label => 'memory_usage',
value => $self->{memory_usage},
uom => '%',
);
}

View file

@ -0,0 +1,26 @@
package Classes::CheckPoint::Firewall1::Component::MngmtSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::mngmt::status/) {
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
mgStatShortDescr mgStatLongDescr)));
}
}
sub check {
my $self = shift;
$self->add_info('checking mngmt');
if ($self->mode =~ /device::mngmt::status/) {
if (! defined $self->{mgStatShortDescr}) {
$self->add_unknown('management mib is not implemented');
} elsif ($self->{mgStatShortDescr} ne 'OK') {
$self->add_critical(sprintf 'status of management is %s', $self->{mgStatLongDescr});
} else {
$self->add_ok(sprintf 'status of management is %s', $self->{mgStatLongDescr});
}
}
}

View file

@ -0,0 +1,24 @@
package Classes::CheckPoint::Firewall1::Component::SvnSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::svn::status/) {
$self->get_snmp_objects('CHECKPOINT-MIB', (qw(
svnStatShortDescr svnStatLongDescr)));
}
}
sub check {
my $self = shift;
$self->add_info('checking svn');
if ($self->mode =~ /device::svn::status/) {
if ($self->{svnStatShortDescr} ne 'OK') {
$self->add_critical(sprintf 'status of svn is %s', $self->{svnStatLongDescr});
} else {
$self->add_ok(sprintf 'status of svn is %s', $self->{svnStatLongDescr});
}
}
}

View file

@ -0,0 +1,43 @@
package Classes::CheckPoint::Firewall1::Component::TemperatureSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CHECKPOINT-MIB', [
['temperatures', 'sensorsTemperatureTable', 'Classes::CheckPoint::Firewall1::Component::TemperatureSubsystem::Temperature'],
]);
}
sub check {
my $self = shift;
foreach (@{$self->{temperatures}}) {
$_->check();
}
}
package Classes::CheckPoint::Firewall1::Component::TemperatureSubsystem::Temperature;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub check {
my $self = shift;
$self->add_info(sprintf 'temperature %s is %s (%d %s)',
$self->{sensorsTemperatureName}, $self->{sensorsTemperatureStatus},
$self->{sensorsTemperatureValue}, $self->{sensorsTemperatureUOM});
if ($self->{sensorsTemperatureStatus} eq 'normal') {
$self->add_ok();
} elsif ($self->{sensorsTemperatureStatus} eq 'abnormal') {
$self->add_critical();
} else {
$self->add_unknown();
}
$self->set_thresholds(warning => 60, critical => 70);
$self->add_perfdata(
label => 'temperature_'.$self->{sensorsTemperatureName},
value => $self->{sensorsTemperatureValue},
);
}

View file

@ -0,0 +1,42 @@
package Classes::CheckPoint::Firewall1::Component::VoltageSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CHECKPOINT-MIB', [
['voltages', 'sensorsVoltageTable', 'Classes::CheckPoint::Firewall1::Component::VoltageSubsystem::Voltage'],
]);
}
sub check {
my $self = shift;
foreach (@{$self->{voltages}}) {
$_->check();
}
}
package Classes::CheckPoint::Firewall1::Component::VoltageSubsystem::Voltage;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'voltage %s is %s (%.2f %s)',
$self->{sensorsVoltageName}, $self->{sensorsVoltageStatus},
$self->{sensorsVoltageValue}, $self->{sensorsVoltageUOM});
if ($self->{sensorsVoltageStatus} eq 'normal') {
$self->add_ok();
} elsif ($self->{sensorsVoltageStatus} eq 'abnormal') {
$self->add_critical();
} else {
$self->add_unknown();
}
$self->set_thresholds(warning => 60, critical => 70);
$self->add_perfdata(
label => 'voltage'.$self->{sensorsVoltageName}.'_rpm',
value => $self->{sensorsVoltageValue},
);
}

View file

@ -0,0 +1,68 @@
package Classes::Cisco;
our @ISA = qw(Classes::Device);
use strict;
use constant trees => (
'1.3.6.1.2.1', # mib-2
'1.3.6.1.4.1.9', # cisco
'1.3.6.1.4.1.9.1', # ciscoProducts
'1.3.6.1.4.1.9.2', # local
'1.3.6.1.4.1.9.3', # temporary
'1.3.6.1.4.1.9.4', # pakmon
'1.3.6.1.4.1.9.5', # workgroup
'1.3.6.1.4.1.9.6', # otherEnterprises
'1.3.6.1.4.1.9.7', # ciscoAgentCapability
'1.3.6.1.4.1.9.8', # ciscoConfig
'1.3.6.1.4.1.9.9', # ciscoMgmt
'1.3.6.1.4.1.9.10', # ciscoExperiment
'1.3.6.1.4.1.9.11', # ciscoAdmin
'1.3.6.1.4.1.9.12', # ciscoModules
'1.3.6.1.4.1.9.13', # lightstream
'1.3.6.1.4.1.9.14', # ciscoworks
'1.3.6.1.4.1.9.15', # newport
'1.3.6.1.4.1.9.16', # ciscoPartnerProducts
'1.3.6.1.4.1.9.17', # ciscoPolicy
'1.3.6.1.4.1.9.18', # ciscoPolicyAuto
'1.3.6.1.4.1.9.19', # ciscoDomains
'1.3.6.1.4.1.14179.1', # airespace-switching-mib
'1.3.6.1.4.1.14179.2', # airespace-wireless-mib
);
sub init {
my $self = shift;
if ($self->{productname} =~ /Cisco NX-OS/i) {
bless $self, 'Classes::Cisco::NXOS';
$self->debug('using Classes::Cisco::NXOS');
} elsif ($self->{productname} =~ /Cisco Controller/i) {
bless $self, 'Classes::Cisco::WLC';
$self->debug('using Classes::Cisco::WLC');
} elsif ($self->{productname} =~ /Cisco.*(IronPort|AsyncOS)/i) {
bless $self, 'Classes::Cisco::AsyncOS';
$self->debug('using Classes::Cisco::AsyncOS');
} elsif ($self->{productname} =~ /Cisco.*Prime Network Control System/i) {
bless $self, 'Classes::Cisco::PrimeNCS';
$self->debug('using Classes::Cisco::PrimeNCS');
} elsif ($self->{productname} =~ /UCOS /i) {
bless $self, 'Classes::Cisco::UCOS';
$self->debug('using Classes::Cisco::UCOS');
} elsif ($self->{productname} =~ /Cisco (PIX|Adaptive) Security Appliance/i) {
bless $self, 'Classes::Cisco::ASA';
$self->debug('using Classes::Cisco::ASA');
} elsif ($self->{productname} =~ /Cisco/i) {
bless $self, 'Classes::Cisco::IOS';
$self->debug('using Classes::Cisco::IOS');
} elsif ($self->{productname} =~ /Fujitsu Intelligent Blade Panel 30\/12/i) {
bless $self, 'Classes::Cisco::IOS';
$self->debug('using Classes::Cisco::IOS');
} elsif ($self->get_snmp_object('MIB-II', 'sysObjectID', 0) eq '1.3.6.1.4.1.9.1.1348') {
bless $self, 'Classes::Cisco::CCM';
$self->debug('using Classes::Cisco::CCM');
} elsif ($self->get_snmp_object('MIB-II', 'sysObjectID', 0) eq '1.3.6.1.4.1.9.1.746') {
bless $self, 'Classes::Cisco::CCM';
$self->debug('using Classes::Cisco::CCM');
}
if (ref($self) ne "Classes::Cisco") {
$self->init();
}
}

View file

@ -0,0 +1,28 @@
package Classes::Cisco::ASA;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::CISCOENTITYALARMMIB::Component::AlarmSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::IOS::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::Cisco::IOS::Component::MemSubsystem");
} elsif ($self->mode =~ /device::hsrp/) {
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
} elsif ($self->mode =~ /device::users/) {
$self->analyze_and_check_connection_subsystem("Classes::Cisco::IOS::Component::ConnectionSubsystem");
} elsif ($self->mode =~ /device::config/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::ConfigSubsystem");
} elsif ($self->mode =~ /device::interfaces::nat::sessions::count/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,19 @@
package Classes::Cisco::AsyncOS;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::AsyncOS::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::AsyncOS::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::Cisco::AsyncOS::Component::MemSubsystem");
} elsif ($self->mode =~ /device::licenses::/) {
$self->analyze_and_check_key_subsystem("Classes::Cisco::AsyncOS::Component::KeySubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,24 @@
package Classes::Cisco::AsyncOS::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('ASYNCOS-MAIL-MIB', (qw(
perCentCPUUtilization)));
}
sub check {
my $self = shift;
$self->add_info('checking cpus');
$self->add_info(sprintf 'cpu usage is %.2f%%',
$self->{perCentCPUUtilization});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{perCentCPUUtilization}));
$self->add_perfdata(
label => 'cpu_usage',
value => $self->{perCentCPUUtilization},
uom => '%',
);
}

View file

@ -0,0 +1,38 @@
package Classes::Cisco::AsyncOS::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
#
# 1.3.6.1.4.1.9.9.13.1.1.0 ciscoEnvMonPresent (irgendein typ of envmon)
#
$self->{fan_subsystem} =
Classes::Cisco::AsyncOS::Component::FanSubsystem->new();
$self->{temperature_subsystem} =
Classes::Cisco::AsyncOS::Component::TemperatureSubsystem->new();
$self->{powersupply_subsystem} =
Classes::Cisco::AsyncOS::Component::PowersupplySubsystem->new();
$self->{raid_subsystem} =
Classes::Cisco::AsyncOS::Component::RaidSubsystem->new();
}
sub check {
my $self = shift;
$self->{fan_subsystem}->check();
$self->{temperature_subsystem}->check();
$self->{powersupply_subsystem}->check();
$self->{raid_subsystem}->check();
if (! $self->check_messages()) {
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
$self->{fan_subsystem}->dump();
$self->{temperature_subsystem}->dump();
$self->{powersupply_subsystem}->dump();
$self->{raid_subsystem}->dump();
}

View file

@ -0,0 +1,28 @@
package Classes::Cisco::AsyncOS::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('ASYNCOS-MAIL-MIB', [
['fans', 'fanTable', 'Classes::Cisco::AsyncOS::Component::FanSubsystem::Fan'],
]);
}
package Classes::Cisco::AsyncOS::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'fan %d (%s) has %s rpm',
$self->{fanIndex},
$self->{fanName},
$self->{fanRPMs});
$self->add_perfdata(
label => sprintf('fan_c%s', $self->{fanIndex}),
value => $self->{fanRPMs},
thresholds => 0,
);
}

View file

@ -0,0 +1,38 @@
package Classes::Cisco::AsyncOS::Component::KeySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('ASYNCOS-MAIL-MIB', [
['keys', 'keyExpirationTable', 'Classes::Cisco::AsyncOS::Component::KeySubsystem::Key'],
]);
}
package Classes::Cisco::AsyncOS::Component::KeySubsystem::Key;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->{keyDaysUntilExpire} = int($self->{keySecondsUntilExpire} / 86400);
if ($self->{keyIsPerpetual} eq 'true') {
$self->add_info(sprintf 'perpetual key %d (%s) never expires',
$self->{keyExpirationIndex},
$self->{keyDescription});
$self->add_ok();
} else {
$self->add_info(sprintf 'key %d (%s) expires in %d days',
$self->{keyExpirationIndex},
$self->{keyDescription},
$self->{keyDaysUntilExpire});
$self->set_thresholds(warning => '14:', critical => '7:');
$self->add_message($self->check_thresholds($self->{keyDaysUntilExpire}));
}
$self->add_perfdata(
label => sprintf('lifetime_%s', $self->{keyDaysUntilExpire}),
value => $self->{keyDaysUntilExpire},
thresholds => $self->{keyIsPerpetual} eq 'true' ? 0 : 1,
);
}

View file

@ -0,0 +1,34 @@
package Classes::Cisco::AsyncOS::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('ASYNCOS-MAIL-MIB', (qw(
perCentMemoryUtilization memoryAvailabilityStatus)));
}
sub check {
my $self = shift;
$self->add_info('checking memory');
$self->add_info(sprintf 'memory usage is %.2f%% (%s)',
$self->{perCentMemoryUtilization}, $self->{memoryAvailabilityStatus});
$self->set_thresholds(warning => 80, critical => 90);
if ($self->check_thresholds($self->{perCentMemoryUtilization})) {
$self->add_message($self->check_thresholds($self->{perCentMemoryUtilization}));
} elsif ($self->{memoryAvailabilityStatus} eq 'memoryShortage') {
$self->add_warning();
$self->set_thresholds(warning => $self->{perCentMemoryUtilization}, critical => 90);
} elsif ($self->{memoryAvailabilityStatus} eq 'memoryFull') {
$self->add_critical();
$self->set_thresholds(warning => 80, critical => $self->{perCentMemoryUtilization});
} else {
$self->add_ok();
}
$self->add_perfdata(
label => 'memory_usage',
value => $self->{perCentMemoryUtilization},
uom => '%',
);
}

View file

@ -0,0 +1,27 @@
package Classes::Cisco::AsyncOS::Component::PowersupplySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('ASYNCOS-MAIL-MIB', [
['supplies', 'powerSupplyTable', 'Classes::Cisco::AsyncOS::Component::PowersupplySubsystem::Powersupply'],
]);
}
package Classes::Cisco::AsyncOS::Component::PowersupplySubsystem::Powersupply;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'powersupply %d (%s) has status %s',
$self->{powerSupplyIndex},
$self->{powerSupplyName},
$self->{powerSupplyStatus});
if ($self->{powerSupplyStatus} eq 'powerSupplyNotInstalled') {
} elsif ($self->{powerSupplyStatus} ne 'powerSupplyHealthy') {
$self->add_critical();
}
}

View file

@ -0,0 +1,30 @@
package Classes::Cisco::AsyncOS::Component::RaidSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('ASYNCOS-MAIL-MIB', (qw(
raidEvents)));
$self->get_snmp_tables('ASYNCOS-MAIL-MIB', [
['raids', 'raidTable', 'Classes::Cisco::AsyncOS::Component::RaidSubsystem::Raid'],
]);
}
package Classes::Cisco::AsyncOS::Component::RaidSubsystem::Raid;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'raid %d has status %s',
$self->{raidIndex},
$self->{raidStatus});
if ($self->{raidStatus} eq 'driveHealthy') {
} elsif ($self->{raidStatus} eq 'driveRebuild') {
$self->add_warning();
} elsif ($self->{raidStatus} eq 'driveFailure') {
$self->add_critical();
}
}

View file

@ -0,0 +1,32 @@
package Classes::Cisco::AsyncOS::Component::TemperatureSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('ASYNCOS-MAIL-MIB', [
['temperatures', 'temperatureTable', 'Classes::Cisco::AsyncOS::Component::TemperatureSubsystem::Temperature'],
]);
}
package Classes::Cisco::AsyncOS::Component::TemperatureSubsystem::Temperature;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->set_thresholds(warning => 60, critical => 70);
$self->add_info(sprintf 'temperature %d (%s) is %s degree C',
$self->{temperatureIndex},
$self->{temperatureName},
$self->{degreesCelsius});
if ($self->check_thresholds($self->{degreesCelsius})) {
$self->add_message($self->check_thresholds($self->{degreesCelsius}),
$self->{info});
}
$self->add_perfdata(
label => sprintf('temp_%s', $self->{temperatureIndex}),
value => $self->{degreesCelsius},
);
}

View file

@ -0,0 +1,21 @@
package Classes::Cisco::CCM;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::HOSTRESOURCESMIB::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::HOSTRESOURCESMIB::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::HOSTRESOURCESMIB::Component::MemSubsystem");
} elsif ($self->mode =~ /device::phone::cm/) {
$self->analyze_and_check_cm_subsystem("Classes::Cisco::CCM::Component::CmSubsystem");
} elsif ($self->mode =~ /device::phone/) {
$self->analyze_and_check_phone_subsystem("Classes::Cisco::CCM::Component::PhoneSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,37 @@
package Classes::Cisco::CCM::Component::CmSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-CCM-MIB', [
['ccms', 'ccmTable', 'Classes::Cisco::CCM::Component::CmSubsystem::Cm'],
]);
}
sub check {
my $self = shift;
foreach (@{$self->{ccms}}) {
$_->check();
}
if (! scalar(@{$self->{ccms}})) {
$self->add_message(
defined $self->opts->mitigation() ? $self->opts->mitigation() : 2,
'local callmanager is down');
}
}
package Classes::Cisco::CCM::Component::CmSubsystem::Cm;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub check {
my $self = shift;
$self->add_info(sprintf 'cm %s is %s',
$self->{ccmName},
$self->{ccmStatus});
$self->add_message($self->{ccmStatus} eq 'up' ? OK : CRITICAL);
}

View file

@ -0,0 +1,47 @@
package Classes::Cisco::CCM::Component::PhoneSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CISCO-CCM-MIB', (qw(
ccmRegisteredPhones ccmUnregisteredPhones ccmRejectedPhones)));
if (! defined $self->{ccmRegisteredPhones}) {
$self->get_snmp_tables('CISCO-CCM-MIB', [
['ccms', 'ccmTable', 'Classes::Cisco::CCM::Component::CmSubsystem::Cm'],
]);
}
}
sub check {
my $self = shift;
if (! defined $self->{ccmRegisteredPhones}) {
foreach (qw(ccmRegisteredPhones ccmUnregisteredPhones ccmRejectedPhones)) {
$self->{$_} = 0;
}
if (! scalar(@{$self->{ccms}})) {
$self->add_ok('cm is down');
} else {
$self->add_unknown('unable to count phones');
}
}
$self->add_info(sprintf 'phones: %d registered, %d unregistered, %d rejected',
$self->{ccmRegisteredPhones},
$self->{ccmUnregisteredPhones},
$self->{ccmRejectedPhones});
$self->set_thresholds(warning => 10, critical => 20);
$self->add_message($self->check_thresholds($self->{ccmRejectedPhones}));
$self->add_perfdata(
label => 'registered',
value => $self->{ccmRegisteredPhones},
);
$self->add_perfdata(
label => 'unregistered',
value => $self->{ccmUnregisteredPhones},
);
$self->add_perfdata(
label => 'rejected',
value => $self->{ccmRejectedPhones},
);
}

View file

@ -0,0 +1,283 @@
package Classes::Cisco::CISCOENTITYALARMMIB::Component::AlarmSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $alarms = {};
$self->get_snmp_tables('CISCO-ENTITY-ALARM-MIB', [
['alarms', 'ceAlarmTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::Alarm', sub { my $o = shift; $o->{parent} = $self; $self->filter_name($o->{entPhysicalIndex})}],
['alarmdescriptionmappings', 'ceAlarmDescrMapTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmDescriptionMapping' ],
['alarmdescriptions', 'ceAlarmDescrTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmDescription' ],
['alarmfilterprofiles', 'ceAlarmFilterProfileTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmFilterProfile' ],
['alarmhistory', 'ceAlarmHistTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmHistory', sub { my $o = shift; $o->{parent} = $self; $self->filter_name($o->{entPhysicalIndex})}],
]);
$self->get_snmp_tables('ENTITY-MIB', [
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::PhysicalEntity'],
]);
$self->get_snmp_objects('CISCO-ENTITY-ALARM-MIB', qw(
ceAlarmCriticalCount ceAlarmMajorCount ceAlarmMinorCount
ceAlarmFilterProfileIndexNext
));
foreach (qw(ceAlarmCriticalCount ceAlarmMajorCount ceAlarmMinorCount)) {
$self->{$_} ||= 0;
}
@{$self->{alarms}} = grep {
$_->{ceAlarmSeverity} ne 'none' &&
$_->{ceAlarmSeverity} ne 'info'
} @{$self->{alarms}};
foreach my $alarm (@{$self->{alarms}}) {
foreach my $entity (@{$self->{entities}}) {
if ($alarm->{entPhysicalIndex} eq $entity->{entPhysicalIndex}) {
$alarm->{entity} = $entity;
}
}
}
}
sub check {
my $self = shift;
if (scalar(@{$self->{alarms}}) == 0) {
$self->add_info('no alarms');
$self->add_ok();
} else {
foreach (@{$self->{alarms}}) {
$_->check();
}
foreach (@{$self->{alarmhistory}}) {
$_->check();
}
if (! $self->check_messages()) { # blacklisted des ganze glump
$self->add_info('no alarms');
$self->add_ok();
}
}
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::Alarm;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
$self->{ceAlarmTypes} = [];
if ($self->{ceAlarmList}) {
my $index = 0;
foreach my $octet (split(/\s+/, $self->{ceAlarmList})) {
my $hexoctet = hex($octet) & 0xff;
if ($hexoctet) {
my $base = 8 * $index;
foreach my $bit (0..7) {
my $mask = (2 ** $bit) & 0xff;
if ($hexoctet & $mask) {
push(@{$self->{ceAlarmTypes}}, $base + $bit);
}
}
}
$index++;
}
}
$self->{ceAlarmTypes} = join(",", @{$self->{ceAlarmTypes}}); # weil sonst der drecks-dump nicht funktioniert.
}
sub check {
my $self = shift;
my $location = exists $self->{entity} ?
$self->{entity}->{entPhysicalDescr} : "unknown";
if (length($self->{ceAlarmTypes})) {
my @descriptorindexes = map {
$_->{ceAlarmDescrIndex}
} grep {
$self->{entity}->{entPhysicalVendorType} eq $_->{ceAlarmDescrVendorType}
} @{$self->{parent}->{alarmdescriptionmappings}};
if (@descriptorindexes) {
my $ceAlarmDescrIndex = $descriptorindexes[0];
my @descriptions = grep {
$_->{ceAlarmDescrIndex} == $ceAlarmDescrIndex;
} @{$self->{parent}->{alarmdescriptions}};
foreach my $ceAlarmType (split(",", $self->{ceAlarmTypes})) {
foreach my $alarmdesc (@descriptions) {
if ($alarmdesc->{ceAlarmDescrAlarmType} == $ceAlarmType) {
$self->add_info(sprintf "%s alarm '%s' in entity %d (%s)",
$alarmdesc->{ceAlarmDescrSeverity},
$alarmdesc->{ceAlarmDescrText},
$self->{entPhysicalIndex},
$location);
if ($alarmdesc->{ceAlarmDescrSeverity} eq "none") {
# A value of '0' indicates that there the corresponding physical entity currently is not asserting any alarms.
} elsif ($alarmdesc->{ceAlarmDescrSeverity} eq "critical") {
$self->add_critical();
} elsif ($alarmdesc->{ceAlarmDescrSeverity} eq "major") {
$self->add_critical();
} elsif ($alarmdesc->{ceAlarmDescrSeverity} eq "minor") {
$self->add_warning();
} elsif ($alarmdesc->{ceAlarmDescrSeverity} eq "info") {
$self->add_ok();
}
}
}
}
}
}
delete $self->{parent}; # brauch ma nimmer, daad eh sched bon dump scheebern
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::PhysicalEntity;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmDescription;
our @ISA = qw(GLPlugin::SNMP::TableItem);
sub finish {
my $self = shift;
$self->{ceAlarmDescrIndex} = $self->{indices}->[0];
$self->{ceAlarmDescrAlarmType} = $self->{indices}->[1];
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmDescriptionMapping;
our @ISA = qw(GLPlugin::SNMP::TableItem);
sub finish {
my $self = shift;
$self->{ceAlarmDescrIndex} = $self->{indices}->[0];
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmFilterProfile;
our @ISA = qw(GLPlugin::SNMP::TableItem);
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::AlarmSubsystem::AlarmHistory;
our @ISA = qw(GLPlugin::SNMP::TableItem);
sub finish {
my $self = shift;
$self->{ceAlarmHistTimeStamp} = time - $self->uptime() + $self->timeticks($self->{ceAlarmHistTimeStamp});
$self->{ceAlarmHistTimeStampLocal} = scalar localtime $self->{ceAlarmHistTimeStamp};
}
sub check {
my $self = shift;
my $vendortype = "unknown";
my @entities = grep {
$_->{entPhysicalIndex} == $self->{ceAlarmHistEntPhysicalIndex};
} @{$self->{parent}->{entities}};
if (@entities) {
$vendortype = $entities[0]->{entPhysicalVendorType};
$self->{ceAlarmHistEntPhysicalDescr} = $entities[0]->{entPhysicalDescr};
}
my @descriptorindexes = map {
$_->{ceAlarmDescrIndex}
} grep {
$vendortype eq $_->{ceAlarmDescrVendorType}
} @{$self->{parent}->{alarmdescriptionmappings}};
if (@descriptorindexes) {
my $ceAlarmDescrIndex = $descriptorindexes[0];
my @descriptions = grep {
$_->{ceAlarmDescrIndex} == $ceAlarmDescrIndex;
} @{$self->{parent}->{alarmdescriptions}};
foreach my $alarmdesc (@descriptions) {
if ($alarmdesc->{ceAlarmDescrAlarmType} == $self->{ceAlarmHistAlarmType}) {
$self->{ceAlarmHistAlarmDescrText} = $alarmdesc->{ceAlarmDescrText};
}
}
}
delete $self->{parent};
}
__END__
ceAlarmTable
"This table specifies alarm control and status information
related to each physical entity contained by the system,
including the alarms currently being asserted by each physical
entity capable of generating alarms."
ceAlarmEntry
INDEX { entPhysicalIndex }
"Alarm control and status information related to the
corresponding physical entity, including a list of those
alarms currently being asserted by that physical entity."
ceAlarmSeverity
"This object specifies the highest severity alarm currently
being asserted by the corresponding physical entity. A value
of '0' indicates that there the corresponding physical entity
currently is not asserting any alarms."
ceAlarmFilterProfile
"This object specifies the alarm filter profile associated
with the corresponding physical entity. An alarm filter
profile controls which alarm types the agent will monitor
and signal for the corresponding physical entity.
If the value of this object is '0', then the agent monitors
and signals all alarms associated with the corresponding
physical entity."
ceAlarmList
If an alarm is being asserted by the physical entity, then the
corresponding bit in the alarm list is set to a one. Observe
that if the physical entity is not currently asserting any
alarms, then the list will have a length of zero."
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
32 octets
An OCTET STRING represents an alarm list, in which each
bit represents an alarm type. The bits in the first octet
represent alarm types identified by the integer values 1
through 8, inclusive, The bits in the second octet represent
alarm types identified by the integer values 9 through 16,
inclusive, and so forth.
Alternativ:
http://webcache.googleusercontent.com/search?q=cache:H9-CC7j7rxQJ:trbonet.com/download/HelpFile/TRBOnet_Watch_User_Guide_1.9_ENG.pdf+&cd=13&hl=de&ct=clnk&gl=de
4. How to read a list of alarms from a ceAlarmList (ceAlarmTable, Oid: 1.3.6.1.4.1.9.9.138.1.2.5.1.3)
This line consists of 32 bytes in hexadecimal format. Type of alarm is encoded by ordinal bit.
The encoding line may look like this:
00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I.e. 13 * 8 + 3(00001000) = 107 (PeerDisconnected Alarm).
rechtes bit von oktett 0 = fehler 0
rechtes bit von oktett 1 = fehler 9
also ist rechtes bit von oktett 13 der fehler 104
zweitrechtes bit von oktett 13 der fehler 105 ...
Other types of alarms are defined similarly. If no alarms are set, the line will have zero length.
jetzt wirds dreckig:
AlarmTable
Ein Entry gehoert zu einem entPhysicalIndex
Ein Entry hat ceAlarmList und daraus abgeleitet ceAlarmTypes
Entites
Ein physical Entity hat eindeutig entPhysicalIndex
und hat einen entPhysicalVendorType, also die Bauteilbezeichnung
ceAlarmDescrMapTable ist eine stupide durchnumerierte Tabelle, die
ceAlarmDescrIndex und ceAlarmDescrVendorType- Paerchen buendelt
AlarmTable
mit entPhysicalIndex wird entPhysicalVendorType ermittelt
ceAlarmDescrMapTable
mit entPhysicalVendorType=ceAlarmDescrVendorType wird ceAlarmDescrIndex ermittelt
ceAlarmDescrTable
mit ceAlarmDescrIndex = ceAlarmDescrIndex &&
ceAlarmTypes aus AlarmTable = ceAlarmDescrAlarmType
wird ceAlarmDescrText geholt

View file

@ -0,0 +1,285 @@
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $sensors = {};
$self->get_snmp_tables('CISCO-ENTITY-SENSOR-MIB', [
['sensors', 'entSensorValueTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor', sub { my $o = shift; $self->filter_name($o->{entPhysicalIndex})}],
['thresholds', 'entSensorThresholdTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold'],
]);
$self->get_snmp_tables('ENTITY-MIB', [
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity'],
]);
@{$self->{entities}} = grep { $_->{entPhysicalClass} eq 'sendor' } @{$self->{entities}};
foreach my $sensor (@{$self->{sensors}}) {
$sensors->{$sensor->{entPhysicalIndex}} = $sensor;
foreach my $threshold (@{$self->{thresholds}}) {
if ($sensor->{entPhysicalIndex} eq $threshold->{entPhysicalIndex}) {
push(@{$sensors->{thresholds}}, $threshold);
}
}
foreach my $entity (@{$self->{entities}}) {
if ($sensor->{entPhysicalIndex} eq $entity->{entPhysicalIndex}) {
$sensor->{entity} = $entity;
}
}
}
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
# www.thaiadmin.org%2Fboard%2Findex.php%3Faction%3Ddlattach%3Btopic%3D45832.0%3Battach%3D23494&ei=kV9zT7GHJ87EsgbEvpX6DQ&usg=AFQjCNHuHiS2MR9TIpYtu7C8bvgzuqxgMQ&cad=rja
# zu klaeren. entPhysicalIndex entspricht dem entPhysicalindex der ENTITY-MIB.
# In der stehen alle moeglichen Powersupplies etc.
# Was bedeutet aber dann entSensorMeasuredEntity? gibt's eh nicht in meinen
# Beispiel-walks
$self->{thresholds} = [];
$self->{entSensorMeasuredEntity} ||= 'undef';
}
sub check {
my $self = shift;
$self->add_info(sprintf '%s sensor %s%s is %s',
$self->{entSensorType},
$self->{entPhysicalIndex},
exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.')' : '',
$self->{entSensorStatus});
if ($self->{entSensorStatus} eq "nonoperational") {
$self->add_critical();
} elsif ($self->{entSensorStatus} eq "unknown_10") {
# these sensors do not exist according to cisco-tools
return;
} elsif ($self->{entSensorStatus} eq "unavailable") {
return;
} elsif (scalar(grep { $_->{entSensorThresholdEvaluation} eq "true" }
@{$self->{thresholds}})) {
$self->add_critical(sprintf "%s sensor %s threshold evaluation is true",
$self->{entSensorType},
$self->{entPhysicalIndex});
} else {
}
if (scalar(@{$self->{thresholds}} == 2)) {
# reparaturlauf
foreach my $idx (0..1) {
my $otheridx = $idx == 0 ? 1 : 0;
if (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "major";
} elsif (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "minor";
}
}
my $warning = (map { $_->{entSensorThresholdValue} }
grep { $_->{entSensorThresholdSeverity} eq "minor" }
@{$self->{thresholds}})[0];
my $critical = (map { $_->{entSensorThresholdValue} }
grep { $_->{entSensorThresholdSeverity} eq "major" }
@{$self->{thresholds}})[0];
$self->add_perfdata(
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
value => $self->{entSensorValue},
warning => $warning,
critical => $critical,
);
} elsif ($self->{entSensorValue}) {
$self->add_perfdata(
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
value => $self->{entSensorValue},
warning => $self->{ciscoEnvMonSensorThreshold},
critical => undef,
);
}
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{indices}->[0];
$self->{entSensorThresholdIndex} = $self->{indices}->[1];
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
}
__END__
nex5-rz2-04# sh env
Fan:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis-1 N5K-C5010-FAN -- ok
Chassis-2 N5K-C5010-FAN -- ok
PS-1 N5K-PAC-550W -- ok
PS-2 N5K-PAC-550W -- ok
Temperature
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 60 50 45 ok
1 Outlet-2 60 50 46 ok
1 Intake-1 60 50 33 ok
1 Intake-2 60 50 34 ok
1 Intake-3 50 40 34 ok
1 Intake-4 50 40 34 ok
1 PS-1 60 50 33 ok
1 PS-2 60 50 31 ok
2 Outlet-1 60 50 38 ok
nex5-rz2-04# sh env fex all
Temperature Fex 100:
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 57 45 45 ok
1 Die-1 95 85 58 ok
Fan Fex: 100:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis N2K-C2248-FAN -- ok
PS-1 N2200-PAC-400W -- ok
PS-2 N2200-PAC-400W -- ok
Power Supply Fex 100:
---------------------------------------------------------------------------
Voltage: 12 Volts
-----------------------------------------------------
PS Model Power Power Status
(Watts) (Amp)
-----------------------------------------------------
1 N2200-PAC-400W 396.00 33.00 ok
2 N2200-PAC-400W 396.00 33.00 ok
Mod Model Power Power Power Power Status
Requested Requested Allocated Allocated
(Watts) (Amp) (Watts) (Amp)
--- ------------------- ------- ---------- --------- ---------- ----------
1 N2K-C2248TP-1GE 85.20 7.10 85.20 7.10 powered-up
Power Usage Summary:
--------------------
Power Supply redundancy mode: redundant
Total Power Capacity 792.00 W
Power reserved for Supervisor(s) 85.20 W
Power currently used by Modules 0.00 W
-------------
Total Power Available 706.80 W
-------------
Temperature Fex 101:
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 57 45 42 ok
1 Die-1 95 85 53 ok
Fan Fex: 101:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis N2K-C2248-FAN -- ok
PS-1 N2200-PAC-400W -- ok
PS-2 N2200-PAC-400W -- ok
Power Supply Fex 101:
---------------------------------------------------------------------------
Voltage: 12 Volts
-----------------------------------------------------
PS Model Power Power Status
(Watts) (Amp)
-----------------------------------------------------
1 N2200-PAC-400W 396.00 33.00 ok
2 N2200-PAC-400W 396.00 33.00 ok
Mod Model Power Power Power Power Status
Requested Requested Allocated Allocated
(Watts) (Amp) (Watts) (Amp)
--- ------------------- ------- ---------- --------- ---------- ----------
1 N2K-C2248TP-1GE 94.80 7.90 94.80 7.90 powered-up
Power Usage Summary:
--------------------
Power Supply redundancy mode: redundant
Total Power Capacity 792.00 W
Power reserved for Supervisor(s) 94.80 W
Power currently used by Modules 0.00 W
-------------
Total Power Available 697.20 W
-------------
OK - environmental hardware working fine, environmental hardware working fine
checking sensors
celsius sensor 100021590 (Fex-100 Module-1 Outlet-1) is ok
celsius sensor 100021591 (Fex-100 Module-1 Outlet-2) is unknown_10
celsius sensor 100021592 (Fex-100 Module-1 Inlet-1) is unknown_10
celsius sensor 101021590 (Fex-101 Module-1 Outlet-1) is ok
celsius sensor 101021591 (Fex-101 Module-1 Outlet-2) is unknown_10
celsius sensor 101021592 (Fex-101 Module-1 Inlet-1) is unknown_10
celsius sensor 21590 (Module-1, Outlet-1) is ok
celsius sensor 21591 (Module-1, Outlet-2) is ok
celsius sensor 21592 (Module-1, Intake-1) is ok
celsius sensor 21593 (Module-1, Intake-2) is ok
celsius sensor 21594 (Module-1, Intake-3) is ok
celsius sensor 21595 (Module-1, Intake-4) is ok
celsius sensor 21596 (PowerSupply-1 Sensor-1) is ok
celsius sensor 21597 (PowerSupply-2 Sensor-1) is ok
celsius sensor 21602 (Module-2, Outlet-1) is ok
checking fans
fan/tray 100000534 (Fex-100 FanModule-1 ) status is up
fan/tray 100000539 (Fex-100 PowerSupply-1 Fan-1 ) status is up
fan/tray 100000540 (Fex-100 PowerSupply-2 Fan-1 ) status is up
fan/tray 101000534 (Fex-101 FanModule-1 ) status is up
fan/tray 101000539 (Fex-101 PowerSupply-1 Fan-1 ) status is up
fan/tray 101000540 (Fex-101 PowerSupply-2 Fan-1 ) status is up
fan/tray 534 (FanModule-1 ) status is up
fan/tray 535 (FanModule-2 ) status is up
fan/tray 536 (PowerSupply-1 Fan-1 ) status is up
fan/tray 537 (PowerSupply-1 Fan-2 ) status is up
fan/tray 538 (PowerSupply-2 Fan-1 ) status is up
fan/tray 539 (PowerSupply-2 Fan-2 ) status is up | 'sens_celsius_100021590'=44 'sens_celsius_101021590'=41 'sens_celsius_21590'=44 'sens_celsius_21591'=46 'sens_celsius_21592'=33 'sens_celsius_21593'=34 'sens_celsius_21594'=34 'sens_celsius_21595'=33 'sens_celsius_21596'=33 'sens_celsius_21597'=31 'sens_celsius_21602'=38

View file

@ -0,0 +1,27 @@
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->{fan_subsystem} =
Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::FanSubsystem->new();
$self->{supply_subsystem} =
Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem->new();
}
sub check {
my $self = shift;
$self->{fan_subsystem}->check();
$self->{supply_subsystem}->check();
if (! $self->check_messages()) {
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
$self->{fan_subsystem}->dump();
$self->{supply_subsystem}->dump();
}

View file

@ -0,0 +1,42 @@
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENTITY-FRU-CONTROL-MIB', [
['fans', 'cefcFanTrayStatusTable', 'Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::FanSubsystem::Fan'],
]);
$self->get_snmp_tables('ENTITY-MIB', [
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity'],
]);
@{$self->{entities}} = grep { $_->{entPhysicalClass} eq 'fan' } @{$self->{entities}};
foreach my $fan (@{$self->{fans}}) {
foreach my $entity (@{$self->{entities}}) {
if ($fan->{flat_indices} eq $entity->{entPhysicalIndex}) {
$fan->{entity} = $entity;
}
}
}
}
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'fan/tray %s%s status is %s',
$self->{flat_indices},
#exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.' idx '.$self->{entity}->{entPhysicalIndex}.' class '.$self->{entity}->{entPhysicalClass}.')' : '',
exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.')' : '',
$self->{cefcFanTrayOperStatus});
if ($self->{cefcFanTrayOperStatus} eq "unknown") {
$self->add_unknown();
} elsif ($self->{cefcFanTrayOperStatus} eq "down") {
$self->add_warning();
} elsif ($self->{cefcFanTrayOperStatus} eq "warning") {
$self->add_warning();
}
}

View file

@ -0,0 +1,114 @@
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENTITY-FRU-CONTROL-MIB', [
['powersupplies', 'cefcFRUPowerStatusTable', 'Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem::Powersupply'],
['powersupplygroups', 'cefcFRUPowerSupplyGroupTable', 'Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem::PowersupplyGroup'],
]);
$self->get_snmp_tables('ENTITY-MIB', [
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity'],
]);
@{$self->{entities}} = grep { $_->{entPhysicalClass} eq 'powerSupply' } @{$self->{entities}};
foreach my $supply (@{$self->{supplies}}) {
foreach my $entity (@{$self->{entities}}) {
if ($supply->{flat_indices} eq $entity->{entPhysicalIndex}) {
$supply->{entity} = $entity;
}
}
}
}
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem::Powersupply;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'power supply %s%s admin status is %s, oper status is %s',
$self->{flat_indices},
#exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.' idx '.$self->{entity}->{entPhysicalIndex}.' class '.$self->{entity}->{entPhysicalClass}.')' : '',
exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.' )' : '',
$self->{cefcFRUPowerAdminStatus},
$self->{cefcFRUPowerOperStatus});
return;
if ($self->{cefcSupplyTrayOperStatus} eq "on") {
} elsif ($self->{cefcSupplyTrayOperStatus} eq "onButFanFail") {
$self->add_warning();
} else {
$self->add_critical();
}
}
package Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::PowersupplySubsystem::PowersupplyGroup;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
__END__
"Operational FRU Status types. valid values are:
offEnvOther(1) FRU is powered off because of a problem not
listed below.
on(2): FRU is powered on.
offAdmin(3): Administratively off.
offDenied(4): FRU is powered off because available
system power is insufficient.
offEnvPower(5): FRU is powered off because of power problem in
the FRU. for example, the FRU's power
translation (DC-DC converter) or distribution
failed.
offEnvTemp(6): FRU is powered off because of temperature
problem.
offEnvFan(7): FRU is powered off because of fan problems.
failed(8): FRU is in failed state.
onButFanFail(9): FRU is on, but fan has failed.
offCooling(10): FRU is powered off because of the system's
insufficient cooling capacity.
offConnectorRating(11): FRU is powered off because of the
system's connector rating exceeded.
onButInlinePowerFail(12): The FRU on, but no inline power
is being delivered as the
data/inline power component of the
FRU has failed."
"Administratively desired FRU power state types. valid values
are:
on(1): Turn FRU on.
off(2): Turn FRU off.
The inline power means that the FRU itself won't cost any power,
but the external device connecting to the FRU will drain the
power from FRU. For example, the IP phone device. The FRU is a
port of a switch with voice ability and IP phone will cost power
from the port once it connects to the port.
inlineAuto(3): Turn FRU inline power to auto mode. It means that
the FRU will try to detect whether the connecting device needs
power or not. If it needs power, the FRU will supply power. If
it doesn't, the FRU will treat the device as a regular network
device.
inlineOn(4): Turn FRU inline power to on mode. It means that
once the device connects to the FRU, the FRU will always supply
power to the device no matter the device needs the power or not.
powerCycle(5): Power cycle the FRU. This value may be specified
in a management protocol set operation, it will not be returned
in response to a management protocol retrieval operation."

View file

@ -0,0 +1,285 @@
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $sensors = {};
$self->get_snmp_tables('CISCO-ENTITY-SENSOR-MIB', [
['sensors', 'entSensorValueTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor', sub { my $o = shift; $self->filter_name($o->{entPhysicalIndex})}],
['thresholds', 'entSensorThresholdTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold'],
]);
$self->get_snmp_tables('ENTITY-MIB', [
['entities', 'entPhysicalTable', 'Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity'],
]);
@{$self->{sensor_entities}} = grep { $_->{entPhysicalClass} eq 'sensor' } @{$self->{entities}};
foreach my $sensor (@{$self->{sensors}}) {
$sensors->{$sensor->{entPhysicalIndex}} = $sensor;
foreach my $threshold (@{$self->{thresholds}}) {
if ($sensor->{entPhysicalIndex} eq $threshold->{entPhysicalIndex}) {
push(@{$sensor->{thresholds}}, $threshold);
}
}
foreach my $entity (@{$self->{sensor_entities}}) {
if ($sensor->{entPhysicalIndex} eq $entity->{entPhysicalIndex}) {
$sensor->{entity} = $entity;
}
}
}
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::Sensor;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
# www.thaiadmin.org%2Fboard%2Findex.php%3Faction%3Ddlattach%3Btopic%3D45832.0%3Battach%3D23494&ei=kV9zT7GHJ87EsgbEvpX6DQ&usg=AFQjCNHuHiS2MR9TIpYtu7C8bvgzuqxgMQ&cad=rja
# zu klaeren. entPhysicalIndex entspricht dem entPhysicalindex der ENTITY-MIB.
# In der stehen alle moeglichen Powersupplies etc.
# Was bedeutet aber dann entSensorMeasuredEntity? gibt's eh nicht in meinen
# Beispiel-walks
$self->{thresholds} = [];
$self->{entSensorMeasuredEntity} ||= 'undef';
}
sub check {
my $self = shift;
$self->add_info(sprintf '%s sensor %s%s is %s',
$self->{entSensorType},
$self->{entPhysicalIndex},
exists $self->{entity} ? ' ('.$self->{entity}->{entPhysicalDescr}.')' : '',
$self->{entSensorStatus});
if ($self->{entSensorStatus} eq "nonoperational") {
$self->add_critical();
} elsif ($self->{entSensorStatus} eq "unknown_10") {
# these sensors do not exist according to cisco-tools
return;
} elsif ($self->{entSensorStatus} eq "unavailable") {
return;
} elsif (scalar(grep { $_->{entSensorThresholdEvaluation} eq "true" }
@{$self->{thresholds}})) {
$self->add_critical(sprintf "%s sensor %s threshold evaluation is true",
$self->{entSensorType},
$self->{entPhysicalIndex});
} else {
}
if (scalar(@{$self->{thresholds}} == 2)) {
# reparaturlauf
foreach my $idx (0..1) {
my $otheridx = $idx == 0 ? 1 : 0;
if (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "major";
} elsif (! defined @{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} &&
@{$self->{thresholds}}[$otheridx]->{entSensorThresholdSeverity} eq "minor") {
@{$self->{thresholds}}[$idx]->{entSensorThresholdSeverity} = "minor";
}
}
my $warning = (map { $_->{entSensorThresholdValue} }
grep { $_->{entSensorThresholdSeverity} eq "minor" }
@{$self->{thresholds}})[0];
my $critical = (map { $_->{entSensorThresholdValue} }
grep { $_->{entSensorThresholdSeverity} eq "major" }
@{$self->{thresholds}})[0];
$self->add_perfdata(
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
value => $self->{entSensorValue},
warning => $warning,
critical => $critical,
);
} elsif ($self->{entSensorValue}) {
$self->add_perfdata(
label => sprintf('sens_%s_%s', $self->{entSensorType}, $self->{entPhysicalIndex}),
value => $self->{entSensorValue},
warning => $self->{ciscoEnvMonSensorThreshold},
critical => undef,
);
}
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::SensorThreshold;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{indices}->[0];
$self->{entSensorThresholdIndex} = $self->{indices}->[1];
}
package Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem::PhysicalEntity;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{entPhysicalIndex} = $self->{flat_indices};
}
__END__
nex5-rz2-04# sh env
Fan:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis-1 N5K-C5010-FAN -- ok
Chassis-2 N5K-C5010-FAN -- ok
PS-1 N5K-PAC-550W -- ok
PS-2 N5K-PAC-550W -- ok
Temperature
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 60 50 45 ok
1 Outlet-2 60 50 46 ok
1 Intake-1 60 50 33 ok
1 Intake-2 60 50 34 ok
1 Intake-3 50 40 34 ok
1 Intake-4 50 40 34 ok
1 PS-1 60 50 33 ok
1 PS-2 60 50 31 ok
2 Outlet-1 60 50 38 ok
nex5-rz2-04# sh env fex all
Temperature Fex 100:
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 57 45 45 ok
1 Die-1 95 85 58 ok
Fan Fex: 100:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis N2K-C2248-FAN -- ok
PS-1 N2200-PAC-400W -- ok
PS-2 N2200-PAC-400W -- ok
Power Supply Fex 100:
---------------------------------------------------------------------------
Voltage: 12 Volts
-----------------------------------------------------
PS Model Power Power Status
(Watts) (Amp)
-----------------------------------------------------
1 N2200-PAC-400W 396.00 33.00 ok
2 N2200-PAC-400W 396.00 33.00 ok
Mod Model Power Power Power Power Status
Requested Requested Allocated Allocated
(Watts) (Amp) (Watts) (Amp)
--- ------------------- ------- ---------- --------- ---------- ----------
1 N2K-C2248TP-1GE 85.20 7.10 85.20 7.10 powered-up
Power Usage Summary:
--------------------
Power Supply redundancy mode: redundant
Total Power Capacity 792.00 W
Power reserved for Supervisor(s) 85.20 W
Power currently used by Modules 0.00 W
-------------
Total Power Available 706.80 W
-------------
Temperature Fex 101:
-----------------------------------------------------------------
Module Sensor MajorThresh MinorThres CurTemp Status
(Celsius) (Celsius) (Celsius)
-----------------------------------------------------------------
1 Outlet-1 57 45 42 ok
1 Die-1 95 85 53 ok
Fan Fex: 101:
------------------------------------------------------
Fan Model Hw Status
------------------------------------------------------
Chassis N2K-C2248-FAN -- ok
PS-1 N2200-PAC-400W -- ok
PS-2 N2200-PAC-400W -- ok
Power Supply Fex 101:
---------------------------------------------------------------------------
Voltage: 12 Volts
-----------------------------------------------------
PS Model Power Power Status
(Watts) (Amp)
-----------------------------------------------------
1 N2200-PAC-400W 396.00 33.00 ok
2 N2200-PAC-400W 396.00 33.00 ok
Mod Model Power Power Power Power Status
Requested Requested Allocated Allocated
(Watts) (Amp) (Watts) (Amp)
--- ------------------- ------- ---------- --------- ---------- ----------
1 N2K-C2248TP-1GE 94.80 7.90 94.80 7.90 powered-up
Power Usage Summary:
--------------------
Power Supply redundancy mode: redundant
Total Power Capacity 792.00 W
Power reserved for Supervisor(s) 94.80 W
Power currently used by Modules 0.00 W
-------------
Total Power Available 697.20 W
-------------
OK - environmental hardware working fine, environmental hardware working fine
checking sensors
celsius sensor 100021590 (Fex-100 Module-1 Outlet-1) is ok
celsius sensor 100021591 (Fex-100 Module-1 Outlet-2) is unknown_10
celsius sensor 100021592 (Fex-100 Module-1 Inlet-1) is unknown_10
celsius sensor 101021590 (Fex-101 Module-1 Outlet-1) is ok
celsius sensor 101021591 (Fex-101 Module-1 Outlet-2) is unknown_10
celsius sensor 101021592 (Fex-101 Module-1 Inlet-1) is unknown_10
celsius sensor 21590 (Module-1, Outlet-1) is ok
celsius sensor 21591 (Module-1, Outlet-2) is ok
celsius sensor 21592 (Module-1, Intake-1) is ok
celsius sensor 21593 (Module-1, Intake-2) is ok
celsius sensor 21594 (Module-1, Intake-3) is ok
celsius sensor 21595 (Module-1, Intake-4) is ok
celsius sensor 21596 (PowerSupply-1 Sensor-1) is ok
celsius sensor 21597 (PowerSupply-2 Sensor-1) is ok
celsius sensor 21602 (Module-2, Outlet-1) is ok
checking fans
fan/tray 100000534 (Fex-100 FanModule-1 ) status is up
fan/tray 100000539 (Fex-100 PowerSupply-1 Fan-1 ) status is up
fan/tray 100000540 (Fex-100 PowerSupply-2 Fan-1 ) status is up
fan/tray 101000534 (Fex-101 FanModule-1 ) status is up
fan/tray 101000539 (Fex-101 PowerSupply-1 Fan-1 ) status is up
fan/tray 101000540 (Fex-101 PowerSupply-2 Fan-1 ) status is up
fan/tray 534 (FanModule-1 ) status is up
fan/tray 535 (FanModule-2 ) status is up
fan/tray 536 (PowerSupply-1 Fan-1 ) status is up
fan/tray 537 (PowerSupply-1 Fan-2 ) status is up
fan/tray 538 (PowerSupply-2 Fan-1 ) status is up
fan/tray 539 (PowerSupply-2 Fan-2 ) status is up | 'sens_celsius_100021590'=44 'sens_celsius_101021590'=41 'sens_celsius_21590'=44 'sens_celsius_21591'=46 'sens_celsius_21592'=33 'sens_celsius_21593'=34 'sens_celsius_21594'=34 'sens_celsius_21595'=33 'sens_celsius_21596'=33 'sens_celsius_21597'=31 'sens_celsius_21602'=38

View file

@ -0,0 +1,28 @@
package Classes::Cisco::CISCOENVMONMIB::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['fans', 'ciscoEnvMonFanStatusTable', 'Classes::Cisco::CISCOENVMONMIB::Component::FanSubsystem::Fan'],
]);
}
package Classes::Cisco::CISCOENVMONMIB::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->ensure_index('ciscoEnvMonFanStatusIndex');
$self->add_info(sprintf 'fan %d (%s) is %s',
$self->{ciscoEnvMonFanStatusIndex},
$self->{ciscoEnvMonFanStatusDescr},
$self->{ciscoEnvMonFanState});
if ($self->{ciscoEnvMonFanState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonFanState} ne 'normal') {
$self->add_critical();
}
}

View file

@ -0,0 +1,30 @@
package Classes::Cisco::CISCOENVMONMIB::Component::PowersupplySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['supplies', 'ciscoEnvMonSupplyStatusTable', 'Classes::Cisco::CISCOENVMONMIB::Component::PowersupplySubsystem::Powersupply'],
]);
}
package Classes::Cisco::CISCOENVMONMIB::Component::PowersupplySubsystem::Powersupply;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->ensure_index('ciscoEnvMonSupplyStatusIndex');
$self->add_info(sprintf 'powersupply %d (%s) is %s',
$self->{ciscoEnvMonSupplyStatusIndex},
$self->{ciscoEnvMonSupplyStatusDescr},
$self->{ciscoEnvMonSupplyState});
if ($self->{ciscoEnvMonSupplyState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonSupplyState} eq 'warning') {
$self->add_warning();
} elsif ($self->{ciscoEnvMonSupplyState} ne 'normal') {
$self->add_critical();
}
}

View file

@ -0,0 +1,86 @@
package Classes::Cisco::CISCOENVMONMIB::Component::TemperatureSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['temperatures', 'ciscoEnvMonTemperatureStatusTable', 'Classes::Cisco::CISCOENVMONMIB::Component::TemperatureSubsystem::Temperature'],
]);
}
package Classes::Cisco::CISCOENVMONMIB::Component::TemperatureSubsystem::Temperature;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub new {
my $class = shift;
my %params = @_;
my $self = {};
foreach (keys %params) {
$self->{$_} = $params{$_};
}
if ($self->{ciscoEnvMonTemperatureStatusValue}) {
bless $self, $class;
} else {
bless $self, $class.'::Simple';
}
$self->ensure_index('ciscoEnvMonTemperatureStatusIndex');
$self->{ciscoEnvMonTemperatureLastShutdown} ||= 0;
return $self;
}
sub check {
my $self = shift;
if ($self->{ciscoEnvMonTemperatureStatusValue} >
$self->{ciscoEnvMonTemperatureThreshold}) {
$self->add_info(sprintf 'temperature %d %s is too high (%d of %d max = %s)',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureStatusValue},
$self->{ciscoEnvMonTemperatureThreshold},
$self->{ciscoEnvMonTemperatureState});
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
$self->add_warning();
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
$self->add_critical();
}
} else {
$self->add_info(sprintf 'temperature %d %s is %d (of %d max = normal)',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureStatusValue},
$self->{ciscoEnvMonTemperatureThreshold},
$self->{ciscoEnvMonTemperatureState});
}
$self->add_perfdata(
label => sprintf('temp_%s', $self->{ciscoEnvMonTemperatureStatusIndex}),
value => $self->{ciscoEnvMonTemperatureStatusValue},
warning => $self->{ciscoEnvMonTemperatureThreshold},
critical => undef,
);
}
package Classes::Cisco::CISCOENVMONMIB::Component::TemperatureSubsystem::Temperature::Simple;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->{ciscoEnvMonTemperatureStatusIndex} ||= 0;
$self->{ciscoEnvMonTemperatureStatusDescr} ||= 0;
$self->add_info(sprintf 'temperature %d %s is %s',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureState});
if ($self->{ciscoEnvMonTemperatureState} ne 'normal') {
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
$self->add_warning();
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
$self->add_critical();
}
} else {
}
}

View file

@ -0,0 +1,48 @@
package Classes::Cisco::CISCOENVMONMIB::Component::VoltageSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $index = 0;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['voltages', 'ciscoEnvMonVoltageStatusTable', 'Classes::Cisco::CISCOENVMONMIB::Component::VoltageSubsystem::Voltage'],
]);
}
sub check {
my $self = shift;
my $errorfound = 0;
$self->add_info('checking voltages');
if (scalar (@{$self->{voltages}}) == 0) {
} else {
foreach (@{$self->{voltages}}) {
$_->check();
}
}
}
package Classes::Cisco::CISCOENVMONMIB::Component::VoltageSubsystem::Voltage;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->ensure_index('ciscoEnvMonVoltageStatusIndex');
$self->add_info(sprintf 'voltage %d (%s) is %s',
$self->{ciscoEnvMonVoltageStatusIndex},
$self->{ciscoEnvMonVoltageStatusDescr},
$self->{ciscoEnvMonVoltageState});
if ($self->{ciscoEnvMonVoltageState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonVoltageState} ne 'normal') {
$self->add_critical();
}
$self->add_perfdata(
label => sprintf('mvolt_%s', $self->{ciscoEnvMonVoltageStatusIndex}),
value => $self->{ciscoEnvMonVoltageStatusValue},
warning => $self->{ciscoEnvMonVoltageThresholdLow},
critical => $self->{ciscoEnvMonVoltageThresholdHigh},
);
}

View file

@ -0,0 +1,28 @@
package Classes::Cisco::IOS;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::IOS::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::IOS::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::Cisco::IOS::Component::MemSubsystem");
} elsif ($self->mode =~ /device::hsrp/) {
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
} elsif ($self->mode =~ /device::users/) {
$self->analyze_and_check_connection_subsystem("Classes::Cisco::IOS::Component::ConnectionSubsystem");
} elsif ($self->mode =~ /device::config/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::ConfigSubsystem");
} elsif ($self->mode =~ /device::interfaces::nat::sessions::count/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
$self->analyze_and_check_config_subsystem("Classes::Cisco::IOS::Component::NatSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,64 @@
package Classes::Cisco::IOS::Component::ConfigSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CISCO-CONFIG-MAN-MIB', (qw(
ccmHistoryRunningLastChanged ccmHistoryRunningLastSaved
ccmHistoryStartupLastChanged)));
foreach ((qw(ccmHistoryRunningLastChanged ccmHistoryRunningLastSaved
ccmHistoryStartupLastChanged))) {
if (! defined $self->{$_}) {
$self->add_unknown(sprintf "%s is not defined", $_);
}
$self->{$_} = time - $self->uptime() + $self->timeticks($self->{$_});
}
}
sub check {
my $self = shift;
my $info;
$self->add_info('checking config');
if ($self->check_messages()) {
return;
}
# ccmHistoryRunningLastChanged
# ccmHistoryRunningLastSaved - saving is ANY write (local/remote storage, terminal)
# ccmHistoryStartupLastChanged
$self->set_thresholds(warning => 3600, critical => 3600*24);
# how much is ccmHistoryRunningLastChanged ahead of ccmHistoryRunningLastSaved
# the current running config is definitively lost in case of an outage
my $unsaved_since =
$self->{ccmHistoryRunningLastChanged} > $self->{ccmHistoryRunningLastSaved} ?
time - $self->{ccmHistoryRunningLastChanged} : 0;
# how much is ccmHistoryRunningLastSaved ahead of ccmHistoryStartupLastChanged
# the running config could have been saved for backup purposes.
# the saved config can still be identical to the saved running config
# if there are regular backups of the running config and no one messes
# with the latter without flushing it to the startup config, then i recommend
# to use --mitigation ok. this can be in an environment, where there is
# a specific day of the week reserved for maintenance and admins are forced
# to save their modifications to the startup-config.
my $unsynced_since =
$self->{ccmHistoryRunningLastSaved} > $self->{ccmHistoryStartupLastChanged} ?
time - $self->{ccmHistoryRunningLastSaved} : 0;
if ($unsaved_since) {
$self->add_info(sprintf "running config is modified and unsaved since %d minutes. your changes my be lost in case of a reboot",
$unsaved_since / 60);
} else {
$self->add_info("saved config is up to date");
}
$self->add_message($self->check_thresholds($unsaved_since));
if ($unsynced_since) {
my $errorlevel = defined $self->opts->mitigation() ?
$self->opts->mitigation() :
$self->check_thresholds($unsynced_since);
$self->add_info(sprintf "saved running config is ahead of startup config since %d minutes. device will boot with a config different from the one which was last saved",
$unsynced_since / 60);
$self->add_message($self->check_thresholds($unsaved_since));
}
}

View file

@ -0,0 +1,33 @@
package Classes::Cisco::IOS::Component::ConnectionSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-FIREWALL-MIB', [
['connectionstates', 'cfwConnectionStatTable', 'Classes::Cisco::IOS::Component::ConnectionSubsystem::ConnectionState'],
]);
}
package Classes::Cisco::IOS::Component::ConnectionSubsystem::ConnectionState;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
if ($self->{cfwConnectionStatDescription} !~ /number of connections currently in use/i) {
$self->add_blacklist(sprintf 'c:%s', $self->{cfwConnectionStatDescription});
$self->add_info(sprintf '%d connections currently in use',
$self->{cfwConnectionStatValue}||$self->{cfwConnectionStatCount}, $self->{usage});
} else {
$self->add_info(sprintf '%d connections currently in use',
$self->{cfwConnectionStatValue}, $self->{usage});
$self->set_thresholds(warning => 500000, critical => 750000);
$self->add_message($self->check_thresholds($self->{cfwConnectionStatValue}));
$self->add_perfdata(
label => 'connections',
value => $self->{cfwConnectionStatValue},
);
}
}

View file

@ -0,0 +1,83 @@
package Classes::Cisco::IOS::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
{
our $cpmCPUTotalIndex = 0;
}
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-PROCESS-MIB', [
['cpus', 'cpmCPUTotalTable', 'Classes::Cisco::IOS::Component::CpuSubsystem::Cpu' ],
]);
if (scalar(@{$self->{cpus}}) == 0) {
# maybe too old. i fake a cpu. be careful. this is a really bad hack
my $response = $self->get_request(
-varbindlist => [
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1},
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5},
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{busyPer},
]
);
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
push(@{$self->{cpus}},
Classes::Cisco::IOS::Component::CpuSubsystem::Cpu->new(
cpmCPUTotalPhysicalIndex => 0, #fake
cpmCPUTotalIndex => 0, #fake
cpmCPUTotal5sec => 0, #fake
cpmCPUTotal5secRev => 0, #fake
cpmCPUTotal1min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
cpmCPUTotal1minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
cpmCPUTotal5min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
cpmCPUTotal5minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
cpmCPUMonInterval => 0, #fake
cpmCPUTotalMonIntervalValue => 0, #fake
cpmCPUInterruptMonIntervalValue => 0, #fake
));
}
}
}
package Classes::Cisco::IOS::Component::CpuSubsystem::Cpu;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{cpmCPUTotalIndex} = exists $self->{cpmCPUTotalIndex} ?
$self->{cpmCPUTotalIndex} :
$Classes::Cisco::IOS::Component::CpuSubsystem::cpmCPUTotalIndex++;
$self->{cpmCPUTotalPhysicalIndex} = exists $self->{cpmCPUTotalPhysicalIndex} ?
$self->{cpmCPUTotalPhysicalIndex} : 0;
if (exists $self->{cpmCPUTotal5minRev}) {
$self->{usage} = $self->{cpmCPUTotal5minRev};
} else {
$self->{usage} = $self->{cpmCPUTotal5min};
}
$self->protect_value($self->{cpmCPUTotalIndex}.$self->{cpmCPUTotalPhysicalIndex}, 'usage', 'percent');
if ($self->{cpmCPUTotalPhysicalIndex}) {
my $entPhysicalName = '1.3.6.1.2.1.47.1.1.1.1.7';
$self->{entPhysicalName} = $self->get_request(
-varbindlist => [$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}]
);
$self->{entPhysicalName} = $self->get_snmp_object('ENTITY-MIB', 'entPhysicalName', $self->{cpmCPUTotalPhysicalIndex});
} else {
$self->{entPhysicalName} = $self->{cpmCPUTotalIndex};
}
}
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
$self->{entPhysicalName}, $self->{usage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds(value => $self->{usage},
metric => 'cpu_'.$self->{entPhysicalName}.'_usage'));
$self->add_perfdata(
label => 'cpu_'.$self->{entPhysicalName}.'_usage',
value => $self->{usage},
uom => '%',
);
}

View file

@ -0,0 +1,66 @@
package Classes::Cisco::IOS::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
#
# 1.3.6.1.4.1.9.9.13.1.1.0 ciscoEnvMonPresent (irgendein typ of envmon)
#
$self->get_snmp_objects('CISCO-ENVMON-MIB', qw(
ciscoEnvMonPresent));
if (! $self->{ciscoEnvMonPresent}) {
# gibt IOS-Kisten, die haben kein ciscoEnvMonPresent
$self->{ciscoEnvMonPresent} = $self->implements_mib('CISCO-ENVMON-MIB');
}
if ($self->{ciscoEnvMonPresent} &&
$self->{ciscoEnvMonPresent} ne 'oldAgs') {
$self->{fan_subsystem} =
Classes::Cisco::CISCOENVMONMIB::Component::FanSubsystem->new();
$self->{temperature_subsystem} =
Classes::Cisco::CISCOENVMONMIB::Component::TemperatureSubsystem->new();
$self->{powersupply_subsystem} =
Classes::Cisco::CISCOENVMONMIB::Component::PowersupplySubsystem->new();
$self->{voltage_subsystem} =
Classes::Cisco::CISCOENVMONMIB::Component::VoltageSubsystem->new();
} elsif ($self->implements_mib('CISCO-ENTITY-SENSOR-MIB')) {
# (IOS can have ENVMON+ENTITY. Sensors are copies, so not needed)
$self->{sensor_subsystem} =
Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem->new();
} elsif ($self->get_snmp_object('MIB-II', 'sysDescr', 0) =~ /C1700 Software/) {
$self->add_ok("environmental hardware working fine");
$self->add_ok('soho device, hopefully too small to fail');
} else {
# last hope
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::CISCOENTITYALARMMIB::Component::AlarmSubsystem");
#$self->no_such_mode();
}
}
sub check {
my $self = shift;
if ($self->{ciscoEnvMonPresent}) {
$self->{fan_subsystem}->check();
$self->{temperature_subsystem}->check();
$self->{voltage_subsystem}->check();
$self->{powersupply_subsystem}->check();
} elsif ($self->{ciscoEntitySensorPresent}) {
$self->{sensor_subsystem}->check();
}
if (! $self->check_messages()) {
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
if ($self->{ciscoEnvMonPresent}) {
$self->{fan_subsystem}->dump();
$self->{temperature_subsystem}->dump();
$self->{voltage_subsystem}->dump();
$self->{powersupply_subsystem}->dump();
} elsif ($self->{ciscoEntitySensorPresent}) {
$self->{sensor_subsystem}->dump();
}
}

View file

@ -0,0 +1,67 @@
package Classes::Cisco::IOS::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-MEMORY-POOL-MIB', [
['mems', 'ciscoMemoryPoolTable', 'Classes::Cisco::IOS::Component::MemSubsystem::Mem'],
]);
}
package Classes::Cisco::IOS::Component::MemSubsystem::Mem;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{usage} = 100 * $self->{ciscoMemoryPoolUsed} /
($self->{ciscoMemoryPoolFree} + $self->{ciscoMemoryPoolUsed});
}
sub check {
my $self = shift;
$self->{ciscoMemoryPoolType} ||= 0;
$self->add_info(sprintf 'mempool %s usage is %.2f%%',
$self->{ciscoMemoryPoolName}, $self->{usage});
if ($self->{ciscoMemoryPoolName} eq 'lsmpi_io' &&
$self->get_snmp_object('MIB-II', 'sysDescr', 0) =~ /IOS.*XE/i) {
# https://supportforums.cisco.com/docs/DOC-16425
$self->force_thresholds(
metric => $self->{ciscoMemoryPoolName}.'_usage',
warning => 100,
critical => 100,
);
} elsif ($self->{ciscoMemoryPoolName} eq 'reserved' &&
$self->get_snmp_object('MIB-II', 'sysDescr', 0) =~ /IOS.*XR/i) {
# ASR9K "reserved" and "image" are always at 100%
$self->force_thresholds(
metric => $self->{ciscoMemoryPoolName}.'_usage',
warning => 100,
critical => 100,
);
} elsif ($self->{ciscoMemoryPoolName} eq 'image' &&
$self->get_snmp_object('MIB-II', 'sysDescr', 0) =~ /IOS.*XR/i) {
$self->force_thresholds(
metric => $self->{ciscoMemoryPoolName}.'_usage',
warning => 100,
critical => 100,
);
} else {
$self->set_thresholds(
metric => $self->{ciscoMemoryPoolName}.'_usage',
warning => 80,
critical => 90,
);
}
$self->add_message($self->check_thresholds(
metric => $self->{ciscoMemoryPoolName}.'_usage',
value => $self->{usage},
));
$self->add_perfdata(
label => $self->{ciscoMemoryPoolName}.'_usage',
value => $self->{usage},
uom => '%',
);
}

View file

@ -0,0 +1,72 @@
package Classes::Cisco::IOS::Component::NatSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::interfaces::nat::sessions::count/) {
$self->get_snmp_objects('CISCO-IETF-NAT-MIB', qw(
cnatAddrBindNumberOfEntries cnatAddrPortBindNumberOfEntries
));
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
$self->get_snmp_tables('CISCO-IETF-NAT-MIB', [
['protocolstats', 'cnatProtocolStatsTable', 'Classes::Cisco::IOS::Component::NatSubsystem::CnatProtocolStats'],
]);
}
}
sub check {
my $self = shift;
if ($self->mode =~ /device::interfaces::nat::sessions::count/) {
$self->add_info(sprintf '%d bind entries (%d addr, %d port)',
$self->{cnatAddrBindNumberOfEntries} + $self->{cnatAddrPortBindNumberOfEntries},
$self->{cnatAddrBindNumberOfEntries},
$self->{cnatAddrPortBindNumberOfEntries}
);
$self->add_ok();
$self->add_perfdata(
label => 'nat_bindings',
value => $self->{cnatAddrBindNumberOfEntries} + $self->{cnatAddrPortBindNumberOfEntries},
);
$self->add_perfdata(
label => 'nat_addr_bindings',
value => $self->{cnatAddrBindNumberOfEntries},
);
$self->add_perfdata(
label => 'nat_port_bindings',
value => $self->{cnatAddrPortBindNumberOfEntries},
);
} elsif ($self->mode =~ /device::interfaces::nat::rejects/) {
foreach (@{$self->{protocolstats}}) {
$_->check();
}
}
}
package Classes::Cisco::IOS::Component::NatSubsystem::CnatProtocolStats;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
$self->{cnatProtocolStatsName} = $self->{flat_indices};
$self->make_symbolic('CISCO-IETF-NAT-MIB', 'cnatProtocolStatsName', $self->{cnatProtocolStatsName});
$self->valdiff({name => $self->{cnatProtocolStatsName}},
qw(cnatProtocolStatsInTranslate cnatProtocolStatsOutTranslate cnatProtocolStatsRejectCount));
$self->{delta_cnatProtocolStatsTranslate} =
$self->{delta_cnatProtocolStatsInTranslate} +
$self->{delta_cnatProtocolStatsOutTranslate};
$self->{rejects} = $self->{delta_cnatProtocolStatsTranslate} ?
(100 * $self->{delta_cnatProtocolStatsRejectCount} /
$self->{delta_cnatProtocolStatsTranslate}) : 0;
$self->protect_value($self->{rejects}, 'rejects', 'percent');
}
sub check {
my $self = shift;
$self->add_info(sprintf '%.2f%% of all %s packets have been dropped/rejected',
$self->{rejects}, $self->{cnatProtocolStatsName});
$self->set_thresholds(warning => 30, critical => 50);
$self->add_message($self->check_thresholds($self->{rejects}));
}

View file

@ -0,0 +1,63 @@
package Classes::Cisco::NXOS;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::NXOS::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::cisco::fex::watch/) {
$self->analyze_fex_subsystem();
$self->check_fex_subsystem();
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::NXOS::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::Cisco::NXOS::Component::MemSubsystem");
} elsif ($self->mode =~ /device::hsrp/) {
$self->analyze_and_check_hsrp_subsystem("Classes::HSRP::Component::HSRPSubsystem");
} else {
$self->no_such_mode();
}
}
sub analyze_fex_subsystem {
my $self = shift;
$self->{components}->{fex_subsystem} = Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem->new();
@{$self->{fexes}} = grep {
$_->{entPhysicalName} =~ /^fex.*chassis$/i;
} map {
$_->{entPhysicalName} ||= $_->{entPhysicalDescr}; $_;
} grep {
$_->{entPhysicalClass} eq "chassis"
} @{$self->{components}->{fex_subsystem}->{entities}};
}
sub check_fex_subsystem {
my $self = shift;
$self->add_info('counting fexes');
$self->{numOfFexes} = scalar (@{$self->{fexes}});
$self->{fexNameList} = [map { $_->{entPhysicalName} } @{$self->{fexes}}];
if (scalar (@{$self->{fexes}}) == 0) {
$self->add_unknown('no FEXes found');
} else {
$self->opts->override_opt('lookback', 1800) if ! $self->opts->lookback;
$self->valdiff({name => $self->{name}, lastarray => 1},
qw(fexNameList numOfFexes));
if (scalar(@{$self->{delta_found_fexNameList}}) > 0) {
$self->add_warning(sprintf '%d new FEX(es) (%s)',
scalar(@{$self->{delta_found_fexNameList}}),
join(", ", @{$self->{delta_found_fexNameList}}));
}
if (scalar(@{$self->{delta_lost_fexNameList}}) > 0) {
$self->add_critical(sprintf '%d FEXes missing (%s)',
scalar(@{$self->{delta_lost_fexNameList}}),
join(", ", @{$self->{delta_lost_fexNameList}}));
}
$self->add_ok(sprintf 'found %d FEXes', scalar (@{$self->{fexes}}));
$self->add_perfdata(
label => 'num_fexes',
value => $self->{numOfFexes},
);
}
}

View file

@ -0,0 +1,79 @@
package Classes::Cisco::NXOS::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $type = 0;
foreach ($self->get_snmp_table_objects(
'CISCO-PROCESS-MIB', 'cpmCPUTotalTable')) {
$_->{cpmCPUTotalIndex} ||= $type++;
push(@{$self->{cpus}},
Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu->new(%{$_}));
}
if (scalar(@{$self->{cpus}}) == 0) {
# maybe too old. i fake a cpu. be careful. this is a really bad hack
my $response = $self->get_request(
-varbindlist => [
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1},
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5},
$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{busyPer},
]
);
if (exists $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}}) {
push(@{$self->{cpus}},
Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu->new(
cpmCPUTotalPhysicalIndex => 0, #fake
cpmCPUTotalIndex => 0, #fake
cpmCPUTotal5sec => 0, #fake
cpmCPUTotal5secRev => 0, #fake
cpmCPUTotal1min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
cpmCPUTotal1minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy1}},
cpmCPUTotal5min => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
cpmCPUTotal5minRev => $response->{$Classes::Device::mibs_and_oids->{'OLD-CISCO-CPU-MIB'}->{avgBusy5}},
cpmCPUMonInterval => 0, #fake
cpmCPUTotalMonIntervalValue => 0, #fake
cpmCPUInterruptMonIntervalValue => 0, #fake
));
}
}
}
package Classes::Cisco::NXOS::Component::CpuSubsystem::Cpu;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub new {
my $class = shift;
my %params = @_;
my $self = {};
foreach (keys %params) {
$self->{$_} = $params{$_};
}
bless $self, $class;
$self->{usage} = $params{cpmCPUTotal5minRev};
if ($self->{cpmCPUTotalPhysicalIndex}) {
my $entPhysicalName = '1.3.6.1.2.1.47.1.1.1.1.7';
$self->{entPhysicalName} = $self->get_request(
-varbindlist => [$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}]
);
$self->{entPhysicalName} = $self->{entPhysicalName}->{$entPhysicalName.'.'.$self->{cpmCPUTotalPhysicalIndex}};
} else {
$self->{entPhysicalName} = $self->{cpmCPUTotalIndex};
}
return $self;
}
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu %s usage (5 min avg.) is %.2f%%',
$self->{entPhysicalName}, $self->{usage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{usage}));
$self->add_perfdata(
label => 'cpu_'.$self->{entPhysicalName}.'_usage',
value => $self->{usage},
uom => '%',
);
}

View file

@ -0,0 +1,33 @@
package Classes::Cisco::NXOS::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->{sensor_subsystem} =
Classes::Cisco::CISCOENTITYSENSORMIB::Component::SensorSubsystem->new();
if ($self->implements_mib('CISCO-ENTITY-FRU-CONTROL-MIB')) {
$self->{fru_subsystem} = Classes::Cisco::CISCOENTITYFRUCONTROLMIB::Component::EnvironmentalSubsystem->new();
}
}
sub check {
my $self = shift;
$self->{sensor_subsystem}->check();
if (exists $self->{fru_subsystem}) {
$self->{fru_subsystem}->check();
}
if (! $self->check_messages()) {
$self->clear_ok();
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
$self->{sensor_subsystem}->dump();
if (exists $self->{fru_subsystem}) {
$self->{fru_subsystem}->dump();
}
}

View file

@ -0,0 +1,29 @@
package Classes::Cisco::NXOS::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('CISCO-SYSTEM-EXT-MIB', (qw(
cseSysMemoryUtilization)));
}
sub check {
my $self = shift;
$self->add_info('checking memory');
if (defined $self->{cseSysMemoryUtilization}) {
$self->add_info(sprintf 'memory usage is %.2f%%',
$self->{cseSysMemoryUtilization});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{cseSysMemoryUtilization}));
$self->add_perfdata(
label => 'memory_usage',
value => $self->{cseSysMemoryUtilization},
uom => '%',
);
} else {
$self->add_unknown('cannot aquire memory usage');
}
}

View file

@ -0,0 +1,17 @@
package Classes::Cisco::PrimeNCS;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::HOSTRESOURCESMIB::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::HOSTRESOURCESMIB::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::HOSTRESOURCESMIB::Component::MemSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,21 @@
package Classes::Cisco::UCOS;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::HOSTRESOURCESMIB::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::HOSTRESOURCESMIB::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::HOSTRESOURCESMIB::Component::MemSubsystem");
} elsif ($self->mode =~ /device::phone::cm/) {
$self->analyze_and_check_cm_subsystem("Classes::Cisco::CCM::Component::CmSubsystem");
} elsif ($self->mode =~ /device::phone/) {
$self->analyze_and_check_phone_subsystem("Classes::Cisco::CCM::Component::PhoneSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,19 @@
package Classes::Cisco::WLC;
our @ISA = qw(Classes::Cisco);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::Cisco::WLC::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::Cisco::WLC::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::Cisco::WLC::Component::MemSubsystem");
} elsif ($self->mode =~ /device::wlan/) {
$self->analyze_and_check_wlan_subsystem("Classes::Cisco::WLC::Component::WlanSubsystem");
} else {
$self->no_such_mode();
}
}

View file

@ -0,0 +1,24 @@
package Classes::Cisco::WLC::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $type = 0;
$self->get_snmp_objects('AIRESPACE-SWITCHING-MIB', (qw(
agentCurrentCPUUtilization)));
}
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu usage is %.2f%%',
$self->{agentCurrentCPUUtilization});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{agentCurrentCPUUtilization}));
$self->add_perfdata(
label => 'cpu_usage',
value => $self->{agentCurrentCPUUtilization},
uom => '%',
);
}

View file

@ -0,0 +1,81 @@
package Classes::Cisco::WLC::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->{ps1_present} = $self->get_snmp_object(
'AIRESPACE-SWITCHING-MIB', 'agentSwitchInfoPowerSupply1Present', 0);
$self->{ps1_operational} = $self->get_snmp_object(
'AIRESPACE-SWITCHING-MIB', 'agentSwitchInfoPowerSupply1Operational', 0);
$self->{ps2_present} = $self->get_snmp_object(
'AIRESPACE-SWITCHING-MIB', 'agentSwitchInfoPowerSupply2Present', 0);
$self->{ps2_operational} = $self->get_snmp_object(
'AIRESPACE-SWITCHING-MIB', 'agentSwitchInfoPowerSupply2Operational', 0);
$self->{temp_environment} = $self->get_snmp_object(
'AIRESPACE-WIRELESS-MIB', 'bsnOperatingTemperatureEnvironment', 0);
$self->{temp_value} = $self->get_snmp_object(
'AIRESPACE-WIRELESS-MIB', 'bsnSensorTemperature', 0);
$self->{temp_alarm_low} = $self->get_snmp_object(
'AIRESPACE-WIRELESS-MIB', 'bsnTemperatureAlarmLowLimit', 0);
$self->{temp_alarm_high} = $self->get_snmp_object(
'AIRESPACE-WIRELESS-MIB', 'bsnTemperatureAlarmHighLimit', 0);
}
sub check {
my $self = shift;
#$self->blacklist('t', $self->{cpmCPUTotalPhysicalIndex});
my $tinfo = sprintf 'temperature is %.2fC (%s env %s-%s)',
$self->{temp_value}, $self->{temp_environment},
$self->{temp_alarm_low}, $self->{temp_alarm_high};
$self->set_thresholds(
warning => $self->{temp_alarm_low}.':'.$self->{temp_alarm_high},
critical => $self->{temp_alarm_low}.':'.$self->{temp_alarm_high});
$self->add_message($self->check_thresholds($self->{temp_value}), $tinfo);
$self->add_perfdata(
label => 'temperature',
value => $self->{temp_value},
);
if ($self->{ps1_present} eq "true") {
if ($self->{ps1_operational} ne "true") {
$self->add_warning("Powersupply 1 is not operational");
}
}
if ($self->{ps2_present} eq "true") {
if ($self->{ps2_operational} ne "true") {
$self->add_warning("Powersupply 2 is not operational");
}
}
my $p1info = sprintf "PS1 is %spresent and %soperational",
$self->{ps1_present} eq "true" ? "" : "not ",
$self->{ps1_operational} eq "true" ? "" : "not ";
my $p2info = sprintf "PS2 is %spresent and %soperational",
$self->{ps2_present} eq "true" ? "" : "not ",
$self->{ps2_operational} eq "true" ? "" : "not ";
$self->add_info($tinfo.", ".$p1info.", ".$p2info);
}
sub dump {
my $self = shift;
printf "[TEMPERATURE]\n";
foreach (qw(temp_environment temp_value temp_alarm_low temp_alarm_high)) {
if (exists $self->{$_}) {
printf "%s: %s\n", $_, $self->{$_};
}
}
printf "[PS1]\n";
foreach (qw(ps1_present ps1_operational)) {
if (exists $self->{$_}) {
printf "%s: %s\n", $_, $self->{$_};
}
}
printf "[PS2]\n";
foreach (qw(ps2_present ps2_operational)) {
if (exists $self->{$_}) {
printf "%s: %s\n", $_, $self->{$_};
}
}
printf "info: %s\n", $self->{info};
printf "\n";
}

View file

@ -0,0 +1,28 @@
package Classes::Cisco::IOS::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['fans', 'ciscoEnvMonFanStatusTable', 'Classes::Cisco::IOS::Component::FanSubsystem::Fan'],
]);
}
package Classes::Cisco::IOS::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->{ciscoEnvMonFanStatusIndex} ||= 0;
$self->add_info(sprintf 'fan %d (%s) is %s',
$self->{ciscoEnvMonFanStatusIndex},
$self->{ciscoEnvMonFanStatusDescr},
$self->{ciscoEnvMonFanState});
if ($self->{ciscoEnvMonFanState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonFanState} ne 'normal') {
$self->add_critical();
}
}

View file

@ -0,0 +1,25 @@
package Classes::Cisco::WLC::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('AIRESPACE-SWITCHING-MIB', (qw(
agentTotalMemory agentFreeMemory)));
$self->{memory_usage} = $self->{agentFreeMemory} ?
( ($self->{agentTotalMemory} - $self->{agentFreeMemory}) / $self->{agentTotalMemory} * 100) : 100;
}
sub check {
my $self = shift;
$self->add_info(sprintf 'memory usage is %.2f%%',
$self->{memory_usage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{memory_usage}));
$self->add_perfdata(
label => 'memory_usage',
value => $self->{memory_usage},
uom => '%',
);
}

View file

@ -0,0 +1,28 @@
package Classes::Cisco::IOS::Component::PowersupplySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['supplies', 'ciscoEnvMonSupplyStatusTable', 'Classes::Cisco::IOS::Component::PowersupplySubsystem::Powersupply'],
]);
}
package Classes::Cisco::IOS::Component::PowersupplySubsystem::Powersupply;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->{ciscoEnvMonSupplyStatusIndex} ||= 0;
$self->add_info(sprintf 'powersupply %d (%s) is %s',
$self->{ciscoEnvMonSupplyStatusIndex},
$self->{ciscoEnvMonSupplyStatusDescr},
$self->{ciscoEnvMonSupplyState});
if ($self->{ciscoEnvMonSupplyState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonSupplyState} ne 'normal') {
$self->add_critical();
}
}

View file

@ -0,0 +1,100 @@
package Classes::Cisco::IOS::Component::TemperatureSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $tempcnt = 0;
foreach ($self->get_snmp_table_objects(
'CISCO-ENVMON-MIB', 'ciscoEnvMonTemperatureStatusTable')) {
$_->{ciscoEnvMonTemperatureStatusIndex} = $tempcnt++ if (! exists $_->{ciscoEnvMonTemperatureStatusIndex});
push(@{$self->{temperatures}},
Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature->new(%{$_}));
}
}
package Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub new {
my $class = shift;
my %params = @_;
my $self = {};
foreach (keys %params) {
$self->{$_} = $params{$_};
}
$self->{ciscoEnvMonTemperatureStatusIndex} ||= 0;
$self->{ciscoEnvMonTemperatureLastShutdown} ||= 0;
if ($self->{ciscoEnvMonTemperatureStatusValue}) {
bless $self, $class;
} else {
bless $self, $class.'::Simple';
}
return $self;
}
sub check {
my $self = shift;
if ($self->{ciscoEnvMonTemperatureStatusValue} >
$self->{ciscoEnvMonTemperatureThreshold}) {
$self->add_info(sprintf 'temperature %d %s is too high (%d of %d max = %s)',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureStatusValue},
$self->{ciscoEnvMonTemperatureThreshold},
$self->{ciscoEnvMonTemperatureState});
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
$self->add_warning();
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
$self->add_critical();
}
} else {
$self->add_info(sprintf 'temperature %d %s is %d (of %d max = normal)',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureStatusValue},
$self->{ciscoEnvMonTemperatureThreshold},
$self->{ciscoEnvMonTemperatureState});
}
$self->add_perfdata(
label => sprintf('temp_%s', $self->{ciscoEnvMonTemperatureStatusIndex}),
value => $self->{ciscoEnvMonTemperatureStatusValue},
warning => $self->{ciscoEnvMonTemperatureThreshold},
critical => undef,
);
}
package Classes::Cisco::IOS::Component::TemperatureSubsystem::Temperature::Simple;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub new {
my $class = shift;
my %params = @_;
my $self = {
ciscoEnvMonTemperatureStatusIndex => $params{ciscoEnvMonTemperatureStatusIndex} || 0,
ciscoEnvMonTemperatureStatusDescr => $params{ciscoEnvMonTemperatureStatusDescr},
ciscoEnvMonTemperatureState => $params{ciscoEnvMonTemperatureState},
};
bless $self, $class;
return $self;
}
sub check {
my $self = shift;
$self->add_info(sprintf 'temperature %d %s is %s',
$self->{ciscoEnvMonTemperatureStatusIndex},
$self->{ciscoEnvMonTemperatureStatusDescr},
$self->{ciscoEnvMonTemperatureState});
if ($self->{ciscoEnvMonTemperatureState} ne 'normal') {
if ($self->{ciscoEnvMonTemperatureState} eq 'warning') {
$self->add_warning();
} elsif ($self->{ciscoEnvMonTemperatureState} eq 'critical') {
$self->add_critical();
}
} else {
}
}

View file

@ -0,0 +1,37 @@
package Classes::Cisco::IOS::Component::VoltageSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
my $index = 0;
$self->get_snmp_tables('CISCO-ENVMON-MIB', [
['voltages', 'ciscoEnvMonVoltageStatusTable', 'Classes::Cisco::IOS::Component::VoltageSubsystem::Voltage'],
]);
foreach (@{$self->{voltages}}) {
$_->{ciscoEnvMonVoltageStatusIndex} ||= $index++;
}
}
package Classes::Cisco::IOS::Component::VoltageSubsystem::Voltage;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'voltage %d (%s) is %s',
$self->{ciscoEnvMonVoltageStatusIndex},
$self->{ciscoEnvMonVoltageStatusDescr},
$self->{ciscoEnvMonVoltageState});
if ($self->{ciscoEnvMonVoltageState} eq 'notPresent') {
} elsif ($self->{ciscoEnvMonVoltageState} ne 'normal') {
$self->add_critical();
}
$self->add_perfdata(
label => sprintf('mvolt_%s', $self->{ciscoEnvMonVoltageStatusIndex}),
value => $self->{ciscoEnvMonVoltageStatusValue},
warning => $self->{ciscoEnvMonVoltageThresholdLow},
critical => $self->{ciscoEnvMonVoltageThresholdHigh},
);
}

View file

@ -0,0 +1,139 @@
package Classes::Cisco::WLC::Component::WlanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->{name} = $self->get_snmp_object('MIB-II', 'sysName', 0);
$self->get_snmp_tables('AIRESPACE-WIRELESS-MIB', [
['aps', 'bsnAPTable', 'Classes::Cisco::WLC::Component::WlanSubsystem::AP', sub { return $self->filter_name(shift->{bsnAPName}) } ],
['ifs', 'bsnAPIfTable', 'Classes::Cisco::WLC::Component::WlanSubsystem::AP' ],
['ifloads', 'bsnAPIfLoadParametersTable', 'Classes::Cisco::WLC::Component::WlanSubsystem::IFLoad' ],
]);
$self->assign_loads_to_ifs();
$self->assign_ifs_to_aps();
}
sub check {
my $self = shift;
$self->add_info('checking access points');
$self->{numOfAPs} = scalar (@{$self->{aps}});
$self->{apNameList} = [map { $_->{bsnAPName} } @{$self->{aps}}];
if (scalar (@{$self->{aps}}) == 0) {
$self->add_unknown('no access points found');
} else {
foreach (@{$self->{aps}}) {
$_->check();
}
if ($self->mode =~ /device::wlan::aps::watch/) {
$self->opts->override_opt('lookback', 1800) if ! $self->opts->lookback;
$self->valdiff({name => $self->{name}, lastarray => 1},
qw(apNameList numOfAPs));
if (scalar(@{$self->{delta_found_apNameList}}) > 0) {
#if (scalar(@{$self->{delta_found_apNameList}}) > 0 &&
# $self->{delta_timestamp} > $self->opts->lookback) {
$self->add_warning(sprintf '%d new access points (%s)',
scalar(@{$self->{delta_found_apNameList}}),
join(", ", @{$self->{delta_found_apNameList}}));
}
if (scalar(@{$self->{delta_lost_apNameList}}) > 0) {
$self->add_critical(sprintf '%d access points missing (%s)',
scalar(@{$self->{delta_lost_apNameList}}),
join(", ", @{$self->{delta_lost_apNameList}}));
}
$self->add_ok(sprintf 'found %d access points', scalar (@{$self->{aps}}));
$self->add_perfdata(
label => 'num_aps',
value => scalar (@{$self->{aps}}),
);
} elsif ($self->mode =~ /device::wlan::aps::count/) {
$self->set_thresholds(warning => '10:', critical => '5:');
$self->add_message($self->check_thresholds(
scalar (@{$self->{aps}})),
sprintf 'found %d access points', scalar (@{$self->{aps}}));
$self->add_perfdata(
label => 'num_aps',
value => scalar (@{$self->{aps}}),
);
} elsif ($self->mode =~ /device::wlan::aps::status/) {
if ($self->opts->report eq "short") {
$self->clear_ok();
$self->add_ok('no problems') if ! $self->check_messages();
}
} elsif ($self->mode =~ /device::wlan::aps::list/) {
foreach (@{$self->{aps}}) {
printf "%s\n", $_->{bsnAPName};
}
}
}
}
sub assign_ifs_to_aps {
my $self = shift;
foreach my $ap (@{$self->{aps}}) {
$ap->{interfaces} = [];
foreach my $if (@{$self->{ifs}}) {
if ($if->{flat_indices} eq $ap->{bsnAPDot3MacAddress}.".".$if->{bsnAPIfSlotId}) {
push(@{$ap->{interfaces}}, $if);
}
}
$ap->{NumOfClients} = 0;
map {$ap->{NumOfClients} += $_->{bsnAPIfLoadNumOfClients} }
@{$ap->{interfaces}};
}
}
sub assign_loads_to_ifs {
my $self = shift;
foreach my $if (@{$self->{ifs}}) {
foreach my $load (@{$self->{ifloads}}) {
if ($load->{flat_indices} eq $if->{flat_indices}) {
map { $if->{$_} = $load->{$_} } grep { $_ !~ /indices/ } keys %{$load};
}
}
}
}
package Classes::Cisco::WLC::Component::WlanSubsystem::IF;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
package Classes::Cisco::WLC::Component::WlanSubsystem::IFLoad;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
package Classes::Cisco::WLC::Component::WlanSubsystem::AP;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub finish {
my $self = shift;
if ($self->{bsnAPDot3MacAddress} && $self->{bsnAPDot3MacAddress} =~ /0x(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})/) {
$self->{bsnAPDot3MacAddress} = join(".", map { hex($_) } ($1, $2, $3, $4, $5, $6));
} elsif ($self->{bsnAPDot3MacAddress} && unpack("H12", $self->{bsnAPDot3MacAddress}) =~ /(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})/) {
$self->{bsnAPDot3MacAddress} = join(".", map { hex($_) } ($1, $2, $3, $4, $5, $6));
}
}
sub check {
my $self = shift;
$self->add_info(sprintf 'access point %s is %s (%d interfaces with %d clients)',
$self->{bsnAPName}, $self->{bsnAPOperationStatus},
scalar(@{$self->{interfaces}}), $self->{NumOfClients});
if ($self->mode =~ /device::wlan::aps::status/) {
if ($self->{bsnAPOperationStatus} eq 'disassociating') {
$self->add_critical();
} elsif ($self->{bsnAPOperationStatus} eq 'downloading') {
# das verschwindet hoffentlich noch vor dem HARD-state
$self->add_warning();
} elsif ($self->{bsnAPOperationStatus} eq 'associated') {
$self->add_ok();
} else {
$self->add_unknown();
}
}
}

View file

@ -0,0 +1,172 @@
package Classes::Device;
our @ISA = qw(GLPlugin::SNMP GLPlugin::UPNP);
use strict;
sub classify {
my $self = shift;
if (! ($self->opts->hostname || $self->opts->snmpwalk)) {
$self->add_unknown('either specify a hostname or a snmpwalk file');
} else {
if ($self->opts->servertype && $self->opts->servertype eq 'linuxlocal') {
} elsif ($self->opts->port && $self->opts->port == 49000) {
$self->{productname} = 'upnp';
$self->check_upnp_and_model();
} else {
$self->check_snmp_and_model();
}
if ($self->opts->servertype) {
$self->{productname} = $self->opts->servertype;
$self->{productname} = 'cisco' if $self->opts->servertype eq 'cisco';
$self->{productname} = 'huawei' if $self->opts->servertype eq 'huawei';
$self->{productname} = 'hp' if $self->opts->servertype eq 'hp';
$self->{productname} = 'brocade' if $self->opts->servertype eq 'brocade';
$self->{productname} = 'netscreen' if $self->opts->servertype eq 'netscreen';
$self->{productname} = 'linuxlocal' if $self->opts->servertype eq 'linuxlocal';
$self->{productname} = 'procurve' if $self->opts->servertype eq 'procurve';
$self->{productname} = 'bluecoat' if $self->opts->servertype eq 'bluecoat';
$self->{productname} = 'checkpoint' if $self->opts->servertype eq 'checkpoint';
$self->{productname} = 'ifmib' if $self->opts->servertype eq 'ifmib';
}
if (! $self->check_messages()) {
if ($self->opts->verbose && $self->opts->verbose) {
printf "I am a %s\n", $self->{productname};
}
if ($self->opts->mode =~ /^my-/) {
$self->load_my_extension();
} elsif ($self->{productname} =~ /upnp/i) {
bless $self, 'Classes::UPNP';
$self->debug('using Classes::UPNP');
} elsif ($self->{productname} =~ /FRITZ/i) {
bless $self, 'Classes::UPNP::AVM';
$self->debug('using Classes::UPNP::AVM');
} elsif ($self->{productname} =~ /linuxlocal/i) {
bless $self, 'Server::Linux';
$self->debug('using Server::Linux');
} elsif ($self->{productname} =~ /Cisco/i) {
bless $self, 'Classes::Cisco';
$self->debug('using Classes::Cisco');
} elsif ($self->{productname} =~ /fujitsu intelligent blade panel 30\/12/i) {
bless $self, 'Classes::Cisco';
$self->debug('using Classes::Cisco');
} elsif ($self->{productname} =~ /UCOS /i) {
bless $self, 'Classes::Cisco';
$self->debug('using Classes::Cisco');
} elsif ($self->{productname} =~ /Nortel/i) {
bless $self, 'Classes::Nortel';
$self->debug('using Classes::Nortel');
} elsif ($self->{productname} =~ /AT-GS/i) {
bless $self, 'Classes::AlliedTelesyn';
$self->debug('using Classes::AlliedTelesyn');
} elsif ($self->{productname} =~ /AT-\d+GB/i) {
bless $self, 'Classes::AlliedTelesyn';
$self->debug('using Classes::AlliedTelesyn');
} elsif ($self->{productname} =~ /Allied Telesyn Ethernet Switch/i) {
bless $self, 'Classes::AlliedTelesyn';
$self->debug('using Classes::AlliedTelesyn');
} elsif ($self->{productname} =~ /DS_4100/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /Connectrix DS_4900B/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /EMC\s*DS.*4700M/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /EMC\s*DS-24M2/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /Brocade/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /Fibre Channel Switch/i) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{productname} =~ /Juniper.*MAG\-\d+/i) {
# Juniper Networks,Inc,MAG-4610,7.2R10
bless $self, 'Classes::Juniper';
$self->debug('using Classes::Juniper');
} elsif ($self->{productname} =~ /Juniper.*MAG\-SM\d+/i) {
# Juniper Networks,Inc,MAG-SMx60,7.4R8
bless $self, 'Classes::Juniper::IVE';
$self->debug('using Classes::Juniper::IVE');
} elsif ($self->{productname} =~ /NetScreen/i) {
bless $self, 'Classes::Juniper';
$self->debug('using Classes::Juniper');
} elsif ($self->{productname} =~ /^(GS|FS)/i) {
bless $self, 'Classes::Juniper';
$self->debug('using Classes::Juniper');
} elsif ($self->implements_mib('NETSCREEN-PRODUCTS-MIB')) {
$self->debug('using Classes::Juniper::NetScreen');
bless $self, 'Classes::Juniper::NetScreen';
} elsif ($self->{productname} =~ /SecureOS/i) {
bless $self, 'Classes::SecureOS';
$self->debug('using Classes::SecureOS');
} elsif ($self->{productname} =~ /Linux.*((el6.f5.x86_64)|(el5.1.0.f5app)) .*/i) {
bless $self, 'Classes::F5';
$self->debug('using Classes::F5');
} elsif ($self->{productname} =~ /Procurve/i) {
bless $self, 'Classes::HP';
$self->debug('using Classes::HP');
} elsif ($self->{productname} =~ /(cpx86_64)|(Check\s*Point)|(Linux.*\dcp )/i) {
bless $self, 'Classes::CheckPoint';
$self->debug('using Classes::CheckPoint');
} elsif ($self->{productname} =~ /Blue\s*Coat/i) {
bless $self, 'Classes::Bluecoat';
$self->debug('using Classes::Bluecoat');
} elsif ($self->{productname} =~ /Foundry/i) {
bless $self, 'Classes::Foundry';
$self->debug('using Classes::Foundry');
} elsif ($self->{productname} =~ /IronWare/i) {
# although there can be a
# Brocade Communications Systems, Inc. FWS648, IronWare Version 07.1....
bless $self, 'Classes::Foundry';
$self->debug('using Classes::Foundry');
} elsif ($self->{productname} =~ /Linux Stingray/i) {
bless $self, 'Classes::HOSTRESOURCESMIB';
$self->debug('using Classes::HOSTRESOURCESMIB');
} elsif ($self->{productname} =~ /Fortinet|Fortigate/i) {
bless $self, 'Classes::Fortigate';
$self->debug('using Classes::Fortigate');
} elsif ($self->{productname} eq "ifmib") {
bless $self, 'Classes::Generic';
$self->debug('using Classes::Generic');
} elsif ($self->implements_mib('SW-MIB')) {
bless $self, 'Classes::Brocade';
$self->debug('using Classes::Brocade');
} elsif ($self->{sysobjectid} =~ /1\.3\.6\.1\.4\.1\.9\./) {
bless $self, 'Classes::Cisco';
$self->debug('using Classes::Cisco');
} else {
if (my $class = $self->discover_suitable_class()) {
bless $self, $class;
$self->debug('using '.$class);
} else {
bless $self, 'Classes::Generic';
$self->debug('using Classes::Generic');
}
}
}
}
return $self;
}
package Classes::Generic;
our @ISA = qw(Classes::Device);
use strict;
sub init {
my $self = shift;
if ($self->mode =~ /device::interfaces::aggregation::availability/) {
$self->analyze_and_check_aggregation_subsystem("Classes::IFMIB::Component::LinkAggregation");
} elsif ($self->mode =~ /device::interfaces/) {
$self->analyze_and_check_interface_subsystem("Classes::IFMIB::Component::InterfaceSubsystem");
} elsif ($self->mode =~ /device::bgp/) {
$self->analyze_and_check_bgp_subsystem("Classes::BGP::Component::PeerSubsystem");
} else {
bless $self, 'GLPlugin::SNMP';
$self->no_such_mode();
}
}

View file

@ -0,0 +1,24 @@
package Classes::F5;
our @ISA = qw(Classes::Device);
use strict;
use constant trees => (
'1.3.6.1.4.1.3375.1.2.1.1.1', # F5-3DNS-MIB
'1.3.6.1.4.1.3375', # F5-BIGIP-COMMON-MIB
'1.3.6.1.4.1.3375.2.2', # F5-BIGIP-LOCAL-MIB
'1.3.6.1.4.1.3375.2.1', # F5-BIGIP-SYSTEM-MIB
'1.3.6.1.4.1.3375.1.1.1.1', # LOAD-BAL-SYSTEM-MIB
'1.3.6.1.4.1.2021', # UCD-SNMP-MIB
);
sub init {
my $self = shift;
if ($self->{productname} =~ /Linux.*((el6.f5.x86_64)|(el5.1.0.f5app)) .*/i) {
bless $self, 'Classes::F5::F5BIGIP';
$self->debug('using Classes::F5::F5BIGIP');
}
if (ref($self) ne "Classes::F5") {
$self->init();
}
}

View file

@ -0,0 +1,31 @@
package Classes::F5::F5BIGIP;
our @ISA = qw(Classes::F5);
use strict;
sub init {
my $self = shift;
# gets 11.* and 9.*
$self->{productversion} = $self->get_snmp_object('F5-BIGIP-SYSTEM-MIB', 'sysProductVersion');
if (! defined $self->{productversion} ||
$self->{productversion} !~ /^((9)|(10)|(11))/) {
$self->{productversion} = "4";
}
if ($self->mode =~ /device::hardware::health/) {
$self->analyze_and_check_environmental_subsystem("Classes::F5::F5BIGIP::Component::EnvironmentalSubsystem");
} elsif ($self->mode =~ /device::hardware::load/) {
$self->analyze_and_check_cpu_subsystem("Classes::F5::F5BIGIP::Component::CpuSubsystem");
} elsif ($self->mode =~ /device::hardware::memory/) {
$self->analyze_and_check_mem_subsystem("Classes::F5::F5BIGIP::Component::MemSubsystem");
} elsif ($self->mode =~ /device::lb/) {
$self->analyze_and_check_ltm_subsystem();
} else {
$self->no_such_mode();
}
}
sub analyze_ltm_subsystem {
my $self = shift;
$self->{components}->{ltm_subsystem} =
Classes::F5::F5BIGIP::Component::LTMSubsystem->new('productversion' => $self->{productversion});
}

View file

@ -0,0 +1,77 @@
package Classes::F5::F5BIGIP::Component::CpuSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
if ($self->mode =~ /load/) {
$self->overall_init();
} else {
$self->init();
}
return $self;
}
sub overall_init {
my $self = shift;
$self->get_snmp_objects('F5-BIGIP-SYSTEM-MIB', (qw(
sysStatTmTotalCycles sysStatTmIdleCycles sysStatTmSleepCycles)));
$self->valdiff({name => 'cpu'}, qw(sysStatTmTotalCycles sysStatTmIdleCycles sysStatTmSleepCycles ));
my $delta_used_cycles = $self->{delta_sysStatTmTotalCycles} -
($self->{delta_sysStatTmIdleCycles} + $self->{delta_sysStatTmSleepCycles});
$self->{cpu_usage} = $self->{delta_sysStatTmTotalCycles} ?
(($delta_used_cycles / $self->{delta_sysStatTmTotalCycles}) * 100) : 0;
}
sub init {
my $self = shift;
$self->get_snmp_tables('F5-BIGIP-SYSTEM-MIB', [
['cpus', 'sysCpuTable', 'Classes::F5::F5BIGIP::Component::CpuSubsystem::Cpu'],
]);
}
sub check {
my $self = shift;
$self->add_info('checking cpus');
if ($self->mode =~ /load/) {
$self->add_info(sprintf 'tmm cpu usage is %.2f%%',
$self->{cpu_usage});
$self->set_thresholds(warning => 80, critical => 90);
$self->add_message($self->check_thresholds($self->{cpu_usage}));
$self->add_perfdata(
label => 'cpu_tmm_usage',
value => $self->{cpu_usage},
uom => '%',
);
return;
}
foreach (@{$self->{cpus}}) {
$_->check();
}
}
package Classes::F5::F5BIGIP::Component::CpuSubsystem::Cpu;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'cpu %d has %dC (%drpm)',
$self->{sysCpuIndex},
$self->{sysCpuTemperature},
$self->{sysCpuFanSpeed});
$self->add_perfdata(
label => sprintf('temp_c%s', $self->{sysCpuIndex}),
value => $self->{sysCpuTemperature},
thresholds => 0,
);
$self->add_perfdata(
label => sprintf('fan_c%s', $self->{sysCpuIndex}),
value => $self->{sysCpuFanSpeed},
thresholds => 0,
);
}

View file

@ -0,0 +1,43 @@
package Classes::F5::F5BIGIP::Component::EnvironmentalSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->init();
return $self;
}
sub init {
my $self = shift;
$self->{cpu_subsystem} =
Classes::F5::F5BIGIP::Component::CpuSubsystem->new();
$self->{fan_subsystem} =
Classes::F5::F5BIGIP::Component::FanSubsystem->new();
$self->{temperature_subsystem} =
Classes::F5::F5BIGIP::Component::TemperatureSubsystem->new();
$self->{powersupply_subsystem} =
Classes::F5::F5BIGIP::Component::PowersupplySubsystem->new();
}
sub check {
my $self = shift;
$self->{cpu_subsystem}->check();
$self->{fan_subsystem}->check();
$self->{temperature_subsystem}->check();
$self->{powersupply_subsystem}->check();
if (! $self->check_messages()) {
$self->add_ok("environmental hardware working fine");
}
}
sub dump {
my $self = shift;
$self->{cpu_subsystem}->dump();
$self->{fan_subsystem}->dump();
$self->{temperature_subsystem}->dump();
$self->{powersupply_subsystem}->dump();
}

View file

@ -0,0 +1,33 @@
package Classes::F5::F5BIGIP::Component::FanSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('F5-BIGIP-SYSTEM-MIB', [
['fans', 'sysChassisFanTable', 'Classes::F5::F5BIGIP::Component::FanSubsystem::Fan'],
]);
}
package Classes::F5::F5BIGIP::Component::FanSubsystem::Fan;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'chassis fan %d is %s (%drpm)',
$self->{sysChassisFanIndex},
$self->{sysChassisFanStatus},
$self->{sysChassisFanSpeed});
if ($self->{sysChassisFanStatus} eq 'notpresent') {
} else {
if ($self->{sysChassisFanStatus} ne 'good') {
$self->add_critical();
}
$self->add_perfdata(
label => sprintf('fan_%s', $self->{sysChassisFanIndex}),
value => $self->{sysChassisFanSpeed},
);
}
}

View file

@ -0,0 +1,351 @@
package Classes::F5::F5BIGIP::Component::LTMSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub new {
my $class = shift;
my %params = @_;
my $self = {};
# tables can be huge
if ($GLPlugin::SNMP::session) {
$GLPlugin::SNMP::session->max_msg_size(10 * $GLPlugin::SNMP::session->max_msg_size());
}
if ($params{productversion} =~ /^4/) {
bless $self, "Classes::F5::F5BIGIP::Component::LTMSubsystem4";
$self->debug("use Classes::F5::F5BIGIP::Component::LTMSubsystem4");
#} elsif ($params{productversion} =~ /^9/) {
} else {
bless $self, "Classes::F5::F5BIGIP::Component::LTMSubsystem9";
$self->debug("use Classes::F5::F5BIGIP::Component::LTMSubsystem9");
}
$self->init();
return $self;
}
sub check {
my $self = shift;
$self->add_info('checking ltm pools');
if (scalar(@{$self->{pools}}) == 0) {
$self->add_unknown('no pools');
return;
}
if ($self->mode =~ /pool::list/) {
foreach (sort {$a->{ltmPoolName} cmp $b->{ltmPoolName}} @{$self->{pools}}) {
printf "%s\n", $_->{ltmPoolName};
#$_->list();
}
} else {
foreach (@{$self->{pools}}) {
$_->check();
}
}
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem9;
our @ISA = qw(Classes::F5::F5BIGIP::Component::LTMSubsystem GLPlugin::SNMP::TableItem);
use strict;
sub init {
my $self = shift;
# ! merge ltmPoolStatus, ltmPoolMemberStatus, bec. ltmPoolAvailabilityState is deprecated
if ($self->mode =~ /pool::list/) {
$self->update_entry_cache(1, 'F5-BIGIP-LOCAL-MIB', 'ltmPoolStatusTable', 'ltmPoolStatusName');
$self->update_entry_cache(1, 'F5-BIGIP-LOCAL-MIB', 'ltmPoolTable', 'ltmPoolName');
$self->update_entry_cache(1, 'F5-BIGIP-LOCAL-MIB', 'ltmPoolMbrStatusTable', 'ltmPoolMbrStatusPoolName');
$self->update_entry_cache(1, 'F5-BIGIP-LOCAL-MIB', 'ltmPoolMemberTable', 'ltmPoolMemberPoolName');
$self->update_entry_cache(1, 'F5-BIGIP-LOCAL-MIB', 'ltmPoolStatTable', 'ltmPoolStatName');
}
my @auxpools = ();
foreach ($self->get_snmp_table_objects_with_cache(
'F5-BIGIP-LOCAL-MIB', 'ltmPoolStatusTable', 'ltmPoolStatusName')) {
push(@auxpools, $_);
}
my @auxstats = ();
foreach ($self->get_snmp_table_objects_with_cache(
'F5-BIGIP-LOCAL-MIB', 'ltmPoolStatTable', 'ltmPoolStatName')) {
push(@auxstats, $_);
}
foreach ($self->get_snmp_table_objects_with_cache(
'F5-BIGIP-LOCAL-MIB', 'ltmPoolTable', 'ltmPoolName')) {
if ($self->filter_name($_->{ltmPoolName})) {
foreach my $auxpool (@auxpools) {
if ($_->{ltmPoolName} eq $auxpool->{ltmPoolStatusName}) {
foreach my $key (keys %{$auxpool}) {
$_->{$key} = $auxpool->{$key};
}
}
}
foreach my $auxstat (@auxstats) {
if ($_->{ltmPoolName} eq $auxstat->{ltmPoolStatName}) {
foreach my $key (keys %{$auxstat}) {
$_->{$key} = $auxstat->{$key};
}
}
}
push(@{$self->{pools}},
Classes::F5::F5BIGIP::Component::LTMSubsystem9::LTMPool->new(%{$_}));
}
}
my @auxmembers = ();
foreach ($self->get_snmp_table_objects_with_cache(
'F5-BIGIP-LOCAL-MIB', 'ltmPoolMbrStatusTable', 'ltmPoolMbrStatusPoolName')) {
next if ! defined $_->{ltmPoolMbrStatusPoolName};
$_->{ltmPoolMbrStatusAddr} = $self->unhex_ip($_->{ltmPoolMbrStatusAddr});
push(@auxmembers, $_);
}
my @auxaddrs = ();
foreach ($self->get_snmp_table_objects(
'F5-BIGIP-LOCAL-MIB', 'ltmNodeAddrStatusTable')) {
$_->{ltmNodeAddrStatusAddr} = $self->unhex_ip($_->{ltmNodeAddrStatusAddr});
push(@auxaddrs, $_);
}
foreach ($self->get_snmp_table_objects_with_cache(
'F5-BIGIP-LOCAL-MIB', 'ltmPoolMemberTable', 'ltmPoolMemberPoolName')) {
if ($self->filter_name($_->{ltmPoolMemberPoolName})) {
$_->{ltmPoolMemberAddr} = $self->unhex_ip($_->{ltmPoolMemberAddr});
foreach my $auxmember (@auxmembers) {
if ($_->{ltmPoolMemberPoolName} eq $auxmember->{ltmPoolMbrStatusPoolName} &&
$_->{ltmPoolMemberAddrType} eq $auxmember->{ltmPoolMbrStatusAddrType} &&
$_->{ltmPoolMemberAddr} eq $auxmember->{ltmPoolMbrStatusAddr}) {
foreach my $key (keys %{$auxmember}) {
$_->{$key} = $auxmember->{$key};
}
}
}
foreach my $auxaddr (@auxaddrs) {
if ($_->{ltmPoolMemberAddrType} eq $auxaddr->{ltmNodeAddrStatusAddrType} &&
$_->{ltmPoolMemberAddr} eq $auxaddr->{ltmNodeAddrStatusAddr}) {
$_->{ltmNodeAddrStatusName} = $auxaddr->{ltmNodeAddrStatusName};
}
}
push(@{$self->{poolmembers}},
Classes::F5::F5BIGIP::Component::LTMSubsystem9::LTMPoolMember->new(%{$_}));
}
}
$self->assign_members_to_pools();
}
sub assign_members_to_pools {
my $self = shift;
foreach my $pool (@{$self->{pools}}) {
foreach my $poolmember (@{$self->{poolmembers}}) {
if ($poolmember->{ltmPoolMemberPoolName} eq $pool->{ltmPoolName}) {
$poolmember->{ltmPoolMonitorRule} = $pool->{ltmPoolMonitorRule};
push(@{$pool->{members}}, $poolmember);
}
}
if (! defined $pool->{ltmPoolMemberCnt}) {
$pool->{ltmPoolMemberCnt} = scalar(@{$pool->{members}}) ;
$self->debug("calculate ltmPoolMemberCnt");
}
$pool->{completeness} = $pool->{ltmPoolMemberCnt} ?
$pool->{ltmPoolActiveMemberCnt} / $pool->{ltmPoolMemberCnt} * 100
: 0;
}
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem9::LTMPool;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub finish {
my $self = shift;
$self->{ltmPoolMemberMonitorRule} ||= $self->{ltmPoolMonitorRule};
}
sub check {
my $self = shift;
$self->add_info(sprintf "pool %s is %s, avail state is %s, active members: %d of %d",
$self->{ltmPoolName},
$self->{ltmPoolStatusEnabledState}, $self->{ltmPoolStatusAvailState},
$self->{ltmPoolActiveMemberCnt}, $self->{ltmPoolMemberCnt});
if ($self->{ltmPoolActiveMemberCnt} == 1) {
# only one member left = no more redundancy!!
$self->set_thresholds(warning => "100:", critical => "51:");
} else {
$self->set_thresholds(warning => "51:", critical => "26:");
}
my $message = sprintf ("pool %s has %d active members (of %d) and %d sessions",
$self->{ltmPoolName},
$self->{ltmPoolActiveMemberCnt}, $self->{ltmPoolMemberCnt},
$self->{ltmPoolStatServerCurConns});
$self->add_message($self->check_thresholds($self->{completeness}), $message);
if ($self->{ltmPoolMinActiveMembers} > 0 &&
$self->{ltmPoolActiveMemberCnt} < $self->{ltmPoolMinActiveMembers}) {
$message = sprintf("pool %s has not enough active members (%d, min is %d)",
$self->{ltmPoolName}, $self->{ltmPoolActiveMemberCnt},
$self->{ltmPoolMinActiveMembers});
$self->add_message(defined $self->opts->mitigation() ? $self->opts->mitigation() : CRITICAL, $message);
}
if ($self->check_messages()) {
foreach my $member (@{$self->{members}}) {
$member->check();
}
}
$self->add_perfdata(
label => sprintf('pool_%s_completeness', $self->{ltmPoolName}),
value => $self->{completeness},
uom => '%',
);
$self->add_perfdata(
label => sprintf('pool_%s_servercurconns', $self->{ltmPoolName}),
value => $self->{ltmPoolStatServerCurConns},
warning => undef, critical => undef,
);
if ($self->opts->report eq "html") {
printf "%s - %s%s\n", $self->status_code($self->check_messages()), $message, $self->perfdata_string() ? " | ".$self->perfdata_string() : "";
$self->suppress_messages();
printf "<table style=\"border-collapse:collapse; border: 1px solid black;\">";
printf "<tr>";
foreach (qw(Name Enabled Avail Reason)) {
printf "<th style=\"text-align: left; padding-left: 4px; padding-right: 6px;\">%s</th>", $_;
}
printf "</tr>";
foreach (sort {$a->{ltmPoolMemberNodeName} cmp $b->{ltmPoolMemberNodeName}} @{$self->{members}}) {
printf "<tr>";
printf "<tr style=\"border: 1px solid black;\">";
foreach my $attr (qw(ltmPoolMemberNodeName ltmPoolMbrStatusEnabledState ltmPoolMbrStatusAvailState ltmPoolMbrStatusDetailReason)) {
if ($_->{ltmPoolMbrStatusEnabledState} eq "enabled") {
if ($_->{ltmPoolMbrStatusAvailState} eq "green") {
printf "<td style=\"text-align: left; padding-left: 4px; padding-right: 6px; background-color: #33ff00;\">%s</td>", $_->{$attr};
} else {
printf "<td style=\"text-align: left; padding-left: 4px; padding-right: 6px; background-color: #f83838;\">%s</td>", $_->{$attr};
}
} else {
printf "<td style=\"text-align: left; padding-left: 4px; padding-right: 6px; background-color: #acacac;\">%s</td>", $_->{$attr};
}
}
printf "</tr>";
}
printf "</table>\n";
printf "<!--\nASCII_NOTIFICATION_START\n";
foreach (qw(Name Enabled Avail Reason)) {
printf "%20s", $_;
}
printf "\n";
foreach (sort {$a->{ltmPoolMemberNodeName} cmp $b->{ltmPoolMemberNodeName}} @{$self->{members}}) {
foreach my $attr (qw(ltmPoolMemberNodeName ltmPoolMbrStatusEnabledState ltmPoolMbrStatusAvailState ltmPoolMbrStatusDetailReason)) {
printf "%20s", $_->{$attr};
}
printf "\n";
}
printf "ASCII_NOTIFICATION_END\n-->\n";
}
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem9::LTMPoolMember;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub finish {
my $self = shift;
$self->{ltmPoolMemberNodeName} ||= $self->{ltmPoolMemberAddr};
if ($self->{ltmPoolMemberNodeName} eq $self->{ltmPoolMemberAddr} &&
$self->{ltmNodeAddrStatusName}) {
$self->{ltmPoolMemberNodeName} = $self->{ltmNodeAddrStatusName};
}
}
sub check {
my $self = shift;
if ($self->{ltmPoolMbrStatusEnabledState} eq "enabled") {
if ($self->{ltmPoolMbrStatusAvailState} ne "green") {
# info only, because it would ruin thresholds in the pool
$self->add_ok(sprintf
"member %s is %s/%s (%s)",
$self->{ltmPoolMemberNodeName},
$self->{ltmPoolMemberMonitorState},
$self->{ltmPoolMbrStatusAvailState},
$self->{ltmPoolMbrStatusDetailReason});
}
}
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem4;
our @ISA = qw(Classes::F5::F5BIGIP::Component::LTMSubsystem GLPlugin::SNMP::TableItem);
use strict;
sub init {
my $self = shift;
foreach ($self->get_snmp_table_objects(
'LOAD-BAL-SYSTEM-MIB', 'poolTable')) {
if ($self->filter_name($_->{poolName})) {
push(@{$self->{pools}},
Classes::F5::F5BIGIP::Component::LTMSubsystem4::LTMPool->new(%{$_}));
}
}
foreach ($self->get_snmp_table_objects(
'LOAD-BAL-SYSTEM-MIB', 'poolMemberTable')) {
if ($self->filter_name($_->{poolMemberPoolName})) {
push(@{$self->{poolmembers}},
Classes::F5::F5BIGIP::Component::LTMSubsystem4::LTMPoolMember->new(%{$_}));
}
}
$self->assign_members_to_pools();
}
sub assign_members_to_pools {
my $self = shift;
foreach my $pool (@{$self->{pools}}) {
foreach my $poolmember (@{$self->{poolmembers}}) {
if ($poolmember->{poolMemberPoolName} eq $pool->{poolName}) {
push(@{$pool->{members}}, $poolmember);
}
}
if (! defined $pool->{poolMemberQty}) {
$pool->{poolMemberQty} = scalar(@{$pool->{members}}) ;
$self->debug("calculate poolMemberQty");
}
$pool->{completeness} = $pool->{poolMemberQty} ?
$pool->{poolActiveMemberCount} / $pool->{poolMemberQty} * 100
: 0;
}
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem4::LTMPool;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
sub check {
my $self = shift;
$self->add_info(sprintf 'pool %s active members: %d of %d', $self->{poolName},
$self->{poolActiveMemberCount},
$self->{poolMemberQty});
if ($self->{poolActiveMemberCount} == 1) {
# only one member left = no more redundancy!!
$self->set_thresholds(warning => "100:", critical => "51:");
} else {
$self->set_thresholds(warning => "51:", critical => "26:");
}
$self->add_message($self->check_thresholds($self->{completeness}));
if ($self->{poolMinActiveMembers} > 0 &&
$self->{poolActiveMemberCount} < $self->{poolMinActiveMembers}) {
$self->add_nagios(
defined $self->opts->mitigation() ? $self->opts->mitigation() : CRITICAL,
sprintf("pool %s has not enough active members (%d, min is %d)",
$self->{poolName}, $self->{poolActiveMemberCount},
$self->{poolMinActiveMembers})
);
}
$self->add_perfdata(
label => sprintf('pool_%s_completeness', $self->{poolName}),
value => $self->{completeness},
uom => '%',
warning => $self->{warning},
critical => $self->{critical},
);
}
package Classes::F5::F5BIGIP::Component::LTMSubsystem4::LTMPoolMember;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;

View file

@ -0,0 +1,35 @@
package Classes::F5::F5BIGIP::Component::MemSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_objects('F5-BIGIP-SYSTEM-MIB', (qw(
sysStatMemoryTotal sysStatMemoryUsed sysHostMemoryTotal sysHostMemoryUsed)));
$self->{stat_mem_usage} = ($self->{sysStatMemoryUsed} / $self->{sysStatMemoryTotal}) * 100;
$self->{host_mem_usage} = ($self->{sysHostMemoryUsed} / $self->{sysHostMemoryTotal}) * 100;
}
sub check {
my $self = shift;
$self->add_info('checking memory');
$self->add_info(sprintf 'tmm memory usage is %.2f%%',
$self->{stat_mem_usage});
$self->set_thresholds(warning => 80, critical => 90, metric => 'tmm_usage');
$self->add_message($self->check_thresholds(metric => 'tmm_usage', value => $self->{stat_mem_usage}));
$self->add_perfdata(
label => 'tmm_usage',
value => $self->{stat_mem_usage},
uom => '%',
);
$self->add_info(sprintf 'host memory usage is %.2f%%',
$self->{host_mem_usage});
$self->set_thresholds(warning => 100, critical => 100, metric => 'host_usage');
$self->add_message($self->check_thresholds(metric => 'host_usage', value => $self->{host_mem_usage}));
$self->add_perfdata(
label => 'host_usage',
value => $self->{host_mem_usage},
uom => '%',
);
}

View file

@ -0,0 +1,28 @@
package Classes::F5::F5BIGIP::Component::PowersupplySubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('F5-BIGIP-SYSTEM-MIB', [
['powersupplies', 'sysChassisPowerSupplyTable', 'Classes::F5::F5BIGIP::Component::PowersupplySubsystem::Powersupply'],
]);
}
package Classes::F5::F5BIGIP::Component::PowersupplySubsystem::Powersupply;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'chassis powersupply %d is %s',
$self->{sysChassisPowerSupplyIndex},
$self->{sysChassisPowerSupplyStatus});
if ($self->{sysChassisPowerSupplyStatus} eq 'notpresent') {
} else {
if ($self->{sysChassisPowerSupplyStatus} ne 'good') {
$self->add_critical();
}
}
}

View file

@ -0,0 +1,26 @@
package Classes::F5::F5BIGIP::Component::TemperatureSubsystem;
our @ISA = qw(GLPlugin::SNMP::Item);
use strict;
sub init {
my $self = shift;
$self->get_snmp_tables('F5-BIGIP-SYSTEM-MIB', [
['temperatures', 'sysChassisTempTable', 'Classes::F5::F5BIGIP::Component::TemperatureSubsystem::Temperature'],
]);
}
package Classes::F5::F5BIGIP::Component::TemperatureSubsystem::Temperature;
our @ISA = qw(GLPlugin::SNMP::TableItem);
use strict;
sub check {
my $self = shift;
$self->add_info(sprintf 'chassis temperature %d is %sC',
$self->{sysChassisTempIndex},
$self->{sysChassisTempTemperature});
$self->add_perfdata(
label => sprintf('temp_%s', $self->{sysChassisTempIndex}),
value => $self->{sysChassisTempTemperature},
);
}

Some files were not shown because too many files have changed in this diff Show more