1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2025-04-03 22:43:41 +02:00

Compare commits

...

349 Commits

Author SHA1 Message Date
Guðvarður Ólafsson
ffbdd754d4
Create readme.md 2022-01-04 13:20:15 +00:00
Garðar Þorsteinsson
0440124d3a
Merge pull request #45 from monitoreoDotOsiAtUchileDotCl/master
:D
2020-10-28 16:34:34 +00:00
monitoreoDotOsiAtUchileDotCl
36582886c9 warn/crit threshold 4 connRate, warning/crit output improvement 2020-10-28 12:24:56 -03:00
monitoreoDotOsiAtUchileDotCl
21c7874418 warn/crit threshold 4 connRate, warning/crit output improvement 2020-10-28 12:17:15 -03:00
Garðar Þorsteinsson
6b12d2414a
Merge pull request #44 from monitoreoDotOsiAtUchileDotCl/master
warn/crit threshold 4 connRate
2020-10-26 21:34:49 +00:00
monitoreoDotOsiAtUchileDotCl
ac1f45311e warn/crit threshold 4 connRate 2020-10-26 17:46:39 -03:00
Garðar Þorsteinsson
be3ea24fd8
Merge pull request #43 from monitoreoDotOsiAtUchileDotCl/master
some improvements
2020-10-22 15:34:40 +00:00
monitoreoDotOsiAtUchileDotCl
1f9e1444cc another minor change, libexec path 2020-10-22 10:37:42 -03:00
monitoreoDotOsiAtUchileDotCl
bdb3233198 minor changes ,using spaces instead of tabs 2020-10-22 10:32:57 -03:00
monitoreoDotOsiAtUchileDotCl
f22a7d8fb8 patch 1.2.1a 2020-10-22 10:27:34 -03:00
Garðar Þorsteinsson
6c12036e30
Update releasers.conf 2020-09-14 12:31:11 +00:00
Your Name
8aed467ab0 Automatic commit of package [nagios-okplugin-check_xroad_token] release [1.2-1]. 2020-09-14 11:51:06 +00:00
Garðar Þorsteinsson
df42d6ee6d
Merge pull request #41 from opinkerfi/xroad-check_xroad_token
check_xroad_token plugin created
2020-09-11 16:04:15 +00:00
Garðar Þorsteinsson
223331510b check_xroad_token plugin created 2020-09-11 16:01:05 +00:00
Garðar Þorsteinsson
ea93f8126f
Fix masking of exit code 2020-09-11 11:09:40 +00:00
Garðar Þorsteinsson
3ad7f64f55
Merge pull request #40 from opinkerfi/check_service
Added check_service plugin
2020-04-21 12:58:41 +00:00
Gardar Thorsteinsson
e48179add8 Added check_service 2020-04-21 12:56:55 +00:00
Gardar Thorsteinsson
56960140fe Added check_service plugin 2020-04-21 12:52:47 +00:00
Garðar Þorsteinsson
9eda5324d5
Merge pull request #39 from opinkerfi/plugin_check_yum_update
Updated check_yum to 0.8.9
2019-10-23 15:45:05 +00:00
Gardar Thorsteinsson
09f29727fb Updated check_yum to 0.8.9 2019-10-23 15:44:17 +00:00
Garðar Þorsteinsson
bb55bd5e09
Update nagios-okplugin-check_hpssacli.spec 2019-06-14 14:43:15 +00:00
Garðar Þorsteinsson
4d6b5ce427
Merge pull request #38 from opinkerfi/plugin-check_hpssacli
Initial packaging of hpssacli plugin
2019-06-14 14:10:13 +00:00
Gardar Thorsteinsson
d9b0b77dc1 ssacli path updated for windows 2019-06-14 14:09:35 +00:00
Gardar Thorsteinsson
23714fa9cd Initial packaging of hpssacli plugin 2019-06-14 11:18:20 +00:00
Garðar Þorsteinsson
22062ef76f
Merge pull request #36 from Popsiclestick/patch-1
Fix check_ipa_replication
2019-04-10 15:21:26 +00:00
Garðar Þorsteinsson
ee29f68bcc
Merge pull request #37 from opinkerfi/filter-out-perl-utils
fixed perl-utils dependency problem by filtering out in spec file
2018-05-11 13:05:29 +00:00
Gardar Thorsteinsson
077e862e6f fixed perl-utils dependency problem by filtering out in spec file 2018-05-09 23:00:16 +00:00
Richard Allen
b96bb5e207 filter out perl-utils dependancy 2018-05-04 13:47:32 +00:00
Michael Salsone
f774b44b47
Update check_ipa_replication
Fix this slice so it gets the correct value.
2017-12-07 10:27:20 -06:00
Garðar Þorsteinsson
51c659990b Merge pull request #31 from eythori-sensa/fix_rhel6_multipatch_check
Fix rhel6 multipath check
2017-03-24 15:34:04 +00:00
Admin - Eyþór Ívarsson
343c42339f Fix syntax error 2017-03-23 12:18:25 +00:00
Admin - Eyþór Ívarsson
8f89f773e3 Changes after multipath upgrade. Use multipath -ll and fix a regex counter for ok lines 2017-03-23 12:18:18 +00:00
gardart
24518a74e7 version update - package release 2016-12-22 20:11:19 +00:00
gardart
cdc1daad6d version fix 2016-12-21 21:47:29 +00:00
gardart
c40bee725a version update 2016-12-21 14:59:01 +00:00
gardart
892f9c267e Lagfæring á spec skrá vegna tito 2016-12-21 13:20:51 +00:00
Richard Allen
3501677f20 Initial commit of check_firewall_active (#28)
* Initial commit of check_firewall_active
* Fixing things found in the review.  Started work on rpm spec file
* Fixing spec a bit
* Fixing url
2016-12-21 12:40:29 +00:00
hakong
6726f614ad Merge pull request #25 from FlorianHeigl/patch-1
make the output compliant with Nagios
2016-10-02 18:30:54 +00:00
Florian Heigl
ee5adc2363 make the output compliant with Nagios
First, use the proper keywords OK/WARN/UNKNOWN so the check follows the plugin guidelines
Second, to not confuse things, the UNKNOWN case would give multiline output. The first bit goes to the status line, the second to the extended status info.

I tried to not mess around, but I also made SELinux caps :-)
2016-10-02 20:25:42 +02:00
Pall Sigurdsson
7dc3b57582 Merge pull request #19 from TJM/issue-18-ipa-busy-replica
Issue #18 - Replica Busy is not critical
2015-10-17 22:49:26 +11:00
Pall Sigurdsson
688e8b8412 Merge pull request #20 from uakfdotb/patch-1
Fix "critical HDD detection" bug in check_hparray
2015-10-17 22:47:04 +11:00
uakfdotb
1ccc433779 Use $HPACUCLI 2015-10-14 19:24:53 -04:00
uakfdotb
ee05a4f24a Fix critical HDD detection bug in check_hparray 2015-10-14 16:23:12 -04:00
Tommy McNeely
871c8348fa Issue #18 - Replica Busy is not critical
Changed the plugin.status to allow for status 0 or status 1.
2015-10-01 15:45:14 -06:00
Pall Sigurdsson
944d47e18e Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2014-11-16 15:02:17 +01:00
Pall Sigurdsson
40ba14c4cb check_hpacucli - critical on failed logical drives 2014-11-16 15:01:41 +01:00
Tomas Edwardsson
f986b73474 Automatic commit of package [nagios-okplugin-check_disks] release [1.0.7-1]. 2014-10-29 23:45:26 +00:00
Tomas Edwardsson
c8e7fbbff8 Fix invalid regex if mountpoint has . in path 2014-10-29 23:42:42 +00:00
Tomas Edwardsson
f23ac92b64 Automatic commit of package [nagios-okplugin-check_hpasm] release [4.1.4-1]. 2014-10-03 10:27:52 +00:00
Tomas Edwardsson
7ab36cbc66 Added rhel7 releaser 2014-09-03 07:57:38 +00:00
Tomas Edwardsson
bf0edd899b Regex filtering broke disk checks 2014-08-28 11:33:30 +00:00
Tomas Edwardsson
9060a171f0 Revert to working copy. 2014-06-26 13:06:45 +00:00
Tomas Edwardsson
1420e93c5c Added lvm mirror checks 2014-06-26 13:04:50 +00:00
Tomas Edwardsson
cbcaa14997 Add metrics without updates for known types
Closes #13
2014-06-21 16:51:15 +00:00
Tomas Edwardsson
03f7389842 Automatic commit of package [nagios-okplugin-apc] release [2.1.2-1]. 2014-06-09 22:45:32 +00:00
Tomas Edwardsson
f186de5585 Disable embedded perl 2014-06-09 22:42:22 +00:00
Tomas Edwardsson
c22b89893d hpacucli Bad permissions on sudoers file 2014-05-15 11:24:48 +00:00
Tomas Edwardsson
d3f75ec93a Changed release priority for rhel6 test build 2014-05-15 11:23:11 +00:00
Tomas Edwardsson
9862b3c0d9 hpasm invalid nrpe check command name 2014-05-15 11:22:13 +00:00
Tomas Edwardsson
790619d820 Automatic commit of package [nagios-okplugin-check_hpasm] release [4.1.3-1]. 2014-05-15 11:13:53 +00:00
Tomas Edwardsson
a743def0c8 hpacucli Missing !requiretty for sudo 2014-05-15 11:09:52 +00:00
Tomas Edwardsson
c414e17b30 Added prodcution builder for fc20 2014-04-13 18:31:36 +00:00
Tomas Edwardsson
b481aadbd5 Automatic commit of package [nagios-okplugin-check_uptime] release [1.0.3-1]. 2014-04-13 18:26:25 +00:00
Tomas Edwardsson
2049fbd692 Automatic commit of package [nagios-okplugin-ipa] release [0.0.4-1]. 2014-04-04 15:19:32 +00:00
Tomas Edwardsson
5f604b852f Automatic commit of package [nagios-okplugin-check_time] release [1.0.3-1]. 2014-04-04 13:10:38 +00:00
Tomas Edwardsson
e5772ab336 check_time - Added requirement for bc 2014-04-04 13:07:33 +00:00
Tomas Edwardsson
e5498e1554 okc-get_network_stat, Bad nrpe command name 2014-04-02 15:57:58 +00:00
Tomas Edwardsson
7d9ba339bc Automatic commit of package [nagios-okplugin-get_network_stat] release [1.0.1-1]. 2014-04-02 15:34:19 +00:00
Tomas Edwardsson
37d504a039 Added okc-get_network_stat 2014-04-02 15:34:07 +00:00
Tomas Edwardsson
e7af0e4098 Automatic commit of package [nagios-okplugin-check_disks] release [1.0.6-1]. 2014-03-25 17:57:03 +00:00
Tomas Edwardsson
6c126130cc Automatic commit of package [nagios-okplugin-check_disks] release [1.0.5-1]. 2014-03-25 14:23:28 +00:00
Tomas Edwardsson
f0968997e4 Automatic commit of package [nagios-okplugin-check_time] release [1.0.2-1]. 2014-03-25 12:08:35 +00:00
Tomas Edwardsson
95693e3c73 Automatic commit of package [nagios-okplugin-apc] release [2.1.1-1]. 2014-03-20 08:10:31 +00:00
Tomas Edwardsson
55daf8f4c9 Rework hostname detection to use local
Removed socket.gethostname to discover own hostname instead using the
local flag which is output from /usr/sbin/clustat -fx node definitions.
The gethostname does not always match the cluster node name which would
make the check fail.
2014-03-07 11:25:24 +00:00
Tomas Edwardsson
d11d29185a Remove debug print 2014-03-07 11:23:28 +00:00
Pall Sigurdsson
06194c84cc Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [4-1]. 2014-02-21 11:10:55 +00:00
Pall Sigurdsson
184d7d3b4a Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2014-02-21 11:07:39 +00:00
Pall Sigurdsson
1574cd13d3 ibm_bladecenter - another firmware bug workaround 2014-02-21 11:06:00 +00:00
Pall Sigurdsson
b0b55dcd3e pep8 fixes 2014-02-21 10:52:39 +00:00
Pall Sigurdsson
b96e973e60 Fix workaround for firmware bug
Blade chassis will sometimes report critical error that
there are no critical or warning events.

Fix plugin so it properly works around the issue.
2014-02-21 10:50:32 +00:00
Pall Sigurdsson
51b75943cf Automatic commit of package [nagios-okplugin-cifs] release [1.1-1]. 2014-02-20 18:11:40 +00:00
Pall Sigurdsson
8ff1cf84d0 Automatic commit of package [nagios-okplugin-check_yum] release [1-1]. 2014-02-20 18:09:38 +00:00
Pall Sigurdsson
5cb19c072e Automatic commit of package [nagios-plugins-check_cpu] release [2-1]. 2014-02-20 18:08:20 +00:00
Pall Sigurdsson
6db73d28d6 Automatic commit of package [nagios-okplugin-check_ironport] release [2-1]. 2014-02-20 18:07:50 +00:00
Pall Sigurdsson
5ba61f91b2 Automatic commit of package [nagios-okplugin-check_eva] release [2-1]. 2014-02-20 18:07:02 +00:00
Pall Sigurdsson
8f6faa8b59 Automatic commit of package [nagios-okplugin-check_snmp] release [2-1]. 2014-02-20 18:06:46 +00:00
Pall Sigurdsson
574538883c Automatic commit of package [nagios-okplugin-check_rhcs] release [1-1]. 2014-02-20 18:06:12 +00:00
Pall Sigurdsson
245ad9ba21 Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [2-1]. 2014-02-20 18:05:51 +00:00
Pall Sigurdsson
854b08c601 Automatic commit of package [nagios-okplugin-check_hpacucli] release [2-1]. 2014-02-20 18:05:17 +00:00
Pall Sigurdsson
55ea04bd73 Automatic commit of package [nagios-okplugin-check_dataprotector] release [2-1]. 2014-02-20 18:04:49 +00:00
Pall Sigurdsson
09dcc39f94 Automatic commit of package [nagios-okplugin-brocade] release [0.0.5-1]. 2014-02-20 18:03:50 +00:00
Pall Sigurdsson
48d0a92707 Automatic commit of package [nagios-okplugin-bond] release [0.0.4-1]. 2014-02-20 18:03:15 +00:00
Pall Sigurdsson
e9222eb215 Automatic commit of package [nagios-okplugin-mailblacklist] release [1.1-1]. 2014-02-20 18:01:51 +00:00
Pall Sigurdsson
e64d51ebc3 remove check_cpu and okplugin-common 2014-02-20 17:58:10 +00:00
Pall Sigurdsson
5d94c9d3a2 Automatic commit of package [nagios-plugins-check_selinux] release [1.3-1]. 2014-02-20 17:56:25 +00:00
Pall Sigurdsson
22e4293db7 Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2014-02-18 15:57:42 +00:00
Pall Sigurdsson
9b89a3d998 update rel-eng for fedora20 repos 2014-02-18 15:57:09 +00:00
Pall Sigurdsson
553a182dd1 Merge pull request #10 from gitmopp/patch-2
bug in for loop. Looped only once
2014-02-04 05:14:39 -08:00
Pall Sigurdsson
9501bef37b Merge pull request #9 from gitmopp/patch-1
Fixed output to be more compatible
2014-02-04 05:14:24 -08:00
gitmopp
b672f6f508 bug in for loop. Looped only once 2014-01-31 15:06:04 +01:00
gitmopp
04d25281e3 Fixed output to be more compatible
My SSSU 10.1.0 reports "SSSU for HP P6000 Command View" instead of "SSSU for HP StorageWorks Command View EVA". I fixed the output to just check for SSSU for HP
2014-01-30 17:36:33 +01:00
Pall Sigurdsson
9b2474fb49 Automatic commit of package [nagios-okplugin-check_msa_hardware] release [1.0.5-1]. 2014-01-30 16:07:10 +00:00
Pall Sigurdsson
156459046c Automatic commit of package [nagios-okplugin-check_msa_hardware] release [1.0.4-1]. 2014-01-30 16:04:50 +00:00
Your Name
a93d887721 README.md added 2014-01-30 15:53:12 +00:00
Your Name
2dbec06282 nrpe.d added to check_msa 2014-01-30 15:47:04 +00:00
Your Name
734e7d5596 rename check_msa_hardware-pl 2014-01-30 15:33:30 +00:00
Pall Sigurdsson
623c1d5159 Automatic commit of package [nagios-okplugin-check_msa_hardware] release [1.0.3-1]. 2014-01-30 11:32:35 +00:00
Pall Sigurdsson
19312f9b55 msa packaging 2014-01-30 11:32:31 +00:00
Pall Sigurdsson
c1005cb911 Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2014-01-27 09:42:48 +00:00
Pall Sigurdsson
f5d4cde8b5 spec file for check_msa_hardware-pl added 2014-01-27 09:42:40 +00:00
Tomas Edwardsson
067f58f52e Added returning of a 5 second sample in perfdata 2014-01-20 17:51:04 +00:00
Tomas Edwardsson
5d0df0bfe9 Check would fail on first run 2014-01-20 11:41:11 +00:00
Tomas Edwardsson
735b2795d8 Removed unneeded directory for state 2014-01-20 11:05:52 +00:00
Tomas Edwardsson
5593391a3b Automatic commit of package [nagios-okplugin-check_cpu] release [1.1-1]. 2014-01-20 11:05:13 +00:00
Tomas Edwardsson
ee4b10b291 Added nagios-okplugin-check_cpu 2014-01-20 11:05:01 +00:00
Tomas Edwardsson
b10d555e52 Invalid directory fixed 2014-01-20 10:14:52 +00:00
Tomas Edwardsson
971afc97f7 Automatic commit of package [nagios-okplugin-common] release [1.2-1]. 2014-01-20 09:27:39 +00:00
Tomas Edwardsson
fcf90cae3e Removed invalid file reference 2014-01-20 09:26:36 +00:00
Tomas Edwardsson
73b632a828 Automatic commit of package [nagios-okplugin-common] release [1.1-1]. 2014-01-20 09:20:43 +00:00
Tomas Edwardsson
b375ae66ee Added nagios-okplugin-common 2014-01-20 09:20:16 +00:00
Tomas Edwardsson
3606e03170 Automatic commit of package [nagios-okplugin-check_uptime] release [1.0.2-1]. 2013-12-30 20:40:11 +00:00
Tomas Edwardsson
63f285a037 Added Fedora 20 2013-12-30 20:31:22 +00:00
Tomas Edwardsson
be7032f4e4 Added fedora 19 2013-12-30 20:30:35 +00:00
Pall Sigurdsson
d259894a9d spec file added 2013-12-06 15:56:44 +00:00
Pall Sigurdsson
6d0ce2c869 Allow -L without -H provided as well 2013-12-06 15:53:59 +00:00
Pall Sigurdsson
4aae5f6327 README updated 2013-12-06 15:53:42 +00:00
Pall Sigurdsson
2112847349 test script added 2013-12-06 15:49:07 +00:00
Pall Sigurdsson
f382acb1a6 lsmgrp added 2013-12-06 15:48:55 +00:00
Pall Sigurdsson
d7efe24a34 fix typos 2013-12-06 14:19:23 +00:00
Pall Sigurdsson
72f2c0de16 added support for more queries 2013-12-06 14:16:57 +00:00
Pall Sigurdsson
7c41c09b2f enclosure battery support added 2013-12-06 13:58:44 +00:00
Pall Sigurdsson
f87963f554 switched to semicolon format. lsdrive added 2013-12-06 13:48:39 +00:00
Pall Sigurdsson
38a207065e Refactor - support for lsdrive added 2013-11-19 15:59:36 +00:00
Pall Sigurdsson
831156308b check_storwize.py added
Experimental!

replaces check_storwize.sh

only lsarray and lsmdiskgrp are supported for now
2013-11-19 11:18:02 +00:00
Tomas Edwardsson
356bb2c762 Renamed to markdown 2013-10-27 23:05:51 +00:00
Tomas Edwardsson
bc15b653b1 Added examples and documentation 2013-10-27 22:57:43 +00:00
Tomas Edwardsson
814426a5a8 Automatic commit of package [nagios-okplugin-check_package_updates] release [0.0.7-1]. 2013-09-13 13:27:49 +00:00
Tomas Edwardsson
2f69dd02cb Merge pull request #8 from opinkerfi/refactor-check_package_updates
Refactor check package updates
2013-09-13 05:28:56 -07:00
Pall Sigurdsson
25b04e822e check_package_updates - minor refactor
Few very minor readability tricks

* replacing the typical "if x not in list: list[x] = ..."  pattern with defaultdict
* replace string.split('\n') with splitlines()
2013-09-13 11:51:16 +00:00
Pall Sigurdsson
f3909a08f6 check_package_updates - fix inconsistent tab/space 2013-09-13 11:43:04 +00:00
Tomas Edwardsson
53ec813478 Removed obsoletes and thresholds 2013-09-13 10:56:51 +00:00
Pall Sigurdsson
46024baa26 check_eva new Make sure --timeout is an integer 2013-09-12 09:14:58 +00:00
Pall Sigurdsson
3d867d84c0 check_eva new command line option --timeout 2013-09-11 15:14:50 +00:00
Pall Sigurdsson
6562732a91 check_eva Fix undefined fix typos 2013-09-11 15:04:52 +00:00
Pall Sigurdsson
c524ee0046 Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2013-09-02 15:14:22 +00:00
Pall Sigurdsson
9907356c39 PEP8 cleanup 2013-09-02 15:14:07 +00:00
Pall Sigurdsson
39f2413957 merged 2013-09-02 15:02:51 +00:00
Pall Sigurdsson
840ef78a7b New plugin - check_other 2013-09-02 10:59:27 +00:00
Pall Sigurdsson
c6cb2b634d check_eva - minor bugfixes 2013-09-02 10:50:48 +00:00
Pall Sigurdsson
92a6643a4b New plugin - check_other 2013-09-02 10:50:00 +00:00
Pall Sigurdsson
a21b3adf43 check_eva.py more code cleanup with pycharm inspections 2013-08-21 14:08:41 +00:00
Pall Sigurdsson
39b7d6a7d9 check_eva.py - Make code more readable 2013-08-21 13:55:57 +00:00
Pall Sigurdsson
598a525ac8 convert from tabs to spaces 2013-08-21 13:50:34 +00:00
Pall Sigurdsson
ceb039eb45 check_eva - fix mixed tab/spaces 2013-08-21 13:48:56 +00:00
Tomas Edwardsson
5ab6e198ec Merge pull request #5 from argusb/patch-1
Update check_eva.py, looking good, merged. Thanks!
2013-08-12 08:05:47 -07:00
argusb
b0663e0495 Update check_eva.py
Change parsing of SSSU output header to make it work with Command View EVA >= 10.
2013-08-12 14:40:23 +02:00
Tomas Edwardsson
a01af47d86 Removed Draft, should be working pretty good 2013-07-17 07:59:40 +00:00
Tomas Edwardsson
30c4b15700 Added --legacy to default since that is the default format 2013-07-16 22:42:44 +00:00
Tomas Edwardsson
1099ad9c02 Added nrpe reload since moving from check_yum needs it 2013-07-16 22:24:47 +00:00
Tomas Edwardsson
677ec90e3e Added obsolete for okplugin check_updates
nagios-okplugin-check_updates was the wrong name for
nagios-okplugin-check_package_updates. It was renamed but some might
have installed check_updates in the mean time.
2013-07-16 22:22:36 +00:00
Tomas Edwardsson
a5dbf632f2 Automatic commit of package [nagios-okplugin-check_package_updates] release [0.0.6-1]. 2013-07-16 22:09:50 +00:00
Tomas Edwardsson
5af347c3df Fix failure on a fully patched system 2013-07-16 22:09:23 +00:00
Tomas Edwardsson
7ad46b2f68 Automatic commit of package [nagios-okplugin-check_package_updates] release [0.0.5-1]. 2013-07-16 19:43:19 +00:00
Tomas Edwardsson
5a8cad9783 Known types always have a metric, even if 0 2013-07-16 19:43:00 +00:00
Tomas Edwardsson
5ff4605400 Automatic commit of package [nagios-okplugin-check_package_updates] release [0.0.4-1]. 2013-07-16 17:43:28 +00:00
Tomas Edwardsson
7143d69552 Re-renamed to check_package_updates 2013-07-16 14:34:04 +00:00
Tomas Edwardsson
a71110fdff Yepp, obsoletes again instead of conflicts 2013-07-16 13:33:38 +00:00
Tomas Edwardsson
5493c0dd15 Automatic commit of package [nagios-okplugin-check_updates] release [0.0.3-1]. 2013-07-16 12:14:07 +00:00
Tomas Edwardsson
f536c03121 Plugin should conflict with check_yum 2013-07-16 11:34:13 +00:00
Tomas Edwardsson
6976284504 No obsolete 2013-07-16 10:47:45 +00:00
Tomas Edwardsson
b884ff14c8 Obsolete nagios-okplugin-check_yum 2013-07-16 10:46:15 +00:00
Tomas Edwardsson
14e8126224 Automatic commit of package [nagios-okplugin-check_updates] release [0.0.2-1]. 2013-07-16 10:44:20 +00:00
Tomas Edwardsson
c2e2739519 Added nrpe.d config file 2013-07-16 10:43:58 +00:00
Tomas Edwardsson
16e167abfc Added spec file 2013-07-16 10:41:22 +00:00
Tomas Edwardsson
24c8127c9f Renamed to check_updates 2013-07-16 10:31:44 +00:00
Tomas Edwardsson
92c4d406fd Renamed to check_updates 2013-07-16 10:31:28 +00:00
Tomas Edwardsson
6a69093487 pycharm recomended formatting fixes 2013-07-16 10:27:04 +00:00
Tomas Edwardsson
ec0cece507 Added example of longoutput 2013-07-16 10:23:39 +00:00
Tomas Edwardsson
e67cc67f90 Added pynag and PluginHelper, usable now. 2013-07-16 09:40:13 +00:00
Tomas Edwardsson
755f10f014 Update documentation with Usage examples 2013-07-16 09:39:57 +00:00
Tomas Edwardsson
5d331dd5e7 Moved draft to second heading 2013-07-14 23:11:04 +00:00
Tomas Edwardsson
53ede666b7 Added a little draft notification.. ;-) 2013-07-14 23:10:13 +00:00
Tomas Edwardsson
86430fbbc5 Added install documentation 2013-07-14 22:54:07 +00:00
Tomas Edwardsson
e610610f21 Clearer description of unprivileged 2013-07-14 22:49:08 +00:00
Tomas Edwardsson
cfd3cfcff8 Print package names 2013-07-14 22:46:30 +00:00
Tomas Edwardsson
c7a4b60654 Missing first char of package name 2013-07-14 22:46:08 +00:00
Tomas Edwardsson
be5d1ce505 Initial commit, without pynag.Plugins 2013-07-14 22:42:47 +00:00
Tomas Edwardsson
911720e5d4 Automatic commit of package [nagios-okplugin-check_http_multi] release [0.1.1-1]. 2013-06-06 10:22:35 +00:00
Tomas Edwardsson
4e21b502b7 Added packaging and rudimentary documentation 2013-06-06 10:22:09 +00:00
Tomas Edwardsson
0828935d90 Allow -u "" for service macros 2013-06-06 10:11:31 +00:00
Tomas Edwardsson
d6e0eee0fb Automatic commit of package [nagios-okplugin-check_ifoperstate] release [0.0.3-1]. 2013-06-05 17:11:14 +00:00
Tomas Edwardsson
c0361e67d9 Rename ifoperstate 2013-06-05 14:33:54 +00:00
Tomas Edwardsson
ad16f4f729 Automatic commit of package [nagios-okplugin-check_ifoperstate] release [0.0.2-1]. 2013-06-05 14:33:26 +00:00
Tomas Edwardsson
4a4794ea0e Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2013-06-05 14:32:38 +00:00
Tomas Edwardsson
91e7874a5b Packaged check_ifoperstate.sh 2013-06-05 14:32:21 +00:00
Tomas Edwardsson
85c1474519 Added check_ifoperstate 2013-06-05 14:24:08 +00:00
Pall Sigurdsson
ec2973e743 RPM Packaging for check_hpasm 2013-06-04 09:50:13 +00:00
Pall Sigurdsson
3591ee0d37 check_oracle_query.py updated 2013-05-29 13:10:16 +00:00
Pall Sigurdsson
b78e958d4d parameter changes to check_oracle_query 2013-05-29 12:49:27 +00:00
Pall Sigurdsson
9ec8d702da check_mssql_query and check_oracle_query prototypes added 2013-05-28 12:24:07 +00:00
Pall Sigurdsson
746420bd15 .gitignore added 2013-05-28 12:23:46 +00:00
Pall Sigurdsson
5482a7e25c Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2013-05-27 17:47:28 +00:00
Pall Sigurdsson
91634a76b7 check_hpacucli.py - fix typo in hpacucli command 2013-05-27 17:45:44 +00:00
Pall Sigurdsson
5eb8ce9199 check_hpacucli.py: pep8 cleanup 2013-05-27 16:58:58 +00:00
Tomas Edwardsson
27e2f7b2d2 Automatic commit of package [nagios-okplugin-check_yum] release [0.8.2-1]. 2013-05-27 16:42:43 +00:00
Pall Sigurdsson
f06667b55d check_hpacucli - fix tab indentation 2013-05-27 16:42:27 +00:00
Tomas Edwardsson
5bbcf099c0 Fixed nrpe with invalid libdir 2013-05-27 16:42:13 +00:00
Tomas Edwardsson
98d7723d9f Automatic commit of package [nagios-okplugin-check_yum] release [0.8.1-1]. 2013-05-27 16:32:45 +00:00
Tomas Edwardsson
e7a474c07a Added missing nrpe config 2013-05-27 16:19:58 +00:00
Pall Sigurdsson
3cf6cb7f2d check_hpacucli: ignore hpacucli output that starts with "Note:" 2013-05-27 16:17:23 +00:00
Tomas Edwardsson
5a49b22a10 Automatic commit of package [nagios-okplugin-check_nagios] release [1.2-1]. 2013-05-22 23:56:39 +00:00
Tomas Edwardsson
9840c23642 Modified to parse on epoch rather that syslog date
Issue #1
2013-05-22 22:41:03 +00:00
Tomas Edwardsson
3828a94a3e Emit unknown if unable to open the logfile and detect location
Issue #1
2013-05-22 21:23:50 +00:00
Tomas Edwardsson
e35455fdc8 Automatic commit of package [nagios-plugins-check_selinux] release [1.1-1]. 2013-05-22 20:49:40 +00:00
Tomas Edwardsson
c0ef6774ad Closes #2 - Initial packaging and fix typos 2013-05-22 20:48:27 +00:00
Your Name
190a9726b1 updated tito releasers.conf 2013-05-19 18:01:22 +00:00
Your Name
1dadb17858 sudoers.d added to install 2013-05-19 17:57:18 +00:00
Your Name
fe453cdd23 dummy commit 2013-05-19 17:52:19 +00:00
Your Name
aa7af97598 fix path in tito package files 2013-05-19 17:51:50 +00:00
Your Name
18fc77d63f dummy commit 2013-05-19 17:49:20 +00:00
Your Name
ca8a2ebb73 tito package files re-added 2013-05-19 17:48:04 +00:00
Your Name
b5308e5a7c Initialized to use tito. 2013-05-19 17:46:20 +00:00
Pall Sigurdsson
a570b1c40e Add sudoers support to check_hpacucli
Affects okconfig issue 3
2013-05-19 17:43:43 +00:00
Pall Sigurdsson
71673753ff Merge branch 'master' of github.com:opinkerfi/nagios-plugins 2013-04-29 16:21:05 +00:00
palli
950a169dbd Initial commit 2013-04-29 09:19:23 -07:00
Tomas Edwardsson
771ec5cf77 Missing colon 2013-04-26 10:52:23 +00:00
Tomas Edwardsson
ff21dd3ec4 Added missing OK when things worked out 2013-04-26 10:36:23 +00:00
Tomas Edwardsson
ebd64badf2 Automatic commit of package [nagios-okplugin-ipa] release [0.0.3-1]. 2013-04-25 21:59:53 +00:00
Tomas Edwardsson
e875698a95 Various errors in syntax fixed 2013-04-25 01:15:00 +00:00
Tomas Edwardsson
9e9c8293cd Detection for no configured replicas 2013-04-25 01:08:15 +00:00
Tomas Edwardsson
fb05e9ad4b Merge branch 'master' of github.com:opinkerfi/misc 2013-04-25 01:01:24 +00:00
Tomas Edwardsson
edf5326de9 Automatic commit of package [nagios-okplugin-ipa] release [0.0.2-1]. 2013-04-25 01:00:35 +00:00
Tomas Edwardsson
ccf72c8c22 Added check_ipa 2013-04-25 00:58:43 +00:00
Pall Sigurdsson
d776077d65 Fix tmp file cleanup 2013-04-19 11:15:59 +00:00
Tomas Edwardsson
4d69437590 Initial rpm packaging 2013-04-16 10:23:32 +00:00
Tomas Edwardsson
43813c1999 Added nrpe reload to post section 2013-03-14 17:47:11 +00:00
palli
6b15a3932b Merge pull request #3 from tryggvi/master
Thank you. Merged.
2013-03-13 09:08:38 -07:00
palli
6d3ee7cdc7 Merge pull request #5 from pallvalmundsson/check_yum_security_patch
fix for changed output in list-security query
2013-03-13 07:37:57 -07:00
Pall Sigurdsson
cf2f4cc1fd Automatic commit of package [nagios-okplugin-bond] release [0.0.3-1]. 2013-03-13 09:27:19 +00:00
Pall Valmundsson
07d3717a29 fix for changed output in list-security query 2013-03-12 21:45:57 +00:00
Tryggvi Farestveit
b29250d12d Added support for inodes 2013-03-02 00:30:03 +00:00
Pall Sigurdsson
565cfa5e1a Merge branch 'master' of github.com:opinkerfi/misc
Conflicts:
	nagios-plugins/check_yum/nagios-okplugin-check_yum.spec
2013-01-23 09:00:01 +00:00
Pall Sigurdsson
968c6330a0 Merge branch 'master' of https://opensource.ok.is/git/misc 2013-01-04 07:12:31 +00:00
Pall Sigurdsson
9be343271c removed warning threshold of 60 2013-01-04 07:12:19 +00:00
Pall Sigurdsson
399b57ba3f contrib removed from plugin path 2013-01-04 07:12:03 +00:00
Tomas Edwardsson
3553793733 Updated rhcs nrpe config as well 2012-12-13 15:09:13 +00:00
Tomas Edwardsson
824665b6d9 Added check for suspended services -Z 2012-12-13 15:07:18 +00:00
Tomas Edwardsson
745c719ac8 Added perfdata and longoutput with ERRATA IDs
Option added:
  -l - runs yum list-security to get advisories and packages
Perfdata now shows how many updates are available.
2012-12-13 10:31:11 +00:00
Tomas Edwardsson
61ca426c4b Added perfdata and longoutput with ERRATA IDs
Option added:
  -l - runs yum list-security to get advisories and packages
Perfdata now shows how many updates are available.
2012-12-13 10:17:58 +00:00
Tomas Edwardsson
cb9faf65e6 Updated to new upstream release 2012-12-13 09:15:20 +00:00
Pall Sigurdsson
d74d766e99 --exclude option added. Added workaround around false positives 2012-11-02 09:34:37 +00:00
Pall Sigurdsson
cee2b2ebf7 Merge github.com:opinkerfi/misc 2012-10-26 16:07:11 +00:00
Pall Sigurdsson
270ddb3d97 Added dependency on bc 2012-10-23 10:49:57 +00:00
Pall Sigurdsson
5b7f683227 Merge branch 'master' of https://opensource.ok.is/git/misc 2012-10-23 10:30:10 +00:00
Tomas Edwardsson
0b20e567de Use the right value for the job nbmstemp 2012-10-22 16:02:25 +00:00
Tomas Edwardsson
ae0968af02 Fixed metric conversion for all mibs 2012-10-22 15:10:57 +00:00
Tomas Edwardsson
d7f9474ed6 Added fahrenheit to celsius conversion 2012-10-22 13:21:47 +00:00
Pall Sigurdsson
2578b81fe0 check_oracle_health and check_mssql_health 2012-10-02 14:33:28 +00:00
Pall Sigurdsson
c0ce018356 Fix broken libdir on 64-bit platforms
Closes okconfig issue number 18
2012-09-30 13:04:06 +00:00
Pall Sigurdsson
f0a0ce515b make sure nagios does not run us in embedded perl 2012-09-17 12:10:51 +00:00
Pall Sigurdsson
468d182014 Automatic commit of package [nagios-okplugin-cifs] release [1.0-1]. 2012-08-23 11:00:52 +00:00
Pall Sigurdsson
16ed641f8b Automatic commit of package [nagios-okplugin-check_hpacucli] release [1.2-2]. 2012-08-23 11:00:03 +00:00
Pall Sigurdsson
77c5917350 Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [1.1.2-3]. 2012-08-23 10:59:45 +00:00
Pall Sigurdsson
8e7144c1a4 Automatic commit of package [nagios-okplugin-check_yum] release [0.7.4-2]. 2012-08-23 10:59:23 +00:00
Pall Sigurdsson
89c8e69d1e version number of scripts bumped 2012-08-23 10:58:42 +00:00
Pall Sigurdsson
36e6dbe188 Automatic commit of package [nagios-okplugin-mailblacklist] release [1.0-1]. 2012-08-23 10:58:21 +00:00
Pall Sigurdsson
518372579a Automatic commit of package [nagios-okplugin-check_hpacucli] release [1.2-1]. 2012-08-23 10:56:08 +00:00
Pall Sigurdsson
75511d21da Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [1.1.2-2]. 2012-08-23 10:55:36 +00:00
Pall Sigurdsson
36db6b9661 Automatic commit of package [nagios-okplugin-check_yum] release [0.7.4-1]. 2012-08-23 10:54:14 +00:00
Pall Sigurdsson
4a98095f7c Automatic commit of package [nagios-okplugin-check_nagios] release [1.1-1]. 2012-08-23 10:51:54 +00:00
Pall Sigurdsson
2ccd5989e3 Automatic commit of package [nagios-plugins-check_cpu] release [1.0-1]. 2012-08-23 10:50:56 +00:00
Pall Sigurdsson
626ec4f2b9 Automatic commit of package [nagios-okplugin-check_eva] release [1.0.2-1]. 2012-08-23 10:49:43 +00:00
Pall Sigurdsson
1637f8f93b Automatic commit of package [nagios-okplugin-apc] release [2.1.0-1]. 2012-08-23 10:49:04 +00:00
Pall Sigurdsson
1209c00087 Merge branch 'master' of https://opensource.ok.is/git/misc 2012-08-07 13:23:14 +00:00
Pall Sigurdsson
65004322a9 bugfix, check_nagios_needs_reload check for reload instead of reparse 2012-08-07 13:23:08 +00:00
Pall Sigurdsson
5342a3cf16 Automatic commit of package [nagios-okplugin-check_ironport] release [1.1.4-1]. 2012-07-31 16:07:22 +00:00
Pall Sigurdsson
d6a23a3ca4 initial packaging for nagios-okplugin-check_ironport 2012-07-31 16:07:01 +00:00
Pall Sigurdsson
960cb63b40 Automatic commit of package [nagios-okplugin-check_ironport] release [1.1.3-1]. 2012-07-31 16:06:33 +00:00
Pall Sigurdsson
59b745678a initial packaging for nagios-okplugin-check_ironport 2012-07-31 16:06:16 +00:00
Pall Sigurdsson
ff9e3d96e7 fixed typo in error messages 2012-07-17 20:33:29 +00:00
Pall Sigurdsson
74cda834ab changed sssu subcommands from being singlequoted to doublequoted for windows compatibility 2012-07-17 20:30:55 +00:00
Pall Sigurdsson
bd4aa7f57d rpm spec file added. version number bumped 2012-07-17 20:20:15 +00:00
Pall Sigurdsson
ba7b80fc1c Automatic commit of package [nagios-okplugin-check_ibm_bladecenter] release [1.1.2-1]. 2012-07-17 20:19:02 +00:00
Pall Sigurdsson
3c87920fd1 rpm spec file added. version number bumped 2012-07-17 20:18:36 +00:00
Pall Sigurdsson
0badbf8619 rpm spec file added. version number bumped 2012-07-17 20:16:50 +00:00
Pall Sigurdsson
59dc82fd44 Fix crash where bladecenter has undocumented extra info, but only partial (closes #62 and #54) 2012-07-17 19:59:51 +00:00
Pall Sigurdsson
afb015b67d Merging with check_yum from code.google.com 2012-07-06 17:14:45 +00:00
Pall Sigurdsson
38c56fe3d8 Bugfix, no longer returns problem when not all powermodules are installed (thanks Davide Gandolfi) 2012-06-25 09:33:12 +00:00
Pall Sigurdsson
bf9ecb7777 Automatic commit of package [nagios-okplugin-check_rhcs] release [0.0.4-1]. 2012-05-24 07:07:15 +00:00
Pall Sigurdsson
756c0ef1de version bump of check_rhcs 2012-05-24 07:07:04 +00:00
Pall Sigurdsson
9346c1a60d check_command is now sudo'ed 2012-05-16 10:37:03 +00:00
Tomas Edwardsson
77b527f44d Automatic commit of package [nagios-okplugin-check_disks] release [1.0.3-1]. 2012-05-16 10:20:19 +00:00
Tomas Edwardsson
5a4d14734e Updated version of nagios-okplugin-check_disks 2012-05-16 10:08:37 +00:00
Pall Sigurdsson
27f4da23bf Merge branch 'master' of http://opensource.ok.is/git/misc 2012-05-11 13:33:07 +00:00
Tomas Edwardsson
468f7ef32a Merge branch 'master' of https://opensource.ok.is/git/misc 2012-05-10 11:20:10 +00:00
Tomas Edwardsson
682ad04b9e Issue #56, temporary fix for selinux and disk checks 2012-05-10 11:19:01 +00:00
Tomas Edwardsson
6f5041d8cd Issue 56, temporary fix for selinux and disk checks 2012-05-10 11:17:49 +00:00
Pall Sigurdsson
2c23f04ffa Merge branch 'master' of https://opensource.ok.is/git/misc 2012-04-23 12:44:12 +00:00
Pall Sigurdsson
ceda55b389 make sure plugin exits cleanly if unable to run clustat -fx command 2012-04-23 12:43:14 +00:00
Tomas Edwardsson
af98917b05 Merge branch 'master' of https://opensource.ok.is/git/misc 2012-04-20 14:41:24 +00:00
Tomas Edwardsson
ddaad8f39d Updates buildarch to noarch 2012-04-20 14:41:11 +00:00
Tomas Edwardsson
d6f9b6093f Updates buildarch to noarch 2012-04-20 14:40:54 +00:00
Tomas Edwardsson
381aef1156 Updated buildarch to noarch 2012-04-20 14:40:13 +00:00
Tomas Edwardsson
ed9d2eb2b9 Added noarch buildarch 2012-04-20 14:39:47 +00:00
Tomas Edwardsson
9248569b6d Issue 49, fixed typo for blower 2012-04-20 14:37:54 +00:00
Pall Sigurdsson
26e5c218b9 Automatic commit of package [nagios-okplugin-mssql] release [0.0.7-1]. 2012-03-19 11:18:42 +00:00
Pall Sigurdsson
aa41f16b6e check_rhcs_fence added for rhel6 compatibility 2012-03-16 11:17:48 +00:00
Pall Sigurdsson
6230193b05 Automatic commit of package [nagios-okplugin-check_drbd] release [0.0.4-1]. 2012-03-14 14:25:32 +00:00
Pall Sigurdsson
bbc5893cfe copy/paste error removed from spec file 2012-03-14 14:17:18 +00:00
Pall Sigurdsson
599134bc5e Automatic commit of package [nagios-okplugin-check_rhcs] release [0.0.3-1]. 2012-03-14 14:16:31 +00:00
Pall Sigurdsson
f60a518bd3 licence and readme removed from specfile 2012-03-14 14:13:12 +00:00
Pall Sigurdsson
f4615ffed5 Automatic commit of package [nagios-okplugin-check_drbd] release [0.0.3-1]. 2012-03-14 14:11:39 +00:00
Pall Sigurdsson
05251498c1 Automatic commit of package [nagios-okplugin-check_linux_modules] release [0.0.13-1]. 2012-03-12 18:00:00 +00:00
Pall Sigurdsson
8d0494c4ff typo in plugin name fixed 2012-03-12 17:59:49 +00:00
Pall Sigurdsson
1bc3ed0782 Automatic commit of package [nagios-okplugin-check_linux_modules] release [0.0.12-1]. 2012-03-12 17:59:07 +00:00
Pall Sigurdsson
da2ae8dd2d spec file and license added for check_linux_modules 2012-03-12 17:58:18 +00:00
Pall Sigurdsson
28e8660037 Automatic commit of package [nagios-okplugin-check_smssend] release [0.0.11-1]. 2012-03-12 17:52:08 +00:00
Pall Sigurdsson
9a42e9c21e license added 2012-03-12 17:49:50 +00:00
Pall Sigurdsson
44fc2600fd Automatic commit of package [nagios-okplugin-check_smssend] release [0.0.10-1]. 2012-03-12 17:49:17 +00:00
Pall Sigurdsson
b72f03415a Automatic commit of package [nagios-okplugin-check_smssend] release [0.0.9-1]. 2012-03-12 17:48:07 +00:00
Pall Sigurdsson
bbfaac455c Automatic commit of package [nagios-okplugin-check_nagios] release [0.0.8-1]. 2012-03-12 17:37:17 +00:00
Pall Sigurdsson
9065fa7ec8 LICENSE file added 2012-03-12 17:37:04 +00:00
Pall Sigurdsson
b5e5207c62 Automatic commit of package [nagios-okplugin-check_nagios] release [0.0.7-1]. 2012-03-12 17:34:35 +00:00
Pall Sigurdsson
82a6090e64 Automatic commit of package [nagios-okplugin-check_nagios] release [0.0.6-1]. 2012-03-12 17:31:14 +00:00
Pall Sigurdsson
e6dce9e9b5 Automatic commit of package [nagios-okplugin-mssql] release [0.0.6-1]. 2012-03-12 16:09:40 +00:00
Pall Sigurdsson
f14db81ca5 Automatic commit of package [nagios-okplugin-crit2warn] release [0.0.2-1]. 2012-03-12 16:09:00 +00:00
Pall Sigurdsson
aebaefa4bf Automatic commit of package [nagios-okplugin-check_yum] release [0.7.3-1]. 2012-03-12 16:09:00 +00:00
Pall Sigurdsson
2de33b2f02 Automatic commit of package [nagios-okplugin-check_vmware_wbem] release [1.0.1-1]. 2012-03-12 16:09:00 +00:00
Pall Sigurdsson
07cb5f0470 Automatic commit of package [nagios-okplugin-check_uptime] release [1.0.1-1]. 2012-03-12 16:09:00 +00:00
Pall Sigurdsson
38bbcd056f Automatic commit of package [nagios-okplugin-check_time] release [1.0.1-1]. 2012-03-12 16:08:59 +00:00
Pall Sigurdsson
edc84c54a4 Automatic commit of package [nagios-okplugin-check_snmp] release [1.0.1-1]. 2012-03-12 16:08:59 +00:00
Pall Sigurdsson
64119882e9 Automatic commit of package [nagios-okplugin-check_multipath] release [0.0.3-1]. 2012-03-12 16:08:59 +00:00
Pall Sigurdsson
e910d327c5 Automatic commit of package [nagios-okplugin-mssql] release [0.0.5-1]. 2012-03-12 16:08:58 +00:00
Pall Sigurdsson
95d0b84219 Automatic commit of package [nagios-okplugin-check_hpacucli] release [0.0.3-1]. 2012-03-12 16:08:58 +00:00
Pall Sigurdsson
f24a7c050e Automatic commit of package [nagios-okplugin-check_eva] release [1.0.1-1]. 2012-03-12 16:08:57 +00:00
Pall Sigurdsson
74407957c3 Automatic commit of package [nagios-okplugin-check_disks] release [1.0.1-1]. 2012-03-12 16:08:57 +00:00
Pall Sigurdsson
14d5afd698 Automatic commit of package [nagios-okplugin-check_dataprotector] release [1.0.1-1]. 2012-03-12 16:08:57 +00:00
Pall Sigurdsson
2ecfed0b40 Automatic commit of package [nagios-plugins-check_cpu] release [0.3-1]. 2012-03-12 16:08:57 +00:00
Pall Sigurdsson
7779f09241 Automatic commit of package [nagios-okplugin-cifs] release [0.0.4-1]. 2012-03-12 16:08:56 +00:00
Pall Sigurdsson
3ef06cb89f Automatic commit of package [nagios-okplugin-brocade] release [0.0.4-1]. 2012-03-12 16:08:56 +00:00
Pall Sigurdsson
4f13da5ce6 Automatic commit of package [nagios-okplugin-bond] release [0.0.2-1]. 2012-03-12 16:08:56 +00:00
Pall Sigurdsson
851579e88c Automatic commit of package [nagios-okplugin-mailblacklist] release [0.0.2-1]. 2012-03-12 16:08:55 +00:00
Pall Sigurdsson
294f2d78dd Automatic commit of package [nagios-okplugin-apc] release [0.0.3-1]. 2012-03-12 16:08:55 +00:00
Pall Sigurdsson
4ac4af674f Version number added to every spec file 2012-03-12 16:05:44 +00:00
Pall Sigurdsson
b23491b453 moved plugins from subversion-style trunk/ directories 2012-03-12 16:03:21 +00:00
Pall Sigurdsson
d31a51e84c deleted subversion-style /releases/ directories 2012-03-12 15:59:26 +00:00
Pall Sigurdsson
26221affd8 Automatic commit of package [nagios-okplugin-mssql] release [0.0.4-1]. 2012-03-12 15:13:35 +00:00
Pall Sigurdsson
5cdbba7b66 Merge manage.tr.is:/opt/misc 2012-03-04 16:23:00 +00:00
root
15b9e64a88 fixed missing tempfile cleanup 2012-03-04 16:22:37 +00:00
333 changed files with 6620 additions and 41967 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*.pyc
*.swp
.project
.pydevproject
.settings
pagekite*
.idea
MANIFEST
dist

4
README.md Normal file
View File

@ -0,0 +1,4 @@
nagios-plugins
==============
Small army of nagios-plugins either made or maintained by opinkerfi

View File

@ -1,4 +1,5 @@
#!/usr/bin/perl
# nagios: -epn
#
# check_apcext.pl - APC Extra gear monitoring plugin for Nagios
# 05.02.07 Paul Venezia
@ -14,6 +15,7 @@ use vars qw/ %opt /;
use strict;
sub getmasked_values ($$);
sub f2c ($);
if ($ARGV[0] =~ /(--help|-h|help)/ || !defined$ARGV[0]) {
&usage;
@ -40,11 +42,11 @@ my %rpduamps;
my %oids = (
'nbmstemp' => {
'label' => 'Temp',
'unit' => ($metric ? 'degC' : 'degF'),
'unit' => 'degF',
'oidbase' => '.1.3.6.1.4.1.5528.100.4.1.1.1',
'sensor_key' => 5,
'sensor_val' => 2,
'cdef' => ($metric ? '$val * 0.1' : '($val * .18) + 32')
'sensor_val' => 9,
#'cdef' => '$val * 0.1'
},
'nbmshum' => {
'label' => 'Humidity',
@ -94,13 +96,13 @@ my %oids = (
},
'acscsupair' => {
'label' => 'Supply Air',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.8.0',
'cdef' => '$val * .10'
},
'acscretair' => {
'label' => 'Return Air',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.10.0',
'cdef' => '$val * .10'
},
@ -111,19 +113,19 @@ my %oids = (
},
'acscracktemp' => {
'label' => 'Rack Inlet Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.6.0',
'cdef' => '$val * .10'
},
'acsccondin' => {
'label' => 'Cond Inlet Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.30.0',
'cdef' => '$val * .10'
},
'acsccondout' => {
'label' => 'Cond Outlet Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.28.0',
'cdef' => '$val * .10'
},
@ -151,19 +153,19 @@ my %oids = (
},
'acrcracktemp' => {
'label' => 'Rack Inlet Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.6.0',
'cdef' => '$val * .10'
},
'acrcsupair' => {
'label' => 'Supply Air',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.8.0',
'cdef' => '$val * .10'
},
'acrcretair' => {
'label' => 'Return Air',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.10.0',
'cdef' => '$val * .10'
},
@ -182,13 +184,13 @@ my %oids = (
},
'acrcflenttemp' => {
'label' => 'Entering Fluid Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.23.0',
'cdef' => '$val * .10'
},
'acrcflrettemp' => {
'label' => 'Returning Fluid Temp',
'unit' => 'F',
'unit' => 'degF',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.25.0',
'cdef' => '$val * .10'
},
@ -367,6 +369,11 @@ if ($param eq "rpduamps") {
$fval = $val;
}
if ($metric and $oids{$param}->{unit} eq 'degF') {
$oids{$param}->{unit} = 'degC';
$fval = sprintf("%.1f", f2c($fval));
}
if ($fval > $crit) {
$retval = 2;
$outmsg = "CRITICAL";
@ -417,6 +424,12 @@ APC ACRC In-Row
}
sub f2c($) {
my $f = shift;
return ($f - 32) * (5/9);
}
sub getmasked_values ($$) {
my ($baseoid, $values) = @_;

View File

@ -2,7 +2,7 @@
Summary: A Nagios plugin to check APC devices
Name: nagios-okplugin-apc
Version: 0.0.2
Version: 2.1.2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
@ -11,6 +11,7 @@ Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_apcext.pl/rel
Requires: nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
BuildArch: noarch
%description
@ -37,5 +38,21 @@ rm -rf %{buildroot}
%{_libdir}/nagios/plugins/*
%changelog
* Mon Jun 09 2014 Tomas Edwardsson <tommi@tommi.org> 2.1.2-1
- Disable embedded perl (tommi@tommi.org)
* Thu Mar 20 2014 Tomas Edwardsson <tommi@tommi.org> 2.1.1-1
- Merge github.com:opinkerfi/misc (palli@opensource.is)
- Use the right value for the job nbmstemp (tommi@tommi.org)
- Fixed metric conversion for all mibs (tommi@opensource.is)
- Added fahrenheit to celsius conversion (tommi@tommi.org)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 2.1.0-1
- Version number bumped to 2.1.0 (palli@opensource.is)
- Added noarch buildarch (tommi@tommi.org)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.3-1
- new package built with tito
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -1,41 +0,0 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check APC devices
Name: nagios-okplugin-apc
Version: 0.0.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-APC
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_apcext.pl/releases/nagios-okplugin-apc-%{version}.tar.gz
Requires: nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
%description
Checks APC devices, both netbotz and UPS
%prep
%setup -q
#perl -pi -e "s|/usr/lib|%{_libdir}|g" check_sip
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_apcext.pl %{buildroot}%{_libdir}/nagios/plugins/check_apcext.pl
install -D -p -m 0755 check_snmp_apc_ups %{buildroot}%{_libdir}/nagios/plugins/snmp_apc_ups
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README
%{_libdir}/nagios/plugins/*
%changelog
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -1 +0,0 @@
check_apcext.pl - APC Extra gear checks (netbotz/pdus)

View File

@ -1,447 +0,0 @@
#!/usr/bin/perl
#
# check_apcext.pl - APC Extra gear monitoring plugin for Nagios
# 05.02.07 Paul Venezia
#
# v0.0.1
#
#
use Net::SNMP;
use Getopt::Std;
use Data::Dumper;
use vars qw/ %opt /;
use strict;
sub getmasked_values ($$);
if ($ARGV[0] =~ /(--help|-h|help)/ || !defined$ARGV[0]) {
&usage;
exit 0;
}
my $opts = 's:lmC:H:p:w:c:';
getopts ( "$opts", \%opt ) or &usage;
my $host = $opt{H};
my $comm = $opt{C};
my $param = $opt{p};
my $warn = $opt{w};
my $crit = $opt{c};
my $metric = $opt{m};
my $list = $opt{l};
my $sensor_int_name = $opt{s};
my ($oid, $oidbase, $fval, $unit, $outmsg);
my $retval = 0;
my %rpduamps;
my %oids = (
'nbmstemp' => {
'label' => 'Temp',
'unit' => ($metric ? 'degC' : 'degF'),
'oidbase' => '.1.3.6.1.4.1.5528.100.4.1.1.1',
'sensor_key' => 5,
'sensor_val' => 2,
'cdef' => ($metric ? '$val * 0.1' : '($val * .18) + 32')
},
'nbmshum' => {
'label' => 'Humidity',
'unit' => '%',
'oidbase' => '.1.3.6.1.4.1.5528.100.4.1.2.1',
'sensor_key' => 5,
'sensor_val' => 8,
},
'nbmsairflow' => {
'label' => 'Air Flow',
'unit' => 'CFM',
'oidbase' => '.1.3.6.1.4.1.5528.100.4.1.5.1',
'sensor_val' => 8,
'sensor_key' => 5,
'mod' => 'lt'
},
'nbmsaudio' => {
'label' => 'Audio Level',
'unit' => '',
'oidbase' => '.1.3.6.1.4.1.5528.100.4.1.4.1',
'sensor_val' => 7,
'sensor_key' => 5,
'mod' => ''
},
'rpduamps' => {
'label' => 'Power Output',
'unit' => 'Amps',
'oid' => '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.',
'cdef' => '$val * .10'
},
'acscstatus' => {
'label' => 'Status',
'unit' => '',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.1.0'
},
'acscload' => {
'label' => 'Cooling Load',
'unit' => 'kW',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.3.0',
'cdef' => '$val * .10'
},
'acscoutput' => {
'label' => 'Cooling output',
'unit' => 'kW',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.2.0',
'cdef' => '$val * .10'
},
'acscsupair' => {
'label' => 'Supply Air',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.8.0',
'cdef' => '$val * .10'
},
'acscretair' => {
'label' => 'Return Air',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.10.0',
'cdef' => '$val * .10'
},
'acscairflow' => {
'label' => 'Airflow',
'unit' => 'CFM',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.4.0',
},
'acscracktemp' => {
'label' => 'Rack Inlet Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.6.0',
'cdef' => '$val * .10'
},
'acsccondin' => {
'label' => 'Cond Inlet Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.30.0',
'cdef' => '$val * .10'
},
'acsccondout' => {
'label' => 'Cond Outlet Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.4.1.2.28.0',
'cdef' => '$val * .10'
},
'acrcstatus' => {
'label' => 'Status',
'unit' => '',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.1.0'
},
'acrcload' => {
'label' => 'Cooling Load',
'unit' => 'kW',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.2.0',
'cdef' => '$val * .10'
},
'acrcoutput' => {
'label' => 'Cooling Output',
'unit' => 'kW',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.3.0',
'cdef' => '$val * .10'
},
'acrcairflow' => {
'label' => 'Airflow',
'unit' => 'CFM',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.4.0'
},
'acrcracktemp' => {
'label' => 'Rack Inlet Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.6.0',
'cdef' => '$val * .10'
},
'acrcsupair' => {
'label' => 'Supply Air',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.8.0',
'cdef' => '$val * .10'
},
'acrcretair' => {
'label' => 'Return Air',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.10.0',
'cdef' => '$val * .10'
},
'acrcfanspeed' => {
'label' => 'Fan Speed',
'unit' => '%',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.16.0',
'cdef' => '$val * .10',
},
'acrcfluidflow' => {
'label' => 'Fluid Flow',
'unit' => 'GPM',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.21.0',
'cdef' => '$val * .10',
'mod' => 'lt'
},
'acrcflenttemp' => {
'label' => 'Entering Fluid Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.23.0',
'cdef' => '$val * .10'
},
'acrcflrettemp' => {
'label' => 'Returning Fluid Temp',
'unit' => 'F',
'oid' => '.1.3.6.1.4.1.318.1.1.13.3.2.2.2.25.0',
'cdef' => '$val * .10'
},
);
if ($list) {
my ($baseoid, $int_name_id, $value_id) = @_;
my ($session, $error) = Net::SNMP->session(
-hostname => $host,
-community => $comm,
-version => 1,
# -translate => [-octetstring => 0x0],
-port => "161"
);
my $response = $session->get_table(-baseoid => ".1.3.6.1.4.1.5528.100.2.1.1");
my $err = $session->error;
if ($err){
$retval = 3;
$outmsg = "UNKNOWN";
$session->close();
print "$outmsg $err - SNMP Error connecting to $host\n";
exit $retval;
}
my %sensor;
foreach my $k (keys %{$response}) {
my ($type, $id) = (split(/\./, $k))[-2,-1];
next if ($type != 1 and $type != 4);
next if ($id < 2000000000);
if ($type == 1) {
$sensor{$id}->{"int_name"} = $response->{$k};
} else {
$sensor{$id}->{"friendly_name"} = $response->{$k};
}
}
print <<" EO";
Specify a sensor by using the -s and the INTERNAL name of the sensor
Detected sensors:
EO
printf("\t%-32s %s\n", "Friendly Name", "Internal Name");
foreach my $id (sort { $sensor{$a}->{"friendly_name"} cmp $sensor{$b}->{"friendly_name"} } keys %sensor) {
printf ("\t%-32s %s\n", "\"$sensor{$id}->{friendly_name}\"", "\"$sensor{$id}->{int_name}\"");
}
exit 0;
} elsif (!$oids{$param}) {
print "No test parameter specified";
exit 3;
} else {
$oid = $oids{$param}->{oid};
$oidbase = $oids{$param}->{oidbase};
}
my ($session, $error) = Net::SNMP->session(
-hostname => $host,
-community => $comm,
-version => 1,
# -translate => [-octetstring => 0x0],
-port => "161"
);
if ($param eq "rpduamps") {
# $param = "RackPDU";
my $i;
for ($i=1;$i<4;$i++) {
my $phoid = $oid . $i;
my $response = $session->get_request($phoid);
my $err = $session->error;
if ($err){
$retval = 3;
$outmsg = "UNKNOWN";
$session->close();
print "$outmsg $err - SNMP Error connecting to $host\n";
exit $retval;
}
$rpduamps{$i} = $response->{$phoid};
}
$session->close;
#$crit = ($crit * 10);
#$warn = ($warn * 10);
$unit = "Amps";
foreach my $ph ( sort keys %rpduamps ) {
my $tphase = ($rpduamps{$ph} * .1);
if (($tphase >= $crit) && ($retval < 2)) {
$retval = 2;
$outmsg = "CRITICAL";
} elsif (($tphase >= $warn) && ($retval < 1)) {
$retval = 1;
$outmsg = "WARNING";
} elsif ($retval < 1) {
$retval = 0;
$outmsg = "OK";
}
$fval .= "Phase $ph: " . $tphase;
#$fval .= "Phase $ph: " . ($tphase * .1);
if ($ph lt 3) {
$fval .= " Amps, ";
#} else {
# $fval .= " ";
}
}
} else {
my $val;
if ($oid) {
my $response = $session->get_request($oid);
my $err = $session->error;
if ($err){
$retval = 3;
$outmsg = "UNKNOWN";
$session->close();
print "$outmsg $err - SNMP Error connecting to $host\n";
exit $retval;
}
$val = $response->{$oid};
$session->close();
} else {
my $snmpd = getmasked_values($oidbase, { $oids{$param}->{sensor_key} => 'sensor_key',
$oids{$param}->{sensor_val} => 'sensor_val' });
if ((keys %{$snmpd}) > 1 && !$sensor_int_name) {
print "UNKNOWN - Many sensors found but none specified, see -s and -l\n";
exit 3;
} elsif ((keys %{$snmpd}) == 0) {
print "UNKNOWN - no sensors found on this device\n";
exit 3;
} else {
my $id = (keys %{$snmpd})[0];
$val = $snmpd->{$id}->{sensor_val};
}
if ($sensor_int_name) {
foreach my $k (keys %{$snmpd}) {
if (lc($snmpd->{$k}->{sensor_key}) eq lc($sensor_int_name)) {
$val = $snmpd->{$k}->{sensor_val};
}
}
}
if ($val eq "") {
print Dumper $snmpd;
print "UNKNOWN Unable to get sensor status\n";
exit 3;
}
}
if ($param eq "acscstatus" || $param eq "acrcstatus") {
if ($val == 1) {
$fval = "Standby";
$retval = 1;
$outmsg = "WARNING";
} elsif ($val == 2) {
$fval = "On";
$retval = 0;
$outmsg = "OK";
}
} else {
if ($oids{$param}->{cdef}) {
$fval = eval "$oids{$param}->{cdef}";
} else {
$fval = $val;
}
if ($fval > $crit) {
$retval = 2;
$outmsg = "CRITICAL";
} elsif ($fval > $warn) {
$retval = 1;
$outmsg = "WARNING";
} else {
$retval = 0;
$outmsg = "OK";
}
}
}
print "$outmsg - " . $oids{$param}->{label} . " " .$fval . " " . $oids{$param}->{unit} . " | $param=$fval$oids{$param}->{unit}\n";
exit $retval;
sub usage {
print "Usage: $0 -H <hostip> -C <community> -p <parameter> -w <warnval> -c <critval> [-l] [-s sensor]\n";
print "\nParameters:\n";
print <<" EO";
APC NetBotz
nbmstemp NetBotz main sensor temp | nbmshum NetBotz main sensor humidity
nbmsairflow NetBotz main sensor airflow | nbmsaudio NetBotz main sensor audio
-l List connected sensors | -s sensor Sensor we want info from
APC Metered Rack PDU
rpduamps Amps on each phase
APC ACSC In-Row
acscstatus System status (on/standby) | acscload Cooling load
acscoutput Cooling output | acscsupair Supply air
acscairflow Air flow | acscracktemp Rack inlet temp
acsccondin Condenser input temp | acsccondout Condenser outlet temp
APC ACRC In-Row
acrcstatus System status (on/standby) | acrcload Cooling load
acrcoutput Cooling output | acrcairflow Air flow
acrcracktemp Rack inlet temp | acrcsupair Supply air
acrcretair Return air | acrcfanspeed Fan speed
acrcfluidflow Fluid flow | acrcflenttemp Fluid entering temp
acrcflrettemp Fluid return temp
EO
exit 3;
}
sub getmasked_values ($$) {
my ($baseoid, $values) = @_;
my ($session, $error) = Net::SNMP->session(
-hostname => $host,
-community => $comm,
-version => 1,
-port => "161"
);
my $response = $session->get_table(-baseoid => $baseoid);
my $err = $session->error;
if ($err){
$retval = 3;
$outmsg = "UNKNOWN";
$session->close();
print "$err - SNMP Error connecting to $host\n";
exit $retval;
}
my %snmpdata;
foreach my $k (keys %{$response}) {
my ($type, $id) = (split(/\./, $k))[-2,-1];
if ($values->{$type}) {
$snmpdata{$id}->{$values->{$type}} = $response->{$k};
}
}
return \%snmpdata;
}

View File

@ -1,562 +0,0 @@
#!/usr/bin/perl
# Copyright (C) 2004 Altinity Limited
# E: info@altinity.com W: http://www.altinity.com/
#
# Edited by Roderick Derks (roderick@r71.nl)
# I changed the output of this plugin so it can bu used with Nagiosgrapher
# to create nice graphs (output is in hours is changed to minutes).
#
# 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
#
# Adjusted by Roderick Derks (roderick@r71.nl)
# Output of snmp query for remaing battery runtime is in minutes or in hours. This
# is a problem when you want to create some nice graphs because of the different
# output. Now hours are converted to minutes.
#
use Net::SNMP;
use Getopt::Std;
$script = "check_snmp_apcups";
$script_version = "2.1.0";
$metric = 1;
$ipaddress = "192.168.1.1"; # default IP address, if none supplied
$version = "1"; # SNMP version
$timeout = 2; # SNMP query timeout
# $warning = 100;
# $critical = 150;
$status = 0;
$returnstring = "";
$community = "public"; # Default community string
# .1.3.6.1.4.1.
# enterprises.318.1.1.1.1.1.1.0 = STRING: "SMART-UPS 1000" upsIdent
# enterprises.318.1.1.1.2.2.1.0 Battery capacity (%)
# enterprises.318.1.1.1.2.2.2.0 Temperature (Celcius)
# enterprises.318.1.1.1.2.2.3.0 Battery runtime remaining
# enterprises.318.1.1.1.2.2.4.0 Battery replace indicator (1=ok, 2=replace)
# enterprises.318.1.1.1.2.2.5.0 Number of battery packs
# enterprises.318.1.1.1.2.2.6.0 Number of bad battery packs
# enterprises.318.1.1.1.3.2.1.0 Input voltage
# enterprises.318.1.1.1.3.2.4.0 Input frequency
# enterprises.318.1.1.1.3.2.5.0 Reason for last transfer to UPS battery power:
# enterprises.318.1.1.1.4.2.1.0 Output voltage
# enterprises.318.1.1.1.4.2.2.0 Output frequency
# enterprises.318.1.1.1.4.2.3.0 Output load as % of capacity
# enterprises.318.1.1.1.4.2.4.0 Output current in ampheres
# enterprises.318.1.1.1.4.2.1.0 Configured voltage
# enterprises.318.1.1.1.8.1.0 Whether agent is communicating with UPS (1)
$oid_upstype = ".1.3.6.1.4.1.318.1.1.1.1.1.1.0";
$oid_battery_capacity = ".1.3.6.1.4.1.318.1.1.1.2.2.1.0";
$oid_battery_temperature = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0";
$oid_battery_runtimeremain = ".1.3.6.1.4.1.318.1.1.1.2.2.3.0";
$oid_battery_replace = ".1.3.6.1.4.1.318.1.1.1.2.2.4.0";
$oid_input_voltage = ".1.3.6.1.4.1.318.1.1.1.3.2.1.0";
$oid_input_frequency = ".1.3.6.1.4.1.318.1.1.1.3.2.4.0";
$oid_input_reasonforlasttransfer = ".1.3.6.1.4.1.318.1.1.1.3.2.5.0";
$oid_output_voltage = ".1.3.6.1.4.1.318.1.1.1.4.2.1.0";
$oid_output_frequency = ".1.3.6.1.4.1.318.1.1.1.4.2.2.0";
$oid_output_load = ".1.3.6.1.4.1.318.1.1.1.4.2.3.0";
$oid_output_current = ".1.3.6.1.4.1.318.1.1.1.4.2.4.0";
$oid_output_configuredvoltage = ".1.3.6.1.4.1.318.1.1.1.4.2.1.0";
$oid_comms = ".1.3.6.1.4.1.318.1.1.1.8.1.0";
$oid_test_result = ".1.3.6.1.4.1.318.1.1.1.7.2.3.0";
$oid_test_date = ".1.3.6.1.4.1.318.1.1.1.7.2.4.0";
$oid_sysDescr = ".1.3.6.1.2.1.1.1.0";
$upstype = "";
$battery_capacity = 0;
$battery_temperature = 0;
$battery_runtimeremain = 0;
$battery_replace = "";
$input_voltage = 0;
$input_frequency = 0;
$input_reasonforlasttransfer = "";
$output_voltage = 0;
$output_frequency = 0;
$output_load = 0;
$output_current = 0;
$output_configuredvoltage = 0;
$outagecause = "";
$test_result = "";
$test_date = "";
# Do we have enough information?
if (@ARGV < 1) {
print "Too few arguments\n";
usage();
}
getopts("h:H:C:w:c:");
if ($opt_h){
usage();
exit(0);
}
if ($opt_H){
$hostname = $opt_H;
}
else {
print "No hostname specified\n";
usage();
}
if ($opt_C){
$community = $opt_C;
}
else {
}
# Create the SNMP session
my ($s, $e) = Net::SNMP->session(
-community => $community,
-hostname => $hostname,
-version => $version,
-timeout => $timeout,
);
main();
# Close the session
$s->close();
if ($returnstring eq ""){
$status = 3;
}
if ($status == 0){
print "Status is OK - $returnstring\n";
# print "$returnstring\n";
}
elsif ($status == 1){
print "Status is a WARNING level - $returnstring\n";
}
elsif ($status == 2){
print "Status is CRITICAL - $returnstring\n";
}
else{
print "Problem with plugin. No response from SNMP agent.\n";
}
exit $status;
####################################################################
# This is where we gather data via SNMP and return results #
####################################################################
sub main {
#######################################################
if (!defined($s->get_request($oid_comms))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$temp = $s->var_bind_list()->{$_};
}
if ($temp eq "1"){
}
else {
append("SNMP agent not communicating with UPS");
$status = 2;
return 1;
}
#######################################################
if (!defined($s->get_request($oid_upstype))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$upstype = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_battery_capacity))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$battery_capacity = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_battery_temperature))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$battery_temperature = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_battery_runtimeremain))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$battery_runtimeremain = $s->var_bind_list()->{$_};
}
# RRD if output is in hours, change it to minutes so we can make a nice graph
if ( $battery_runtimeremain =~ "hour" ) {
$battery_runtimeremain2 = "$battery_runtimeremain";
$battery_runtimeremain =~s/hour.*//g;
$battery_runtimeremain = $battery_runtimeremain*60;
$battery_runtimeremain = "$battery_runtimeremain minutes";
}
#######################################################
if (!defined($s->get_request($oid_battery_replace))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$battery_replace = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_input_voltage))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$input_voltage = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_input_frequency))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$input_frequency = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_input_reasonforlasttransfer))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$input_reasonforlasttransfer = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_output_voltage))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$output_voltage = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_output_frequency))) {
if (!defined($s->get_request($oid_sysDescr))) { $returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$output_frequency = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_output_load))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$output_load = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_test_result))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$test_result = $s->var_bind_list()->{$_};
}
#######################################################
if (!defined($s->get_request($oid_test_date))) {
if (!defined($s->get_request($oid_sysDescr))) {
$returnstring = "SNMP agent not responding";
$status = 1;
return 1;
}
else {
$returnstring = "SNMP OID does not exist";
$status = 1;
return 1;
}
}
foreach ($s->var_bind_names()) {
$test_date = $s->var_bind_list()->{$_};
}
#######################################################
$issue = "";
if ($input_reasonforlasttransfer eq "1"){
$outagecause = "No events"
}
elsif ($input_reasonforlasttransfer eq "2"){
$outagecause = "High line voltage"
}
elsif ($input_reasonforlasttransfer eq "3"){
$outagecause = "Brownout"
}
elsif ($input_reasonforlasttransfer eq "4"){
$outagecause = "Loss of mains power"
}
elsif ($input_reasonforlasttransfer eq "5"){
$outagecause = "Small temporary power drop"
}
elsif ($input_reasonforlasttransfer eq "6"){
$outagecause = "Large temporary power drop"
}
elsif ($input_reasonforlasttransfer eq "7"){
$outagecause = "Small spike"
}
elsif ($input_reasonforlasttransfer eq "8"){
$outagecause = "Large spike"
}
elsif ($input_reasonforlasttransfer eq "9"){
$outagecause = "UPS self test"
}
elsif ($input_reasonforlasttransfer eq "10"){
$outagecause = "Excessive input voltage fluctuation"
}
else {
$outagecause = "Cannot establish reason"
}
if ($test_result eq "1") {
$test_result_string = "Passed";
}
elsif ($test_result eq "2") {
$test_result_string = "Failed";
}
elsif ($test_result eq "4") {
$test_result_string = "In Progress";
}
else {
$test_result_string = "Unknown";
}
if ($battery_capacity < 50) {
$issue = $issue . "BATTERY CAPACITY WARNING! ";
$status = 1;
}
if ($output_load > 80) {
$status = 1;
$issue = $issue . "OUTPUT LOAD WARNING! ";
}
if ($test_result eq "2") {
$issue = $issue . "SELF TEST FAILED! ";
$status = 1;
}
if ($input_voltage < 1){
$status = 2;
$issue = $issue . "RUNNING ON BATTERY! ";
}
if ($battery_capacity < 25) {
$issue = $issue . "BATTERY RUNNING LOW! ";
$status = 2;
}
if ($output_load > 90) {
$issue = $issue . "HIGH OUTPUT LOAD! ";
$status = 2;
}
if ($battery_replace eq "2") {
$issue = $issue . "REPLACE BATTERY! ";
$status = 2;
}
# Modified by Pall Sigurdsson <palli@opensource.is> to add some perfdata
# Modified 2010-06-03
my $perfdata="| 'battery_capacity'=$battery_capacity% 'temperature'=$battery_temperature 'input_voltage'=$input_voltage input_frequency=$input_frequency output_voltage=$output_voltage output_frequency=$output_frequency output_load=$output_load%";
if ($status == 0){
$temp = sprintf "$upstype - BATTERY:(capacity $battery_capacity%%, temperature $battery_temperature C, runtime $battery_runtimeremain) INPUT:(voltage $input_voltage V, frequency $input_frequency Hz) OUTPUT:(voltage $output_voltage V, frequency $output_frequency Hz, load $output_load%%) SELF TEST:($test_result_string on $test_date) LAST EVENT:($outagecause) $perfdata";
}
else {
$temp = sprintf "$issue - $upstype - BATTERY:(capacity $battery_capacity%%, temperature $battery_temperature C, runtime $battery_runtimeremain) INPUT:(voltage $input_voltage V, frequency $input_frequency Hz) OUTPUT:(voltage $output_voltage V, frequency $output_frequency Hz, load $output_load%%) LAST EVENT:$outagecause $perfdata ";
}
append($temp);
}
####################################################################
# help and usage information #
####################################################################
sub usage {
print << "USAGE";
-----------------------------------------------------------------
$script v$script_version
Monitors APC SmartUPS via AP9617 SNMP management card.
Usage: $script -H <hostname> -c <community> [...]
Options: -H Hostname or IP address
-C Community (default is public)
-----------------------------------------------------------------
Copyright 2004 Altinity Limited
This program is free software; you can redistribute it or modify
it under the terms of the GNU General Public License
-----------------------------------------------------------------
USAGE
exit 1;
}
####################################################################
# Appends string to existing $returnstring #
####################################################################
sub append {
my $appendstring = @_[0];
$returnstring = "$returnstring$appendstring";
}

View File

@ -2,8 +2,8 @@
Summary: A Nagios plugin to check SMTP blacklists
Name: nagios-okplugin-mailblacklist
Version: 0.0.1
Release: 1%{?dist}
Version: 1.1
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-MailBlacklist
@ -11,7 +11,8 @@ Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bl/releases/%
Requires: nagios-plugins
Requires: nagios-plugins-perl
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
Packager: Gardar Thorsteinsson <gardar@ok.is>
BuildArch: noarch
%description
@ -21,6 +22,8 @@ Checks DNS Blacklists for existance of hosts
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_bl
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
%build
@ -37,5 +40,17 @@ rm -rf %{buildroot}
%{_libdir}/nagios/plugins/*
%changelog
* Fri May 04 2018 Richard Allen <ra@ok.is> 1.1-2
- Filter out perl-utils dependancy
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
-
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.0-1
- Updated buildarch to noarch (tommi@tommi.org)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.2-1
- new package built with tito
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -1,160 +0,0 @@
#!/usr/bin/perl -w
#
# check_bl plugin for nagios
# $Revision: 1.0 $
#
# Nagios plugin designed to warn you if you mail servers appear in one of the
# many anti-spam 'blacklists'
#
# By Sam Bashton, Bashton Ltd
# bashton.com/content/nagios-plugins
#
# 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
use strict;
use lib "/usr/lib/nagios/plugins";
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::DNS;
use vars qw($PROGNAME);
my ($verbose,$host),;
my ($opt_V,$opt_h,$opt_B,$opt_H,$opt_c);
$opt_V = $opt_h = $opt_B = $opt_H = $opt_c = '';
my $state = 'UNKNOWN';
sub print_help();
sub print_usage();
$PROGNAME = "check_bl";
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
$ENV{'PATH'}='';
$ENV{'LC_ALL'}='C';
use Getopt::Long;
Getopt::Long::Configure('bundling');
GetOptions(
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"B=s" => \$opt_B, "blacklists=s" => \$opt_B,
"c=s" => \$opt_c, "critical=s" => \$opt_c
);
# -h means display verbose help screen
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
# -V means display version number
if ($opt_V) {
print_revision($PROGNAME,'$Revision: 1.0 $ ');
exit $ERRORS{'OK'};
}
# First check the hostname is OK..
unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; }
if (! utils::is_hostname($opt_H)){
print "$opt_H is not a valid host name\n";
print_usage();
exit $ERRORS{"UNKNOWN"};
}else{
if ($opt_H =~ /[a-zA-Z]/ )
# If the host contains letters we assume it's a hostname, not an IP
{
$host = lookup($opt_H);
}
else { $host = $opt_H }
}
# $opt_c is a count of the blacklists a mail server is in,
# after which state will be CRITICAL rather than WARNING
# By default any listing is CRITICAL
my $critcount = 0;
if ($opt_c) { $critcount = $opt_c };
# $opt_B is a comma seperated list of blacklists
$opt_B = shift unless ($opt_B);
unless ($opt_B) { print_usage(); exit -1 }
my @bls = split(/,/, $opt_B);
# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
print ("ERROR: No response from BL server (alarm)\n");
exit $ERRORS{"UNKNOWN"};
};
alarm($TIMEOUT);
my %listed; # Hash of blacklists we're listed in.
foreach(@bls)
{
if (blcheck($host,$_)) { $listed{$_} = 1 }
}
if (scalar(keys(%listed)) == 0) { $state = 'OK' }
elsif (scalar(keys(%listed)) < $critcount) { $state = 'WARNING' }
else { $state = 'CRITICAL' }
if (%listed)
{
print "Listed at";
foreach (keys(%listed)) { print " $_" }
print "\n";
}
else { print "Not black-listed\n" }
exit $ERRORS{$state};
######## Subroutines ==========================
sub print_help() {
print_revision($PROGNAME,'$Revision: 1.0 $ ');
print "\n";
support();
}
sub print_usage () {
print "Usage: \n";
print " $PROGNAME -H host -B [blacklist1],[blacklist2] [-c critnum]\n";
print " $PROGNAME [-h | --help]\n";
print " $PROGNAME [-V | --version]\n";
}
sub blcheck
{
my ($ip, $bl) = @_;
my $lookupip = $ip;
$lookupip =~
s/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/$4.$3.$2.$1.$bl/;
if (lookup($lookupip)) { return 1 }
else { return 0 }
}
sub lookup
{
my $tolookup = shift;
my $res = Net::DNS::Resolver->new;
my $query = $res->search($tolookup);
if ($query)
{
foreach my $rr ($query->answer)
{
next unless $rr->type eq "A"; # We're not interested in TXT records
return $rr->address;
}
}
}

View File

@ -1,44 +0,0 @@
Nagios check_bl plugin (C)Copyright 2005 Bashton Ltd
----------------------------------------------------
A Nagios plugin to check whether a server is in any known anti-spam
blocklists. Licensed under the GNU GPL v2.0 or later (at your option). For
full copyright and warranty details, please see the COPYING file included in
this package.
By Sam Bashton, Bashton Ltd - sam@bashton.com www.bashton.com
Comments, bug reports etc are welcome.
Pre-Requisites
--------------
- Working Nagios install
- Perl 5 (tested with Perl 5.6.1 and 5.8)
- Net::DNS Perl library and associated dependencies
Installation
------------
- Copy to your nagios plugins directory (possibly /usr/lib/nagios/plugins)
- Add the following to your checkcommands.cfg:
define command{
command_name check_bl
command_line $USER1$/check_bl -H $HOSTADDRESS$ -B sbl-xbl.spamhaus.or
g,bl.spamcop.net,t1.dnsbl.net.au
}
- Alter your services.cfg to include a check against the check_bl command
Variables
---------
check_bl requires the following variables:
-H host : Hostname to check
-B blacklist1,blacklist2 : Comma separated list of blacklists to check against
The following optional variable is also available:
-c critnum : Number of blacklists the server must be listed in before the status is 'critical'. By default, any listing is regarded as critical.

View File

@ -1,41 +0,0 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check SMTP blacklists
Name: nagios-okplugin-mailblacklist
Version: 0.0.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-MailBlacklist
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bl/releases/%{name}-%{version}.tar.gz
Requires: nagios-plugins
Requires: nagios-plugins-perl
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
%description
Checks DNS Blacklists for existance of hosts
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_bl
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_bl %{buildroot}%{_libdir}/nagios/plugins/check_bl
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README COPYING
%{_libdir}/nagios/plugins/*
%changelog
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -2,8 +2,8 @@
Summary: A Nagios plugin to check network bond devices
Name: nagios-okplugin-bond
Version: 0.0.1
Release: 2%{?dist}
Version: 0.0.4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Bond
@ -40,6 +40,16 @@ rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 0.0.4-1
- Merge pull request #5 from pallvalmundsson/check_yum_security_patch (palli-
github@minor.is)
* Wed Mar 13 2013 Pall Sigurdsson <palli@opensource.is> 0.0.3-1
-
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.2-1
- new package built with tito
* Sun Oct 16 2011 Tomas Edwardsson <tommi@opensource.is> 0.1-2
- Added configuration into package

View File

@ -1,125 +0,0 @@
#!/usr/bin/python
# Copyright 2010, Tomas Edwardsson
#
# check_bond.py 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 3 of the License, or
# (at your option) any later version.
#
# check_bond.py 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/>.
import pprint
import re
import sys
import getopt
def readbond( interface ):
intfile = "/proc/net/bonding/%s" % interface
# Read interface info
try:
bondfh = open (intfile, 'r')
except IOError, (errno, strerror):
print "Unable to open bond %s: %s" % (intfile, strerror)
sys.exit(3)
except:
print "Unexpected error:", sys.exc_info()[0]
sys.exit(3)
# Initialize bond data
bond = {}
bond['slaves'] = []
# Which interface are we working with
current_int = ''
# Loop throught the file contents
for line in bondfh.readlines():
# Remove newlines and split on colon, ignore other
try:
k, v = line.replace('\n', '').split(': ', 1)
except:
pass
# Remove leading whitespaces
k = re.sub('^\s*', '', k)
# Bonding mode for the channel
if k == "Bonding Mode":
bond['bonding_mode'] = v
# Record current slave interface
elif k == "Slave Interface":
current_int = v
# Slave interface mii status
elif current_int and k == "MII Status":
bond['slaves'].append( { 'int' : current_int, 'mii_status' : v })
# Bond mii status
elif k == "MII Status":
bond['mii_status'] = v
return bond
def usage():
print "Usage: %s -i bond0" % sys.argv[0]
sys.exit(3)
def main(argv):
# Set variables
interface = ''
outstring = ''
retval = 0
# Nagios return code states
states = { 0 : 'OK', 1 : 'Warning', 2 : 'Critical', 3 : 'Unknown' }
# Try to read the arguments
try:
opts, args = getopt.getopt(argv, "hi:", ["help", "interface="])
except getopt.GetoptError:
usage()
sys.exit(3)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit(3)
elif opt in ("-i", "--interface"):
interface = arg
if (interface == ""):
usage()
sys.exit(3)
bond = readbond(interface)
# The whole bond is down
if bond['mii_status'] != 'up':
print "Critical: bonding device %s %s" % (interface, bond['mii_status'])
sys.exit(2)
# Some interface in the bond is down
for slave in bond['slaves']:
if slave['mii_status'] != 'up':
outstring = "%s%s down " % (outstring, slave['int'])
if retval < 1:
retval = 1
if retval:
print "%s: %s%s %s" % (states[retval], outstring, "in bonding device", interface)
sys.exit(retval)
print "OK: bonding device %s up and running" % interface
sys.exit(0)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@ -1,39 +0,0 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check network bond devices
Name: nagios-okplugin-bond
Version: 0.0.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Bond
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bond/releases/%{name}-%{version}.tar.gz
Requires: nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
%description
Checks the network bond device on a Linux machine
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_bond %{buildroot}%{_libdir}/nagios/plugins/check_bond
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README
%{_libdir}/nagios/plugins/*
%changelog
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -1,3 +0,0 @@
check_bond
Simple Nagios plugin that checks the status of bond devices

View File

@ -2,15 +2,15 @@
Summary: A Nagios plugin to check Brocade devices
Name: nagios-okplugin-brocade
Version: 0.0.3
Release: 1%{?dist}
Version: 0.0.5
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_brocade/releases/nagios-okplugin-brocade-%{version}.tar.gz
Requires: perl-Nagios-Plugin
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
Packager: Gardar Thorsteinsson <gardar@ok.is>
%description
@ -20,6 +20,8 @@ Checks Brocade devices
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_brocade_env
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
%build
@ -36,5 +38,14 @@ rm -rf %{buildroot}
%{_libdir}/nagios/plugins/*
%changelog
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 0.0.5-2
- filter out perl-utils dep
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 0.0.5-1
-
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.4-1
- new package built with tito
* Mon Nov 21 2010 Tomas Edwardsson <tommi@ok.is> 0.0.3-1
- Initial packaging

View File

@ -23,7 +23,7 @@ use Nagios::Plugin;
# Create the Nagios plugin object
my $np = Nagios::Plugin->new(
usage => "Usage: %s -H <hostname> -u <username> -p <password> -s <share>",
version => "0.01",
version => "1.0",
);
# Add valid arguments

View File

@ -2,8 +2,8 @@
Summary: A Nagios plugin to check CIFS shares
Name: nagios-okplugin-cifs
Version: 0.0.3
Release: 1%{?dist}
Version: 1.1
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade
@ -11,7 +11,8 @@ Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_cifs/releases
Requires: perl-Nagios-Plugin
Requires: samba-client, krb5-workstation
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
Packager: Gardar Thorsteinsson <gardar@ok.is>
BuildArch: noarch
%description
@ -22,6 +23,8 @@ NTML authentication
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_cifs
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
%build
@ -38,5 +41,18 @@ rm -rf %{buildroot}
%{_libdir}/nagios/plugins/*
%changelog
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 1.1-2
- Filter out perl-utils dep
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 1.1-1
- Merge github.com:opinkerfi/misc (palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.0-1
- version number of scripts bumped (palli@opensource.is)
- Updates buildarch to noarch (tommi@tommi.org)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.4-1
- new package built with tito
* Mon Nov 21 2010 Tomas Edwardsson <tommi@ok.is> 0.0.3-1
- Initial packaging

View File

@ -0,0 +1,59 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check CPU on Linux servers
Name: nagios-okplugin-check_cpu
Version: 1.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://github.com/opinkerfi/nagios-plugins/
Source0: https://github.com/opinkerfi/nagios-plugins/archive/%{name}-%{version}-%{release}.tar.gz
Requires: nagios-okplugin-common
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@tommi.org>
BuildArch: noarch
%description
Check cpu states on line machines
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 okplugin_check_cpu %{buildroot}%{_libdir}/nagios/plugins/okplugin_check_cpu
install -D -p -m 0755 nrpe.d/okplugin_check_cpu.cfg %{buildroot}/etc/nrpe.d/okplugin_check_cpu.cfg
%clean
rm -rf %{buildroot}
%post
/sbin/service nrpe reload
%files
%defattr(-,root,root,-)
%{_libdir}/nagios/plugins/*
%{_sysconfdir}/nrpe.d/*
%changelog
* Mon Jan 20 2014 Tomas Edwardsson <tommi@tommi.org> 1.1-1
- new package built with tito
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.0-1
- Version number bumped
- Updates buildarch to noarch (tommi@tommi.org)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.3-1
- new package built with tito
* Thu Nov 25 2010 Pall Sigurdsson <palli@opensource.is> 0.1-2
- Nrpe config now ships with plugin by default
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1
- Initial packaging

View File

@ -0,0 +1 @@
command[okplugin_check_cpu]=/usr/lib/nagios/plugins/okplugin_check_cpu

View File

@ -0,0 +1,131 @@
#!/usr/bin/python
#
# Copyright 2014, Tomas Edwardsson
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
"""
Gathers information on cpu usage on a linux machine
It returns performance data for both the last 5 seconds and from last run.
"""
from pynag.Plugins import PluginHelper, ok, unknown
import os
import time
def main():
"""The main logic of the program"""
# See man proc and search for /proc/stat
stat_fields = ['cpu', 'user', 'nice', 'system', 'idle', 'iowait', 'irq',
'softirq', 'steal', 'guest', 'guest_nice']
pyplug = PluginHelper()
# Get the statistics from last run
old_stat = get_saved_stat()
# Get current state
stat = get_stat()
# Resample
time.sleep(5)
stat2 = get_stat()
try:
save_stat(stat)
except IOError, err:
pyplug.exit(unknown, "Unable to save cpu statistics: %s" % err)
# Calculate averages for the last few seconds
current_averages = diff_stats(stat2, stat)
for pos in range(len(current_averages)):
pyplug.add_metric(label=stat_fields[pos+1],
value=current_averages[pos],
uom="%")
# Calculate averages from last run
if old_stat:
last_run_avg = diff_stats(old_stat, stat)
for pos in range(len(current_averages)):
pyplug.add_metric(label=stat_fields[pos+1]+"_avg",
value=last_run_avg[pos],
uom="%")
pyplug.add_status(ok)
pyplug.add_summary("CPU load %.2f%%" % (100.0 - current_averages[3]))
pyplug.exit()
def diff_stats(older, newer):
"""Calculates the percentage between two stat arrays"""
if older:
diff = []
for pos in range(len(newer)):
diff.append(newer[pos] - older[pos])
averages = calc_avg(diff)
else:
averages = calc_avg(newer)
return averages
def remove_stale_state():
"""Removes the last state file if we have rebooted"""
try:
state_mtime = os.stat("/var/lib/nagios-okplugin/check_cpu").st_mtime
boot_time = os.stat("/proc/1").st_mtime
if state_mtime < boot_time:
os.unlink("/var/lib/nagios-okplugin/check_cpu")
except OSError:
return None
return state_mtime
def calc_avg(stat):
"""Calculates the average of each int in array"""
stat_sum = sum(stat)
avg = []
for pos in range(len(stat)):
avg.append(float(stat[pos]) / stat_sum * 100)
return avg
def get_stat():
"""Fetches the first line from /proc/stat and returns the numbers"""
stat_fh = open("/proc/stat")
return [int(pos) for pos in stat_fh.readline().split()[1:]]
def get_saved_stat():
"""Fetches information about the last run to be able to do averages"""
remove_stale_state()
try:
stat_fh = open("/var/lib/nagios-okplugin/check_cpu")
except IOError:
return None
return [int(pos) for pos in stat_fh.readline().split()[1:]]
def save_stat(stat):
"""Save statistics to compare to in next run"""
stat_fh = open("/var/lib/nagios-okplugin/check_cpu", "w")
stat_fh.write("cpu " + " ".join([str(pos) for pos in stat]) + "\n")
stat_fh.close()
if __name__ == "__main__":
main()
# vim: sts=4 expandtab

View File

@ -167,6 +167,11 @@ must be lower than the critical level!"
exit $ST_UK
fi
fi
which bc >> /dev/null
if [ $? -gt 0 ]; then
echo "UNKNOWN - command 'bc' not found in path. Exiting..."
exit 3
fi
get_cpuvals
do_output

View File

@ -2,15 +2,16 @@
Summary: A Nagios plugin to check CPU on Linux servers
Name: nagios-plugins-check_cpu
Version: 0.2
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.matejunkie.com/cpu-check-plugin-for-nagios/
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_cpu/releases/nagios-plugins-check_cpu-%{version}.tar.gz
Requires: nrpe
Requires: nrpe bc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
BuildArch: noarch
%description
This shell script checks cpu utilization (user,system,iowait,idle in %)
@ -33,6 +34,9 @@ install -D -p -m 0755 nrpe.d/check_cpu.cfg %{buildroot}/etc/nrpe.d/check_cpu.cfg
%clean
rm -rf %{buildroot}
%post
/sbin/service nrpe reload
%files
%defattr(-,root,root,-)
#%doc README LICENSE
@ -41,6 +45,18 @@ rm -rf %{buildroot}
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- Added nrpe reload to post section (tommi@tommi.org)
- Merge github.com:opinkerfi/misc (palli@opensource.is)
- Added dependency on bc (palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.0-1
- Version number bumped
- Updates buildarch to noarch (tommi@tommi.org)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.3-1
- new package built with tito
* Thu Nov 25 2010 Pall Sigurdsson <palli@opensource.is> 0.1-2
- Nrpe config now ships with plugin by default
* Mon Mar 1 2010 Tomas Edwardsson <tommi@ok.is> 0.1-1

View File

@ -64,7 +64,6 @@ def check_tablespaces():
global default_warning_threshold
global nagios_status
warn = default_warning_threshold
warn = 60
max_size = i['max_size'] * 1024
curr_size = i['curr_size'] * 1024
occupancy = 100.0 * curr_size / max_size

View File

@ -2,7 +2,7 @@
Summary: Nagios Plugins to monitor HP Dataprotector
Name: nagios-okplugin-check_dataprotector
Version: AUTOVERSION
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
@ -45,5 +45,12 @@ rm -rf %{buildroot}
/etc/nrpe.d/check_dataprotector.cfg
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- removed warning threshold of 60 (palli@opensource.is)
- contrib removed from plugin path (palli@opensource.is)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 1.0.1-1
- new package built with tito
* Mon Sep 15 2010 Pall Sigurdsson <palli@opensource.is> 0.1-1
- Initial packaging

View File

@ -0,0 +1,8 @@
command[check_dp_pool]=/usr/lib/nagios/plugins/check_dp_pool "$ARG1$"
command[check_dp_tablespace]=/usr/lib/nagios/plugins/check_dp_tablespace
command[check_dp_services]=/usr/lib/nagios/plugins/check_dp_services
command[check_dp_mountrequest]=/usr/lib/nagios/plugins/check_dp_mountrequest
command[check_dp_idb]=/usr/lib/nagios/plugins/check_dp_idb
command[check_dp_backups]=/usr/lib/nagios/plugins/check_dp_backups

View File

@ -1,7 +0,0 @@
command[check_dp_pool]=/usr/lib/nagios/plugins/contrib/check_dp_pool "$ARG1$"
command[check_dp_tablespace]=/usr/lib/nagios/plugins/contrib/check_dp_tablespace
command[check_dp_services]=/usr/lib/nagios/plugins/contrib/check_dp_services
command[check_dp_mountrequest]=/usr/lib/nagios/plugins/contrib/check_dp_mountrequest
command[check_dp_idb]=/usr/lib/nagios/plugins/contrib/check_dp_idb

View File

@ -24,6 +24,7 @@
-h | --help : Display this help
-w | --warning : % free space to send warning alert (default 10)
-c | --critical : % free space to send critical alert (default 5)
-I | --inodes : Check for inodes
-H | --host : host you want to check by NRPE (default localhost)
-u | --user : user for NRPE connection (default nagios)
-i | --ignore : Filesystem you want to ignore
@ -94,6 +95,9 @@ not be used.
$Log: check_disk.pl,v $
Revision 1.10 2013/03/01 14:28:00 tryggvi@ok.is
o Added support for inodes
Revision 1.9 2010/02/27 00:55:00 palli@ok.is
o Changed UNKNOWN return code from -1 to 3
o Modified to use check_nrpe instead of ssh
@ -129,7 +133,7 @@ use Pod::Usage;
use strict;
my ($opt_c, $opt_w, $opt_h, $opt_i,$opt_f,$opt_s,$opt_u,$opt_H,$opt_C,$opt_v,
$opt_html, $opt_srvperf, $opt_r, $opt_R);
$opt_html, $opt_srvperf, $opt_r, $opt_R, $opt_inodes);
$ENV{'PATH'} = "/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/usr/local/libexec:/usr/libexec:/usr/local/nagios/libexec";
@ -140,12 +144,13 @@ $opt_c = "5"; # Valeur par defaut de critical
$opt_H = "localhost";
$opt_R = q/^$/;
$opt_r = "";
my $cmd = "/bin/df -k";
my $multiply = 1024; # For bytes
my $exclude_re = "(^//|^none)";
my %alldisks; # Tous les disques trouves avec la commande df
my %checkdisks; # seulement les disque a verifier
my $cmd = "/bin/df -k";
my $output ;
my $retour = 'OK';
my %EXIT_CODES = (
@ -168,6 +173,7 @@ GetOptions(
"i=s" => \$opt_i, "ignore=s" => \$opt_i,
"f=s" => \$opt_f, "filesystem=s" => \$opt_f,
"C=s" => \$opt_C, "conf=s" => \$opt_C,
"I" => \$opt_inodes, "inodes" => \$opt_inodes,
"v" => \$opt_v, "verbose" => \$opt_v,
"r=s" => \$opt_r, "R=s" => \$opt_R,
"html" => \$opt_html,
@ -197,26 +203,37 @@ my $args;
# ->{critical} : taux critique en % espace libre
#
if(defined($opt_inodes)){
# Using -i for inodes
$cmd = "/bin/df -i";
$multiply = 1000;
}
#Si on est en local inutile de faire du nrpe
if($opt_H ne "localhost" and $opt_H ne "127.0.0.1") {
#$cmd = "ssh $opt_u\@$opt_H '$cmd'";
$cmd = "check_nrpe -H $opt_H -c get_disks";
if(defined($opt_inodes)){
$cmd = "check_nrpe -H $opt_H -c get_disks_inodes";
} else {
$cmd = "check_nrpe -H $opt_H -c get_disks";
}
#$cmd = "cat /tmp/df";
#print "$cmd";
}
# Envoi commande et renseignement Hashage %disks
my @output = `$cmd`;
my $ret = $?;
$ret >>= 8;
if ($ret == -1) {
print "Could not find " . (split(' ', $cmd))[0] . "\n";
exit $EXIT_CODES{'UNKNOWN'};
}
$ret >>= 8;
# 2010/02/25 palli@ok.is : Check if $cmd ran successfully
if ($ret > 0) {
if ($ret > 1) {
print "Failed to execute $cmd: " . join("\n", @output) . "\n";
exit $EXIT_CODES{'UNKNOWN'} ;
}
@ -234,16 +251,16 @@ if ($ret > 0) {
#
foreach my $l (@output) {
next if ($l =~ m/$opt_R/);
next if ($l !~ m/$opt_r/);
next if ($l =~ m/$exclude_re/);
if($l =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+([\/\w\d\.-]+)$/) {
next if ($l =~ m/$opt_R/);
next if ($l !~ m/$opt_r/);
next if ($l =~ m/$exclude_re/);
my ($s,$u,$f,$pu,$d) = ($1,$2,$3,$4,$5);
$alldisks{$d}->{pused} = $pu;
$alldisks{$d}->{pfree} = 100-$pu;
$alldisks{$d}->{somme} = $s*1024;
$alldisks{$d}->{used} = $u*1024;
$alldisks{$d}->{free} = $f*1024;
$alldisks{$d}->{somme} = $s*$multiply;
$alldisks{$d}->{used} = $u*$multiply;
$alldisks{$d}->{free} = $f*$multiply;
# par defaut on prend les taux Warn et Crit specifies
updateRates($d,$opt_w,$opt_c,$alldisks{$d}->{somme});
@ -251,16 +268,16 @@ foreach my $l (@output) {
# This is the output of df.exe on Windows
#C:\ 9097126 6094081 3003045 67% argon-c (ntfs)
else {
if ($l =~ /(\w)\:\\\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)$/) {
next if ($l =~ m/$opt_R/);
next if ($l !~ m/$opt_r/);
next if ($l =~ m/$exclude_re/);
if ($l =~ /(\w)\:\\\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)$/) {
my ($d,$s,$u,$f,$pu) = ("/$1",$2,$3,$4,$5);
$alldisks{$d}->{pused} = $pu;
$alldisks{$d}->{pfree} = 100-$pu;
$alldisks{$d}->{somme} = $s*1024;
$alldisks{$d}->{used} = $u*1024;
$alldisks{$d}->{free} = $f*1024;
$alldisks{$d}->{somme} = $s*$multiply;
$alldisks{$d}->{used} = $u*$multiply;
$alldisks{$d}->{free} = $f*$multiply;
#print $l;
#print "pused = $pu\n";
#print "pfree = 100-$pu\n";
@ -307,7 +324,7 @@ if($opt_f) {
if(defined($alldisks{$f})) {
$checkdisks{$f}=$alldisks{$f};
}
} elsif ($f =~ /([\/\w\d]+)\:(\w+)\:(\w+)/) {
} elsif ($f =~ /^(.+?)\:(\w+)\:(\w+)/) {
if(defined($alldisks{$1})) {
$checkdisks{$1}=$alldisks{$1};
updateRates($1,$2,$3,$checkdisks{$1}->{somme});
@ -437,14 +454,15 @@ sub byte2percent {
print "Erreur : unite inconnue ($unit)\n";
return 0;
}
if($unit eq 'K') {
$return = sprintf("%d",100*(1024*$value)/$max);
$return = sprintf("%d",100*($multiply*$value)/$max);
} elsif ($unit eq 'M') {
$return = sprintf("%d",100*(1024*1024*$value)/$max);
$return = sprintf("%d",100*($multiply*$multiply*$value)/$max);
} elsif ($unit eq 'G') {
$return = sprintf("%d",100*(1024*1024*1024*$value)/$max);
$return = sprintf("%d",100*($multiply*$multiply*$multiply*$value)/$max);
} elsif ($unit eq 'T') {
$return = sprintf("%d",100*(1024*1024*1024*1024*$value)/$max);
$return = sprintf("%d",100*($multiply*$multiply*$multiply*$multiply*$value)/$max);
}
#Borne a 100 %
if($return > 100) {
@ -459,8 +477,8 @@ sub byte2human {
my @units = qw/B K M G T/;
while (($value / 1024) >= 1) {
$value /= 1024;
while (($value / $multiply) >= 1) {
$value /= $multiply;
$i++;
}
return sprintf('%.1f%s',$value, $units[$i]);

View File

@ -2,8 +2,8 @@
Summary: A Nagios plugin to check disks via NRPE
Name: nagios-okplugin-check_disks
Version: AUTOVERSION
Release: 2%{?dist}
Version: 1.0.7
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_disks
@ -40,6 +40,29 @@ rm -rf %{buildroot}
%{_libdir}/nagios/plugins/check_disks.pl
%changelog
* Wed Oct 29 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.7-1
- Fix invalid regex if mountpoint has . in path (tommi@tommi.org)
- Regex filtering broke disk checks (tommi@tommi.org)
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.6-1
- Bumped version
* Tue Mar 25 2014 Tomas Edwardsson <tommi@tommi.org> 1.0.5-1
- Added support for inodes (tryggvi@linux.is)
* Sat Mar 02 2013 Tryggvi Farestveit <tryggvi@linux.is> 1.0.4-1
- Added support for inodes
* Wed May 16 2012 Tomas Edwardsson <tommi@tommi.org> 1.0.3-1
- Updated version of nagios-okplugin-check_disks (tommi@tommi.org)
- Issue #56, temporary fix for selinux and disk checks (tommi@tommi.org)
* Mon May 16 2012 Tomas Edwardsson <tommi@opensource.is> 1.0.2-1
- Ignore warning states from nrpe
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 1.0.1-1
- new package built with tito
* Sun Oct 16 2011 Tomas Edwardsson <tommi@opensource.is> 0.1-2
- Fixed dependencies and build arch

View File

@ -0,0 +1,59 @@
%define debug_package %{nil}
%define plugin_name check_drbd
Summary: A Nagios plugin to check Linux Devicemapper Multipathing
Name: nagios-okplugin-%{plugin_name}
Version: 0.0.4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/%{plugin_name}
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{plugin_name}/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
%description
%{summary}
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/%{plugin_name}.cfg
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_drbd %{buildroot}%{_libdir}/nagios/plugins/check_drbd
install -D -p -m 0755 nrpe.d/%{plugin_name}.cfg %{buildroot}/etc/nrpe.d/%{plugin_name}.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
#%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/%{plugin_name}.cfg
%changelog
* Wed Mar 14 2012 Pall Sigurdsson <palli@opensource.is> 0.0.4-1
- licence and readme removed from specfile (palli@opensource.is)
* Wed Mar 14 2012 Pall Sigurdsson <palli@opensource.is>
- licence and readme removed from specfile (palli@opensource.is)
* Wed Mar 14 2012 Pall Sigurdsson <palli@opensource.is>
- licence and readme removed from specfile (palli@opensource.is)
* Wed Mar 14 2012 Pall Sigurdsson <palli@opensource.is>
- licence and readme removed from specfile (palli@opensource.is)
* Wed Mar 14 2012 Pall Sigurdsson <palli@opensource.is> 0.0.3-1
- new package built with tito
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.2-1
- new package built with tito

View File

@ -288,7 +288,7 @@ sub check_disk {
}
close (NAVICLIOUT);
if ($disk_ok_count eq 0) {
print "No disk were founded !\n";
print "No disk were found !\n";
$state = 'UNKNOWN';
} elsif ($crit_count > 0) {
$state='CRITICAL';

767
check_eva/check_eva.py Normal file
View File

@ -0,0 +1,767 @@
#!/usr/bin/python
#
# Copyright 2010, Pall Sigurdsson <palli@opensource.is>
#
# check_eva.py 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 3 of the License, or
# (at your option) any later version.
#
# check_eva.py 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/>.
# About this script
#
# This script will check the status of all EVA arrays via the sssu binary.
# You will need the sssu binary in path (/usr/bin/sssu is a good place)
# If you do not have sssu, check your commandview CD, it should have both
# binaries for Windows and Linux
# Some Defaults
show_perfdata = True
show_longserviceoutput = True
debugging = False
# check_eva defaults
hostname = "localhost"
username = "eva"
password = "eva1234"
mode = "check_systems"
path = ''
nagios_server = "94.142.154.10"
nagios_port = 80
nagios_myhostname = None
do_phone_home = False
escape_newlines = False
check_system = None # By default check all systems
proxyserver = None
timeout = 0 # 0 means no timeout
# set to true, if you do not have sssu binary handy
server_side_troubleshooting = False
# No real need to change anything below here
version = "1.0.1"
ok = 0
warning = 1
critical = 2
unknown = 3
not_present = -1
state = {}
state[not_present] = "Not Present"
state[ok] = "OK"
state[warning] = "Warning"
state[critical] = "Critical"
state[unknown] = "Unknown"
longserviceoutput = "\n"
perfdata = ""
valid_modes = ("check_systems", "check_controllers", "check_diskgroups",
"check_disks", "check_diskshelfs", "check_diskshelves")
from sys import exit
from sys import argv
from os import getenv, environ
import signal
import subprocess
import xmlrpclib
import httplib
# we need to set socket default timeout in case we are using the phone-home part
import socket
socket.setdefaulttimeout(5)
def print_help():
print "check_eva version %s" % version
print "This plugin checks HP EVA Array with the sssu command"
print ""
print "Usage: %s [OPTIONS]" % argv[0]
print "OPTIONS:"
print " [--host <host>]"
print " [--username <user>]"
print " [--password <password]"
print " [--path </path/to/sssu>]"
print " [--mode <mode>] "
print " [--test]"
print " [--timeout <timeout>]"
print " [--debug]"
print " [--help]"
print ""
print " Valid modes are: %s" % ', '.join(valid_modes)
print ""
print "Example: %s --host commandview.example.net --username eva --password myPassword --mode check_systems" % (argv[0])
def error(errortext):
print "* Error: %s" % errortext
print_help()
print "* Error: %s" % errortext
exit(unknown)
def debug(debugtext):
global debugging
if debugging:
print debugtext
# parse arguments
arguments = argv[1:]
while len(arguments) > 0:
arg = arguments.pop(0)
if arg == 'invalid':
pass
elif arg == '-H' or arg == '--host':
hostname = arguments.pop(0)
elif arg == '-U' or arg == '--username':
username = arguments.pop(0)
elif arg == '-P' or arg == '--password':
password = arguments.pop(0)
elif arg == '-T' or arg == '--test':
testmode = 1
elif arg == '--timeout':
timeout = int(arguments.pop(0))
elif arg == '--path':
path = arguments.pop(0) + '/'
elif arg == '-M' or arg == '--mode':
mode = arguments.pop(0)
if mode not in valid_modes:
error("Invalid --mode %s" % arg)
elif arg == '-d' or arg == '--debug':
debugging = True
elif arg == '--longserviceoutput':
show_longserviceoutput = True
elif arg == '--no-longserviceoutput':
show_longserviceoutput = False
elif arg == '--perfdata':
show_perfdata = True
elif arg == '--no-perfdata':
show_perfdata = False
elif arg == '--nagios_myhostname':
nagios_myhostname = arguments.pop(0)
elif arg == '--nagios_server':
nagios_server = arguments.pop(0)
elif arg == '--nagios_port':
nagios_port = arguments.pop(0)
elif arg == '--system':
check_system = arguments.pop(0)
elif arg == '--phone-home':
do_phone_home = True
elif arg == '--proxy':
proxyserver = arguments.pop(0)
elif arg == '--escape-newlines':
escape_newlines = True
elif arg == '-h' or arg == '--help':
print_help()
exit(ok)
else:
error("Invalid argument %s" % arg)
subitems = {}
subitems['fan'] = 'fans'
subitems['source'] = 'powersources'
subitems['hostport'] = 'hostports'
subitems['module'] = 'modules'
subitems['sensor'] = 'sensors'
subitems['powersupply'] = 'powersupplies'
subitems['bus'] = 'communicationbuses'
subitems['port'] = 'fibrechannelports'
def runCommand(command):
""" runCommand: Runs command from the shell prompt. Exit Nagios style if unsuccessful """
proc = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,)
stdout, stderr = proc.communicate('through stdin to stdout')
if proc.returncode > 0:
print "Error %s: %s\n command was: '%s'" % (proc.returncode, stderr.strip(), command)
# File not found, lets print path
if proc.returncode == 127 or proc.returncode == 1:
path = getenv("PATH")
print "Current Path: %s" % path
exit(unknown)
else:
return stdout
def run_sssu(system=None, command="ls system full"):
"""Runs the sssu command. This one is responsible for error checking from sssu"""
commands = []
continue_on_error = "set option on_error=continue"
login = "select manager %s USERNAME=%s PASSWORD=%s" % (
hostname, username, password)
commands.append(continue_on_error)
commands.append(login)
if system is not None:
commands.append('select SYSTEM "%s"' % system)
commands.append(command)
commandstring = "sssu "
for i in commands:
commandstring += '"%s" ' % i
global server_side_troubleshooting
if server_side_troubleshooting == True:
commandstring = 'cat "debug/%s"' % command
# print mystring
# if command == "ls system full":
# output = runCommand("cat sssu.out")
# elif command == "ls disk_groups full":
# output = runCommand("cat ls_disk*")
# elif command == "ls controller full":
# output = runCommand("cat ls_controller")
# else:
# print "What command is this?", command
# exit(unknown)
output = runCommand(commandstring)
debug(commandstring)
output = output.split('\n')
# Lets process the top few results from the sssu command. Make sure the
# results make sense
error = 0
if output.pop(0).strip() != '':
error = 1
if output.pop(0).strip() != '':
error = 2
if output.pop(0).strip().find('SSSU for HP') != 0:
error = 3
if output.pop(0).strip().find('Version:') != 0:
error = 4
if output.pop(0).strip().find('Build:') != 0:
error = 5
if output.pop(0).strip().find('NoSystemSelected> ') != 0:
error = 6
#if output.pop(0).strip() != '': error = 1
#if output.pop(0).strip().find('NoSystemSelected> ') != 0: error=1
#if output.pop(0).strip() != '': error = 1
str_buffer = ""
for i in output:
str_buffer = str_buffer + i + "\n"
if i.find('Error') > -1:
print "This is the command i was trying to execute: %s" % i
error = 1
if i.find('information:') > 0:
break
if error > 0:
print "Error running the sssu command: " + str(error)
print commandstring
print str_buffer
exit(unknown)
objects = []
current_object = None
for line in output:
if len(line) == 0:
continue
line = line.strip()
tmp = line.split()
if len(tmp) == 0:
if current_object:
if not current_object['master'] in objects:
objects.append(current_object['master'])
current_object = None
continue
key = tmp[0].strip()
if current_object and not current_object['master'] in objects:
objects.append(current_object['master'])
if key == 'object':
current_object = {}
current_object['master'] = current_object
if key == 'controllertemperaturestatus':
current_object = current_object['master']
if key == 'iomodules':
key = 'modules'
# if key in subitems.values():
# object['master'][key] = []
if key in subitems.keys():
mastergroup = subitems[key]
master = current_object['master']
current_object = {}
current_object['object_type'] = key
current_object['master'] = master
if not current_object['master'].has_key(mastergroup):
current_object['master'][mastergroup] = []
current_object['master'][mastergroup].append(current_object)
if line.find('.:') > 0:
# We work on first come, first serve basis, so if
# we accidentally see same key again, we will ignore
if not current_object.has_key(key):
value = ' '.join(tmp[2:]).strip()
current_object[key] = value
# Check if we were instructed to check only one eva system
global check_system
if command == "ls system full" and check_system is not None:
tmp_objects = []
for i in objects:
if i['objectname'] == check_system:
tmp_objects.append(i)
objects = tmp_objects
return objects
def end(summary, perfdata, longserviceoutput, nagios_state):
global show_longserviceoutput
global show_perfdata
global nagios_server
global do_phone_home
global nagios_port
global nagios_myhostname
global hostname
global mode
global escape_newlines
global check_system
message = "%s - %s" % (state[nagios_state], summary)
if show_perfdata:
message = "%s | %s" % (message, perfdata)
if show_longserviceoutput:
message = "%s\n%s" % (message, longserviceoutput.strip())
if escape_newlines == True:
lines = message.split('\n')
message = '\\n'.join(lines)
debug("do_phone_home = %s" % do_phone_home)
if do_phone_home == True:
try:
if nagios_myhostname is None:
if environ.has_key('HOSTNAME'):
nagios_myhostname = environ['HOSTNAME']
elif environ.has_key('COMPUTERNAME'):
nagios_myhostname = environ['COMPUTERNAME']
else:
nagios_myhostname = hostname
try:
phone_home(nagios_server,
nagios_port,
status=nagios_state,
message=message,
hostname=nagios_myhostname,
servicename=mode,
system=check_system
)
except Exception:
pass
except:
raise
print message
exit(nagios_state)
class ProxiedTransport(xmlrpclib.Transport):
def set_proxy(self, proxy):
self.proxy = proxy
def make_connection(self, host):
self.realhost = host
h = httplib.HTTP(self.proxy)
return h
def send_request(self, connection, handler, request_body):
connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
def send_host(self, connection, host):
connection.putheader('Host', self.realhost)
def phone_home(nagios_server, nagios_port, status, message, hostname=None, servicename=None, system=None):
"""phone_home: Sends results to remote nagios server via python xml-rpc"""
debug("phoning home: %s" % servicename)
if system is not None:
servicename = str(servicename) + str(system)
uri = "http://%s:%s" % (nagios_server, nagios_port)
global proxyserver
if proxyserver is not None:
p = ProxiedTransport()
p.set_proxy(proxyserver)
s = xmlrpclib.Server(uri, transport=p)
else:
s = xmlrpclib.ServerProxy(uri)
s.nagiosupdate(hostname, servicename, status, message)
return 0
def check_systems():
summary = ""
perfdata = ""
# longserviceoutput="\n"
nagios_state = ok
objects = run_sssu()
for i in objects:
name = i['objectname']
operationalstate = i['operationalstate']
# Lets see if this array is working
if operationalstate != 'good':
nagios_state = max(nagios_state, warning)
# Lets add to the summary
summary += " %s=%s " % (name, operationalstate)
# Collect the performance data
interesting_perfdata = 'totalstoragespace|usedstoragespace|availablestoragespace'
perfdata += get_perfdata(
i, interesting_perfdata.split('|'), identifier="%s_" % name)
# Collect extra info for longserviceoutput
longoutput("%s = %s (%s)\n" %
(i['objectname'], i['operationalstate'], i['operationalstatedetail']))
interesting_fields = 'licensestate|systemtype|firmwareversion|nscfwversion|totalstoragespace|usedstoragespace|availablestoragespace'
for x in interesting_fields.split('|'):
longoutput("- %s = %s \n" % (x, i[x]))
longoutput("\n")
end(summary, perfdata, longserviceoutput, nagios_state)
def get_perfdata(my_object, interesting_fields, identifier=""):
perfdata = ""
for i in interesting_fields:
if i == '':
continue
perfdata += "'%s%s'=%s " % (identifier, i, my_object[i])
return perfdata
def add_perfdata(text):
global perfdata
text = text.strip()
perfdata += " %s " % text
def longoutput(text):
global longserviceoutput
longserviceoutput = longserviceoutput + text
def get_longserviceoutput(my_object, interesting_fields):
longserviceoutput = ""
for i in interesting_fields:
longserviceoutput += "%s = %s \n" % (i, my_object[i])
return longserviceoutput
def check_operationalstate(my_object, print_failed_objects=False, namefield='objectname', detailfield='operationalstatedetail', statefield='operationalstate', valid_states=None):
if not valid_states:
valid_states = ['good']
if not my_object.has_key(detailfield):
detailfield = statefield
if not my_object.has_key(statefield):
if print_failed_objects:
longoutput("- Warning, %s does not have any '%s'" %
(my_object[namefield], statefield))
return warning
if my_object[statefield] not in valid_states:
if print_failed_objects:
longoutput("- Warning, %s=%s (%s)\n" %
(my_object[namefield], my_object['operationalstate'], my_object[detailfield]))
return warning
debug("OK, %s=%s (%s)\n" %
(my_object[namefield], my_object['operationalstate'], my_object[detailfield]))
return ok
def check_generic(command="ls disk full", namefield="objectname", perfdata_fields=None, longserviceoutputfields=None, detailedsummary=False):
if not perfdata_fields:
perfdata_fields = []
if not longserviceoutputfields:
longserviceoutputfields = []
global perfdata
nagios_state = ok
systems = run_sssu()
objects = []
if command == 'ls system full':
objects = systems
for i in systems:
i['systemname'] = '' # i['objectname']
else:
for i in systems:
result = run_sssu(system=i['objectname'], command=command)
for x in result:
x['systemname'] = i['objectname']
objects.append(x)
summary = "%s objects found " % len(objects)
usedstoragespacegb = 0
occupancyalarmlvel = 0
warninggb = 0
for i in objects:
systemname = i['systemname']
# Some versions of commandview use "objectname" instead of namefield
if i.has_key(namefield):
objectname = i[namefield]
else:
objectname = i['objectname']
# Some versions of CV also return garbage objects, luckily it is easy
# to find these
if i.has_key('objecttype') and i['objecttype'] == 'typenotset':
longoutput(
"Object %s was skipped because objecttype == typenotset\n" % objectname)
continue
# Lets see if this object is working
nagios_state = max(check_operationalstate(i), nagios_state)
# Lets add to the summary
if i['operationalstate'] != 'good' or detailedsummary == True:
summary += " %s/%s=%s " % (
systemname, objectname, i['operationalstate'])
# Lets get some perfdata
identifier = "%s/%s_" % (systemname, objectname)
i['identifier'] = identifier
for field in perfdata_fields:
if field == '':
continue
add_perfdata("'%s%s'=%s " %
(identifier, field, i.get(field, None)))
# Disk group gets a special perfdata treatment
if command == "ls disk_group full":
totalstoragespacegb = float(i['totalstoragespacegb'])
usedstoragespacegb = float(i['usedstoragespacegb'])
occupancyalarmlvel = float(i['occupancyalarmlevel'])
warninggb = totalstoragespacegb * occupancyalarmlvel / 100
add_perfdata(" '%sdiskusage'=%s;%s;%s " %
(identifier, usedstoragespacegb, warninggb, totalstoragespacegb))
# Long Serviceoutput
# There are usually to many disks for nagios to display. Skip.
if command != "ls disk full":
longoutput("\n%s/%s = %s (%s)\n" %
(systemname, objectname, i['operationalstate'], i['operationalstatedetail']))
# If diskgroup has a problem because it is over allocated. Lets inform
# about that
if command == "ls disk_group full" and usedstoragespacegb > warninggb:
longoutput(
"- %s - diskgroup usage is over %s%% threshold !\n" %
(state[warning], occupancyalarmlvel))
# If a disk has a problem, lets display some extra info on it
elif command == "ls disk full" and i['operationalstate'] != 'good':
longoutput("Warning - %s=%s (%s)\n" %
(i['diskname'], i['operationalstate'], i['operationalstatedetail']))
fields = "modelnumber firmwareversion serialnumber failurepredicted diskdrivetype".split(
)
for field in fields:
longoutput("- %s = %s\n" % (field, i[field]))
nagios_state = max(nagios_state, check_multiple_objects(i, 'sensors'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'fans'))
nagios_state = max(
nagios_state, check_multiple_objects(i, 'powersupplies'))
nagios_state = max(
nagios_state, check_multiple_objects(i, 'communicationbuses'))
nagios_state = max(
nagios_state, check_multiple_objects(i, 'fibrechannelports'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'modules'))
for x in longserviceoutputfields:
if i.has_key(x):
longoutput("- %s = %s\n" % (x, i[x]))
end(summary, perfdata, longserviceoutput, nagios_state)
def check_multiple_objects(my_object, name):
item_status = not_present
if my_object.has_key(name):
item_status = not_present
valid_states = ['good']
namefield = "name"
detailfield = 'operationalstatedetail'
if name == 'fans' or name == 'sensors':
valid_states = [
'good', 'notavailable', 'unsupported', 'notinstalled']
elif name == 'fibrechannelports':
valid_states.append('notinstalled')
num_items = len(my_object[name])
for item in my_object[name]:
stat = check_operationalstate(
item, print_failed_objects=True, namefield=namefield, valid_states=valid_states, detailfield=detailfield)
item_status = max(stat, item_status)
longoutput('- %s on %s (%s detected)\n' %
(state[item_status], name, num_items))
add_perfdata(" '%s%s'=%s" %
(my_object['identifier'], name, num_items))
return item_status
def check_controllers():
perfdata = ""
# longserviceoutput="\n"
nagios_state = ok
systems = run_sssu()
controllers = []
for i in systems:
result = run_sssu(system=i['objectname'], command="ls controller full")
for controller in result:
controller['systemname'] = i['objectname']
controllers.append(controller)
summary = "%s objects found " % len(controllers)
for i in controllers:
systemname = i['systemname']
if i.has_key('controllername'):
controllername = i['controllername']
else:
controllername = i['objectname']
# Lets see if this controller is working
nagios_state = max(check_operationalstate(i), nagios_state)
# Lets add to the summary
if not i.has_key('operationalstate'):
summary += " %s does not have any operationalstate " % controllername
nagios_state = max(unknown, nagios_state)
continue
elif i['operationalstate'] != 'good':
summary += " %s/%s=%s " % (
systemname, controllername, i['operationalstate'])
# Lets get some perfdata
interesting_fields = "controllermainmemory"
identifier = "%s/%s_" % (systemname, controllername)
perfdata += get_perfdata(
i, interesting_fields.split('|'), identifier=identifier)
# Long Serviceoutput
#longserviceoutput = longserviceoutput + get_longserviceoutput(i, interesting_fields.split('|') )
#longserviceoutput = longserviceoutput + "\n%s/%s\n"%(systemname,controllername)
longoutput("\n%s/%s = %s (%s)\n" %
(systemname, controllername, i['operationalstate'], i['operationalstatedetail']))
longoutput("- firmwareversion = %s \n" % (i['firmwareversion']))
longoutput("- serialnumber = %s \n" % (i['serialnumber']))
controllertemperaturestatus = not_present
fanstate = not_present
hostportstate = not_present
sensorstate = ok
source_state = not_present
module_state = not_present
# Check the cache status
if i['cachecondition'] == 'good':
cache_state = ok
else:
cache_state = warning
# Check Temperature
if i.has_key("controllertemperaturestatus"):
if i['controllertemperaturestatus'] == 'normal':
controllertemperaturestatus = ok
else:
controllertemperaturestatus = warning
# Process the subsensors
for hostport in i['hostports']:
#long(" %s = %s\n" % (hostport['portname'], hostport['operationalstate']))
hostportstate = max(hostportstate, ok)
if hostport['operationalstate'] != 'good':
hostportstate = max(warning, hostportstate)
message = "Hostport %s state = %s\n" % (
hostport['portname'], hostport['operationalstate'])
longoutput(message)
if i.has_key('fans'):
for fan in i['fans']:
fanstate = max(fanstate, ok)
#long(" %s = %s\n" % (fan['fanname'], fan['status']))
if fan.has_key('status'):
status = fan['status']
elif fan.has_key('installstatus'):
status = fan['installstatus']
if status != 'normal' and status != 'yes':
fanstate = max(warning, fanstate)
longoutput("Fan %s status = %s\n" %
(fan['fanname'], status))
if i.has_key('powersources'):
for source in i['powersources']:
source_state = max(source_state, ok)
if not source.has_key('status'):
continue
if source['state'] != 'good':
source_state = max(warning, source_state)
longoutput("Powersource %s status = %s\n" %
(source['type'], source['state']))
if i.has_key('modules'):
for module in i['modules']:
module_state = max(module_state, ok)
if module['operationalstate'] not in ('good', 'not_present'):
module_state = max(warning, module_state)
longoutput("Battery Module %s status = %s\n" %
(module['name'], module['operationalstate']))
for i in (fanstate, hostportstate, sensorstate, source_state, module_state, cache_state, controllertemperaturestatus):
nagios_state = max(nagios_state, i)
longoutput("- %s on fans\n" % (state[fanstate]))
longoutput("- %s on cachememory\n" % (state[cache_state]))
longoutput("- %s on temperature\n" %
(state[controllertemperaturestatus]))
longoutput("- %s on hostports\n" % (state[hostportstate]))
longoutput("- %s on sensors\n" % (state[sensorstate]))
longoutput("- %s on powersupplies\n" % (state[source_state]))
longoutput("- %s on batterymodules\n" % (state[module_state]))
longoutput('\n')
end(summary, perfdata, longserviceoutput, nagios_state)
def set_path():
global path
current_path = getenv('PATH')
if path == '':
if current_path.find('C:\\') > -1: # We are on this platform
path = ";C:\\Program Files\\Hewlett-Packard\\Sanworks\\Element Manager for StorageWorks HSV"
else:
path = ":/usr/local/bin"
current_path = "%s%s" % (current_path, path)
environ['PATH'] = current_path
set_path()
# Create an alarm so that plugin can exit properly if timeout occurs
exit_with_timeout = lambda x, y: error("Timeout of %s seconds exceeded" % timeout)
signal.signal(signal.SIGALRM, exit_with_timeout)
signal.alarm(timeout)
if mode == 'check_systems':
perfdata_fields = 'totalstoragespace usedstoragespace availablestoragespace'.split(
)
longserviceoutputfields = 'licensestate systemtype firmwareversion nscfwversion totalstoragespace usedstoragespace availablestoragespace'.split(
)
command = "ls system full"
namefield = "objectname"
check_generic(command=command, namefield=namefield,
longserviceoutputfields=longserviceoutputfields, perfdata_fields=perfdata_fields)
elif mode == 'check_controllers':
check_controllers()
elif mode == 'check_diskgroups':
command = "ls disk_group full"
namefield = 'diskgroupname'
longserviceoutputfields = "totaldisks levelingstate levelingprogress totalstoragespacegb usedstoragespacegb occupancyalarmlevel".split(
)
perfdata_fields = "totaldisks".split()
check_generic(command=command, namefield=namefield,
longserviceoutputfields=longserviceoutputfields, perfdata_fields=perfdata_fields)
elif mode == 'check_disks':
check_generic(command="ls disk full", namefield="objectname")
elif mode == 'check_diskshelfs' or mode == 'check_diskshelves':
check_generic(command="ls diskshelf full", namefield="diskshelfname",
longserviceoutputfields=[], perfdata_fields=[])
else:
print "* Error: Mode %s not found" % mode
print_help()
print "* Error: Mode %s not found" % mode
exit(unknown)

View File

@ -0,0 +1,67 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check HP EVA Disk Systems
Name: nagios-okplugin-check_eva
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_eva
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_eva/releases/nagios-okplugin-check_eva-%{version}.tar.gz
Requires: sssu,nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
%description
Checks HP EVA Disk Systems with the sssu binary
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_eva.cfg
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_eva.py %{buildroot}%{_libdir}/nagios/plugins/check_eva.py
install -D -p -m 0755 nrpe.d/check_eva.cfg %{buildroot}/etc/nrpe.d/check_eva.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_eva.cfg
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- Merge pull request #10 from gitmopp/patch-2 (palli-github@minor.is)
- bug in for loop. Looped only once (mopp@gmx.net)
- Fixed output to be more compatible (mopp@gmx.net)
- check_eva new Make sure --timeout is an integer (palli@opensource.is)
- check_eva new command line option --timeout (palli@opensource.is)
- check_eva Fix undefined fix typos (palli@opensource.is)
- PEP8 cleanup (palli@opensource.is)
- merged (palli@opensource.is)
- check_eva - minor bugfixes (palli@opensource.is)
- check_eva.py more code cleanup with pycharm inspections (palli@opensource.is)
- check_eva.py - Make code more readable (palli@opensource.is)
- convert from tabs to spaces (palli@opensource.is)
- check_eva - fix mixed tab/spaces (palli@opensource.is)
- Update check_eva.py (sander.grendelman@gmail.com)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.0.2-1
- changed sssu subcommands from being singlequoted to doublequoted for windows
compatibility (palli@opensource.is)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 1.0.1-1
- new package built with tito
* Mon Mar 1 2010 Pall Sigurdsson <palli@opensource.is> 0.1-1
- Initial packaging

View File

@ -1,693 +0,0 @@
#!/usr/bin/python
#
# Copyright 2010, Pall Sigurdsson <palli@opensource.is>
#
# check_eva.py 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 3 of the License, or
# (at your option) any later version.
#
# check_eva.py 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/>.
# About this script
#
# This script will check the status of all EVA arrays via the sssu binary.
# You will need the sssu binary in path (/usr/bin/sssu is a good place)
# If you do not have sssu, check your commandview CD, it should have both
# binaries for Windows and Linux
# Some Defaults
show_perfdata = True
show_longserviceoutput = True
debugging = False
# check_eva defaults
hostname="localhost"
username="eva"
password="eva1234"
mode="check_systems"
path=''
nagios_server = "94.142.154.10"
nagios_port = 80
nagios_myhostname = None
do_phone_home = False
escape_newlines = False
check_system = None # By default check all systems
proxyserver = None
server_side_troubleshooting = False # set to true, if you do not have sssu binary handy
# No real need to change anything below here
version="1.0"
ok=0
warning=1
critical=2
unknown=3
not_present = -1
state = {}
state[not_present] = "Not Present"
state[ok] = "OK"
state[warning] = "Warning"
state[critical] = "Critical"
state[unknown] = "Unknown"
longserviceoutput="\n"
perfdata=""
valid_modes = ( "check_systems", "check_controllers", "check_diskgroups","check_disks", "check_diskshelfs", "check_diskshelves")
from sys import exit
from sys import argv
from os import getenv,putenv,environ
import subprocess
import xmlrpclib,httplib
import socket
socket.setdefaulttimeout(5)
def print_help():
print "check_eva version %s" % version
print "This plugin checks HP EVA Array with the sssu command"
print ""
print "Usage: %s [OPTIONS]" % argv[0]
print "OPTIONS:"
print " [--host <host>]"
print " [--username <user>]"
print " [--password <password]"
print " [--path </path/to/sssu>]"
print " [--mode <mode>] "
print " [--test]"
print " [--debug]"
print " [--help]"
print ""
print " Valid modes are: %s" % ', '.join(valid_modes)
print ""
print "Example: %s --host commandview.example.net --username eva --password myPassword --mode check_systems" % (argv[0])
def error(errortext):
print "* Error: %s" % errortext
print_help()
print "* Error: %s" % errortext
exit(unknown)
def debug( debugtext ):
global debugging
if debugging:
print debugtext
# parse arguments
arguments=argv[1:]
while len(arguments) > 0:
arg=arguments.pop(0)
if arg == 'invalid':
pass
elif arg == '-H' or arg == '--host':
hostname=arguments.pop(0)
elif arg == '-U' or arg == '--username':
username=arguments.pop(0)
elif arg == '-P' or arg == '--password':
password = arguments.pop(0)
elif arg == '-T' or arg == '--test':
testmode=1
elif arg == '--path':
path = arguments.pop(0) + '/'
elif arg == '-M' or arg == '--mode':
mode=arguments.pop(0)
if mode not in valid_modes:
error("Invalid --mode %s" % arg)
elif arg == '-d' or arg == '--debug':
debugging=True
elif arg == '--longserviceoutput':
show_longserviceoutput = True
elif arg == '--no-longserviceoutput':
show_longserviceoutput = False
elif arg == '--perfdata':
show_perfdata = True
elif arg == '--no-perfdata':
show_perfdata = False
elif arg == '--nagios_myhostname':
nagios_myhostname = arguments.pop(0)
elif arg == '--nagios_server':
nagios_server = arguments.pop(0)
elif arg == '--nagios_port':
nagios_port = arguments.pop(0)
elif arg == '--system':
check_system = arguments.pop(0)
elif arg == '--phone-home':
do_phone_home = True
elif arg == '--proxy':
proxyserver = arguments.pop(0)
elif arg == '--escape-newlines':
escape_newlines = True
elif arg == '-h' or arg == '--help':
print_help()
exit(ok)
else:
error( "Invalid argument %s"% arg)
subitems = {}
subitems['fan'] = 'fans'
subitems['source'] = 'powersources'
subitems['hostport'] = 'hostports'
subitems['module'] = 'modules'
subitems['sensor'] = 'sensors'
subitems['powersupply'] = 'powersupplies'
subitems['bus'] = 'communicationbuses'
subitems['port'] = 'fibrechannelports'
'''runCommand: Runs command from the shell prompt. Exit Nagios style if unsuccessful'''
def runCommand(command):
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE,)
stdout, stderr = proc.communicate('through stdin to stdout')
if proc.returncode > 0:
print "Error %s: %s\n command was: '%s'" % (proc.returncode,stderr.strip(),command)
if proc.returncode == 127 or proc.returncode == 1: # File not found, lets print path
path=getenv("PATH")
print "Current Path: %s" % (path)
exit(unknown)
else:
return stdout
'''Runs the sssu command. This one is responsible for error checking from sssu'''
def run_sssu(system=None, command="ls system full"):
commands = []
continue_on_error="set option on_error=continue"
login="select manager %s USERNAME=%s PASSWORD=%s"%(hostname,username,password)
commands.append(continue_on_error)
commands.append(login)
if system != None:
commands.append('select SYSTEM "%s"' % system)
commands.append(command)
commandstring = "sssu "
for i in commands: commandstring = commandstring + "'%s' " % i
global server_side_troubleshooting
if server_side_troubleshooting == True:
commandstring = 'cat "debug/%s"' % command
#print mystring
#if command == "ls system full":
# output = runCommand("cat sssu.out")
#elif command == "ls disk_groups full":
# output = runCommand("cat ls_disk*")
#elif command == "ls controller full":
# output = runCommand("cat ls_controller")
#else:
# print "What command is this?", command
# exit(unknown)
output = runCommand(commandstring)
debug( commandstring )
output = output.split('\n')
# Lets process the top few results from the sssu command. Make sure the results make sense
error = 0
if output.pop(0).strip() != '': error = 1
if output.pop(0).strip() != '': error = 1
if output.pop(0).strip() != 'SSSU for HP StorageWorks Command View EVA': error = 1
if output.pop(0).strip().find('Version:') != 0: error=1
if output.pop(0).strip().find('Build:') != 0: error=1
if output.pop(0).strip().find('NoSystemSelected> ') != 0: error=1
#if output.pop(0).strip() != '': error = 1
#if output.pop(0).strip().find('NoSystemSelected> ') != 0: error=1
#if output.pop(0).strip() != '': error = 1
buffer = ""
for i in output:
buffer = buffer + i + "\n"
if i.find('Error') > -1:
print "This is the command i was trying to execute: %s" % i
error = 1
if i.find('information:') > 0: break
if error > 0:
print "Error running the sssu command"
print commandstring
print buffer
exit(unknown)
objects = []
object = None
parent_object = None
for line in output:
if len(line) == 0:
continue
line = line.strip()
tmp = line.split()
if len(tmp) == 0:
if object:
if not object['master'] in objects: objects.append( object['master'] )
object = None
continue
key = tmp[0].strip()
if object and not object['master'] in objects: objects.append( object['master'] )
if key == 'object':
object = {}
object['master'] = object
if key == 'controllertemperaturestatus':
object = object['master']
if key == 'iomodules':
key = 'modules'
#if key in subitems.values():
# object['master'][key] = []
if key in subitems.keys():
mastergroup = subitems[key]
master = object['master']
object = {}
object['object_type'] = key
object['master'] = master
if not object['master'].has_key(mastergroup):
object['master'][mastergroup] = []
object['master'][mastergroup].append(object)
if line.find('.:') > 0:
# We work on first come, first serve basis, so if
# we accidentally see same key again, we will ignore
if not object.has_key(key):
value = ' '.join( tmp[2:] ).strip()
object[key] = value
# Check if we were instructed to check only one eva system
global check_system
if command == "ls system full" and check_system != None:
tmp_objects = []
for i in objects:
if i['objectname'] == check_system:
tmp_objects.append( i )
objects = tmp_objects
return objects
def end(summary,perfdata,longserviceoutput,nagios_state):
global show_longserviceoutput
global show_perfdata
global nagios_server
global do_phone_home
global nagios_port
global nagios_myhostname
global hostname
global mode
global escape_newlines
global check_system
message = "%s - %s" % ( state[nagios_state], summary)
if show_perfdata:
message = "%s | %s" % ( message, perfdata)
if show_longserviceoutput:
message = "%s\n%s" % ( message, longserviceoutput.strip())
if escape_newlines == True:
lines = message.split('\n')
message = '\\n'.join(lines)
debug( "do_phone_home = %s" %(do_phone_home) )
if do_phone_home == True:
try:
if nagios_myhostname is None:
if environ.has_key( 'HOSTNAME' ):
nagios_myhostname = environ['HOSTNAME']
elif environ.has_key( 'COMPUTERNAME' ):
nagios_myhostname = environ['COMPUTERNAME']
else:
nagios_myhostname = hostname
try: phone_home(nagios_server,nagios_port, status=nagios_state, message=message, hostname=nagios_myhostname, servicename=mode,system=check_system)
except:pass
except:
raise
print message
exit(nagios_state)
class ProxiedTransport(xmlrpclib.Transport):
def set_proxy(self, proxy):
self.proxy = proxy
def make_connection(self, host):
self.realhost = host
h = httplib.HTTP(self.proxy)
return h
def send_request(self, connection, handler, request_body):
connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
def send_host(self, connection, host):
connection.putheader('Host', self.realhost)
''' phone_home: Sends results to remote nagios server via python xml-rpc '''
def phone_home(nagios_server,nagios_port, status, message, hostname=None, servicename=None,system=None):
debug("phoning home: %s" % (servicename) )
if system is not None:
servicename = str(servicename) + str(system)
uri = "http://%s:%s" % (nagios_server,nagios_port)
global proxyserver
if proxyserver != None:
p = ProxiedTransport()
p.set_proxy(proxyserver)
s = xmlrpclib.Server( uri, transport=p )
else:
s = xmlrpclib.ServerProxy( uri )
s.nagiosupdate(hostname, servicename, status, message)
return 0
def check_systems():
summary=""
perfdata=""
#longserviceoutput="\n"
nagios_state = ok
objects = run_sssu()
for i in objects:
name = i['objectname']
operationalstate = i['operationalstate']
# Lets see if this array is working
if operationalstate != 'good':
nagios_state = max(nagios_state, warning)
# Lets add to the summary
summary = summary + " %s=%s " %(name, operationalstate)
# Collect the performance data
interesting_perfdata = 'totalstoragespace|usedstoragespace|availablestoragespace'
perfdata = perfdata + get_perfdata(i,interesting_perfdata.split('|'), identifier="%s_"% name)
# Collect extra info for longserviceoutput
long("%s = %s (%s)\n" % ( i['objectname'], i['operationalstate'], i['operationalstatedetail']) )
interesting_fields = 'licensestate|systemtype|firmwareversion|nscfwversion|totalstoragespace|usedstoragespace|availablestoragespace'
for x in interesting_fields.split('|'):
long( "- %s = %s \n" %(x, i[x]) )
long("\n")
end(summary,perfdata,longserviceoutput,nagios_state)
def get_perfdata(object, interesting_fields, identifier=""):
perfdata = ""
for i in interesting_fields:
if i == '': continue
perfdata = perfdata + "'%s%s'=%s " % (identifier, i, object[i])
return perfdata
def add_perfdata(text):
global perfdata
text = text.strip()
perfdata = perfdata + " %s " % (text)
def long(text):
global longserviceoutput
longserviceoutput = longserviceoutput + text
def get_longserviceoutput(object, interesting_fields):
longserviceoutput = ""
for i in interesting_fields:
longserviceoutput = longserviceoutput + "%s = %s \n" %(i, object[i])
return longserviceoutput
def check_operationalstate(object, print_failed_objects=False,namefield='objectname',detailfield='operationalstatedetail',statefield='operationalstate',valid_states=['good']):
if not object.has_key(detailfield): detailfield = statefield
if not object.has_key(statefield):
if print_failed_objects:
long("- Warning, %s does not have any '%s'" % ( object[namefield], statefield ) )
return warning
if object[statefield] not in valid_states:
if print_failed_objects:
long("- Warning, %s=%s (%s)\n" % ( object[namefield], object['operationalstate'], object[detailfield] ))
return warning
debug( "OK, %s=%s (%s)\n" % ( object[namefield], object['operationalstate'], object[detailfield] ) )
return ok
def check_generic(command="ls disk full",namefield="objectname", perfdata_fields=[], longserviceoutputfields=[], detailedsummary=False):
summary=""
global perfdata
nagios_state = ok
systems = run_sssu()
objects = []
if command == 'ls system full':
objects = systems
for i in systems: i['systemname'] = '' #i['objectname']
else:
for i in systems:
result = run_sssu(system=i['objectname'], command=command)
for x in result:
x['systemname'] = i['objectname']
objects.append( x )
summary = "%s objects found " % len(objects)
for i in objects:
systemname = i['systemname']
# Some versions of commandview use "objectname" instead of namefield
if i.has_key( namefield ):
objectname = i[namefield]
else:
objectname = i['objectname']
# Some versions of CV also return garbage objects, luckily it is easy to find these
if i.has_key('objecttype') and i['objecttype'] == 'typenotset':
long("Object %s was skipped because objecttype == typenotset\n" % objectname )
continue
# Lets see if this object is working
nagios_state = max( check_operationalstate(i), nagios_state )
# Lets add to the summary
if i['operationalstate'] != 'good' or detailedsummary == True:
summary = summary + " %s/%s=%s " %(systemname,objectname, i['operationalstate'])
# Lets get some perfdata
identifier = "%s/%s_" % (systemname,objectname)
i['identifier'] = identifier
for field in perfdata_fields:
if field == '': continue
add_perfdata( "'%s%s'=%s " % (identifier, field, i[field]) )
# Disk group gets a special perfdata treatment
if command == "ls disk_group full":
totalstoragespacegb= float( i['totalstoragespacegb'] )
usedstoragespacegb= float ( i['usedstoragespacegb'] )
occupancyalarmlvel = float( i['occupancyalarmlevel'] )
warninggb= totalstoragespacegb * occupancyalarmlvel / 100
add_perfdata( " '%sdiskusage'=%s;%s;%s "% (identifier, usedstoragespacegb,warninggb,totalstoragespacegb) )
# Long Serviceoutput
# There are usually to many disks for nagios to display. Skip.
if command != "ls disk full":
long( "\n%s/%s = %s (%s)\n"%(systemname,objectname,i['operationalstate'], i['operationalstatedetail']) )
# If diskgroup has a problem because it is over allocated. Lets inform about that
if command == "ls disk_group full" and usedstoragespacegb > warninggb:
long("- %s - diskgroup usage is over %s%% threshold !\n" % (state[warning], occupancyalarmlvel) )
# If a disk has a problem, lets display some extra info on it
elif command == "ls disk full" and i['operationalstate'] != 'good':
long( "Warning - %s=%s (%s)\n" % (i['diskname'], i['operationalstate'], i['operationalstatedetail'] ))
fields="modelnumber firmwareversion serialnumber failurepredicted diskdrivetype".split()
for field in fields:
long( "- %s = %s\n" % (field, i[field]) )
nagios_state = max(nagios_state, check_multiple_objects(i, 'sensors'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'fans'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'powersupplies'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'communicationbuses'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'fibrechannelports'))
nagios_state = max(nagios_state, check_multiple_objects(i, 'modules'))
for x in longserviceoutputfields:
if i.has_key( x ):
long( "- %s = %s\n" % (x, i[x]))
end(summary,perfdata,longserviceoutput,nagios_state)
def check_multiple_objects(object, name):
item_status = not_present
if object.has_key(name):
item_status = not_present
valid_states=['good']
namefield="name"
detailfield = 'operationalstatedetail'
if name == 'fans' or name == 'sensors':
valid_states = ['good','notavailable','unsupported','notinstalled']
elif name == 'fibrechannelports':
valid_states.append( 'notinstalled' )
num_items = len(object[name])
for item in object[name]:
stat = check_operationalstate( item,print_failed_objects=True, namefield=namefield, valid_states=valid_states,detailfield=detailfield)
item_status = max( stat, item_status )
long('- %s on %s (%s detected)\n'% (state[item_status], name, num_items) )
add_perfdata( " '%s%s'=%s" % (object['identifier'],name, num_items) )
return item_status
def check_controllers():
summary=""
perfdata=""
#longserviceoutput="\n"
nagios_state = ok
systems = run_sssu()
controllers =[]
for i in systems:
result = run_sssu(system=i['objectname'], command="ls controller full")
for controller in result:
controller['systemname'] = i['objectname']
controllers.append( controller )
summary = "%s objects found " % len(controllers)
for i in controllers:
systemname = i['systemname']
if i.has_key('controllername'):
controllername = i['controllername']
else:
controllername = i['objectname']
# Lets see if this controller is working
nagios_state = max( check_operationalstate(i), nagios_state )
# Lets add to the summary
if not i.has_key('operationalstate'):
summary = summary + " %s does not have any operationalstate " % controllername
nagios_state = max( unknown, nagios_state )
continue
elif i['operationalstate'] != 'good':
summary = summary + " %s/%s=%s " %(systemname,controllername, i['operationalstate'])
# Lets get some perfdata
interesting_fields = "controllermainmemory"
identifier = "%s/%s_" % (systemname,controllername)
perfdata = perfdata + get_perfdata(i, interesting_fields.split('|'), identifier=identifier)
# Long Serviceoutput
interesting_fields = "operationalstate|operationalstatedetail|firmwareversion|serialnumber"
#longserviceoutput = longserviceoutput + get_longserviceoutput(i, interesting_fields.split('|') )
#longserviceoutput = longserviceoutput + "\n%s/%s\n"%(systemname,controllername)
long( "\n%s/%s = %s (%s)\n"%(systemname,controllername,i['operationalstate'], i['operationalstatedetail']) )
long( "- firmwareversion = %s \n" %(i['firmwareversion']))
long( "- serialnumber = %s \n" %(i['serialnumber']))
controllertemperaturestatus = not_present
cache_state = not_present
fanstate = not_present
hostportstate = not_present
sensorstate = ok
source_state = not_present
module_state = not_present
# Check the cache status
if i['cachecondition'] == 'good':
cache_state = ok
else:
cache_state = warning
# Check Temperature
if i.has_key("controllertemperaturestatus"):
if i['controllertemperaturestatus'] == 'normal':
controllertemperaturestatus = ok
else:
controllertemperaturestatus = warning
# Process the subsensors
for hostport in i['hostports']:
#long(" %s = %s\n" % (hostport['portname'], hostport['operationalstate']))
hostportstate = max(hostportstate,ok)
if hostport['operationalstate'] != 'good':
hostportstate = max(warning,hostport_state)
long("Hostport %s state = %s\n" % hostport['portname'], hostport['operationalstate'])
if i.has_key('fans'):
for fan in i['fans']:
fanstate = max(fanstate,ok)
#long(" %s = %s\n" % (fan['fanname'], fan['status']))
if fan.has_key('status'): status = fan['status']
elif fan.has_key('installstatus'): status = fan['installstatus']
if status != 'normal' and status != 'yes':
fanstate = max(warning,fanstate)
long("Fan %s status = %s\n" % (fan['fanname'],status))
if i.has_key('powersources'):
for source in i['powersources']:
source_state = max(source_state,ok)
if not source.has_key('status'): continue
if source['state'] != 'good':
source_state = max(warning,source_state)
long("Powersource %s status = %s\n" % (source['type'],source['state']))
if i.has_key('modules'):
for module in i['modules']:
module_state = max(module_state,ok)
if module['operationalstate'] not in ('good','not_present'):
module_state = max(warning,module_state)
long("Battery Module %s status = %s\n" % (module['name'],module['operationalstate']))
for i in (fanstate,hostportstate,sensorstate,source_state,module_state,cache_state,controllertemperaturestatus):
nagios_state = max(nagios_state, i)
long("- %s on fans\n"%( state[fanstate] ) )
long("- %s on cachememory\n"%( state[cache_state] ) )
long("- %s on temperature\n"%( state[controllertemperaturestatus] ) )
long("- %s on hostports\n"%( state[hostportstate] ) )
long("- %s on sensors\n"%( state[sensorstate] ) )
long("- %s on powersupplies\n"%( state[source_state] ) )
long("- %s on batterymodules\n"%( state[module_state] ) )
long('\n')
end(summary,perfdata,longserviceoutput,nagios_state)
def set_path():
global path
current_path = getenv('PATH')
if path == '':
if current_path.find('C:\\') > -1: # We are on this platform
path = ";C:\\Program Files\\Hewlett-Packard\\Sanworks\\Element Manager for StorageWorks HSV"
else:
path = ":/usr/local/bin"
current_path = "%s%s" % (current_path,path)
environ['PATH'] = current_path
set_path()
if mode == 'check_systems':
perfdata_fields = 'totalstoragespace usedstoragespace availablestoragespace'.split()
longserviceoutputfields = 'licensestate systemtype firmwareversion nscfwversion totalstoragespace usedstoragespace availablestoragespace'.split()
command = "ls system full"
namefield="objectname"
check_generic(command=command,namefield=namefield,longserviceoutputfields=longserviceoutputfields, perfdata_fields=perfdata_fields)
#check_systems
elif mode == 'check_controllers':
check_controllers()
elif mode == 'check_diskgroups':
command = "ls disk_group full"
namefield='diskgroupname'
longserviceoutputfields = "totaldisks levelingstate levelingprogress totalstoragespacegb usedstoragespacegb occupancyalarmlevel".split()
perfdata_fields="totaldisks".split()
check_generic(command=command,namefield=namefield,longserviceoutputfields=longserviceoutputfields, perfdata_fields=perfdata_fields)
elif mode == 'check_disks':
check_generic(command="ls disk full",namefield="objectname")
elif mode == 'check_diskshelfs' or mode == 'check_diskshelves':
check_generic(command="ls diskshelf full",namefield="diskshelfname",longserviceoutputfields=[], perfdata_fields=[])
else:
print "* Error: Mode %s not found" % mode
print_help()
print "* Error: Mode %s not found" % mode
exit(unknown)

View File

@ -1,44 +0,0 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check HP EVA Disk Systems
Name: nagios-okplugin-check_eva
Version: AUTOVERSION
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_eva
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_eva/releases/nagios-okplugin-check_eva-%{version}.tar.gz
Requires: sssu,nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
%description
Checks HP EVA Disk Systems with the sssu binary
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_eva.cfg
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_eva.py %{buildroot}%{_libdir}/nagios/plugins/check_eva.py
install -D -p -m 0755 nrpe.d/check_eva.cfg %{buildroot}/etc/nrpe.d/check_eva.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_eva.cfg
%changelog
* Mon Mar 1 2010 Pall Sigurdsson <palli@opensource.is> 0.1-1
- Initial packaging

View File

@ -0,0 +1,23 @@
#!/bin/bash
EXIT_OK=0
EXIT_WARN=1
EXIT_CRIT=2
PATH=/sbin:/usr/sbin:$PATH
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit $EXIT_CRIT
fi
blocks=$(iptables -L -v -n | egrep 'REJECT|DROP' | wc -l)
if [ $blocks -eq 0 ]; then
echo "CRITICAL: No firewall detected"
exit $EXIT_CRIT
fi
echo "OK: Firewall is active"
exit $EXIT_OK

View File

@ -0,0 +1,52 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check if iptables are actually enforcing rules
Name: nagios-okplugin-check_firewall_active
Version: 1.0.2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://github.com/opinkerfi/nagios-plugins/issues
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_firewall_active/releases/nagios-okplugin-check_firewall_active-%{version}.tar.gz
Requires: nagios-nrpe
Requires: iptables
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Richard Allen <ra@ok.is>
%description
A Nagios plugin to check if iptables are actually enforcing rules
%prep
%setup -q
#perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/check_firewall_active.cfg
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_firewall_active.sh %{buildroot}%{_libdir}/nagios/plugins/check_firewall_active.sh
install -D -p -m 0755 nrpe.d/check_firewall_active.cfg %{buildroot}/etc/nrpe.d/check_firewall_active.cfg
install -D -p -m 0644 sudoers.d/check_firewall_active %{buildroot}/etc/sudoers.d/check_firewall_active
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
#%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_firewall_active.cfg
/etc/sudoers.d/check_firewall_active
%post
restorecon -v %{_libdir}/nagios/plugins/check_firewall_active.sh /etc/nrpe.d/check_firewall_active.cfg /etc/sudoers.d/check_firewall_active
%changelog
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.1-1
* Thu Dec 21 2016 Gardar Thorsteinsson <gardart@gmail.com> 1.0.0-3
* Thu Dec 20 2016 Richard Allen <ra@ok.is> 0.1-1
- Initial packaging

View File

@ -0,0 +1,3 @@
command[check_firewall_active]=sudo /usr/lib64/nagios/plugins/check_firewall_active.sh

View File

@ -0,0 +1,2 @@
Defaults:nrpe !requiretty
nrpe ALL = (root) NOPASSWD: /usr/lib64/nagios/plugins/check_firewall_active.sh

View File

@ -0,0 +1,362 @@
#!/usr/bin/python
#
# Copyright 2010, Pall Sigurdsson <palli@opensource.is>
#
# check_hpacucli.py 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 3 of the License, or
# (at your option) any later version.
#
# check_hpacucli.py 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/>.
# About this script
#
# This script will check the status of Smart Array Raid Controller
# You need the hpacucli binary in path (/usr/sbin/hpacucli is a good place)
# hpacucli comes with the Proliant Support Pack (PSP) from HP
debugging = False
# No real need to change anything below here
version = "1.1"
ok = 0
warning = 1
critical = 2
unknown = 3
not_present = -1
nagios_status = -1
state = {}
state[not_present] = "Not Present"
state[ok] = "OK"
state[warning] = "Warning"
state[critical] = "Critical"
state[unknown] = "Unknown"
longserviceoutput = "\n"
perfdata = ""
summary = ""
sudo = False
from sys import exit
from sys import argv
from os import getenv, putenv, environ
import subprocess
def print_help():
print "check_hpacucli version %s" % version
print "This plugin checks HP Array with the hpacucli command"
print ""
print "Usage: %s " % argv[0]
print "Usage: %s [--help]" % argv[0]
print "Usage: %s [--version]" % argv[0]
print "Usage: %s [--path </path/to/hpacucli>]" % argv[0]
print "Usage: %s [--no-perfdata]" % argv[0]
print "Usage: %s [--no-longoutput]" % argv[0]
print ""
def error(errortext):
print "* Error: %s" % errortext
print_help()
print "* Error: %s" % errortext
exit(unknown)
def debug(debugtext):
global debugging
if debugging:
print debugtext
def runCommand(command):
""" Run command from the shell prompt. Exit Nagios style if unsuccessful"""
proc = subprocess.Popen(command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = proc.communicate('through stdin to stdout')
if proc.returncode > 0:
print "Error %s: %s\n command was: '%s'"\
% (proc.returncode, stderr.strip(), command)
debug("results: %s" % (stdout.strip()))
if proc.returncode == 127: # File not found, lets print path
path = getenv("PATH")
print "Check if your path is correct %s" % (path)
if stderr.find('Password:') == 0 and command.find('sudo') == 0:
print "Check if user is in the sudoers file"
if stderr.find('sorry, you must have a tty to run sudo') == 0 and command.find('sudo') == 0:
print "Please remove 'requiretty' from /etc/sudoers"
exit(unknown)
else:
return stdout
def end():
global summary
global longserviceoutput
global perfdata
global nagios_status
print "%s - %s | %s" % (state[nagios_status], summary, perfdata)
print longserviceoutput
if nagios_status < 0:
nagios_status = unknown
exit(nagios_status)
def add_perfdata(text):
global perfdata
text = text.strip()
perfdata = perfdata + " %s " % (text)
def add_long(text):
global longserviceoutput
longserviceoutput = longserviceoutput + text + '\n'
def add_summary(text):
global summary
summary = summary + text
def set_path(path):
current_path = getenv('PATH')
if current_path.find('C:\\') > -1: # We are on this platform
if path == '':
path = ";C:\Program Files\Hewlett-Packard\Sanworks\Element Manager for StorageWorks HSV"
path = path + ";C:\Program Files (x86)\Compaq\Hpacucli\Bin"
path = path + ";C:\Program Files\Compaq\Hpacucli\Bin"
else:
path = ';' + path
else: # Unix/Linux, etc
if path == '':
path = ":/usr/sbin"
else:
path = ':' + path
current_path = "%s%s" % (current_path, path)
environ['PATH'] = current_path
def run_hpacucli(run_type='controllers', controller=None):
if run_type == 'controllers':
command = "hpacucli controller all show detail"
elif run_type in ('logicaldisks', 'physicaldisks'):
if 'Slot' not in controller:
add_summary("Controller not found")
end()
identifier = 'slot=%s' % (controller['Slot'])
command = "hpacucli controller %s %s all show detail"
if run_type == 'logicaldisks':
subcommand = 'ld'
elif run_type == 'physicaldisks':
subcommand = 'pd'
else:
end()
return
command = command % (identifier, subcommand)
debug(command)
if sudo:
command = "sudo " + command
output = runCommand(command)
# Some basic error checking
error_strings = ['Permission denied']
error_strings.append('Error: You need to have administrator rights to continue.')
for error in error_strings:
if output.find(error) > -1 and output.find("sudo") != 0:
command = "sudo " + command
print command
output = runCommand(command)
output = output.split('\n')
objects = []
my_object = None
for i in output:
if len(i) == 0:
continue
if i.strip() == '':
continue
if i.startswith('Note:'):
continue
if run_type == 'controllers' and i[0] != ' ': # space on first line
if my_object and not my_object in objects:
objects.append(my_object)
my_object = {}
my_object['name'] = i
elif run_type == 'logicaldisks' and i.find('Logical Drive:') > 0:
if my_object and not my_object in objects:
objects.append(my_object)
my_object = {}
my_object['name'] = i.strip()
elif run_type == 'physicaldisks' and i.find('physicaldrive') > 0:
if my_object and not my_object in objects:
objects.append(my_object)
my_object = {}
my_object['name'] = i.strip()
else:
i = i.strip()
if i.find(':') < 1:
continue
i = i.split(':')
if i[0] == '':
continue # skip empty lines
if len(i) == 1:
continue
key = i[0].strip()
value = ' '.join(i[1:]).strip()
my_object[key] = value
if my_object and not my_object in objects:
objects.append(my_object)
return objects
controllers = []
def check_controllers():
global controllers
status = -1
controllers = run_hpacucli()
if len(controllers) == 0:
add_summary("No Disk Controllers Found. Exiting...")
global nagios_state
nagios_state = unknown
end()
add_summary("Found %s controllers" % (len(controllers)))
for i in controllers:
controller_status = check(i, 'Controller Status', 'OK')
status = max(status, controller_status)
cache_status = check(i, 'Cache Status')
status = max(status, cache_status)
controller_serial = 'n/a'
cache_serial = 'n/a'
if 'Serial Number' in i:
controller_serial = i['Serial Number']
if 'Cache Serial Number' in i:
cache_serial = i['Cache Serial Number']
add_long("%s" % (i['name']))
add_long("- Controller Status: %s (sn: %s)"
% (state[controller_status], controller_serial))
add_long("- Cache Status: %s (sn: %s)"
% (state[cache_status], cache_serial))
if controller_status > ok or cache_status > ok:
add_summary(";%s on %s;" % (state[controller_status], i['name']))
add_summary(', ')
return status
def check_logicaldisks():
global controllers
if len(controllers) < 1:
controllers = run_hpacucli()
logicaldisks = []
for controller in controllers:
for ld in run_hpacucli(run_type='logicaldisks',
controller=controller):
logicaldisks.append(ld)
status = -1
add_long("\nChecking logical Disks:")
add_summary("%s logicaldisks" % (len(logicaldisks)))
for i in logicaldisks:
ld_status = check(i, 'Status')
status = max(status, ld_status)
if i.get('Status') == 'Failed':
status = max(status, critical)
mount_point = i['Mount Points']
add_long("- %s (%s) = %s" % (i['name'], mount_point, state[ld_status]))
add_summary(". ")
def check_physicaldisks():
global controllers
disktype = 'physicaldisks'
if len(controllers) < 1:
controllers = run_hpacucli()
disks = []
for controller in controllers:
for disk in run_hpacucli(run_type=disktype, controller=controller):
disks.append(disk)
status = -1
add_long("\nChecking Physical Disks:")
add_summary("%s %s" % (len(disks), disktype))
for i in disks:
disk_status = check(i, 'Status')
status = max(status, disk_status)
size = i['Size']
firmware = i['Firmware Revision']
interface = i['Interface Type']
serial = i['Serial Number']
model = i['Model']
add_long("- %s, %s, %s = %s" %
(i['name'], interface, size, state[disk_status])
)
if disk_status > ok:
error_str = "-- Replace drive, firmware=%s, model=%s, serial=%s"
add_long(error_str % (firmware, model, serial))
if status > ok:
add_summary("(errors)")
add_summary(". ")
def check(my_object, field, valid_states=None):
if valid_states is None:
valid_states = ['OK']
state = -1
global nagios_status
if field in my_object:
if my_object[field] in valid_states:
state = ok
else:
state = warning
nagios_status = max(nagios_status, state)
return state
def parse_arguments():
arguments = argv[1:]
while len(arguments) > 0:
arg = arguments.pop(0)
if arg == '--help':
print_help()
exit(ok)
elif arg == '--path':
path = arguments.pop(0)
set_path(path)
elif arg == '--debug':
global debugging
debugging = True
elif arg == '--sudo':
global sudo
sudo = True
else:
print_help()
exit(unknown)
def main():
parse_arguments()
set_path('')
check_controllers()
check_logicaldisks()
check_physicaldisks()
end()
if __name__ == '__main__':
main()

View File

@ -2,7 +2,7 @@
Summary: A Nagios plugin to check HP Array with hpacucli
Name: nagios-okplugin-check_hpacucli
Version: 0.0.2
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
@ -19,6 +19,7 @@ Checks HP Array with hpacucli
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg
perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/*
%build
@ -27,6 +28,7 @@ perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg
rm -rf %{buildroot}
install -D -p -m 0755 check_hpacucli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpacucli.py
install -D -p -m 0755 nrpe.d/check_hpacucli.cfg %{buildroot}/etc/nrpe.d/check_hpacucli.cfg
install -D -p -m 0440 sudoers.d/check_hpacucli %{buildroot}/etc/sudoers.d/check_hpacucli
%clean
rm -rf %{buildroot}
@ -36,7 +38,28 @@ rm -rf %{buildroot}
%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_hpacucli.cfg
/etc/sudoers.d/check_hpacucli
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- check_hpacucli.py - fix typo in hpacucli command (palli@opensource.is)
- check_hpacucli.py: pep8 cleanup (palli@opensource.is)
- check_hpacucli - fix tab indentation (palli@opensource.is)
- check_hpacucli: ignore hpacucli output that starts with "Note:"
(palli@opensource.is)
- sudoers.d added to install (you@example.com)
- dummy commit (you@example.com)
- dummy commit (you@example.com)
- Add sudoers support to check_hpacucli (palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.2-2
- version number of scripts bumped (palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.2-1
- check_command is now sudo'ed (palli@opensource.is)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.3-1
- new package built with tito
* Mon Mar 1 2010 Pall Sigurdsson <palli@opensource.is> 0.1-1
- Initial packaging

View File

@ -0,0 +1,2 @@
command[check_hpacucli]=sudo /usr/lib/nagios/plugins/check_hpacucli.py

View File

@ -0,0 +1,2 @@
Defaults:nrpe !requiretty
nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpacucli.py

View File

@ -1,329 +0,0 @@
#!/usr/bin/python
#
# Copyright 2010, Pall Sigurdsson <palli@opensource.is>
#
# check_hpacucli.py 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 3 of the License, or
# (at your option) any later version.
#
# check_hpacucli.py 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/>.
# About this script
#
# This script will check the status of Smart Array Raid Controller
# You will need the hpacucli binary in path (/usr/sbin/hpacucli is a good place)
# hpacucli comes with the Proliant Support Pack (PSP) from HP
debugging = False
# No real need to change anything below here
version="1.0"
ok=0
warning=1
critical=2
unknown=3
not_present = -1
nagios_status = -1
state = {}
state[not_present] = "Not Present"
state[ok] = "OK"
state[warning] = "Warning"
state[critical] = "Critical"
state[unknown] = "Unknown"
longserviceoutput="\n"
perfdata=""
summary=""
sudo=False
from sys import exit
from sys import argv
from os import getenv,putenv,environ
import subprocess
def print_help():
print "check_hpacucli version %s" % version
print "This plugin checks HP Array with the hpacucli command"
print ""
print "Usage: %s " % argv[0]
print "Usage: %s [--help]" % argv[0]
print "Usage: %s [--version]" % argv[0]
print "Usage: %s [--path </path/to/hpacucli>]" % argv[0]
print "Usage: %s [--no-perfdata]" % argv[0]
print "Usage: %s [--no-longoutput]" % argv[0]
print ""
def error(errortext):
print "* Error: %s" % errortext
print_help()
print "* Error: %s" % errortext
exit(unknown)
def debug( debugtext ):
global debugging
if debugging:
print debugtext
'''runCommand: Runs command from the shell prompt. Exit Nagios style if unsuccessful'''
def runCommand(command):
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE,)
stdout, stderr = proc.communicate('through stdin to stdout')
if proc.returncode > 0:
print "Error %s: %s\n command was: '%s'" % (proc.returncode,stderr.strip(),command)
debug("results: %s" % (stdout.strip() ) )
if proc.returncode == 127: # File not found, lets print path
path=getenv("PATH")
print "Check if your path is correct %s" % (path)
if stderr.find('Password:') == 0 and command.find('sudo') == 0:
print "Check if user is in the sudoers file"
if stderr.find('sorry, you must have a tty to run sudo') == 0 and command.find('sudo') == 0:
print "Please remove 'requiretty' from /etc/sudoers"
exit(unknown)
else:
return stdout
def end():
global summary
global longserviceoutput
global perfdata
global nagios_status
print "%s - %s | %s" % (state[nagios_status], summary,perfdata)
print longserviceoutput
if nagios_status < 0: nagios_status = unknown
exit(nagios_status)
def add_perfdata(text):
global perfdata
text = text.strip()
perfdata = perfdata + " %s " % (text)
def add_long(text):
global longserviceoutput
longserviceoutput = longserviceoutput + text + '\n'
def add_summary(text):
global summary
summary = summary + text
def set_path(path):
current_path = getenv('PATH')
if current_path.find('C:\\') > -1: # We are on this platform
if path == '':
path = ";C:\Program Files\Hewlett-Packard\Sanworks\Element Manager for StorageWorks HSV"
path = path + ";C:\Program Files (x86)\Compaq\Hpacucli\Bin"
path = path + ";C:\Program Files\Compaq\Hpacucli\Bin"
else: path = ';' + path
else: # Unix/Linux, etc
if path == '': path = ":/usr/sbin"
else: path = ':' + path
current_path = "%s%s" % (current_path,path)
environ['PATH'] = current_path
def run_hpacucli(type='controllers', controller=None):
if type=='controllers':
command="hpacucli controller all show detail"
elif type=='logicaldisks' or type=='physicaldisks':
if controller.has_key('Slot'):
identifier = 'slot=%s' % (controller['Slot'] )
else:
add_summary( "Controller not found" )
end()
if type=='logicaldisks':
command = "hpacucli controller %s ld all show detail" % (identifier)
if type=='physicaldisks':
command = "hpacucli controller %s pd all show detail" % (identifier)
#command="hpacucli controller slot=1 ld all show detail"
#command="hpacucli controller slot=1 ld all show detail"
debug ( command )
if sudo: command = "sudo " + command
output = runCommand(command)
# Some basic error checking
error_strings = [ 'Permission denied' ]
error_strings.append('Error: You need to have administrator rights to continue.')
for error in error_strings:
if output.find( error ) > -1 and output.find("sudo") != 0:
command = "sudo " + command
print command
output = runCommand(command)
output = output.split('\n')
objects = []
object = None
for i in output:
if len(i) == 0: continue
if i.strip() == '': continue
if type=='controllers' and i[0] != ' ': # No space on first line
if object and not object in objects: objects.append(object)
object = {}
object['name'] = i
elif type=='logicaldisks' and i.find('Logical Drive:') > 0:
if object and not object in objects: objects.append(object)
object = {}
object['name'] = i.strip()
elif type=='physicaldisks' and i.find('physicaldrive') > 0:
if object and not object in objects: objects.append(object)
object = {}
object['name'] = i.strip()
else:
i = i.strip()
if i.find(':') < 1: continue
i = i.split(':')
if i[0] == '': continue # skip empty lines
if len(i) == 1: continue
key = i[0].strip()
value = ' '.join( i[1:] ).strip()
object[key] = value
if object and not object in objects: objects.append(object)
return objects
controllers = []
def check_controllers():
global controllers
status = -1
controllers = run_hpacucli()
if len(controllers) == 0:
add_summary("No Disk Controllers Found. Exiting...")
global nagios_state
nagios_state = unknown
end()
add_summary( "Found %s controllers" % ( len(controllers) ) )
for i in controllers:
controller_status = check(i, 'Controller Status', 'OK' )
status = max(status, controller_status)
cache_status = check(i, 'Cache Status' )
status = max(status, cache_status)
controller_serial = 'n/a'
cache_serial = 'n/a'
if i.has_key('Serial Number'):
controller_serial = i['Serial Number']
if i.has_key('Cache Serial Number'):
cache_serial = i['Cache Serial Number']
add_long ( "%s" % (i['name']) )
add_long( "- Controller Status: %s (sn: %s)" % ( state[controller_status], controller_serial ) )
add_long( "- Cache Status: %s (sn: %s)" % ( state[cache_status], cache_serial ) )
if controller_status > ok or cache_status > ok:
add_summary( ";%s on %s;" % (state[controller_status], i['name']) )
add_summary(', ')
return status
def check_logicaldisks():
global controllers
if len(controllers) < 1:
controllers = run_hpacucli()
logicaldisks = []
for controller in controllers:
for ld in run_hpacucli(type='logicaldisks', controller=controller):
logicaldisks.append ( ld )
status = -1
add_long("\nChecking logical Disks:" )
add_summary( "%s logicaldisks" % ( len(logicaldisks) ) )
for i in logicaldisks:
ld_status = check(i, 'Status' )
status = max(status, ld_status)
mount_point = i['Mount Points']
add_long( "- %s (%s) = %s" % (i['name'], mount_point, state[ld_status]) )
add_summary(". ")
def check_physicaldisks():
global controllers
disktype='physicaldisks'
if len(controllers) < 1:
controllers = run_hpacucli()
disks = []
for controller in controllers:
for disk in run_hpacucli(type=disktype, controller=controller):
disks.append ( disk )
status = -1
add_long("\nChecking Physical Disks:" )
add_summary( "%s %s" % ( len(disks), disktype ) )
for i in disks:
disk_status = check(i, 'Status' )
status = max(status, disk_status)
size = i['Size']
firmware = i['Firmware Revision']
interface = i['Interface Type']
serial = i['Serial Number']
model = i['Model']
add_long( "- %s, %s, %s = %s" % (i['name'], interface, size, state[disk_status]) )
if disk_status > ok:
add_long( "-- Replace drive, firmware=%s, model=%s, serial=%s" % (firmware,model, serial))
if status > ok:
add_summary( "(errors)" )
add_summary(". ")
def check(object, field, valid_states = ['OK']):
state = -1
global nagios_status
if object.has_key(field):
if object[field] in valid_states:
state = ok
else:
state = warning
nagios_status = max(nagios_status, state)
return state
def parse_arguments():
arguments = argv[1:]
while len(arguments) > 0:
arg = arguments.pop(0)
if arg == '--help':
print_help()
exit(ok)
elif arg == '--path':
path = arguments.pop(0)
set_path(path)
elif arg == '--debug':
global debugging
debugging = True
elif arg == '--sudo':
global sudo
sudo = True
else:
print_help()
exit(unknown)
def main():
parse_arguments()
set_path('')
check_controllers()
check_logicaldisks()
check_physicaldisks()
end()
if __name__ == '__main__':
main()

View File

@ -1,2 +0,0 @@
command[check_hpacucli]=/usr/lib/nagios/plugins/check_hpacucli.py

View File

@ -81,7 +81,7 @@ check_raid()
{
raid_ok=`cat $TEMPFILE |grep -i ok|wc -l`
raid_warning=`cat $TEMPFILE|grep -i -E 'rebuild|predictive' |wc -l`
raid_critical_1=`cat $TEMPFILE|grep -i 'failed|recovery' | wc -l`
raid_critical_1=`cat $TEMPFILE|grep -i -E 'failed|recovery' | wc -l`
err_check=`expr $raid_ok + $raid_warning + $raid_critical_1 `
@ -133,7 +133,7 @@ case "$1" in
exit 0
;;
--all)
controllers=`sudo -u root hpacucli controller all show | sed 's/.*Slot \([0-9]*\).*/\1/'`
controllers=`sudo -u root $HPACUCLI controller all show | sed 's/.*Slot \([0-9]*\).*/\1/'`
for i in $controllers ; do sudo -u root $HPACUCLI controller slot=$i pd all show status;done > $TEMPFILE
check_raid
;;

View File

@ -0,0 +1,55 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check HP Hardware Status
Name: nagios-okplugin-check_hpasm
Version: 4.1.4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_hpasm
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpasm/releases/nagios-okplugin-check_hpasm-%{version}.tar.gz
Requires: nagios-okconfig-nrpe
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
BuildArch: noarch
%description
A Nagios plugin to check HP Hardware Status
%prep
%setup -q
%build
perl -pi -e "s|/usr/lib|%{_libdir}|g" sudoers.d/check_hpasm
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpasm.cfg
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_hpasm %{buildroot}%{_libdir}/nagios/plugins/check_hpasm
install -D -p -m 0440 sudoers.d/check_hpasm %{buildroot}/etc/sudoers.d/check_hpasm
install -D -p -m 0644 nrpe.d/check_hpasm.cfg %{buildroot}/etc/nrpe.d/check_hpasm.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
#%doc README LICENSE
#%{_libdir}/nagios/plugins/*
%{_libdir}/nagios/plugins/check_hpasm
/etc/sudoers.d/check_hpasm
/etc/nrpe.d/check_hpasm.cfg
%changelog
* Fri Oct 03 2014 Tomas Edwardsson <tommi@tommi.org> 4.1.4-1
- hpasm invalid nrpe check command name (tommi@tommi.org)
* Thu May 15 2014 Tomas Edwardsson <tommi@tommi.org> 4.1.3-1
- new package built with tito
* Tue Jun 4 2013 Pall Sigurdsson <palli@opensource.is> 4.1.2-1
- Initial packaging

View File

@ -0,0 +1,3 @@
command[check_hpasm]=sudo /usr/lib/nagios/plugins/check_hpasm

View File

@ -0,0 +1,2 @@
Defaults:nrpe !requiretty
nrpe ALL = (root) NOPASSWD: /usr/lib/nagios/plugins/check_hpasm

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