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

Compare commits

...

344 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
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
239 changed files with 6589 additions and 39525 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.3
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,6 +38,19 @@ 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

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

@ -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

@ -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: 1.0.0
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

@ -1,7 +1,8 @@
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
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

@ -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: 1.0.0
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';

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Summary: A Nagios plugin to check HP EVA Disk Systems
Name: nagios-okplugin-check_eva
Version: 1.0.0
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
@ -40,5 +40,28 @@ rm -rf %{buildroot}
/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

@ -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

@ -16,26 +16,22 @@
# 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)
# 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.0"
ok=0
warning=1
critical=2
unknown=3
not_present = -1
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"
@ -44,286 +40,323 @@ state[critical] = "Critical"
state[unknown] = "Unknown"
longserviceoutput="\n"
perfdata=""
summary=""
sudo=False
longserviceoutput = "\n"
perfdata = ""
summary = ""
sudo = False
from sys import exit
from sys import argv
from os import getenv,putenv,environ
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 ""
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
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")
""" 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"
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
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)
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)
global perfdata
text = text.strip()
perfdata = perfdata + " %s " % (text)
def add_long(text):
global longserviceoutput
longserviceoutput = longserviceoutput + text + '\n'
global longserviceoutput
longserviceoutput = longserviceoutput + text + '\n'
def add_summary(text):
global summary
summary = 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
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
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 ) )
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)
if controller_status > ok or cache_status > ok:
add_summary( ";%s on %s;" % (state[controller_status], i['name']) )
cache_status = check(i, 'Cache Status')
status = max(status, cache_status)
add_summary(', ')
return 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(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(". ")
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(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)
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:
add_long( "-- Replace drive, firmware=%s, model=%s, serial=%s" % (firmware,model, serial))
if status > ok:
add_summary( "(errors)" )
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(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 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)
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()
parse_arguments()
set_path('')
check_controllers()
check_logicaldisks()
check_physicaldisks()
end()
if __name__ == '__main__':
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

@ -1,2 +1,2 @@
command[check_hpacucli]=/usr/lib/nagios/plugins/check_hpacucli.py
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

@ -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

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -278,7 +278,8 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
@ -305,7 +306,7 @@ the "copyright" line and a pointer to where the full notice is found.
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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.

53
check_hpssacli/README Normal file
View File

@ -0,0 +1,53 @@
= check_hpssacli =
Checks the raid status on a HP Array using hpssacli. to check the following:
* Controller Status
* Controller Cache Status
* Logical disk health (raid status)
* Physical disk health
== Download ==
check_hpssacli.py depends on the hpssacli binary which comes with the HP Proliant Support Pack (PSP). The PSP can be downloaded [http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack here].
You can get check_hpacucly.py directly from our subversion repo [http://opensource.is/trac/browser/nagios-plugins/check_hpssacli/trunk here]
== help page ==
{{{
# python check_hpssacli.py --help
check_hpssacli version 1.0
This plugin checks HP Array with the hpssacli command
Usage: check_hpssacli.py
Usage: check_hpssacli.py [--help]
Usage: check_hpssacli.py [--version]
Usage: check_hpssacli.py [--path </path/to/hpssacli>]
Usage: check_hpssacli.py [--no-perfdata]
Usage: check_hpssacli.py [--no-longoutput]
}}}
== Example output ==
{{{
# ./check_hparray --all
OK - Found 1 controllers, 2 logicaldisks. 8 physicaldisks. |
Smart Array P400 in Slot 1
- Controller Status: OK (sn: P61620F9VV6FX2)
- Cache Status: OK (sn: PA82C0H9VV4695)
Checking logical Disks:
- Logical Drive: 1 (/boot 101 MB) = OK
- Logical Drive: 2 (None) = OK
Checking Physical Disks:
- physicaldrive 2I:1:1, SAS, 146 GB = OK
- physicaldrive 2I:1:2, SAS, 146 GB = OK
- physicaldrive 1I:1:5, SAS, 146 GB = OK
- physicaldrive 1I:1:6, SAS, 146 GB = OK
- physicaldrive 1I:1:7, SAS, 146 GB = OK
- physicaldrive 1I:1:8, SAS, 146 GB = OK
- physicaldrive 2I:1:3, SAS, 146 GB = OK
- physicaldrive 2I:1:4, SAS, 146 GB = OK
}}}

View File

@ -0,0 +1,362 @@
#!/usr/bin/python
#
# Copyright 2019, Gardar Thorsteinsson <gardar@ok.is>
#
# check_hpssacli.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_hpssacli.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 hpssacli binary in path (/usr/sbin/hpssacli is a good place)
# hpssacli 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_hpssacli version %s" % version
print "This plugin checks HP Array with the hpssacli 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/hpssacli>]" % 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\hp\hpssacli\Bin"
path = path + ";C:\Program Files (x86)\hp\hpssacli\Bin"
path = path + ";C:\Program Files\Smart Storage Administrator\ssacli\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_hpssacli(run_type='controllers', controller=None):
if run_type == 'controllers':
command = "hpssacli 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 = "hpssacli 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_hpssacli()
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_hpssacli()
logicaldisks = []
for controller in controllers:
for ld in run_hpssacli(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_hpssacli()
disks = []
for controller in controllers:
for disk in run_hpssacli(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

@ -0,0 +1,45 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check HP Array with hpssacli
Name: nagios-okplugin-check_hpssacli
Version: 1.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_hpssacli
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpssacli/releases/nagios-okplugin-check_hpssacli-%{version}.tar.gz
Requires: hpssacli
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Gardar Thorsteinsson <gardar@ok.is>
%description
Checks HP Array with hpssacli
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpssacli.cfg
perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/*
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_hpssacli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpssacli.py
install -D -p -m 0755 nrpe.d/check_hpssacli.cfg %{buildroot}/etc/nrpe.d/check_hpssacli.cfg
install -D -p -m 0440 sudoers.d/check_hpssacli %{buildroot}/etc/sudoers.d/check_hpssacli
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_hpssacli.cfg
/etc/sudoers.d/check_hpssacli
%changelog
* Fri Jun 14 2019 Gardar Thorsteinsson <gardar@ok.is> 1.1
- Initial packaging

View File

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

View File

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

View File

@ -0,0 +1,40 @@
Introduction
============
Check http multi was created to check multiple websites in one plugin. You can check the following:
* Latency per website
* Overall runtime of http requests (serial)
* Number of failed websites
* Percentage of failed websites
How
===
Check Percentage Failed
-----------------------
Here we check http://www.google.com and http://adagios.org
Failure rates of
* 0%-30% are ok
* 30%-60% are warning
* everything above is critical
```
$ check_http_multi -u http://www.google.com -u http://adagios.org/ \
--th metric=failed_percentage,warning=30..60,critical=60..inf
Checked 2 uris, 0 failed | 'http://www.google.com'=0.24s;;;; 'http://adagios.org/'=0.47s;;;; 'failed'=0;;;; 'failed_percentage'=0.0%;30..60;60..inf;; 'runtime'=0.711745977402s;;;;
http://www.google.com fetched in 0.24 seconds
http://adagios.org/ fetched in 0.47 seconds
```
Author
======
Tomas Edwardsson <tommi@tommi.org>
License
=======
GPLv3 or later

View File

@ -0,0 +1,90 @@
#!/usr/bin/python
# Copyright 2013, Tomas Edwardsson
#
# This script 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 script 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/>.
from pynag.Plugins import PluginHelper, critical, warning, ok
import requests
import time
import signal
class TimeoutException(Exception):
pass
def signal_alarm(signo, frame):
raise TimeoutException()
def main():
plugin = PluginHelper()
plugin.parser.add_option('-u', help="http uris", dest="uri", action="append")
plugin.parse_arguments()
if not plugin.options.uri:
plugin.parser.error("-u (uri) argument is required")
start_time = time.time()
# Assign timeout handler
signal.signal(signal.SIGALRM, signal_alarm)
success = 0
failed = 0
for uri in plugin.options.uri:
if not uri: continue
webstate, status = check_website(uri)
if webstate:
success += 1
plugin.add_long_output("%s fetched in %s seconds" % (uri, status))
plugin.add_metric(uri, status, uom="s")
else:
failed += 1
plugin.add_long_output("%s failed, %s" % (uri, status))
plugin.add_summary("Checked %i uris, %i failed" % ((failed + success), failed))
plugin.status(ok)
plugin.add_metric("failed", failed)
plugin.add_metric("failed_percentage", (100 * failed / float(failed + success)), uom="%")
plugin.add_metric("runtime", time.time() - start_time, uom="s")
plugin.check_all_metrics()
plugin.exit()
def check_website(uri, timeout=10):
"""Tries fetching the uri specified
returns (False, "Invalid status code <status_code>") on any failure and status code other than 2XX
returns (None, "Timeout in %f seconds") on timeout
returns (True, time (float)) it took to fetch the website on success"""
start_time = time.time()
signal.alarm(timeout)
try:
req = requests.get(uri)
if str(req.status_code)[0] != "2":
return False, "Invalid HTTP status: " + str(req.status_code)
except TimeoutException:
return None, "Timeout in %.2f seconds" % (time.time() - start_time)
except Exception, e:
return False, "Error encountered: " + e.message
signal.alarm(0)
return True, "%.2f" % (time.time() - start_time)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,43 @@
%define debug_package %{nil}
%define plugin check_http_multi
Summary: A Nagios plugin to check multiple websites
Name: nagios-okplugin-%{plugin}
Version: 0.1.1
Release: 1%{?dist}
License: GPLv3+
Group: Applications/System
URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}
Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz
Requires: nagios-okconfig-nrpe >= 0.0.4
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@tommi.org>
BuildArch: noarch
%description
Checks multiple websites for latency and failures. You can specify how many
of them will fail to return warning or critical state.
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.md
%{_libdir}/nagios/plugins/*
%changelog
* Thu Jun 06 2013 Tomas Edwardsson <tommi@tommi.org> 0.1.1-1
- new package built with tito

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check IBM Bladecenters
Name: nagios-okplugin-check_ibm_bladecenter
Version: 4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-check_ibm_bladecenter
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_ibm_bladecenter/releases/%{name}-%{version}.tar.gz
Requires: nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
BuildArch: noarch
Requires: nrpe
%description
Checks the health status of an IBM Bladecenter via SNMP
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_ibm_bladecenter.py %{buildroot}%{_libdir}/nagios/plugins/check_ibm_bladecenter.py
#mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d
#sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/check_bond.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/check_bond.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README
%{_libdir}/nagios/plugins/*
#%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg
%changelog
* Fri Feb 21 2014 Pall Sigurdsson <palli@opensource.is> 4-1
-
* Fri Feb 21 2014 Unknown name 3-1
- Merge branch 'master' of github.com:opinkerfi/nagios-plugins
(palli@opensource.is)
- ibm_bladecenter - another firmware bug workaround (palli@opensource.is)
- pep8 fixes (palli@opensource.is)
- Fix workaround for firmware bug (palli@opensource.is)
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- Merge branch 'master' of github.com:opinkerfi/misc (palli@opensource.is)
- --exclude option added. Added workaround around false positives
(palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.1.2-3
- version number of scripts bumped (palli@opensource.is)
* Thu Aug 23 2012 Pall Sigurdsson <palli@opensource.is> 1.1.2-2
- rpm spec file added. version number bumped (palli@opensource.is)
* Tue Jul 17 2012 Pall Sigurdsson 1.0.0-1
- Initial packaging

View File

@ -0,0 +1,5 @@
Checks the operator status of network interfaces
Requires:
The get_ifoperstate.sh script

View File

@ -0,0 +1,84 @@
#!/usr/bin/python
#
# Copyright 2013, Tomas Edwardsson
#
# This script 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 script 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/>.
# Enumerates interfaces and their operstate (up/down/unknown).
__author__ = 'Tomas Edwardsson <tommi@tommi.org>'
from subprocess import PIPE, Popen
import os
import sys
from pynag.Plugins import PluginHelper, ok, critical, unknown
helper = PluginHelper()
helper.parser.add_option('-I', "--interface", help="Interface (eth0/bond/em/..) multiple supported with -I ... -I ...",
dest="interfaces", action="append")
helper.parser.add_option('-H', "--hostname", help="Check interface on remote host", dest="host_name")
helper.parser.add_option('-l', "--list-interfaces", help="List interfaces", dest="list_interfaces", action="store_true")
helper.parse_arguments()
local_env = os.environ
local_env["PATH"] += ":%s" % (":".join([
"/usr/lib/nagios/plugins",
"/usr/lib64/nagios/plugins",
"/usr/local/libexec",
"/usr/libexec",
"/usr/local/nagios/libexec"]))
if helper.options.host_name:
command = ("check_nrpe -H %s -c get_ifoperstate" % helper.options.host_name).split()
else:
command = ["get_ifoperstate.sh"]
# List the interfaces and exit
def get_interfaces():
interfaces = []
try:
cmd = Popen(command, stdout=PIPE, shell=False)
for line in cmd.stdout.readlines():
interface, status = line.strip().split(":")
interfaces.append((interface, status))
except Exception, e:
helper.add_summary("Unable to get interfaces \"%s\": %s" % (" ".join(command), e))
helper.status(unknown)
helper.exit()
return interfaces
interface_state = get_interfaces()
if helper.options.list_interfaces:
for interface in interface_state:
print "%-20s %s" % (interface[0], interface[1])
sys.exit(0)
for interface in interface_state:
if not helper.options.interfaces or interface[0] in helper.options.interfaces:
if interface[1] == "unknown":
helper.add_status(unknown)
elif interface[1] == "up":
helper.add_status(ok)
else:
helper.add_status(critical)
helper.add_long_output("%s operstate is %s" % (interface[0], interface[1]))
helper.check_all_metrics()
helper.exit()

View File

@ -0,0 +1,45 @@
%define debug_package %{nil}
%define plugin check_ifoperstate
Summary: A Nagios plugin to check interface operator status
Name: nagios-okplugin-%{plugin}
Version: 0.0.3
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}
Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz
Requires: nagios-okconfig-nrpe >= 0.0.4
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@tommi.org>
BuildArch: noarch
%description
Checks the operator status of network interfaces
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.md
%{_libdir}/nagios/plugins/*
%changelog
* Wed Jun 05 2013 Tomas Edwardsson <tommi@tommi.org> 0.0.3-1
- Rename ifoperstate (tommi@tommi.org)
* Wed Jun 05 2013 Tomas Edwardsson <tommi@tommi.org> 0.0.2-1
- new package built with tito

19
check_ipa/README.md Normal file
View File

@ -0,0 +1,19 @@
check_ipa_replication
=====================
You need some configuration for this plugin to have access to replication
information.
Allow anonymous read to replication information
-----------------------------------------------
You will need to do this for every IPA server, masters and replicas
```
ldapmodify -x -D "cn=directory manager" -W -f grant_anonymous_replication_view.ldif -h ipa-host.example.com
```
Configure the directory manager credentials
-------------------------------------------
NOT RECOMENDED, you can use -D and -w with the directory manager credentials
and the plugin will work as expected.

View File

@ -0,0 +1,61 @@
#!/usr/bin/python
# Copyright 2013, Tomas Edwardsson
#
# This script 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 script 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 ldap
from pynag.Plugins import PluginHelper, critical, warning, ok
plugin = PluginHelper()
plugin.parser.add_option('-u', help="ldap uri", dest="uri")
plugin.parser.add_option('-D', help="bind DN", dest="binddn")
plugin.parser.add_option('-w', help="bind password", dest="bindpw")
plugin.parse_arguments()
if not plugin.options.uri:
plugin.parser.error('-u (uri) argument is required')
try:
l = ldap.initialize(plugin.options.uri)
if plugin.options.binddn:
l.bind_s(plugin.options.binddn, plugin.options.bindpw)
replication = l.search_s('cn=config',
ldap.SCOPE_SUBTREE,
'(objectclass=nsds5replicationagreement)',
['nsDS5ReplicaHost', 'nsds5replicaLastUpdateStatus'])
except Exception, e:
plugin.status(critical)
plugin.add_summary("Unable to initialize ldap connection: %s" % (e))
plugin.exit()
# Loop through replication agreements
for rhost in replication:
plugin.add_summary("Replica %s Status: %s" % (rhost[1]['nsDS5ReplicaHost'][0], rhost[1]['nsds5replicaLastUpdateStatus'][0]))
if rhost[1]['nsds5replicaLastUpdateStatus'][0][7:8] == "0":
plugin.status(ok)
elif rhost[1]['nsds5replicaLastUpdateStatus'][0][7:8] == "1":
# Busy Replica is not an error, its "unknown" (but its "ok" for now)
plugin.status(ok)
else:
plugin.status(critical)
if not len(replication):
plugin.add_summary("Warning: No replicas found")
plugin.status(warning)
plugin.exit()

View File

@ -0,0 +1,4 @@
dn: cn="dc=mr,dc=lan",cn=mapping tree,cn=config
changetype: modify
add: aci
aci: (targetattr=*)(targetfilter="(|(objectclass=nsds5replicationagreement)(objectclass=nsDSWindowsReplicationAgreement))")(version 3.0; aci "permission:Read Replication Agreements"; allow (read, search, compare) groupdn = "ldap:///anyone";)

View File

@ -0,0 +1,60 @@
%define debug_package %{nil}
%define plugin ipa
Summary: A Nagios plugin to check IPA server status
Name: nagios-okplugin-%{plugin}
Version: 0.0.4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}
Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz
Requires: python-ldap
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@ok.is>
BuildArch: noarch
Requires: nrpe
%description
Checks IPA server status
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_ipa_replication %{buildroot}%{_libdir}/nagios/plugins/check_ipa_replication
mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d
sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/check_ipa.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/check_ipa.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README
%doc grant_anonymous_replication_view.ldif
%{_libdir}/nagios/plugins/*
%config(noreplace) %{_sysconfdir}/nrpe.d/check_ipa.cfg
%changelog
* Fri Apr 04 2014 Tomas Edwardsson <tommi@tommi.org> 0.0.4-1
- Renamed to markdown (tommi@tommi.org)
- Added examples and documentation (tommi@tommi.org)
- Missing colon (tommi@tommi.org)
- Added missing OK when things worked out (tommi@tommi.org)
* Thu Apr 25 2013 Tomas Edwardsson <tommi@tommi.org> 0.0.3-1
- Preliminary testing done, released
- Various errors in syntax fixed (tommi@tommi.org)
- Detection for no configured replicas (tommi@tommi.org)
* Thu Apr 25 2013 Tomas Edwardsson <tommi@tommi.org> 0.0.2-1
- Tagged new release
* Wed Apr 25 2013 Tomas Edwardss <tommi@opensource.is> 0.0.1-1
- Initial Packaging

View File

@ -0,0 +1 @@
command[check_ipa_replication]=/usr/lib64/nagios/plugins/check_ipa_replication -u 'ldap://localhost'

View File

@ -0,0 +1,52 @@
%define debug_package %{nil}
Summary: A Nagios plugin to check Cisco Ironport
Name: nagios-okplugin-check_ironport
Version: 2
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.ok.is/trac/wiki/
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_ironport/releases/%{name}-%{version}.tar.gz
Requires: nagios-plugins
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
BuildArch: noarch
Requires: nrpe
%description
Checks the health status of a Cisco Ironport
%prep
%setup -q
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_ironport.py %{buildroot}%{_libdir}/nagios/plugins/check_ironport.py
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_libdir}/nagios/plugins/*
#%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg
%changelog
* Thu Feb 20 2014 Pall Sigurdsson <palli@opensource.is> 2-1
- Merge branch 'master' of https://opensource.ok.is/git/misc
(palli@opensource.is)
* Tue Jul 31 2012 Pall Sigurdsson <palli@opensource.is> 1.1.4-1
- initial packaging for nagios-okplugin-check_ironport (palli@opensource.is)
* Tue Jul 31 2012 Pall Sigurdsson <palli@opensource.is> 1.1.3-1
- new package built with tito
* Tue Jul 31 2012 Pall Sigurdsson 1.0.0-1
- Initial packaging

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -278,7 +278,8 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
@ -305,7 +306,7 @@ the "copyright" line and a pointer to where the full notice is found.
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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.

View File

@ -0,0 +1,54 @@
%define debug_package %{nil}
Summary: A Nagios plugins to check if a specific linux module exists
Name: nagios-okplugin-check_linux_modules
Version: 0.0.13
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/check_smssend
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Pall Sigurdsson <palli@opensource.is>
%description
A Nagios plugins to check if a specific linux module exists
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_module.cfg
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_linux_modules.pl %{buildroot}%{_libdir}/nagios/plugins/check_linux_modules.pl
install -D -p -m 0755 nrpe.d/check_module.cfg %{buildroot}/etc/nrpe.d/check_module.cfg
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc LICENSE
%{_libdir}/nagios/plugins/*
/etc/nrpe.d/check_module.cfg
%changelog
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.13-1
- typo in plugin name fixed (palli@opensource.is)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.12-1
- new package built with tito
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.11-1
- license added (palli@opensource.is)
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.10-1
-
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.9-1
- new package built with tito

View File

@ -0,0 +1,117 @@
#!/usr/bin/python
from pynag.Plugins import simple as Plugin, WARNING, CRITICAL, UNKNOWN, OK
from subprocess import Popen, PIPE
import os
def main():
global plugin
plugin = Plugin(must_threshold=False)
plugin.add_arg("l", "logical-volume",
"Comma seperated list of VG/LV, eg vg00/data,vg00/snap",
required=False)
plugin.add_arg("V", "volume-group",
"Comma seperated list of VG, eg vg00,vg01",
required=False)
plugin.add_arg("a", "check-all", "Check all LVs", required=False,
action="store_true")
plugin.activate()
lvs = plugin["logical-volume"] and plugin["logical-volume"].split(
",") or []
vgs = plugin["volume-group"] and plugin["volume-group"].split(",") or []
if not lvs and not vgs and not plugin['check-all']:
plugin.parser.error(
"Either logical-volume or volume-group must be specified")
elif plugin['check-all'] and ( lvs or vgs ):
plugin.parser.error(
"Mixing check-all and logical-volume or volume-group does not make sense")
check_mirror(lvs, vgs, plugin['check-all'], plugin['host'])
(code, message) = (plugin.check_messages(joinallstr="\n"))
plugin.nagios_exit(code, message)
def check_mirror(lv_list, vg_list, check_all, hostname):
# Ensure the right locale for text parsing
"""
:rtype : None
"""
# Change lang setting for string consitency
env = os.environ.copy()
env['LC_ALL'] = 'C'
# Remote execution
if hostname:
cmd = ['check_nrpe', '-H', hostname, '-c', 'get_lvm_mirrors']
# Local
else:
cmd = ["lvs", "--separator", ";", "-o",
"vg_name,lv_name,lv_attr,copy_percent"]
# Execute lvs
ret = None
lvs_output = None
try:
lvs = Popen(cmd, stdout=PIPE, shell=False, env=env)
ret = lvs.wait()
lvs_output = lvs.stdout.readlines()
except Exception, e:
plugin.nagios_exit(UNKNOWN, "Unable to execute lvs: %s" % (e))
if ret != 0:
plugin.nagios_exit(CRITICAL,
"lvs execution failed, return code %i" % (ret))
all_lvs = []
all_vgs = []
# Loop through lvs output
linenumber = 0
for l in lvs_output:
linenumber += 1
try:
vg_name, lv_name, lv_attr, copy_percent = l.strip().split(";")
except ValueError as error:
plugin.add_message(UNKNOWN,
"Unable to parse lvs line %i: %s\n%s" % (
linenumber, error, l))
continue
all_lvs.append("%s/%s" % (vg_name, lv_name))
if vg_name not in all_vgs:
all_vgs.append(vg_name)
if check_all or "%s/%s" % (
vg_name, lv_name) in lv_list or vg_name in vg_list:
if lv_attr[0] != "m" and lv_attr[0] != "M":
plugin.add_message(CRITICAL,
"LV %s/%s not mirrored" % (vg_name, lv_name))
elif lv_attr[2] != "a":
plugin.add_message(CRITICAL,
"LV %s/%s not active" % (vg_name, lv_name))
elif lv_attr[5] != "o":
plugin.add_message(CRITICAL,
"LV %s/%s not open" % (vg_name, lv_name))
elif float(copy_percent or 0) < 100:
plugin.add_message(WARNING, "LV %s/%s Copy Percent %s" % (
vg_name, lv_name, copy_percent))
else:
plugin.add_message(OK, "LV %s/%s functioning" % (vg_name, lv_name))
# Find lvs that were specified in cmd line but were not found via lvs
for v in vg_list:
if v not in all_vgs:
plugin.add_message(CRITICAL, "VG %s not found" % (v))
# Find lvs that were specified in cmd line but were not found via lvs
for l in lv_list:
if l not in all_lvs:
plugin.add_message(CRITICAL, "LV %s not found" % (l))
if __name__ == "__main__":
main()

View File

@ -0,0 +1 @@
Checks hardware status of MSA disk arrays also known as HP P2000

View File

@ -0,0 +1,72 @@
%define debug_package %{nil}
%define plugin check_msa_hardware
%define packager Gardar Thorsteinsson <gardar@ok.is>
Summary: A Nagios plugin to check status of an MSA (HP P2000) disk array
Name: nagios-okplugin-%{plugin}
Version: 1.0.5
Release: 2%{?dist}
License: GPLv3+
Group: Applications/System
URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}
Source0: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: %{packager}
BuildArch: noarch
Requires: pynag
%description
Checks status of a remote MSA disk array, also known as HP P2000
%prep
%setup -q
%global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\)
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin}
mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d
sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/%{plugin}.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/%{plugin}.cfg
# Temporary fix for selinux
chcon system_u:object_r:nagios_unconfined_plugin_exec_t:s0 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin}
%clean
rm -rf %{buildroot}
%post
/sbin/service nrpe status &> /dev/null && /sbin/service nrpe reload || :
%files
%defattr(-,root,root,-)
%doc README.md
%{_libdir}/nagios/plugins/*
%config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg
%changelog
* Fri May 09 2018 Gardar Thorsteinsson <gardar@ok.is> 1.0.5-2
- Filter out perl-utils dep
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.5-1
-
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.4-1
- README.md added (you@example.com)
- nrpe.d added to check_msa (you@example.com)
- rename check_msa_hardware-pl (you@example.com)
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.3-1
- new package built with tito
* Thu Jan 30 2014 Pall Sigurdsson <palli@opensource.is> 1.0.2-1
- new package built with tito
* Thu Jan 30 2014 Unknown name 1.0.1-1
- new package built with tito
* Fri Jan 27 2014 Pall Sigurdsson 1.0.0-1
- Initial Packaging

View File

@ -0,0 +1 @@
command[check_msa_hardware]=/usr/lib64/nagios/plugins/check_msa_hardware

View File

@ -1,8 +0,0 @@
check_mssql_dbsize
Returns the total number of databases and perfdata pertaining size
check_mssql_health
checks a bunch of variables and can execute custom queries into MS-SQL
databases.

View File

@ -1,95 +0,0 @@
#!/usr/bin/perl -w
#
# check_mssql_dbsize 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_mssql_dbsize 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/>.
#
#
# This script will check MSSQL Database size via check_nrpe and NSclient. returns performance data in Nagios format
# Author Pall Sigurdsson <palli@opensource.is>
#
use strict;
use Nagios::Plugin;
my $np = Nagios::Plugin->new(
usage => "Usage: %s <hostname>" );
$np->add_arg(
spec => 'debug|d=i',
help => '-d, --debug=INTEGER',
);
$np->getopts;
my $NRPECMD = "/usr/lib/nagios/plugins/check_nrpe";
if (@ARGV < 1) {
usage();
exit 3;
}
my $HOSTNAME=$ARGV[0];
my $databases = nrpeexec("-H $HOSTNAME -t 60 -c listCounterInstances -a 'SQLServer:Databases'");
my @array1 = split(/\,/, $databases);
my $num_databases = 0;
foreach my $database (@array1)
{
# Strip whitespace
$database =~ s/^\s*(.*?)\s*$/$1/;
# Call check_nrpe
my $dbSize = nrpeexec("-H $HOSTNAME -t 60 -c CheckCounter -a 'Counter:$database=\\SQLServer:Databases($database)\\Data File(s) Size (KB)'");
# Strip everything but the performance data
$dbSize =~ s/^.*\|(.*?)$/$1/;
chomp($dbSize);
$np->add_perfdata($dbSize);
$num_databases = $num_databases + 1;
}
$np->nagios_exit( OK, "$num_databases databases found in $HOSTNAME");
sub usage {
print <<" EOUSAGE";
Usage $0 <hostname>
EOUSAGE
}
# Execute NRPE with some error handling
sub nrpeexec {
my @args = @_;
my $output = '';
if (open NRPE, "$NRPECMD " . join(' ',@args) . ' 2>&1 |') {
$output .= $_ while(<NRPE>);
close NRPE;
}
my $ret = $? >> 8;
# No such file or directory
if ($ret == 127) {
$np->nagios_die("Cannot execute $NRPECMD command missing");
# Some other error
} elsif ($ret != 0) {
$np->nagios_die("Cannot execute $NRPECMD: $!");
}
return $output;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
%define debug_package %{nil}
Summary: Nagios plugins to check the status of MS-SQL Servers
Name: nagios-okplugin-mssql
Version: 0.0.3
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/nagios-MSSQL
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_mssql/releases/nagios-okplugin-mssql-%{version}.tar.gz
Requires: perl-Nagios-Plugin
Requires: perl-DBD-Sybase
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@opensource.is>
%description
MS-SQL checks for health and size of MSSQL servers
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_mssql_dbsize
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_mssql_health
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_mssql_dbsize %{buildroot}%{_libdir}/nagios/plugins/check_mssql_dbsize
install -D -p -m 0755 check_mssql_health %{buildroot}%{_libdir}/nagios/plugins/check_mssql_health
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_libdir}/nagios/plugins/*
%changelog
* Sun Nov 21 2010 Tomas Edwardsson <tommi@opensource.is> 0.0.3-1
- Initial packaging

View File

@ -1,8 +0,0 @@
check_mssql_dbsize
Returns the total number of databases and perfdata pertaining size
check_mssql_health
checks a bunch of variables and can execute custom queries into MS-SQL
databases.

View File

@ -1,95 +0,0 @@
#!/usr/bin/perl -w
#
# check_mssql_dbsize 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_mssql_dbsize 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/>.
#
#
# This script will check MSSQL Database size via check_nrpe and NSclient. returns performance data in Nagios format
# Author Pall Sigurdsson <palli@opensource.is>
#
use strict;
use Nagios::Plugin;
my $np = Nagios::Plugin->new(
usage => "Usage: %s <hostname>" );
$np->add_arg(
spec => 'debug|d=i',
help => '-d, --debug=INTEGER',
);
$np->getopts;
my $NRPECMD = "/usr/lib/nagios/plugins/check_nrpe";
if (@ARGV < 1) {
usage();
exit 3;
}
my $HOSTNAME=$ARGV[0];
my $databases = nrpeexec("-H $HOSTNAME -t 60 -c listCounterInstances -a 'SQLServer:Databases'");
my @array1 = split(/\,/, $databases);
my $num_databases = 0;
foreach my $database (@array1)
{
# Strip whitespace
$database =~ s/^\s*(.*?)\s*$/$1/;
# Call check_nrpe
my $dbSize = nrpeexec("-H $HOSTNAME -t 60 -c CheckCounter -a 'Counter:$database=\\SQLServer:Databases($database)\\Data File(s) Size (KB)'");
# Strip everything but the performance data
$dbSize =~ s/^.*\|(.*?)$/$1/;
chomp($dbSize);
$np->add_perfdata($dbSize);
$num_databases = $num_databases + 1;
}
$np->nagios_exit( OK, "$num_databases databases found in $HOSTNAME");
sub usage {
print <<" EOUSAGE";
Usage $0 <hostname>
EOUSAGE
}
# Execute NRPE with some error handling
sub nrpeexec {
my @args = @_;
my $output = '';
if (open NRPE, "$NRPECMD " . join(' ',@args) . ' 2>&1 |') {
$output .= $_ while(<NRPE>);
close NRPE;
}
my $ret = $? >> 8;
# No such file or directory
if ($ret == 127) {
$np->nagios_die("Cannot execute $NRPECMD command missing");
# Some other error
} elsif ($ret != 0) {
$np->nagios_die("Cannot execute $NRPECMD: $!");
}
return $output;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
%define debug_package %{nil}
Summary: Nagios plugins to check the status of MS-SQL Servers
Name: nagios-okplugin-mssql
Version: 0.0.4
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://opensource.is/trac/wiki/nagios-MSSQL
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_mssql/releases/nagios-okplugin-mssql-%{version}.tar.gz
Requires: perl-Nagios-Plugin
Requires: perl-DBD-Sybase
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Packager: Tomas Edwardsson <tommi@opensource.is>
%description
MS-SQL checks for health and size of MSSQL servers
%prep
%setup -q
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_mssql_dbsize
perl -pi -e "s|/usr/lib|%{_libdir}|g" check_mssql_health
%build
%install
rm -rf %{buildroot}
install -D -p -m 0755 check_mssql_dbsize %{buildroot}%{_libdir}/nagios/plugins/check_mssql_dbsize
install -D -p -m 0755 check_mssql_health %{buildroot}%{_libdir}/nagios/plugins/check_mssql_health
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README LICENSE
%{_libdir}/nagios/plugins/*
%changelog
* Mon Mar 12 2012 Pall Sigurdsson <palli@opensource.is> 0.0.4-1
- new package built with tito
* Sun Nov 21 2010 Tomas Edwardsson <tommi@opensource.is> 0.0.3-1
- Initial packaging

View File

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

View File

@ -1,67 +0,0 @@
###############################################
# Changelog of the check_mssql_health plugin #
###############################################
1.5.8.2 2011-01-19
- output a nicer error message if a sqlrelay connection fails
1.5.8.1 2011-01-03
- bugfix in --mode sql (numeric vs. regexp result)
1.5.8 2010-12-20
- mode sql can now have a non-numerical output which is compared to a string/regexp
- new parameter --dbthresholds
- new mode report can be used to output only the bad news (short,long,html)
1.5.7 2010-09-10
- fixed a bug in database-free (too much free space was calculated when more than one datafile of a database was on the same filesystem). (Thanks Juergen Essberger)
- new parameter extra-opts
1.5.6 2010-08-12
- new parameter --dbthresholds. thresholds can now also be deposited in the table check_mssql_health_thresholds
- added --currentdb so that the plugin can connect to a non-default database
- --with-mymodules-dyn-dir on the commandline overrides the configure-option of the same name
1.5.5
- backup-age is now an alias for the "official" database-backup-age
- catch the "can't change context to database" error
- --mode sqlcmd
1.5.3 2009-11-02
- fixed a bug in mode database-free (results are more accurate now)
- added new mode backup-age which checks the age (in hours) of the last backup
1.5.2
- fixed a bug where database names with special characters showed errors. (Thanks Hugh Ranalli)
1.5.1 2009-05-26
- added --server which can be used instead of --hostname/port (Thanks Mark Monaghan)
- lots of fixes. sql server 2000 should now be fully supported. (Thanks Mereghetti Stefano)
- --warning/--critical were ignored for memory-pool-related modes (Thanks Mereghetti Stefano)
1.5.0.2 2009-05-05
- fixed a bug which led to error messages when using the plugin with sql server 2000 (Thanks Christian Mies)
- fixed a bug so sql server 2000 can list-databases (Thanks Mereghetti Stefano)
1.5.0.1 2009-04-29
- added a security advice to the README (Thanks Mathieu Barret)
- fixed a bug in database-free (Thanks Michael Luebben)
- fixed a typo (Thanks Bernd Staudacher)
1.5 - 2009-03-20
- rewrote database-free so that unrestricted growth is taken into account (limit is disk)
- added support for SQLRelay
1.2 - 2009-03-19
- added support for object_name <> SQLServer:... (this caused "unable to aquire"-errors sometimes)
- fixed a bug in the PNP template
1.1 - 2009-03-11
- added modes: transactions, latches-wait-time, locks-waits, locks-timeouts,
locks-deadlocks, sql-recompilations, total-server-memory
- beautified the PNP template
- fixed counter rollovers after database restart
1.0 - 2009-03-10
----------------
- Initial release

View File

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

View File

@ -1,13 +0,0 @@
## Process this file with automake to produce Makefile.in
# find . \( -type d -and -name .svn -and -prune \) -or -type f -exec fromdos -v {} \;
SUBDIRS = plugins-scripts t
EXTRA_DIST = contrib
dist-hook:
rm -f t/var/tmp/*
rm -f t/var/adm/*
find $(distdir) -depth -name .svn -exec rm -rf {} \;
find $(distdir) -type f -exec fromdos -v {} \;
make

View File

@ -1,575 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# find . \( -type d -and -name .svn -and -prune \) -or -type f -exec fromdos -v {} \;
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS TODO config.guess config.sub install-sh \
missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
INSTALL = @INSTALL@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAT = @CAT@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
GREP = @GREP@
GZIP = @GZIP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_OPTS = @INSTALL_OPTS@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MYMODULES_DIR = @MYMODULES_DIR@
MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
RELEASE = @RELEASE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SH = @SH@
SHELL = @SHELL@
STATEFILES_DIR = @STATEFILES_DIR@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
VERSION = @VERSION@
WARRANTY = @WARRANTY@
ac_ct_STRIP = @ac_ct_STRIP@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
with_nagios_group = @with_nagios_group@
with_nagios_user = @with_nagios_user@
SUBDIRS = plugins-scripts t
EXTRA_DIST = contrib
all: all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/plugins-scripts
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -755 -exec chmod a+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-recursive ctags \
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-recursive distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-info-am
dist-hook:
rm -f t/var/tmp/*
rm -f t/var/adm/*
find $(distdir) -depth -name .svn -exec rm -rf {} \;
find $(distdir) -type f -exec fromdos -v {} \;
make
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,179 +0,0 @@
check_mssql_health Nagios Plugin README
---------------------
This plugin is used to monitor a variety of MS SQL Server database metrics.
* For instructions on installing this plugin for use with Nagios,
see below. In addition, generic instructions for the GNU toolchain
can be found in the INSTALL file.
* For major changes between releases, read the CHANGES file.
* For information on detailed changes that have been made,
read the Changelog file.
* This plugin is self documenting. All plugins that comply with
the basic guidelines for development will provide detailed help when
invoked with the '-h' or '--help' options.
You can check for the latest plugin at:
http://www.consol.com/opensource/nagios/check-mssql-health
The documentation in this README covers only the most common features.
To view the full documentation and examples, go to
http://www.consol.com/opensource/nagios/check-mssql-health or
http://www.consol.de/opensource/nagios/check-mssql-health
Send mail to gerhard.lausser@consol.de for assistance.
Please include the OS type/version and the Perl DBI/DBD version
that you are using.
Also, run the plugin with the '-vvv' option and provide the resulting
version information. Of course, there may be additional diagnostic information
required as well. Use good judgment.
For patch submissions and bug reports, please send me a mail. You can also find
me at http://www.nagios-portal.de
Requirements
--------------------------------------------------------
You need to install the Perl module DBD::Sybase first.
It is very important to set the protocol version in /etc/freetds.conf to 8.0
Otherwise your database password will be visible on the network.
[global]
# TDS protocol version
tds version = 8.0
How to "compile" the check_mssql_health script.
--------------------------------------------------------
1) Run the configure script to initialize variables and create a Makefile, etc.
./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-perl=PATH_TO_PERL --with-statefiles-dir=STATE_PATH
a) Replace BASEDIRECTORY with the path of the directory under which Nagios
is installed (default is '/usr/local/nagios')
b) Replace SOMEUSER with the name of a user on your system that will be
assigned permissions to the installed plugins (default is 'nagios')
c) Replace SOMEGRP with the name of a group on your system that will be
assigned permissions to the installed plugins (default is 'nagios')
d) Replace PATH_TO_PERL with the path where a perl binary can be found.
Besides the system wide perl you might have installed a private perl
just for the nagios plugins (default is the perl in your path).
e) Replace STATE_PATH with the directory where you want the script to
write state files which transport information from one run to the next.
(default is /tmp)
Simply running ./configure will be sufficient to create a check_mssql_health
script which you can customize later.
2) "Compile" the plugin with the following command:
make
This will produce a "check_mssql_health" script. You will also find
a "check_mssql_health.pl" which you better ignore. It is the base for
the compilation filled with placeholders. These will be replaced during
the make process.
3) Install the compiled plugin script with the following command:
make install
The installation procedure will attempt to place the plugin in a
'libexec/' subdirectory in the base directory you specified with
the --prefix argument to the configure script.
4) Verify that your configuration files for Nagios contains
the correct paths to the new plugin.
Command line parameters
-----------------------
--hostname=<the database server>
This is the hostname or the ip-address.
--port=<the instance port>
This is the port where an instance listens. Default: 1433
--server=<the database server>
This can be used instead of a hostname/port combination.
The servername given here is used for a lookup in /etc/freetds.conf
--user=<username>
This is the user which reads the system tables.
--password=<secret>
This is the user's password.
--mode=<operation mode>
This parameter tells the plugin what it should check.
The list of known modes may grow frequently. Please look at
http://www.consol.com/opensource/nagios/check-mssql-health for a list
of features.
--database=<database name>
Database-related modes check all databases in one run by default.
If only a single database should be checked, use this parameter.
--warning=<warning threshold>
If the metric is out of this range, the plugin returns a warning.
--critical=<critical threshold>
If the metric is out of this range, the plugin returns a critical.
Connecting
----------
You can call the plugin with "--hostname <ip or dns-name> [--port <port number>]"
This bypasses the freetds.conf file and directly connects you to
whatever is listening on port 1433 or <port number>
This will surely be the default instance. If you have different (named) instances
listening on the same port, you need to edit /etc/freetds.conf
[dbsrv1instance01]
host = 192.168.1.1
port = 1433
instance = instance01
[dbsrv1instance02]
host = 192.168.1.1
port = 1433
instance = instance02
....
Then you call the plugin with "--server dbsrv1instance02" for example.
Testing the connection
----------------------
use DBI;
use strict;
my $username = "xxxxx";
my $password = "xxxxx";
my $dsn = "DBI:Sybase:;host=127.0.1.1;port=1433";
#my $dsn = "DBI:Sybase:;server=dbsrv_in_freetds_conf";
if (my $dbh = DBI->connect(
$dsn, $username, $password,
{ RaiseError => 1, AutoCommit => 0, PrintError => 1 })) {
printf "connection succeeded\n";
} else {
printf "connection failed\n";
}
--------------------------------------
That's it. If you have any problems or questions, feel free to send mail
to gerhard.lausser@consol.de

View File

@ -1 +0,0 @@
--database is important

View File

@ -1,78 +0,0 @@
dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
dnl
dnl Provides a test to determine the correct way to call gethostbyname_r
dnl
dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required
dnl
dnl e.g. 6 arguments (linux)
dnl e.g. 5 arguments (solaris)
dnl e.g. 3 arguments (osf/1)
dnl
dnl @version $Id: acinclude.m4,v 1.5 2004/02/18 14:56:34 kdebisschop Exp $
dnl @author Brian Stafford <brian@stafford.uklinux.net>
dnl
dnl based on version by Caolan McNamara <caolan@skynet.ie>
dnl based on David Arnold's autoconf suggestion in the threads faq
dnl
AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R],
[AC_CACHE_CHECK(number of arguments to gethostbyname_r,
acx_which_gethostbyname_r, [
AC_TRY_COMPILE([
# include <netdb.h>
], [
char *name;
struct hostent *he;
struct hostent_data data;
(void) gethostbyname_r(name, he, &data);
],acx_which_gethostbyname_r=3,
[
dnl acx_which_gethostbyname_r=0
AC_TRY_COMPILE([
# include <netdb.h>
], [
char *name;
struct hostent *he, *res;
char *buffer = NULL;
int buflen = 2048;
int h_errnop;
(void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
],acx_which_gethostbyname_r=6,
[
dnl acx_which_gethostbyname_r=0
AC_TRY_COMPILE([
# include <netdb.h>
], [
char *name;
struct hostent *he;
char *buffer = NULL;
int buflen = 2048;
int h_errnop;
(void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0)
]
)
]
)
])
if test $acx_which_gethostbyname_r -gt 0 ; then
AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r,
[Number of parameters to gethostbyname_r or 0 if not available])
fi
])
dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION)
AC_DEFUN([ACX_HELP_STRING],
[ $1 builtin([substr],[ ],len($1))[$2]])
dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE])
AC_DEFUN([ACX_FEATURE],
[echo "builtin([substr],[ ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"])

View File

@ -1,559 +0,0 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
# Run COMMAND, save the exit status in ac_status, and log it.
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
AC_DEFUN([AM_RUN_LOG],
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
(exit $ac_status); }])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([acinclude.m4])

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,101 +0,0 @@
dnl Process this file with autoconf to produce a configure script.
AC_REVISION ($Revision: 1.150 $)
AC_PREREQ(2.58)
AC_INIT(check_mssql_health,1.5.8.2)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AC_CANONICAL_HOST
RELEASE=1
AC_SUBST(RELEASE)
AC_PREFIX_DEFAULT(/usr/local/nagios)
dnl Figure out how to invoke "install" and what install options to use.
AC_PROG_INSTALL
AC_SUBST(INSTALL)
dnl AC_PROG_CC
dnl AC_PROG_CPP
dnl AC_PROG_GCC_TRADITIONAL
dnl AC_PROG_RANLIB
AC_PROG_MAKE_SET
WARRANTY="This plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugin under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
AC_SUBST(WARRANTY)
SUPPORT="Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
AC_SUBST(SUPPORT)
AC_ARG_WITH(nagios_user,
ACX_HELP_STRING([--with-nagios-user=USER],
[set user name to run nagios]),
with_nagios_user=$withval,
with_nagios_user=nagios)
AC_ARG_WITH(nagios_group,
ACX_HELP_STRING([--with-nagios-group=GROUP],
[set group name to run nagios]),
with_nagios_group=$withval,
with_nagios_group=nagios)
AC_SUBST(with_nagios_user)
AC_SUBST(with_nagios_group)
INSTALL_OPTS="-o $with_nagios_user -g $with_nagios_group"
AC_SUBST(INSTALL_OPTS)
AC_ARG_WITH(statefiles_dir,
ACX_HELP_STRING([--with-statefiles-dir=PATH],
[sets directory for the state files (default=/var/tmp/check_mssql_health)]),
with_statefiles_dir=$withval,
with_statefiles_dir=/var/tmp/check_mssql_health)
AC_SUBST(STATEFILES_DIR, $with_statefiles_dir)
echo variable with_statefiles_dir is $with_statefiles_dir
AC_ARG_WITH(mymodules_dir,
ACX_HELP_STRING([--with-mymodules-dir=PATH],
[sets directory for own extensions which will be included during the build process (default=/usr/local/nagios/libexec)]),
with_mymodules_dir=$withval,
with_mymodules_dir=/usr/local/nagios/libexec)
AC_SUBST(MYMODULES_DIR, $with_mymodules_dir)
echo variable with_mymodules_dir is $with_mymodules_dir
AC_ARG_WITH(mymodules_dyn_dir,
ACX_HELP_STRING([--with-mymodules-dyn-dir=PATH],
[sets directory for own extensions which will be included at runtime (default=/usr/local/nagios/libexec)]),
with_mymodules_dyn_dir=$withval,
with_mymodules_dyn_dir=/usr/local/nagios/libexec)
AC_SUBST(MYMODULES_DYN_DIR, $with_mymodules_dyn_dir)
echo variable with_mymodules_dyn_dir is $with_mymodules_dyn_dir
EXTRAS=
dnl PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/etc:/usr/local/bin:/usr/local/sbin:$PATH
dnl Checks for programs.
AC_PATH_PROG(SH,sh)
AC_PATH_PROG(PERL,perl)
AC_PATH_PROG(GZIP,gzip)
AC_PATH_PROGS(AWK,gawk nawk /usr/xpg4/bin/awk awk)
AC_PATH_PROG(GREP,grep)
AC_PATH_PROG(ECHO,echo)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(CAT,cat)
dnl allow them to override the path of perl
AC_ARG_WITH(perl,
ACX_HELP_STRING([--with-perl=PATH],
[sets path to perl executable]),
with_perl=$withval,with_perl=$PERL)
AC_SUBST(PERL, $with_perl)
AC_OUTPUT(
Makefile
plugins-scripts/Makefile
plugins-scripts/subst
t/Makefile
)
ACX_FEATURE([with],[perl])
ACX_FEATURE([with],[statefiles-dir])
ACX_FEATURE([with],[nagios-user])
ACX_FEATURE([with],[nagios-group])
ACX_FEATURE([with],[mymodules-dir])
ACX_FEATURE([with],[mymodules-dyn-dir])

View File

@ -1,73 +0,0 @@
==========================================================================================
http://www.sqlservercentral.com/Forums/Topic261080-5-1.aspx#bm261128
MachineName InstanceName DbName FileGroupName AllocatedMb UsedMb FreeMb FreePercent AutoGrowMb AutoGrowMaxSize
WIN2K3R2EE Default master PRIMARY 4 2 1 49 0.4 2147483647
WIN2K3R2EE Default tempdb PRIMARY 8 1 6 86 0.8 2147483647
WIN2K3R2EE Default model PRIMARY 1 0 0 17 1 2147483647
WIN2K3R2EE Default msdb PRIMARY 4 3 0 15 0.25 2147483647
WIN2K3R2EE Default ReportServer PRIMARY 3 1 1 38 1 2147483647
WIN2K3R2EE Default ReportServerTempDB PRIMARY 2 1 1 53 1 2147483647
WIN2K3R2EE Default AdventureWorksDW PRIMARY 68 60 8 12 16 2147483647
WIN2K3R2EE Default AdventureWorks PRIMARY 163 153 10 6 16 2147483647
set nocount on
create table #DBSpace
(DbName sysname
,FileGroupName sysname
,AllocatedMb integer
,UsedMb integer
,FreeMb integer
,FreePercent integer
,AutoGrowMb decimal(12,2)
,AutoGrowMaxSize integer
)
exec master.dbo.sp_MSForEachDb @command1 =
'dbcc updateusage([?]) with no_infomsgs
insert into #DBSpace
select ''?''
, sysFileGroups.groupname
, F.AllocatedPages / 128 as AllocatedMb
, U.UsedPages / 128 as UsedMb
, (F.AllocatedPages - U.UsedPages) / 128 as FreeMb
, (F.AllocatedPages - U.UsedPages) * 100
/ F.AllocatedPages as FreePercent
, CAST(F.GrowthPages / 128.0 as decimal(12,2) ) as AutoGrowMb
, F.MaxSize as AutoGrowMaxSize
FROM (select GroupId
, sum( cast( used as bigint) )
from [?].dbo.sysindexes
where indid in (0,1,255)
group by GroupId
) as U ( GroupId , UsedPages)
join (select GroupId
, sum(cast( size as bigint) )
, Max(growth)
, MAX(case status & 0x100000
WHEN 0x100000 then Growth * Size / 100 -- Increase in Percentage
else Growth -- Increase in Pages
end)
, MAX( case maxsize when -1 then 2147483647 else maxsize end)
from [?].dbo.sysfiles
where (status & 64 = 0)
group by GroupId
) as F (GroupId , AllocatedPages, Growth, GrowthPages, maxsize)
on F.GroupId = U.groupid
join sysFileGroups
on sysFileGroups.GroupId = U.groupId
'
select CAST( SERVERPROPERTY ('MachineName') as nvarchar(128) ) AS MachineName
, COALESCE ( CAST( SERVERPROPERTY ('InstanceName') as nvarchar(128) ) , 'Default') AS InstanceName
, DbName
, FileGroupName
, AllocatedMb
, UsedMb
, FreeMb
, FreePercent
, AutoGrowMb
, AutoGrowMaxSize
from #DBSpace

View File

@ -1,526 +0,0 @@
<?php
#
# Copyright (c) 2009 Gerhard Lausser (gerhard.lausser@consol.de)
# Plugin: check_mysql_health (http://www.consol.com/opensource/nagios/check-mysql-health)
# Release 1.0 2009-03-02
#
# This is a template for the visualisation addon PNP (http://www.pnp4nagios.org)
#
$defcnt = 1;
$green = "33FF00E0";
$yellow = "FFFF00E0";
$red = "F83838E0";
$now = "FF00FF";
foreach ($DS as $i) {
$warning = ($WARN[$i] != "") ? $WARN[$i] : "";
$warnmin = ($WARN_MIN[$i] != "") ? $WARN_MIN[$i] : "";
$warnmax = ($WARN_MAX[$i] != "") ? $WARN_MAX[$i] : "";
$critical = ($CRIT[$i] != "") ? $CRIT[$i] : "";
$critmin = ($CRIT_MIN[$i] != "") ? $CRIT_MIN[$i] : "";
$critmax = ($CRIT_MAX[$i] != "") ? $CRIT_MAX[$i] : "";
$minimum = ($MIN[$i] != "") ? $MIN[$i] : "";
$maximum = ($MAX[$i] != "") ? $MAX[$i] : "";
if(preg_match('/^connection_time$/', $NAME[$i])) {
$ds_name[$defcnt] = "Time to connect";
$opt[$defcnt] = "--vertical-label \"Seconds\" --title \"Time to establish a connection to $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:connectiontime=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "AREA:connectiontime#111111 ";
$def[$defcnt] .= "VDEF:vconnetiontime=connectiontime,LAST " ;
$def[$defcnt] .= "GPRINT:vconnetiontime:\"is %3.2lf Seconds \" " ;
$defcnt++;
}
if(preg_match('/^cpu_busy$/', $NAME[$i])) {
$ds_name[$defcnt] = "CPU Busy Time";
$opt[$defcnt] = "--vertical-label \"%\" --title \"CPU busy time on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:cpubusy=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=cpubusy,$WARN[$i],LE,cpubusy,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,cpubusy,0,IF ";
$def[$defcnt] .= "CDEF:ay=cpubusy,$CRIT[$i],LE,cpubusy,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,cpubusy,0,IF ";
$def[$defcnt] .= "CDEF:ar=cpubusy,100,LE,cpubusy,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,cpubusy,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:cpubusy#111111:\" \" ";
$def[$defcnt] .= "VDEF:vcpubusy=cpubusy,LAST " ;
$def[$defcnt] .= "GPRINT:vcpubusy:\"CPU is busy for %3.2lf percent of the time\\n\" " ;
$defcnt++;
}
if(preg_match('/^io_busy$/', $NAME[$i])) {
$ds_name[$defcnt] = "IO Busy Time";
$opt[$defcnt] = "--vertical-label \"%\" --title \"IO busy time on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:iobusy=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=iobusy,$WARN[$i],LE,iobusy,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,iobusy,0,IF ";
$def[$defcnt] .= "CDEF:ay=iobusy,$CRIT[$i],LE,iobusy,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,iobusy,0,IF ";
$def[$defcnt] .= "CDEF:ar=iobusy,100,LE,iobusy,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,iobusy,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:iobusy#111111:\" \" ";
$def[$defcnt] .= "VDEF:viobusy=iobusy,LAST " ;
$def[$defcnt] .= "GPRINT:viobusy:\"IO is busy for %3.2lf percent of the time\\n\" " ;
$defcnt++;
}
if(preg_match('/^full_scans_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Full Table Scans / Sec";
$opt[$defcnt] = "--vertical-label \"scans / sec\" --title \"Full table scans / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:fullscans=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=fullscans,$WARN[$i],LE,fullscans,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,fullscans,0,IF ";
$def[$defcnt] .= "CDEF:ay=fullscans,$CRIT[$i],LE,fullscans,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,fullscans,0,IF ";
$def[$defcnt] .= "CDEF:ar=fullscans,INF,LE,fullscans,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,fullscans,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:fullscans#000000:\" \" ";
$def[$defcnt] .= "VDEF:vfullscans=fullscans,LAST " ;
$def[$defcnt] .= "GPRINT:vfullscans:\"%3.2lf full table scans / sec\\n\" " ;
$defcnt++;
}
if(preg_match('/^connected_users$/', $NAME[$i])) {
$ds_name[$defcnt] = "Connected Users";
$opt[$defcnt] = "--vertical-label \"Users\" --title \"Users connected to $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:users=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=users,$WARN[$i],LE,users,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,users,0,IF ";
$def[$defcnt] .= "CDEF:ay=users,$CRIT[$i],LE,users,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,users,0,IF ";
$def[$defcnt] .= "CDEF:ar=users,INF,LE,users,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,users,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:users#000000:\"connected users \" ";
$def[$defcnt] .= "VDEF:lvusers=users,LAST " ;
$def[$defcnt] .= "VDEF:mvusers=users,MAXIMUM " ;
$def[$defcnt] .= "VDEF:avusers=users,AVERAGE " ;
$def[$defcnt] .= "GPRINT:lvusers:\"%.0lf LAST \" " ;
$def[$defcnt] .= "GPRINT:mvusers:\"%.0lf MAX \" " ;
$def[$defcnt] .= "GPRINT:avusers:\"%.0lf AVERAGE \" " ;
$defcnt++;
}
if(preg_match('/^.*_transactions_per_sec/', $NAME[$i])) {
# if exists array dbs && > 0 -> next
if(isset($dbs)) continue; # da muss rein, dass $servicedesc schon gezeichnet wurde.
# hash bauen mit database als key
$dbs = array();
$dsnr = array();
$units = array();
$numds = 1;
$colors = array("#ff0000","#00ffff","#0000ff","#00ff00"); #.....fuer singlegraph
$multigraph = 0;
foreach ($DS as $t) {
if(preg_match('/^(.*)_transactions_per_sec/', $NAME[$t], $match)) {
$dbs[] = $match[1];
}
$dsnr[] = $DS[$t];
$units[] = $UNIT[$t];
$warn[] = $WARN[$t];
$crit[] = $CRIT[$t];
}
foreach ($dbs as $key => $db) {
$ds_transactions = $dsnr[$key * $numds];
$units_transactions = $units[$key * $numds];
$warn_transactions = $warn[$key * $numds];
$crit_transactions = $crit[$key * $numds];
# eine zweite ds wuerde so aussehen
# $ds_used = $dsnr[$key * $numds + 1];
# aber transactions hat nur 1 ds
$ds_name[$defcnt] = "Transactions / sec of DB $db";
$opt[$defcnt] = "--vertical-label \"Transactions/s\" -l0 --title \"Database $db transactions / sec\" ";
$def[$defcnt] = "DEF:trans=$rrdfile:".$ds_transactions.":AVERAGE " ;
if ($multigraph) {
$def[$defcnt] .= "CDEF:ag=trans,$WARN[$i],LE,trans,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,trans,0,IF ";
$def[$defcnt] .= "CDEF:ay=trans,$CRIT[$i],LE,trans,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,trans,0,IF ";
$def[$defcnt] .= "CDEF:ar=trans,100,LE,trans,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,trans,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:trans#000000:\"$db\" " ;
} else {
$def[$defcnt] = "DEF:trans=$rrdfile:".$ds_transactions.":AVERAGE " ;
$def[$defcnt] .= "AREA:trans#F2F2F2:\"\" " ;
$def[$defcnt] .= "LINE1:trans$colors[$multigraph]:\"$db\" " ;
}
$def[$defcnt] .= "GPRINT:trans:LAST:\"%3.2lf/s LAST \" ";
$def[$defcnt] .= "GPRINT:trans:MAX:\"%3.2lf/s MAX \" ";
$def[$defcnt] .= "GPRINT:trans:AVERAGE:\"%3.2lf/s AVERAGE \\n\" ";
if ($multigraph) {
$defcnt++;
}
}
}
if(preg_match('/^latch_waits_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Latch Waits / Sec";
$opt[$defcnt] = "--vertical-label \"waits / sec\" --title \"Latch waits / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:waits=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=waits,$WARN[$i],LE,waits,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "CDEF:ay=waits,$CRIT[$i],LE,waits,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "CDEF:ar=waits,INF,LE,waits,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:waits#000000:\" \" ";
$def[$defcnt] .= "VDEF:vwaits=waits,LAST " ;
$def[$defcnt] .= "GPRINT:vwaits:\"%3.2lf waits / sec\\n\" " ;
$defcnt++;
}
if(preg_match('/^latch_avg_wait_time$/', $NAME[$i])) {
$ds_name[$defcnt] = "Latch Wait Time";
$opt[$defcnt] = "--vertical-label \"msec\" --title \"Latch avg wait time on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:waittime=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=waittime,$WARN[$i],LE,waittime,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,waittime,0,IF ";
$def[$defcnt] .= "CDEF:ay=waittime,$CRIT[$i],LE,waittime,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,waittime,0,IF ";
$def[$defcnt] .= "CDEF:ar=waittime,INF,LE,waittime,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,waittime,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:waittime#000000:\" \" ";
$def[$defcnt] .= "VDEF:vwaittime=waittime,LAST " ;
$def[$defcnt] .= "GPRINT:vwaittime:\"%3.2lf waittime (milliseconds)\\n\" " ;
$defcnt++;
}
if(preg_match('/^sql_initcompilations_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Initial Compilations";
$opt[$defcnt] = "--vertical-label \"initcomps/s\" --title \"Initial compilations / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:comps=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=comps,$WARN[$i],LE,comps,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "CDEF:ay=comps,$CRIT[$i],LE,comps,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "CDEF:ar=comps,INF,LE,comps,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:comps#000000:\" \" ";
$def[$defcnt] .= "VDEF:vcomps=comps,LAST " ;
$def[$defcnt] .= "GPRINT:vcomps:\"%3.2lf initial compilations / sec\\n\" " ;
$defcnt++;
}
if(preg_match('/^sql_recompilations_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Re-Compilations";
$opt[$defcnt] = "--vertical-label \"re-comps/s\" --title \"Re-Compilations / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:comps=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=comps,$WARN[$i],LE,comps,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "CDEF:ay=comps,$CRIT[$i],LE,comps,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "CDEF:ar=comps,INF,LE,comps,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,comps,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:comps#000000:\" \" ";
$def[$defcnt] .= "VDEF:vcomps=comps,LAST " ;
$def[$defcnt] .= "GPRINT:vcomps:\"%3.2lf re-compilations / sec\\n\" " ;
$defcnt++;
}
if(preg_match('/^batch_requests_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Batch Requests";
$opt[$defcnt] = "--vertical-label \"batchreqs/s\" --title \"Batch requests / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:breqs=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=breqs,$WARN[$i],LE,breqs,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,breqs,0,IF ";
$def[$defcnt] .= "CDEF:ay=breqs,$CRIT[$i],LE,breqs,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,breqs,0,IF ";
$def[$defcnt] .= "CDEF:ar=breqs,INF,LE,breqs,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,breqs,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:breqs#000000:\" \" ";
$def[$defcnt] .= "VDEF:lvbreqs=breqs,LAST " ;
$def[$defcnt] .= "VDEF:avbreqs=breqs,AVERAGE " ;
$def[$defcnt] .= "VDEF:mvbreqs=breqs,MAXIMUM " ;
$def[$defcnt] .= "GPRINT:lvbreqs:\"%3.2lf batch requests / sec \" " ;
$def[$defcnt] .= "GPRINT:avbreqs:\"(AVERAGE\: %3.2lf\" " ;
$def[$defcnt] .= "GPRINT:mvbreqs:\"MAX %3.2lf)\\n\" " ;
$defcnt++;
}
if(preg_match('/^checkpoint_pages_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Checpoint Pages";
$opt[$defcnt] = "--vertical-label \"pages/s\" --title \"Flushed pages / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:pages=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=pages,$WARN[$i],LE,pages,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,pages,0,IF ";
$def[$defcnt] .= "CDEF:ay=pages,$CRIT[$i],LE,pages,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,pages,0,IF ";
$def[$defcnt] .= "CDEF:ar=pages,INF,LE,pages,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,pages,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:pages#000000:\" \" ";
$def[$defcnt] .= "VDEF:lvpages=pages,LAST " ;
$def[$defcnt] .= "VDEF:avpages=pages,AVERAGE " ;
$def[$defcnt] .= "VDEF:mvpages=pages,MAXIMUM " ;
$def[$defcnt] .= "GPRINT:lvpages:\"%3.2lf pages flushed / sec \" " ;
$def[$defcnt] .= "GPRINT:avpages:\"(AVERAGE\: %3.2lf\" " ;
$def[$defcnt] .= "GPRINT:mvpages:\"MAX %3.2lf)\\n\" " ;
$defcnt++;
}
if(preg_match('/^free_list_stalls_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Free List Stalls";
$opt[$defcnt] = "--vertical-label \"stalls/s\" --title \"Free list stalls / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:stalls=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=stalls,$WARN[$i],LE,stalls,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,stalls,0,IF ";
$def[$defcnt] .= "CDEF:ay=stalls,$CRIT[$i],LE,stalls,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,stalls,0,IF ";
$def[$defcnt] .= "CDEF:ar=stalls,INF,LE,stalls,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,stalls,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:stalls#000000:\" \" ";
$def[$defcnt] .= "VDEF:lvstalls=stalls,LAST " ;
$def[$defcnt] .= "VDEF:avstalls=stalls,AVERAGE " ;
$def[$defcnt] .= "VDEF:mvstalls=stalls,MAXIMUM " ;
$def[$defcnt] .= "GPRINT:lvstalls:\"%3.2lf free list stalls / sec \" " ;
$def[$defcnt] .= "GPRINT:avstalls:\"(AVERAGE\: %3.2lf\" " ;
$def[$defcnt] .= "GPRINT:mvstalls:\"MAX %3.2lf)\\n\" " ;
$defcnt++;
}
if(preg_match('/^lazy_writes_per_sec$/', $NAME[$i])) {
$ds_name[$defcnt] = "Lazy Writes";
$opt[$defcnt] = "--vertical-label \"lazyw/s\" --title \"Lazy writes / sec on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:lazyw=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ag=lazyw,$WARN[$i],LE,lazyw,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,lazyw,0,IF ";
$def[$defcnt] .= "CDEF:ay=lazyw,$CRIT[$i],LE,lazyw,$WARN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,lazyw,0,IF ";
$def[$defcnt] .= "CDEF:ar=lazyw,INF,LE,lazyw,$CRIT[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,lazyw,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:lazyw#000000:\" \" ";
$def[$defcnt] .= "VDEF:lvlazyw=lazyw,LAST " ;
$def[$defcnt] .= "VDEF:avlazyw=lazyw,AVERAGE " ;
$def[$defcnt] .= "VDEF:mvlazyw=lazyw,MAXIMUM " ;
$def[$defcnt] .= "GPRINT:lvlazyw:\"%3.2lf lazy writes / sec \" " ;
$def[$defcnt] .= "GPRINT:avlazyw:\"(AVERAGE\: %3.2lf\" " ;
$def[$defcnt] .= "GPRINT:mvlazyw:\"MAX %3.2lf)\\n\" " ;
$defcnt++;
}
if(preg_match('/^page_life_expectancy$/', $NAME[$i])) {
$ds_name[$defcnt] = "Page Life Expectancy";
$opt[$defcnt] = "--vertical-label \"s\" --title \"Page life expectancy on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:lifeexp=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ar=lifeexp,$CRIT_MIN[$i],LE,lifeexp,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,lifeexp,0,IF ";
$def[$defcnt] .= "CDEF:ay=lifeexp,$WARN_MIN[$i],LE,lifeexp,$CRIT_MIN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,lifeexp,0,IF ";
$def[$defcnt] .= "CDEF:ag=lifeexp,INF,LE,lifeexp,$WARN_MIN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,lifeexp,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:lifeexp#000000:\" \" ";
$def[$defcnt] .= "VDEF:lvlifeexp=lifeexp,LAST " ;
$def[$defcnt] .= "VDEF:avlifeexp=lifeexp,AVERAGE " ;
$def[$defcnt] .= "VDEF:mvlifeexp=lifeexp,MINIMUM " ;
$def[$defcnt] .= "GPRINT:lvlifeexp:\"Page life expectancy is %3.2lf seconds \" " ;
$def[$defcnt] .= "GPRINT:avlifeexp:\"(AVERAGE\: %3.2lf\" " ;
$def[$defcnt] .= "GPRINT:mvlifeexp:\"MIN %3.2lf)\\n\" " ;
$defcnt++;
}
if(preg_match('/^total_server_memory$/', $NAME[$i])) {
$ds_name[$defcnt] = "Total Server memory";
$opt[$defcnt] = "--vertical-label \"Bytes\" --title \"Total sql server memory on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:threads=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "AREA:threads#111111 ";
$def[$defcnt] .= "VDEF:vthreads=threads,LAST " ;
$def[$defcnt] .= "GPRINT:vthreads:\"%.0lf Bytes \" " ;
$defcnt++;
}
if(preg_match('/^buffer_cache_hit_ratio$/', $NAME[$i])) {
$ds_name[$defcnt] = "Buffer Cache Hit Ratio";
$opt[$defcnt] = "--vertical-label \"%\" --title \"Buffer cache hit ratio on $hostname\" ";
$def[$defcnt] = "";
$def[$defcnt] .= "DEF:bufcahitrat=$rrdfile:$DS[$i]:AVERAGE:reduce=LAST " ;
$def[$defcnt] .= "CDEF:ar=bufcahitrat,$CRIT_MIN[$i],LE,bufcahitrat,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF ";
$def[$defcnt] .= "CDEF:ay=bufcahitrat,$WARN_MIN[$i],LE,bufcahitrat,$CRIT_MIN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF ";
$def[$defcnt] .= "CDEF:ag=bufcahitrat,100,LE,bufcahitrat,$WARN_MIN[$i],GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:bufcahitrat#000000:\" \" ";
$def[$defcnt] .= "VDEF:vbufcahitrat=bufcahitrat,LAST " ;
$def[$defcnt] .= "GPRINT:vbufcahitrat:\"Hit ratio is %3.2lf percent\\n\" " ;
$defcnt++;
}
if(preg_match('/^.*_lock_timeouts_per_sec/', $NAME[$i])) {
# if exists array locks && > 0 -> next
if(isset($locks)) continue;
# hash bauen mit tablespace als key
$locks = array();
$dsnr = array();
$units = array();
$numds = 2;
foreach ($DS as $t) {
if(preg_match('/^(.*)_lock_timeouts_per_sec/', $NAME[$t], $match)) {
$locks[] = $match[1];
}
$dsnr[] = $DS[$t];
$units[] = $UNIT[$t];
$warn[] = $WARN[$t];
$crit[] = $CRIT[$t];
$warn_min[] = $WARN_MIN[$t];
$crit_min[] = $CRIT_MIN[$t];
}
foreach ($locks as $key => $lock) {
$lock_timeouts_per_sec = $dsnr[$key * $numds];
$unit_lock_timeouts_per_sec = $units[$key * $numds];
$warn= $warn[$key * $numds];
$crit= $crit[$key * $numds];
$ds_name[$defcnt] = "Lock Timeouts Per Second";
$opt[$defcnt] = "--vertical-label \"timeouts / sec\" -l0 --title \"Timeouts / sec for lock $lock on $hostname \" ";
$def[$defcnt] = "DEF:timeouts=$rrdfile:".$lock_timeouts_per_sec.":AVERAGE " ;
$def[$defcnt] .= "CDEF:ag=timeouts,$warn,LE,timeouts,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,timeouts,0,IF ";
$def[$defcnt] .= "CDEF:ay=timeouts,$crit,LE,timeouts,$warn,GT,INF,UNKN,IF,UNKN,IF,ISINF,timeouts,0,IF ";
$def[$defcnt] .= "CDEF:ar=timeouts,INF,LE,timeouts,$crit,GT,INF,UNKN,IF,UNKN,IF,ISINF,timeouts,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:timeouts#000000:\" \" ";
$def[$defcnt] .= "VDEF:vtimeouts=timeouts,LAST " ;
$def[$defcnt] .= "GPRINT:vtimeouts:\"%8.3lf timeouts / sec\" ";
$defcnt++;
}
}
if(preg_match('/^.*_lock_waits_per_sec/', $NAME[$i])) {
# if exists array locks && > 0 -> next
if(isset($locks)) continue;
# hash bauen mit tablespace als key
$locks = array();
$dsnr = array();
$units = array();
$numds = 2;
foreach ($DS as $t) {
if(preg_match('/^(.*)_lock_waits_per_sec/', $NAME[$t], $match)) {
$locks[] = $match[1];
}
$dsnr[] = $DS[$t];
$units[] = $UNIT[$t];
$warn[] = $WARN[$t];
$crit[] = $CRIT[$t];
$warn_min[] = $WARN_MIN[$t];
$crit_min[] = $CRIT_MIN[$t];
}
foreach ($locks as $key => $lock) {
$lock_waits_per_sec = $dsnr[$key * $numds];
$unit_lock_waits_per_sec = $units[$key * $numds];
$warn= $warn[$key * $numds];
$crit= $crit[$key * $numds];
$ds_name[$defcnt] = "Lock waits Per Second";
$opt[$defcnt] = "--vertical-label \"waits / sec\" -l0 --title \"Waits / sec for lock $lock on $hostname \" ";
$def[$defcnt] = "DEF:waits=$rrdfile:".$lock_waits_per_sec.":AVERAGE " ;
$def[$defcnt] .= "CDEF:ag=waits,$crit,LE,waits,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "CDEF:ay=waits,$warn,LE,waits,$crit,GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "CDEF:ar=waits,100,LE,waits,$warn,GT,INF,UNKN,IF,UNKN,IF,ISINF,waits,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:waits#000000:\" \" ";
$defcnt++;
}
}
if(preg_match('/^.*_deadlocks_per_sec/', $NAME[$i])) {
# if exists array locks && > 0 -> next
if(isset($locks)) continue;
# hash bauen mit tablespace als key
$locks = array();
$dsnr = array();
$units = array();
$numds = 2;
foreach ($DS as $t) {
if(preg_match('/^(.*)_deadlocks_per_sec/', $NAME[$t], $match)) {
$locks[] = $match[1];
}
$dsnr[] = $DS[$t];
$units[] = $UNIT[$t];
$warn[] = $WARN[$t];
$crit[] = $CRIT[$t];
$warn_min[] = $WARN_MIN[$t];
$crit_min[] = $CRIT_MIN[$t];
}
foreach ($locks as $key => $lock) {
$lock_deadlocks_per_sec = $dsnr[$key * $numds];
$unit_lock_deadlocks_per_sec = $units[$key * $numds];
$warn= $warn[$key * $numds];
$crit= $crit[$key * $numds];
$ds_name[$defcnt] = "Deadlocks Per Second";
$opt[$defcnt] = "--vertical-label \"deadlocks / sec\" -l0 --title \"Deadlocks / sec for lock $lock on $hostname \" ";
$def[$defcnt] = "DEF:deadlocks=$rrdfile:".$lock_deadlocks_per_sec.":AVERAGE " ;
$def[$defcnt] .= "CDEF:ag=deadlocks,$crit,LE,deadlocks,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,deadlocks,0,IF ";
$def[$defcnt] .= "CDEF:ay=deadlocks,$warn,LE,deadlocks,$crit,GT,INF,UNKN,IF,UNKN,IF,ISINF,deadlocks,0,IF ";
$def[$defcnt] .= "CDEF:ar=deadlocks,100,LE,deadlocks,$warn,GT,INF,UNKN,IF,UNKN,IF,ISINF,deadlocks,0,IF ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$defcnt++;
}
}
if(preg_match('/^db_.*_free_pct/', $NAME[$i])) {
# if exists array dbs && > 0 -> next
if(isset($dbs)) continue;
# hash bauen mit tablespace als key
$dbs = array();
$dsnr = array();
$units = array();
$numds = 3;
$colors = array("#000000","#00ffff","#0000ff");
foreach ($DS as $t) {
if(preg_match('/^db_(.*)_free_pct/', $NAME[$t], $match)) {
$dbs[] = $match[1];
}
$dsnr[] = $DS[$t];
$act[] = $ACT[$t];
$units[] = $UNIT[$t];
$warn[] = $WARN[$t];
$crit[] = $CRIT[$t];
$warn_min[] = $WARN_MIN[$t];
$crit_min[] = $CRIT_MIN[$t];
$max[] = $MAX[$t];
$min[] = $MIN[$t];
}
foreach ($dbs as $key => $db) {
$db_free_pct = $dsnr[$key * $numds];
$db_free_mb = $dsnr[$key * $numds + 1];
$db_free_mb_val = $act[$key * $numds + 1];
$max_free_mb = $max[$key * $numds + 1];
$db_alloc_pct = $dsnr[$key * $numds + 2];
$unit_free_pct = $units[$key * $numds];
$unit_free_mb = $units[$key * $numds + 1];
$warn_free_pct = $warn_min[$key * $numds];
$crit_free_pct = $crit_min[$key * $numds];
$ds_name[$defcnt] = "DB free space %";
$opt[$defcnt] = "--vertical-label \"DB free space %\" -u102 -l0 --title \"Database $db free space \" ";
$def[$defcnt] = "DEF:free=$rrdfile:".$db_free_pct.":AVERAGE " ;
$def[$defcnt] .= "DEF:allocated=$rrdfile:".$db_alloc_pct.":AVERAGE " ;
$def[$defcnt] .= "DEF:freemb=$rrdfile:".$db_free_mb.":AVERAGE " ;
$def[$defcnt] .= "CDEF:ar=free,$crit_free_pct,LE,free,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,free,0,IF ";
$def[$defcnt] .= "CDEF:ay=free,$warn_free_pct,LE,free,$crit_free_pct,GT,INF,UNKN,IF,UNKN,IF,ISINF,free,0,IF ";
$def[$defcnt] .= "CDEF:ag=free,100,LE,free,$warn_free_pct,GT,INF,UNKN,IF,UNKN,IF,ISINF,free,0,IF ";
$def[$defcnt] .= "CDEF:used=100,free,- ";
$def[$defcnt] .= "AREA:ag#$green: " ;
$def[$defcnt] .= "AREA:ay#$yellow: " ;
$def[$defcnt] .= "AREA:ar#$red: " ;
$def[$defcnt] .= "LINE0.6:free#000000:\" \" ";
$def[$defcnt] .= "AREA:used#00000030::STACK " ;
$def[$defcnt] .= "VDEF:lvfree=free,LAST " ;
$def[$defcnt] .= "VDEF:lvfreemb=freemb,LAST " ;
$def[$defcnt] .= "GPRINT:lvfree:\"Database $db has %.2lf%% free space left \" ";
$def[$defcnt] .= "COMMENT:\"($db_free_mb_val of $max_free_mb$unit_free_mb)\\n\" ";
$def[$defcnt] .= "COMMENT:\"($warn_free_pct $crit_free_pct\" ";
$def[$defcnt] .= "LINE1:allocated#FFFFFF:\" \" ";
$def[$defcnt] .= "VDEF:lvallocated=allocated,LAST " ;
$def[$defcnt] .= "GPRINT:lvallocated:\"Database $db has %.2lf%% allocated\\n\" ";
$defcnt++;
}
}
}
if(isset($dbs)) unset($dbs);
if(isset($locks)) unset($locks);
if(isset($warn)) unset($warn);
if(isset($crit)) unset($crit);
?>

View File

@ -1,68 +0,0 @@
declare @dbname varchar(255)
declare @check_mssql_health_USER varchar(255)
declare @check_mssql_health_PASS varchar(255)
declare @check_mssql_health_ROLE varchar(255)
declare @source varchar(255)
declare @options varchar(255)
declare @backslash int
/*******************************************************************/
SET @check_mssql_health_USER = '"[Servername|Domainname]\Username"'
SET @check_mssql_health_PASS = 'Password'
SET @check_mssql_health_ROLE = 'Rolename'
/*******************************************************************
PLEASE CHANGE THE ABOVE VALUES ACCORDING TO YOUR REQUIREMENTS
- Example for Windows authentication:
SET @check_mssql_health_USER = '"[Servername|Domainname]\Username"'
SET @check_mssql_health_ROLE = 'Rolename'
- Example for SQL Server authentication:
SET @check_mssql_health_USER = 'Username'
SET @check_mssql_health_PASS = 'Password'
SET @check_mssql_health_ROLE = 'Rolename'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
It is strongly recommended to use Windows authentication. Otherwise
you will get no reliable results for database usage.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*********** NO NEED TO CHANGE ANYTHING BELOW THIS LINE *************/
SET @options = 'DEFAULT_DATABASE=MASTER, DEFAULT_LANGUAGE=English'
SET @backslash = (SELECT CHARINDEX('\', @check_mssql_health_USER))
IF @backslash > 0
BEGIN
SET @source = ' FROM WINDOWS'
SET @options = ' WITH ' + @options
END
ELSE
BEGIN
SET @source = ''
SET @options = ' WITH PASSWORD=''' + @check_mssql_health_PASS + ''',' + @options
END
PRINT 'create Nagios plugin user ' + @check_mssql_health_USER
EXEC ('CREATE LOGIN ' + @check_mssql_health_USER + @source + @options)
EXEC ('USE MASTER GRANT VIEW SERVER STATE TO ' + @check_mssql_health_USER)
PRINT 'User ' + @check_mssql_health_USER + ' created.'
PRINT ''
declare dblist cursor for
select name from sysdatabases WHERE name NOT IN ('master', 'tempdb', 'msdb') open dblist
fetch next from dblist into @dbname
while @@fetch_status = 0 begin
EXEC ('USE ' + @dbname + ' print ''Grant permissions in the db '' + ''"'' + DB_NAME() + ''"''')
EXEC ('USE ' + @dbname + ' CREATE ROLE ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' GRANT EXECUTE TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' GRANT VIEW DATABASE STATE TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' GRANT VIEW DEFINITION TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' CREATE USER ' + @check_mssql_health_USER + ' FOR LOGIN ' + @check_mssql_health_USER)
EXEC ('USE ' + @dbname + ' EXEC sp_addrolemember ' + @check_mssql_health_ROLE + ' , ' + @check_mssql_health_USER)
EXEC ('USE ' + @dbname + ' print ''Permissions in the db '' + ''"'' + DB_NAME() + ''" granted.''')
fetch next from dblist into @dbname
end
close dblist
deallocate dblist

View File

@ -1,30 +0,0 @@
declare @dbname varchar(255)
declare @check_mssql_health_USER varchar(255)
declare @check_mssql_health_ROLE varchar(255)
SET @check_mssql_health_USER = '"[Servername|Domainname]\Username"'
SET @check_mssql_health_ROLE = 'Rolename'
declare dblist cursor for
select name from sysdatabases WHERE name NOT IN ('master', 'tempdb', 'msdb') open dblist
fetch next from dblist into @dbname
while @@fetch_status = 0 begin
EXEC ('USE ' + @dbname + ' print ''Revoke permissions in the db '' + ''"'' + DB_NAME() + ''"''')
EXEC ('USE ' + @dbname + ' EXEC sp_droprolemember ' + @check_mssql_health_ROLE + ' , ' + @check_mssql_health_USER)
EXEC ('USE ' + @dbname + ' DROP USER ' + @check_mssql_health_USER)
EXEC ('USE ' + @dbname + ' REVOKE VIEW DEFINITION TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' REVOKE VIEW DATABASE STATE TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' REVOKE EXECUTE TO ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' DROP ROLE ' + @check_mssql_health_ROLE)
EXEC ('USE ' + @dbname + ' print ''Permissions in the db '' + ''"'' + DB_NAME() + ''" revoked.''')
fetch next from dblist into @dbname
end
close dblist
deallocate dblist
PRINT ''
PRINT 'drop Nagios plugin user ' + @check_mssql_health_USER
EXEC ('USE MASTER REVOKE VIEW SERVER STATE TO ' + @check_mssql_health_USER)
EXEC ('DROP LOGIN ' + @check_mssql_health_USER)
PRINT 'User ' + @check_mssql_health_USER + ' dropped.'

View File

@ -1,295 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2003-09-24.23
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=
transform_arg=
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
or: $0 -d DIR1 DIR2...
In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
In the second, create the directory path DIR.
Options:
-b=TRANSFORMBASENAME
-c copy source (using $cpprog) instead of moving (using $mvprog).
-d create directories instead of installing files.
-g GROUP $chgrp installed files to GROUP.
-m MODE $chmod installed files to MODE.
-o USER $chown installed files to USER.
-s strip installed files (using $stripprog).
-t=TRANSFORM
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;;
*) if test -z "$src"; then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if test -z "$src"; then
echo "$0: no input file specified." >&2
exit 1
fi
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
instcmd=:
chmodcmd=
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst"; then
echo "$0: no destination specified." >&2
exit 1
fi
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
test -d "$pathcomp" || $mkdirprog "$pathcomp"
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $instcmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
# If we're going to rename the final executable, determine the name now.
if test -z "$transformarg"; then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename \
| sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename.
test -z "$dstfile" && dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now remove or move aside any old file at destination location. We
# try this two ways since rm can't unlink itself on some systems and
# the destination file might be busy for other reasons. In this case,
# the final cleanup might fail but the new file should still install
# successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,360 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2003-09-02.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -1,51 +0,0 @@
## Process this file with automake to produce Makefile.in
SUFFIXES = .pl .pm .sh
VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t
libexec_SCRIPTS=check_mssql_health
MY_MODULES=
EXTRA_MODULES=\
Nagios/DBD/MSSQL/Server/Memorypool.pm \
Nagios/DBD/MSSQL/Server/Database/Datafile.pm \
Nagios/DBD/MSSQL/Server/Database.pm \
Nagios/DBD/MSSQL/Server.pm \
Nagios/Extraopts.pm
EXTRA_DIST=check_mssql_health.pl $(EXTRA_MODULES)
CLEANFILES=$(libexec_SCRIPTS)
AM_INSTALL_PROGRAM_FLAGS=@INSTALL_OPTS@
.pm :
$(AWK) -f ./subst $< > $@
chmod +x $@
.pl :
$(AWK) -f ./subst $< > $@
chmod +x $@
.sh :
$(AWK) -f ./subst $< > $@
chmod +x $@
$(libexec_SCRIPTS) : $(EXTRA_DIST)
$(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@
#since 1.5.1 $(ECHO) "# nagios: -epn" >> $@
$(ECHO) >> $@
$(ECHO) "my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );" >> $@
$(ECHO) "my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );" >> $@
for m in ${EXTRA_MODULES}; do \
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
done
if [ -d "${MYMODULES_DIR}" ]; then \
for m in ${MYMODULES_DIR}/CheckMSSQLHealthExt*.pm; do \
if [ -f $$m ]; then \
$(ECHO) found $$m; \
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
fi \
done \
fi
$(CAT) check_mssql_health.pl | $(GREP) -v "^use Nagios" | $(GREP) -v "^my %ERROR" | $(AWK) -f ./subst >> $@
chmod +x $@

View File

@ -1,358 +0,0 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = plugins-scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/subst.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES = subst
am__installdirs = "$(DESTDIR)$(libexecdir)"
libexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(libexec_SCRIPTS)
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
VPATH = $(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t
INSTALL = @INSTALL@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAT = @CAT@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
GREP = @GREP@
GZIP = @GZIP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_OPTS = @INSTALL_OPTS@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MYMODULES_DIR = @MYMODULES_DIR@
MYMODULES_DYN_DIR = @MYMODULES_DYN_DIR@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
RELEASE = @RELEASE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SH = @SH@
SHELL = @SHELL@
STATEFILES_DIR = @STATEFILES_DIR@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
VERSION = @VERSION@
WARRANTY = @WARRANTY@
ac_ct_STRIP = @ac_ct_STRIP@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
with_nagios_group = @with_nagios_group@
with_nagios_user = @with_nagios_user@
SUFFIXES = .pl .pm .sh
libexec_SCRIPTS = check_mssql_health
MY_MODULES =
EXTRA_MODULES = \
Nagios/DBD/MSSQL/Server/Memorypool.pm \
Nagios/DBD/MSSQL/Server/Database/Datafile.pm \
Nagios/DBD/MSSQL/Server/Database.pm \
Nagios/DBD/MSSQL/Server.pm \
Nagios/Extraopts.pm
EXTRA_DIST = check_mssql_health.pl $(EXTRA_MODULES)
CLEANFILES = $(libexec_SCRIPTS)
AM_INSTALL_PROGRAM_FLAGS = @INSTALL_OPTS@
all: all-am
.SUFFIXES:
.SUFFIXES: .pl .pm .sh
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins-scripts/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu plugins-scripts/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
subst: $(top_builddir)/config.status $(srcdir)/subst.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-libexecSCRIPTS: $(libexec_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)"
@list='$(libexec_SCRIPTS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f $$d$$p; then \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " $(libexecSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \
$(libexecSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(libexecdir)/$$f"; \
else :; fi; \
done
uninstall-libexecSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(libexec_SCRIPTS)'; for p in $$list; do \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " rm -f '$(DESTDIR)$(libexecdir)/$$f'"; \
rm -f "$(DESTDIR)$(libexecdir)/$$f"; \
done
uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/Nagios $(distdir)/Nagios/DBD/MSSQL $(distdir)/Nagios/DBD/MSSQL/Server $(distdir)/Nagios/DBD/MSSQL/Server/Database
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(SCRIPTS)
installdirs:
for dir in "$(DESTDIR)$(libexecdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-libexecSCRIPTS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libexecSCRIPTS
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-libexecSCRIPTS install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-libexecSCRIPTS
.pm :
$(AWK) -f ./subst $< > $@
chmod +x $@
.pl :
$(AWK) -f ./subst $< > $@
chmod +x $@
.sh :
$(AWK) -f ./subst $< > $@
chmod +x $@
$(libexec_SCRIPTS) : $(EXTRA_DIST)
$(ECHO) "#! #PERL# -w" | $(AWK) -f ./subst > $@
#since 1.5.1 $(ECHO) "# nagios: -epn" >> $@
$(ECHO) >> $@
$(ECHO) "my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );" >> $@
$(ECHO) "my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );" >> $@
for m in ${EXTRA_MODULES}; do \
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
done
if [ -d "${MYMODULES_DIR}" ]; then \
for m in ${MYMODULES_DIR}/CheckMSSQLHealthExt*.pm; do \
if [ -f $$m ]; then \
$(ECHO) found $$m; \
$(SED) -e 's/^1;//g' < $$m | $(AWK) -f ./subst | $(GREP) -v "my %ERROR" >> $@; \
fi \
done \
fi
$(CAT) check_mssql_health.pl | $(GREP) -v "^use Nagios" | $(GREP) -v "^my %ERROR" | $(AWK) -f ./subst >> $@
chmod +x $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,471 +0,0 @@
package DBD::MSSQL::Server::Database;
use strict;
our @ISA = qw(DBD::MSSQL::Server);
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
{
my @databases = ();
my $initerrors = undef;
sub add_database {
push(@databases, shift);
}
sub return_databases {
return reverse
sort { $a->{name} cmp $b->{name} } @databases;
}
sub init_databases {
my %params = @_;
my $num_databases = 0;
if (($params{mode} =~ /server::database::listdatabases/) ||
($params{mode} =~ /server::database::databasefree/) ||
($params{mode} =~ /server::database::lastbackup/) ||
($params{mode} =~ /server::database::transactions/) ||
($params{mode} =~ /server::database::datafile/)) {
my @databaseresult = ();
if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) {
@databaseresult = $params{handle}->fetchall_array(q{
SELECT name, database_id FROM master.sys.databases
});
} else {
#@databaseresult = map {
# [ $_->[0], $_->[3] ] # only name, dbid
#} $params{handle}->fetchall_array(q{exec sp_helpdb});
@databaseresult = $params{handle}->fetchall_array(q{
SELECT name, dbid FROM master.dbo.sysdatabases
});
}
if ($params{mode} =~ /server::database::transactions/) {
push(@databaseresult, [ '_Total', 0 ]);
}
foreach (@databaseresult) {
my ($name, $id) = @{$_};
next if $params{database} && $name ne $params{database};
if ($params{regexp}) {
next if $params{selectname} && $name !~ /$params{selectname}/;
} else {
next if $params{selectname} && lc $params{selectname} ne lc $name;
}
my %thisparams = %params;
$thisparams{name} = $name;
$thisparams{id} = $id;
my $database = DBD::MSSQL::Server::Database->new(
%thisparams);
add_database($database);
$num_databases++;
}
if (! $num_databases) {
$initerrors = 1;
return undef;
}
} elsif ($params{mode} =~ /server::database::backupage/) {
my @databaseresult = ();
if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) {
@databaseresult = $params{handle}->fetchall_array(q{
SELECT
a.name,
DATEDIFF(HH, MAX(b.backup_finish_date), GETDATE()),
DATEDIFF(MI, MAX(b.backup_start_date), MAX(b.backup_finish_date))
FROM sys.sysdatabases a LEFT OUTER JOIN msdb.dbo.backupset b
ON b.database_name = a.name
GROUP BY a.name
ORDER BY a.name
});
} else {
@databaseresult = $params{handle}->fetchall_array(q{
SELECT
a.name,
DATEDIFF(HH, MAX(b.backup_finish_date), GETDATE()),
DATEDIFF(MI, MAX(b.backup_start_date), MAX(b.backup_finish_date))
FROM master.dbo.sysdatabases a LEFT OUTER JOIN msdb.dbo.backupset b
ON b.database_name = a.name
GROUP BY a.name
ORDER BY a.name
});
}
foreach (sort {
if (! defined $b->[1]) {
return 1;
} elsif (! defined $a->[1]) {
return -1;
} else {
return $a->[1] <=> $b->[1];
}
} @databaseresult) {
my ($name, $age, $duration) = @{$_};
next if $params{database} && $name ne $params{database};
if ($params{regexp}) {
next if $params{selectname} && $name !~ /$params{selectname}/;
} else {
next if $params{selectname} && lc $params{selectname} ne lc $name;
}
my %thisparams = %params;
$thisparams{name} = $name;
$thisparams{backup_age} = $age;
$thisparams{backup_duration} = $duration;
my $database = DBD::MSSQL::Server::Database->new(
%thisparams);
add_database($database);
$num_databases++;
}
}
}
}
sub new {
my $class = shift;
my %params = @_;
my $self = {
handle => $params{handle},
warningrange => $params{warningrange},
criticalrange => $params{criticalrange},
name => $params{name},
id => $params{id},
datafiles => [],
backup_age => $params{backup_age},
backup_duration => $params{backup_duration},
};
bless $self, $class;
$self->init(%params);
return $self;
}
sub init {
my $self = shift;
my %params = @_;
$self->init_nagios();
$self->set_local_db_thresholds(%params);
if ($params{mode} =~ /server::database::datafile/) {
$params{database} = $self->{name};
DBD::MSSQL::Server::Database::Datafile::init_datafiles(%params);
if (my @datafiles =
DBD::MSSQL::Server::Database::Datafile::return_datafiles()) {
$self->{datafiles} = \@datafiles;
} else {
$self->add_nagios_critical("unable to aquire datafile info");
}
} elsif ($params{mode} =~ /server::database::databasefree/) {
###################################################################################
# fuer's museum
# 1> sp_spaceused
# 2> go
# database_name database_size unallocated space
# master 4.50 MB 1.32 MB
# reserved data index_size unused
# 2744 KB 1056 KB 1064 KB 624 KB
# (return status = 0)
#my($database_name, $database_size, $unallocated_space,
# $reserved, $data, $index_size, $unused) =
# $params{handle}->fetchrow_array(
# "USE ".$self->{name}."\nEXEC SP_SPACEUSED"
#);
# server mgmt studio sp_spaceused
# Currently Allocated Space database_size 641.94MB
# Available Free Space unallocated space 457.09MB
#$database_size =~ s/MB//g;
#$unallocated_space =~ s/MB//g;
#$self->{size} = $database_size * 1024 * 1024;
#$self->{free} = $unallocated_space * 1024 * 1024;
#$self->{percent_free} = $unallocated_space / $database_size * 100;
#$self->{used} = $self->{size} - $self->{free};
#$self->{maxsize} = "99999999999999999";
###################################################################################
my $calc = {};
if ($params{method} eq 'sqlcmd' || $params{method} eq 'sqsh') {
foreach($self->{handle}->fetchall_array(q{
if object_id('tempdb..#FreeSpace') is null
create table #FreeSpace(
Drive varchar(10),
MB_Free bigint
)
go
DELETE FROM tempdb..#FreeSpace
INSERT INTO tempdb..#FreeSpace exec master.dbo.xp_fixeddrives
go
SELECT * FROM tempdb..#FreeSpace
})) {
$calc->{drive_mb}->{lc $_->[0]} = $_->[1];
}
} else {
$self->{handle}->execute(q{
if object_id('tempdb..#FreeSpace') is null
create table #FreeSpace(
Drive varchar(10),
MB_Free bigint
)
});
$self->{handle}->execute(q{
DELETE FROM #FreeSpace
});
$self->{handle}->execute(q{
INSERT INTO #FreeSpace exec master.dbo.xp_fixeddrives
});
foreach($self->{handle}->fetchall_array(q{
SELECT * FROM #FreeSpace
})) {
$calc->{drive_mb}->{lc $_->[0]} = $_->[1];
}
}
#$self->{handle}->execute(q{
# DROP TABLE #FreeSpace
#});
# Page = 8KB
# sysfiles ist sv2000, noch als kompatibilitaetsview vorhanden
# dbo.sysfiles kann 2008 durch sys.database_files ersetzt werden?
# omeiomeiomei in 2005 ist ein sys.sysindexes compatibility view
# fuer 2000.dbo.sysindexes
# besser ist sys.allocation_units
if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) {
my $sql = q{
SELECT
SUM(CAST(used AS BIGINT)) / 128
FROM
[?].sys.sysindexes
WHERE
indid IN (0,1,255)
};
#$sql =~ s/\[\?\]/$self->{name}/g;
$sql =~ s/\?/$self->{name}/g;
$self->{used_mb} = $self->{handle}->fetchrow_array($sql);
} else {
my $sql = q{
SELECT
SUM(CAST(used AS BIGINT)) / 128
FROM
[?].dbo.sysindexes
WHERE
indid IN (0,1,255)
};
#$sql =~ s/\[\?\]/$self->{name}/g;
$sql =~ s/\?/$self->{name}/g;
$self->{used_mb} = $self->{handle}->fetchrow_array($sql);
}
my @fileresult = ();
if (DBD::MSSQL::Server::return_first_server()->version_is_minimum("9.x")) {
my $sql = q{
SELECT
RTRIM(a.name), RTRIM(a.filename), CAST(a.size AS BIGINT),
CAST(a.maxsize AS BIGINT), a.growth
FROM
[?].sys.sysfiles a
JOIN
[?].sys.sysfilegroups b
ON
a.groupid = b.groupid
};
#$sql =~ s/\[\?\]/$self->{name}/g;
$sql =~ s/\?/$self->{name}/g;
@fileresult = $self->{handle}->fetchall_array($sql);
} else {
my $sql = q{
SELECT
RTRIM(a.name), RTRIM(a.filename), CAST(a.size AS BIGINT),
CAST(a.maxsize AS BIGINT), a.growth
FROM
[?].dbo.sysfiles a
JOIN
[?].dbo.sysfilegroups b
ON
a.groupid = b.groupid
};
#$sql =~ s/\[\?\]/$self->{name}/g;
$sql =~ s/\?/$self->{name}/g;
@fileresult = $self->{handle}->fetchall_array($sql);
}
foreach(@fileresult) {
my($name, $filename, $size, $maxsize, $growth) = @{$_};
my $drive = lc substr($filename, 0, 1);
$calc->{datafile}->{$name}->{allocsize} = $size / 128;
if ($growth == 0) {
$calc->{datafile}->{$name}->{maxsize} = $size / 128;
} else {
if ($maxsize == -1) {
$calc->{datafile}->{$name}->{maxsize} =
exists $calc->{drive_mb}->{$drive} ?
($calc->{datafile}->{$name}->{allocsize} +
$calc->{drive_mb}->{$drive}) : 4 * 1024;
# falls die platte nicht gefunden wurde, dann nimm halt 4GB
if (exists $calc->{drive_mb}->{$drive}) {
# davon kann ausgegangen werden. wenn die drives nicht zur
# vefuegung stehen, stimmt sowieso hinten und vorne nichts.
$calc->{drive_mb}->{$drive} = 0;
# damit ist der platz dieses laufwerks verbraten und in
# max_mb eingeflossen. es darf nicht sein, dass der freie platz
# mehrfach gezaehlt wird, wenn es mehrere datafiles auf diesem
# laufwerk gibt.
}
} else {
$calc->{datafile}->{$name}->{maxsize} = $maxsize / 128;
}
}
$self->{allocated_mb} += $calc->{datafile}->{$name}->{allocsize};
$self->{max_mb} += $calc->{datafile}->{$name}->{maxsize};
}
$self->{allocated_mb} = $self->{allocated_mb};
if ($self->{used_mb} > $self->{allocated_mb}) {
# obige used-berechnung liefert manchmal (wenns knapp hergeht) mehr als
# den maximal verfuegbaren platz. vermutlich muessen dann
# zwecks ermittlung des tatsaechlichen platzverbrauchs
# irgendwelche dbcc updateusage laufen.
# egal, wird schon irgendwie stimmen.
$self->{used_mb} = $self->{allocated_mb};
$self->{estimated} = 1;
} else {
$self->{estimated} = 0;
}
$self->{free_mb} = $self->{max_mb} - $self->{used_mb};
$self->{free_percent} = 100 * $self->{free_mb} / $self->{max_mb};
$self->{allocated_percent} = 100 * $self->{allocated_mb} / $self->{max_mb};
} elsif ($params{mode} =~ /^server::database::transactions/) {
$self->{transactions_s} = $self->{handle}->get_perf_counter_instance(
'SQLServer:Databases', 'Transactions/sec', $self->{name});
if (! defined $self->{transactions_s}) {
$self->add_nagios_unknown("unable to aquire counter data");
} else {
$self->valdiff(\%params, qw(transactions_s));
$self->{transactions_per_sec} = $self->{delta_transactions_s} / $self->{delta_timestamp};
}
}
}
sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::database::datafile::listdatafiles/) {
foreach (sort { $a->{logicalfilename} cmp $b->{logicalfilename}; } @{$self->{datafiles}}) {
printf "%s\n", $_->{logicalfilename};
}
$self->add_nagios_ok("have fun");
} elsif ($params{mode} =~ /^server::database::transactions/) {
$self->add_nagios(
$self->check_thresholds($self->{transactions_per_sec}, 10000, 50000),
sprintf "%s has %.4f transactions / sec",
$self->{name}, $self->{transactions_per_sec});
$self->add_perfdata(sprintf "%s_transactions_per_sec=%.4f;%s;%s",
$self->{name}, $self->{transactions_per_sec},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /server::database::databasefree/) {
# ->percent_free
# ->free
#
# ausgabe
# perfdata db_<db>_free_pct
# perfdata db_<db>_free (real_bytes_max - bytes) + bytes_free (with units)
# perfdata db_<db>_alloc_free bytes_free (with units)
#
# umrechnen der thresholds
# ()/%
# MB
# GB
# KB
if (($self->{warningrange} && $self->{warningrange} !~ /^\d+[\.\d]*:/) ||
($self->{criticalrange} && $self->{criticalrange} !~ /^\d+[\.\d]*:/)) {
$self->add_nagios_unknown("you want an alert if free space is _above_ a threshold????");
return;
}
if (! $params{units}) {
$params{units} = "%";
}
$self->{warning_bytes} = 0;
$self->{critical_bytes} = 0;
if ($params{units} eq "%") {
$self->add_nagios(
$self->check_thresholds($self->{free_percent}, "5:", "2:"),
sprintf("database %s has %.2f%% free space left",
$self->{name}, $self->{free_percent},
($self->{estimated} ? " (estim.)" : ""))
);
$self->{warningrange} =~ s/://g;
$self->{criticalrange} =~ s/://g;
$self->add_perfdata(sprintf "\'db_%s_free_pct\'=%.2f%%;%d:;%d:",
lc $self->{name},
$self->{free_percent},
$self->{warningrange}, $self->{criticalrange});
$self->add_perfdata(sprintf "\'db_%s_free\'=%dMB;%.2f:;%.2f:;0;%.2f",
lc $self->{name},
$self->{free_mb},
$self->{warningrange} * $self->{max_mb} / 100,
$self->{criticalrange} * $self->{max_mb} / 100,
$self->{max_mb});
$self->add_perfdata(sprintf "\'db_%s_allocated_pct\'=%.2f%%",
lc $self->{name},
$self->{allocated_percent});
} else {
my $factor = 1; # default MB
if ($params{units} eq "GB") {
$factor = 1024;
} elsif ($params{units} eq "MB") {
$factor = 1;
} elsif ($params{units} eq "KB") {
$factor = 1 / 1024;
}
$self->{warningrange} ||= "5:";
$self->{criticalrange} ||= "2:";
my $saved_warningrange = $self->{warningrange};
my $saved_criticalrange = $self->{criticalrange};
# : entfernen weil gerechnet werden muss
$self->{warningrange} =~ s/://g;
$self->{criticalrange} =~ s/://g;
$self->{warningrange} = $self->{warningrange} ?
$self->{warningrange} * $factor : 5 * $factor;
$self->{criticalrange} = $self->{criticalrange} ?
$self->{criticalrange} * $factor : 2 * $factor;
$self->{percent_warning} = 100 * $self->{warningrange} / $self->{max_mb};
$self->{percent_critical} = 100 * $self->{criticalrange} / $self->{max_mb};
$self->{warningrange} .= ':';
$self->{criticalrange} .= ':';
$self->add_nagios(
$self->check_thresholds($self->{free_mb}, "5242880:", "1048576:"),
sprintf("database %s has %.2f%s free space left", $self->{name},
$self->{free_mb} / $factor, $params{units})
);
$self->{warningrange} = $saved_warningrange;
$self->{criticalrange} = $saved_criticalrange;
$self->{warningrange} =~ s/://g;
$self->{criticalrange} =~ s/://g;
$self->add_perfdata(sprintf "\'db_%s_free_pct\'=%.2f%%;%.2f:;%.2f:",
lc $self->{name},
$self->{free_percent}, $self->{percent_warning},
$self->{percent_critical});
$self->add_perfdata(sprintf "\'db_%s_free\'=%.2f%s;%.2f:;%.2f:;0;%.2f",
lc $self->{name},
$self->{free_mb} / $factor, $params{units},
$self->{warningrange},
$self->{criticalrange},
$self->{max_mb} / $factor);
$self->add_perfdata(sprintf "\'db_%s_allocated_pct\'=%.2f%%",
lc $self->{name},
$self->{allocated_percent});
}
} elsif ($params{mode} =~ /server::database::backupage/) {
if (! defined $self->{backup_age}) {
$self->add_nagios_critical(sprintf "%s was never backupped",
$self->{name});
$self->{backup_age} = 0;
$self->{backup_duration} = 0;
$self->check_thresholds($self->{backup_age}, 48, 72); # init wg perfdata
} else {
$self->add_nagios(
$self->check_thresholds($self->{backup_age}, 48, 72),
sprintf "%s backupped %dh ago", $self->{name}, $self->{backup_age});
}
$self->add_perfdata(sprintf "'%s_bck_age'=%d;%s;%s",
$self->{name}, $self->{backup_age},
$self->{warningrange}, $self->{criticalrange});
$self->add_perfdata(sprintf "'%s_bck_time'=%d",
$self->{name}, $self->{backup_duration});
}
}
}
1;

View File

@ -1,202 +0,0 @@
package DBD::MSSQL::Server::Database::Datafile;
use strict;
use File::Basename;
our @ISA = qw(DBD::MSSQL::Server::Database);
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
{
my @datafiles = ();
my $initerrors = undef;
sub add_datafile {
push(@datafiles, shift);
}
sub return_datafiles {
return reverse
sort { $a->{logicalfilename} cmp $b->{logicalfilename} } @datafiles;
}
sub clear_datafiles {
@datafiles = ();
}
sub init_datafiles {
my %params = @_;
my $num_datafiles = 0;
if ($params{mode} =~ /server::database::datafile::listdatafiles/) {
my @datafileresults = $params{handle}->fetchall_array(q{
DECLARE @DBInfo TABLE
( ServerName VARCHAR(100),
DatabaseName VARCHAR(100),
FileSizeMB INT,
LogicalFileName sysname,
PhysicalFileName NVARCHAR(520),
Status sysname,
Updateability sysname,
RecoveryMode sysname,
FreeSpaceMB INT,
FreeSpacePct VARCHAR(7),
FreeSpacePages INT,
PollDate datetime)
DECLARE @command VARCHAR(5000)
SELECT @command = 'Use [' + '?' + '] SELECT
@@servername as ServerName,
' + '''' + '?' + '''' + ' AS DatabaseName,
CAST(sysfiles.size/128.0 AS int) AS FileSize,
sysfiles.name AS LogicalFileName, sysfiles.filename AS PhysicalFileName,
CONVERT(sysname,DatabasePropertyEx(''?'',''Status'')) AS Status,
CONVERT(sysname,DatabasePropertyEx(''?'',''Updateability'')) AS Updateability,
CONVERT(sysname,DatabasePropertyEx(''?'',''Recovery'')) AS RecoveryMode,
CAST(sysfiles.size/128.0 - CAST(FILEPROPERTY(sysfiles.name, ' + '''' +
'SpaceUsed' + '''' + ' ) AS int)/128.0 AS int) AS FreeSpaceMB,
CAST(100 * (CAST (((sysfiles.size/128.0 -CAST(FILEPROPERTY(sysfiles.name,
' + '''' + 'SpaceUsed' + '''' + ' ) AS int)/128.0)/(sysfiles.size/128.0))
AS decimal(4,2))) AS varchar(8)) + ' + '''' + '%' + '''' + ' AS FreeSpacePct,
GETDATE() as PollDate FROM dbo.sysfiles'
INSERT INTO @DBInfo
(ServerName,
DatabaseName,
FileSizeMB,
LogicalFileName,
PhysicalFileName,
Status,
Updateability,
RecoveryMode,
FreeSpaceMB,
FreeSpacePct,
PollDate)
EXEC sp_MSForEachDB @command
SELECT
ServerName,
DatabaseName,
FileSizeMB,
LogicalFileName,
PhysicalFileName,
Status,
Updateability,
RecoveryMode,
FreeSpaceMB,
FreeSpacePct,
PollDate
FROM @DBInfo
ORDER BY
ServerName,
DatabaseName
});
if (DBD::MSSQL::Server::return_first_server()->windows_server()) {
fileparse_set_fstype("MSWin32");
}
foreach (@datafileresults) {
my ($servername, $databasename, $filesizemb, $logicalfilename,
$physicalfilename, $status, $updateability, $recoverymode,
$freespacemb, $freespacepct, $polldate) = @{$_};
next if $databasename ne $params{database};
if ($params{regexp}) {
#next if $params{selectname} &&
# (($name !~ /$params{selectname}/) &&
# (basename($name) !~ /$params{selectname}/));
next if $params{selectname} &&
($logicalfilename !~ /$params{selectname}/);
} else {
#next if $params{selectname} &&
# ((lc $params{selectname} ne lc $name) &&
# (lc $params{selectname} ne lc basename($name)));
next if $params{selectname} &&
(lc $params{selectname} ne lc $logicalfilename);
}
my %thisparams = %params;
$thisparams{servername} = $servername;
$thisparams{databasename} = $databasename;
$thisparams{filesizemb} = $filesizemb;
$thisparams{logicalfilename} = $logicalfilename;
$thisparams{servername} = $servername;
$thisparams{status} = $status;
$thisparams{updateability} = $updateability;
$thisparams{recoverymode} = $recoverymode;
$thisparams{freespacemb} = $freespacemb;
$thisparams{freespacepct} = $freespacepct;
$thisparams{polldate} = $polldate;
my $datafile =
DBD::MSSQL::Server::Database::Datafile->new(
%thisparams);
add_datafile($datafile);
$num_datafiles++;
}
}
}
}
sub new {
my $class = shift;
my %params = @_;
my $self = {
handle => $params{handle},
databasename => $params{databasename},
filesizemb => $params{filesizemb},
logicalfilename => $params{logicalfilename},
physicalfilename => $params{physicalfilename},
status => $params{status},
updateability => $params{updateability},
recoverymode => $params{recoverymode},
freespacemb => $params{freespacemb},
freespacepct => $params{freespacepct},
freespacepages => $params{freespacepages},
polldate => $params{polldate},
warningrange => $params{warningrange},
criticalrange => $params{criticalrange},
};
bless $self, $class;
$self->init(%params);
return $self;
}
sub init {
my $self = shift;
my %params = @_;
$self->init_nagios();
if ($params{mode} =~ /server::database::iobalance/) {
if (! defined $self->{phyrds}) {
$self->add_nagios_critical(sprintf "unable to read datafile io %s", $@);
} else {
$params{differenciator} = $self->{path};
$self->valdiff(\%params, qw(phyrds phywrts));
$self->{io_total} = $self->{delta_phyrds} + $self->{delta_phywrts};
}
} elsif ($params{mode} =~ /server::database::datafile::iotraffic/) {
if (! defined $self->{phyrds}) {
$self->add_nagios_critical(sprintf "unable to read datafile io %s", $@);
} else {
$params{differenciator} = $self->{path};
$self->valdiff(\%params, qw(phyrds phywrts));
$self->{io_total_per_sec} = ($self->{delta_phyrds} + $self->{delta_phywrts}) /
$self->{delta_timestamp};
}
}
}
sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::database::datafile::iotraffic/) {
$self->add_nagios(
$self->check_thresholds($self->{io_total_per_sec}, "1000", "5000"),
sprintf ("%s: %.2f IO Operations per Second",
$self->{name}, $self->{io_total_per_sec}));
$self->add_perfdata(sprintf "'dbf_%s_io_total_per_sec'=%.2f;%d;%d",
$self->{name}, $self->{io_total_per_sec},
$self->{warningrange}, $self->{criticalrange});
}
}
}

View File

@ -1,333 +0,0 @@
package DBD::MSSQL::Server::Memorypool;
use strict;
our @ISA = qw(DBD::MSSQL::Server);
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
sub new {
my $class = shift;
my %params = @_;
my $self = {
handle => $params{handle},
buffercache => undef,
procedurecache => undef,
locks => [],
};
bless $self, $class;
$self->init(%params);
return $self;
}
sub init {
my $self = shift;
my %params = @_;
$self->init_nagios();
if ($params{mode} =~ /server::memorypool::buffercache/) {
$self->{buffercache} = DBD::MSSQL::Server::Memorypool::BufferCache->new(
%params);
} elsif ($params{mode} =~ /server::memorypool::procedurecache/) {
$self->{procedurecache} = DBD::MSSQL::Server::Memorypool::ProcedureCache->new(
%params);
} elsif ($params{mode} =~ /server::memorypool::lock/) {
DBD::MSSQL::Server::Memorypool::Lock::init_locks(%params);
if (my @locks = DBD::MSSQL::Server::Memorypool::Lock::return_locks()) {
$self->{locks} = \@locks;
} else {
$self->add_nagios_critical("unable to aquire lock info");
}
}
}
sub nagios {
my $self = shift;
my %params = @_;
if ($params{mode} =~ /server::memorypool::buffercache/) {
$self->{buffercache}->nagios(%params);
$self->merge_nagios($self->{buffercache});
} elsif ($params{mode} =~ /^server::memorypool::lock::listlocks/) {
foreach (sort { $a->{name} cmp $b->{name}; } @{$self->{locks}}) {
printf "%s\n", $_->{name};
}
$self->add_nagios_ok("have fun");
} elsif ($params{mode} =~ /^server::memorypool::lock/) {
foreach (@{$self->{locks}}) {
$_->nagios(%params);
$self->merge_nagios($_);
}
}
}
package DBD::MSSQL::Server::Memorypool::BufferCache;
use strict;
our @ISA = qw(DBD::MSSQL::Server::Memorypool);
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
sub new {
my $class = shift;
my %params = @_;
my $self = {
handle => $params{handle},
hitratio => undef,
warningrange => $params{warningrange},
criticalrange => $params{criticalrange},
};
bless $self, $class;
$self->init(%params);
return $self;
}
sub init {
my $self = shift;
my %params = @_;
$self->init_nagios();
if ($params{mode} =~ /server::memorypool::buffercache::hitratio/) {
# -- (a.cntr_value * 1.0 / b.cntr_value) * 100.0 [BufferCacheHitRatio]
$self->{cnt_hitratio} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Buffer cache hit ratio");
$self->{cnt_hitratio_base} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Buffer cache hit ratio base");
if (! defined $self->{cnt_hitratio}) {
$self->add_nagios_unknown("unable to aquire buffer cache data");
} else {
# das kracht weil teilweise negativ
#$self->valdiff(\%params, qw(cnt_hitratio cnt_hitratio_base));
$self->{hitratio} = ($self->{cnt_hitratio_base} == 0) ?
100 : $self->{cnt_hitratio} / $self->{cnt_hitratio_base} * 100.0;
# soll vorkommen.....
$self->{hitratio} = 100 if ($self->{hitratio} > 100);
}
} elsif ($params{mode} =~ /server::memorypool::buffercache::lazywrites/) {
$self->{lazy_writes_s} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Lazy writes/sec");
if (! defined $self->{lazy_writes_s}) {
$self->add_nagios_unknown("unable to aquire buffer manager data");
} else {
$self->valdiff(\%params, qw(lazy_writes_s));
$self->{lazy_writes_per_sec} = $self->{delta_lazy_writes_s} / $self->{delta_timestamp};
}
} elsif ($params{mode} =~ /server::memorypool::buffercache::pagelifeexpectancy/) {
$self->{pagelifeexpectancy} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Page life expectancy");
if (! defined $self->{pagelifeexpectancy}) {
$self->add_nagios_unknown("unable to aquire buffer manager data");
}
} elsif ($params{mode} =~ /server::memorypool::buffercache::freeliststalls/) {
$self->{freeliststalls_s} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Free list stalls/sec");
if (! defined $self->{freeliststalls_s}) {
$self->add_nagios_unknown("unable to aquire buffer manager data");
} else {
$self->valdiff(\%params, qw(freeliststalls_s));
$self->{freeliststalls_per_sec} = $self->{delta_freeliststalls_s} / $self->{delta_timestamp};
}
} elsif ($params{mode} =~ /server::memorypool::buffercache::checkpointpages/) {
$self->{checkpointpages_s} = $self->{handle}->get_perf_counter(
"SQLServer:Buffer Manager", "Checkpoint pages/sec");
if (! defined $self->{checkpointpages_s}) {
$self->add_nagios_unknown("unable to aquire buffer manager data");
} else {
$self->valdiff(\%params, qw(checkpointpages_s));
$self->{checkpointpages_per_sec} = $self->{delta_checkpointpages_s} / $self->{delta_timestamp};
}
}
}
sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::memorypool::buffercache::hitratio/) {
$self->add_nagios(
$self->check_thresholds($self->{hitratio}, '90:', '80:'),
sprintf "buffer cache hit ratio is %.2f%%", $self->{hitratio});
$self->add_perfdata(sprintf "buffer_cache_hit_ratio=%.2f%%;%s;%s",
$self->{hitratio},
$self->{warningrange}, $self->{criticalrange});
#$self->add_perfdata(sprintf "buffer_cache_hit_ratio_now=%.2f%%",
# $self->{hitratio_now});
} elsif ($params{mode} =~ /server::memorypool::buffercache::lazywrites/) {
$self->add_nagios(
$self->check_thresholds($self->{lazy_writes_per_sec}, '20', '40'),
sprintf "%.2f lazy writes per second", $self->{lazy_writes_per_sec});
$self->add_perfdata(sprintf "lazy_writes_per_sec=%.2f;%s;%s",
$self->{lazy_writes_per_sec},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /server::memorypool::buffercache::pagelifeexpectancy/) {
$self->add_nagios(
$self->check_thresholds($self->{pagelifeexpectancy}, '300:', '180:'),
sprintf "page life expectancy is %d seconds", $self->{pagelifeexpectancy});
$self->add_perfdata(sprintf "page_life_expectancy=%d;%s;%s",
$self->{pagelifeexpectancy},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /server::memorypool::buffercache::freeliststalls/) {
$self->add_nagios(
$self->check_thresholds($self->{freeliststalls_per_sec}, '4', '10'),
sprintf "%.2f free list stalls per second", $self->{freeliststalls_per_sec});
$self->add_perfdata(sprintf "free_list_stalls_per_sec=%.2f;%s;%s",
$self->{freeliststalls_per_sec},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /server::memorypool::buffercache::checkpointpages/) {
$self->add_nagios(
$self->check_thresholds($self->{checkpointpages_per_sec}, '100', '500'),
sprintf "%.2f pages flushed per second", $self->{checkpointpages_per_sec});
$self->add_perfdata(sprintf "checkpoint_pages_per_sec=%.2f;%s;%s",
$self->{checkpointpages_per_sec},
$self->{warningrange}, $self->{criticalrange});
}
}
}
package DBD::MSSQL::Server::Memorypool::Lock;
use strict;
our @ISA = qw(DBD::MSSQL::Server::Memorypool);
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
{
my @locks = ();
my $initerrors = undef;
sub add_lock {
push(@locks, shift);
}
sub return_locks {
return reverse
sort { $a->{name} cmp $b->{name} } @locks;
}
sub init_locks {
my %params = @_;
my $num_locks = 0;
if (($params{mode} =~ /server::memorypool::lock::listlocks/) ||
($params{mode} =~ /server::memorypool::lock::waits/) ||
($params{mode} =~ /server::memorypool::lock::deadlocks/) ||
($params{mode} =~ /server::memorypool::lock::timeouts/)) {
my @lockresult = $params{handle}->get_instance_names(
'SQLServer:Locks');
foreach (@lockresult) {
my ($name) = @{$_};
$name =~ s/\s*$//;
if ($params{regexp}) {
next if $params{selectname} && $name !~ /$params{selectname}/;
} else {
next if $params{selectname} && lc $params{selectname} ne lc $name;
}
my %thisparams = %params;
$thisparams{name} = $name;
my $lock = DBD::MSSQL::Server::Memorypool::Lock->new(
%thisparams);
add_lock($lock);
$num_locks++;
}
if (! $num_locks) {
$initerrors = 1;
return undef;
}
}
}
}
sub new {
my $class = shift;
my %params = @_;
my $self = {
handle => $params{handle},
warningrange => $params{warningrange},
criticalrange => $params{criticalrange},
name => $params{name},
};
bless $self, $class;
$self->init(%params);
return $self;
}
sub init {
my $self = shift;
my %params = @_;
$self->init_nagios();
if ($params{mode} =~ /server::memorypool::lock::listlocks/) {
# name reicht
} elsif ($params{mode} =~ /server::memorypool::lock::waits/) {
$self->{lock_waits_s} = $self->{handle}->get_perf_counter_instance(
"SQLServer:Locks", "Lock Waits/sec", $self->{name});
if (! defined $self->{lock_waits_s}) {
$self->add_nagios_unknown("unable to aquire counter data");
} else {
$self->valdiff(\%params, qw(lock_waits_s));
$self->{lock_waits_per_sec} = $self->{delta_lock_waits_s} / $self->{delta_timestamp};
}
} elsif ($params{mode} =~ /^server::memorypool::lock::timeouts/) {
$self->{lock_timeouts_s} = $self->{handle}->get_perf_counter_instance(
"SQLServer:Locks", "Lock Timeouts/sec", $self->{name});
if (! defined $self->{lock_timeouts_s}) {
$self->add_nagios_unknown("unable to aquire counter data");
} else {
$self->valdiff(\%params, qw(lock_timeouts_s));
$self->{lock_timeouts_per_sec} = $self->{delta_lock_timeouts_s} / $self->{delta_timestamp};
}
} elsif ($params{mode} =~ /^server::memorypool::lock::deadlocks/) {
$self->{lock_deadlocks_s} = $self->{handle}->get_perf_counter_instance(
"SQLServer:Locks", "Number of Deadlocks/sec", $self->{name});
if (! defined $self->{lock_deadlocks_s}) {
$self->add_nagios_unknown("unable to aquire counter data");
} else {
$self->valdiff(\%params, qw(lock_deadlocks_s));
$self->{lock_deadlocks_per_sec} = $self->{delta_lock_deadlocks_s} / $self->{delta_timestamp};
}
}
}
sub nagios {
my $self = shift;
my %params = @_;
if (! $self->{nagios_level}) {
if ($params{mode} =~ /server::memorypool::lock::waits/) {
$self->add_nagios(
$self->check_thresholds($self->{lock_waits_per_sec}, 100, 500),
sprintf "%.4f lock waits / sec for %s",
$self->{lock_waits_per_sec}, $self->{name});
$self->add_perfdata(sprintf "%s_lock_waits_per_sec=%.4f;%s;%s",
$self->{name}, $self->{lock_waits_per_sec},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /^server::memorypool::lock::timeouts/) {
$self->add_nagios(
$self->check_thresholds($self->{lock_timeouts_per_sec}, 1, 5),
sprintf "%.4f lock timeouts / sec for %s",
$self->{lock_timeouts_per_sec}, $self->{name});
$self->add_perfdata(sprintf "%s_lock_timeouts_per_sec=%.4f;%s;%s",
$self->{name}, $self->{lock_timeouts_per_sec},
$self->{warningrange}, $self->{criticalrange});
} elsif ($params{mode} =~ /^server::memorypool::lock::deadlocks/) {
$self->add_nagios(
$self->check_thresholds($self->{lock_deadlocks_per_sec}, 1, 5),
sprintf "%.4f deadlocks / sec for %s",
$self->{lock_deadlocks_per_sec}, $self->{name});
$self->add_perfdata(sprintf "%s_deadlocks_per_sec=%.4f;%s;%s",
$self->{name}, $self->{lock_deadlocks_per_sec},
$self->{warningrange}, $self->{criticalrange});
}
}
}
package DBD::MSSQL::Server::Memorypool::SystemLevelDataStructures::LockTable;
package DBD::MSSQL::Server::Memorypool::ProcedureCache;
package DBD::MSSQL::Server::Memorypool::LogCache;
package DBD::MSSQL::Server::Memorypool::SystemLevelDataStructures;

View File

@ -1,103 +0,0 @@
package Extraopts;
use strict;
use File::Basename;
use Data::Dumper;
sub new {
my $class = shift;
my %params = @_;
my $self = {
file => $params{file},
commandline => $params{commandline},
config => {},
section => 'default_no_section',
};
bless $self, $class;
$self->prepare_file_and_section();
$self->init();
return $self;
}
sub prepare_file_and_section {
my $self = shift;
if (! defined $self->{file}) {
# ./check_stuff --extra-opts
$self->{section} = basename($0);
$self->{file} = $self->get_default_file();
} elsif ($self->{file} =~ /^[^@]+$/) {
# ./check_stuff --extra-opts=special_opts
$self->{section} = $self->{file};
$self->{file} = $self->get_default_file();
} elsif ($self->{file} =~ /^@(.*)/) {
# ./check_stuff --extra-opts=@/etc/myconfig.ini
$self->{section} = basename($0);
$self->{file} = $1;
} elsif ($self->{file} =~ /^(.*?)@(.*)/) {
# ./check_stuff --extra-opts=special_opts@/etc/myconfig.ini
$self->{section} = $1;
$self->{file} = $2;
}
}
sub get_default_file {
my $self = shift;
foreach my $default (qw(/etc/nagios/plugins.ini
/usr/local/nagios/etc/plugins.ini
/usr/local/etc/nagios/plugins.ini
/etc/opt/nagios/plugins.ini
/etc/nagios-plugins.ini
/usr/local/etc/nagios-plugins.ini
/etc/opt/nagios-plugins.ini)) {
if (-f $default) {
return $default;
}
}
return undef;
}
sub init {
my $self = shift;
if (! defined $self->{file}) {
$self->{errors} = sprintf 'no extra-opts file specified and no default file found';
} elsif (! -f $self->{file}) {
$self->{errors} = sprintf 'could not open %s', $self->{file};
} else {
my $data = do { local (@ARGV, $/) = $self->{file}; <> };
my $in_section = 'default_no_section';
foreach my $line (split(/\n/, $data)) {
if ($line =~ /\[(.*)\]/) {
$in_section = $1;
} elsif ($line =~ /(.*)=(.*)/) {
$self->{config}->{$in_section}->{$1} = $2;
}
}
}
}
sub is_valid {
my $self = shift;
return ! exists $self->{errors};
}
sub overwrite {
my $self = shift;
my %commandline = ();
if (scalar(keys %{$self->{config}->{default_no_section}}) > 0) {
foreach (keys %{$self->{config}->{default_no_section}}) {
$commandline{$_} = $self->{config}->{default_no_section}->{$_};
}
}
if (exists $self->{config}->{$self->{section}}) {
foreach (keys %{$self->{config}->{$self->{section}}}) {
$commandline{$_} = $self->{config}->{$self->{section}}->{$_};
}
}
foreach (keys %commandline) {
if (! exists $self->{commandline}->{$_}) {
$self->{commandline}->{$_} = $commandline{$_};
}
}
}

View File

@ -1,551 +0,0 @@
package main;
use strict;
use Getopt::Long qw(:config no_ignore_case);
use File::Basename;
use lib dirname($0);
use Nagios::DBD::MSSQL::Server;
use Nagios::DBD::MSSQL::Server::Instance;
use Nagios::DBD::MSSQL::Server::Instance::SGA;
use Nagios::DBD::MSSQL::Server::Instance::SGA::DataBuffer;
use Nagios::DBD::MSSQL::Server::Instance::SGA::SharedPool;
use Nagios::DBD::MSSQL::Server::Instance::SGA::SharedPool::LibraryCache;
use Nagios::DBD::MSSQL::Server::Instance::SGA::SharedPool::DictionaryCache;
use Nagios::DBD::MSSQL::Server::Instance::SGA::Latches;
use Nagios::DBD::MSSQL::Server::Instance::PGA;
use Nagios::DBD::MSSQL::Server::Instance::SGA::RedoLogBuffer;
my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 );
my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' );
use vars qw ($PROGNAME $REVISION $CONTACT $TIMEOUT $STATEFILESDIR $needs_restart %commandline);
$PROGNAME = "check_mssql_health";
$REVISION = '$Revision: #PACKAGE_VERSION# $';
$CONTACT = 'gerhard.lausser@consol.de';
$TIMEOUT = 60;
$STATEFILESDIR = '#STATEFILES_DIR#';
$needs_restart = 0;
my @modes = (
['server::connectiontime',
'connection-time', undef,
'Time to connect to the server' ],
['server::cpubusy',
'cpu-busy', undef,
'Cpu busy in percent' ],
['server::iobusy',
'io-busy', undef,
'IO busy in percent' ],
['server::fullscans',
'full-scans', undef,
'Full table scans per second' ],
['server::connectedusers',
'connected-users', undef,
'Number of currently connected users' ],
['server::database::transactions',
'transactions', undef,
'Transactions per second (per database)' ],
['server::batchrequests',
'batch-requests', undef,
'Batch requests per second' ],
['server::latch::waits',
'latches-waits', undef,
'Number of latch requests that could not be granted immediately' ],
['server::latch::waittime',
'latches-wait-time', undef,
'Average time for a latch to wait before the request is met' ],
['server::memorypool::lock::waits',
'locks-waits', undef,
'The number of locks per second that had to wait' ],
['server::memorypool::lock::timeouts',
'locks-timeouts', undef,
'The number of locks per second that timed out' ],
['server::memorypool::lock::deadlocks',
'locks-deadlocks', undef,
'The number of deadlocks per second' ],
['server::sql::recompilations',
'sql-recompilations', undef,
'Re-Compilations per second' ],
['server::sql::initcompilations',
'sql-initcompilations', undef,
'Initial compilations per second' ],
['server::totalmemory',
'total-server-memory', undef,
'The amount of memory that SQL Server has allocated to it' ],
['server::memorypool::buffercache::hitratio',
'mem-pool-data-buffer-hit-ratio', ['buffer-cache-hit-ratio'],
'Data Buffer Cache Hit Ratio' ],
['server::memorypool::buffercache::lazywrites',
'lazy-writes', undef,
'Lazy writes per second' ],
['server::memorypool::buffercache::pagelifeexpectancy',
'page-life-expectancy', undef,
'Seconds a page is kept in memory before being flushed' ],
['server::memorypool::buffercache::freeliststalls',
'free-list-stalls', undef,
'Requests per second that had to wait for a free page' ],
['server::memorypool::buffercache::checkpointpages',
'checkpoint-pages', undef,
'Dirty pages flushed to disk per second. (usually by a checkpoint)' ],
['server::database::databasefree',
'database-free', undef,
'Free space in database' ],
['server::database::backupage',
'database-backup-age', ['backup-age'],
'Elapsed time (in hours) since a database was last backupped' ],
['server::sql',
'sql', undef,
'any sql command' ],
['server::database::listdatabases',
'list-databases', undef,
'convenience function which lists all databases' ],
['server::database::datafile::listdatafiles',
'list-datafiles', undef,
'convenience function which lists all datafiles' ],
['server::memorypool::lock::listlocks',
'list-locks', undef,
'convenience function which lists all locks' ],
);
sub print_usage () {
print <<EOUS;
Usage:
$PROGNAME [-v] [-t <timeout>] --hostname=<db server hostname>
--username=<username> --password=<password> [--port <port>]
--mode=<mode>
$PROGNAME [-v] [-t <timeout>] --server=<db server>
--username=<username> --password=<password>
--mode=<mode>
$PROGNAME [-h | --help]
$PROGNAME [-V | --version]
Options:
--hostname
the database server
--port
the database server's port
--server
the name of a predefined connection
--currentdb
the name of a database which is used as the current database
for the connection. (don't use this parameter unless you
know what you're doing)
--username
the mssql user
--password
the mssql user's password
--warning
the warning range
--critical
the critical range
--mode
the mode of the plugin. select one of the following keywords:
EOUS
my $longest = length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0]);
my $format = " %-".
(length ((reverse sort {length $a <=> length $b} map { $_->[1] } @modes)[0])).
"s\t(%s)\n";
foreach (@modes) {
printf $format, $_->[1], $_->[3];
}
printf "\n";
print <<EOUS;
--name
the name of the database etc depending on the mode.
--name2
if name is a sql statement, this statement would appear in
the output and the performance data. This can be ugly, so
name2 can be used to appear instead.
--regexp
if this parameter is used, name will be interpreted as a
regular expression.
--units
one of %, KB, MB, GB. This is used for a better output of mode=sql
and for specifying thresholds for mode=tablespace-free
Database-related modes check all databases in one run by default.
If only a single database should be checked, use the --name parameter.
The same applies to datafile-related modes.
Options specific to 'server::sql' mode:
--sqleval
For results with multiple columns, this is the index (counting from
1) of the column to evaluate with --warning and/or --critical. If
this option is missing, the statement is assumed to return only a
single column.
--sqlname
For results with multiple columns, this is the index (counting from
1) of the column use as the output name (instead of --name2). If
this option is missing, only the first row will be parsed.
--sqlinfo
For results with multiple columns, this is the index (counting from
1) of a column to present as a detailed explanation.
In mode sql you can url-encode the statement so you will not have to mess
around with special characters in your Nagios service definitions.
Instead of
--name="select count(*) from master..sysprocesses"
you can say
--name=select%20count%28%2A%29%20from%20master%2E%2Esysprocesses
For your convenience you can call check_mssql_health with the --encode
option and it will encode the standard input.
You can find the full documentation for this plugin at:
http://www.consol.de/opensource/nagios/check-mssql-health
or http://www.consol.com/opensource/nagios/check-mssql-health
EOUS
#
# --basis
# one of rate, delta, value
}
sub print_help () {
print "Copyright (c) 2009 Gerhard Lausser\n\n";
print "\n";
print " Check various parameters of MSSQL databases \n";
print "\n";
print_usage();
support();
}
sub print_revision ($$) {
my $commandName = shift;
my $pluginRevision = shift;
$pluginRevision =~ s/^\$Revision: //;
$pluginRevision =~ s/ \$\s*$//;
print "$commandName ($pluginRevision)\n";
print "This nagios plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of this plugin under the terms of the GNU General Public License.\n";
}
sub support () {
my $support='Send email to gerhard.lausser@consol.de if you have questions\nregarding use of this software. \nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n';
$support =~ s/@/\@/g;
$support =~ s/\\n/\n/g;
print $support;
}
sub contact_author ($$) {
my $item = shift;
my $strangepattern = shift;
if ($commandline{verbose}) {
printf STDERR
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n".
"You found a line which is not recognized by %s\n".
"This means, certain components of your system cannot be checked.\n".
"Please contact the author %s and\nsend him the following output:\n\n".
"%s /%s/\n\nThank you!\n".
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n",
$PROGNAME, $CONTACT, $item, $strangepattern;
}
}
%commandline = ();
my @params = (
"timeout|t=i",
"version|V",
"help|h",
"verbose|v",
"debug|d",
"hostname=s",
"username=s",
"password=s",
"port=i",
"server=s",
"currentdb=s",
"mode|m=s",
"tablespace=s",
"database=s",
"datafile=s",
"waitevent=s",
"name=s",
"name2=s",
"regexp",
"sqleval=i",
"sqlname=i",
"sqlinfo=i",
"perfdata",
"warning=s",
"critical=s",
"dbthresholds:s",
"absolute|a",
"basis",
"lookback|l=i",
"environment|e=s%",
"method=s",
"runas|r=s",
"scream",
"shell",
"eyecandy",
"encode",
"units=s",
"3",
"with-mymodules-dyn-dir=s",
"report=s",
"extra-opts:s");
if (! GetOptions(\%commandline, @params)) {
print_help();
exit $ERRORS{UNKNOWN};
}
if (exists $commandline{'extra-opts'}) {
# read the extra file and overwrite other parameters
my $extras = Extraopts->new(file => $commandline{'extra-opts'}, commandline => \%commandline);
if (! $extras->is_valid()) {
printf "extra-opts are not valid: %s\n", $extras->{errors};
exit $ERRORS{UNKNOWN};
} else {
$extras->overwrite();
}
}
if (exists $commandline{version}) {
print_revision($PROGNAME, $REVISION);
exit $ERRORS{OK};
}
if (exists $commandline{help}) {
print_help();
exit $ERRORS{OK};
} elsif (! exists $commandline{mode}) {
printf "Please select a mode\n";
print_help();
exit $ERRORS{OK};
}
if ($commandline{mode} eq "encode") {
my $input = <>;
chomp $input;
$input =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
printf "%s\n", $input;
exit $ERRORS{OK};
}
if (exists $commandline{3}) {
$ENV{NRPE_MULTILINESUPPORT} = 1;
}
if (exists $commandline{timeout}) {
$TIMEOUT = $commandline{timeout};
}
if (exists $commandline{verbose}) {
$DBD::MSSQL::Server::verbose = exists $commandline{verbose};
}
if (exists $commandline{scream}) {
# $DBD::MSSQL::Server::hysterical = exists $commandline{scream};
}
if (exists $commandline{report}) {
# short, long, html
} else {
$commandline{report} = "long";
}
if (exists $commandline{'with-mymodules-dyn-dir'}) {
$DBD::MSSQL::Server::my_modules_dyn_dir = $commandline{'with-mymodules-dyn-dir'};
} else {
$DBD::MSSQL::Server::my_modules_dyn_dir = '#MYMODULES_DYN_DIR#';
}
if (exists $commandline{environment}) {
# if the desired environment variable values are different from
# the environment of this running script, then a restart is necessary.
# because setting $ENV does _not_ change the environment of the running script.
foreach (keys %{$commandline{environment}}) {
if ((! $ENV{$_}) || ($ENV{$_} ne $commandline{environment}->{$_})) {
$needs_restart = 1;
$ENV{$_} = $commandline{environment}->{$_};
printf STDERR "new %s=%s forces restart\n", $_, $ENV{$_}
if $DBD::MSSQL::Server::verbose;
}
}
# e.g. called with --runas dbnagio. shlib_path environment variable is stripped
# during the sudo.
# so the perl interpreter starts without a shlib_path. but --runas cares for
# a --environment shlib_path=...
# so setting the environment variable in the code above and restarting the
# perl interpreter will help it find shared libs
}
if (exists $commandline{runas}) {
# remove the runas parameter
# exec sudo $0 ... the remaining parameters
$needs_restart = 1;
# if the calling script has a path for shared libs and there is no --environment
# parameter then the called script surely needs the variable too.
foreach my $important_env qw(LD_LIBRARY_PATH SHLIB_PATH
MSSQL_HOME TNS_ADMIN ORA_NLS ORA_NLS33 ORA_NLS10) {
if ($ENV{$important_env} && ! scalar(grep { /^$important_env=/ }
keys %{$commandline{environment}})) {
$commandline{environment}->{$important_env} = $ENV{$important_env};
printf STDERR "add important --environment %s=%s\n",
$important_env, $ENV{$important_env} if $DBD::MSSQL::Server::verbose;
}
}
}
if ($needs_restart) {
my @newargv = ();
my $runas = undef;
if (exists $commandline{runas}) {
$runas = $commandline{runas};
delete $commandline{runas};
}
foreach my $option (keys %commandline) {
if (grep { /^$option/ && /=/ } @params) {
if (ref ($commandline{$option}) eq "HASH") {
foreach (keys %{$commandline{$option}}) {
push(@newargv, sprintf "--%s", $option);
push(@newargv, sprintf "%s=%s", $_, $commandline{$option}->{$_});
}
} else {
push(@newargv, sprintf "--%s", $option);
push(@newargv, sprintf "%s", $commandline{$option});
}
} else {
push(@newargv, sprintf "--%s", $option);
}
}
if ($runas && ($> == 0)) {
# this was not my idea. some people connect as root to their nagios clients.
exec "su", "-c", sprintf("%s %s", $0, join(" ", @newargv)), "-", $runas;
} elsif ($runas) {
exec "sudo", "-S", "-u", $runas, $0, @newargv;
} else {
exec $0, @newargv;
# this makes sure that even a SHLIB or LD_LIBRARY_PATH are set correctly
# when the perl interpreter starts. Setting them during runtime does not
# help loading e.g. libclntsh.so
}
exit;
}
if (exists $commandline{shell}) {
# forget what you see here.
system("/bin/sh");
}
if (exists $commandline{name}) {
# objects can be encoded like an url
# with s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
if (($commandline{mode} ne "sql") ||
(($commandline{mode} eq "sql") &&
($commandline{name} =~ /select%20/i))) { # protect ... like '%cac%' ... from decoding
$commandline{name} =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
}
if ($commandline{name} =~ /^0$/) {
# without this, $params{selectname} would be treated like undef
$commandline{name} = "00";
}
}
$SIG{'ALRM'} = sub {
printf "UNKNOWN - %s timed out after %d seconds\n", $PROGNAME, $TIMEOUT;
exit $ERRORS{UNKNOWN};
};
alarm($TIMEOUT);
my $nagios_level = $ERRORS{UNKNOWN};
my $nagios_message = "";
my $perfdata = "";
my $racmode = 0;
if ($commandline{mode} =~ /^rac-([^\-.]+)/) {
$racmode = 1;
$commandline{mode} =~ s/^rac\-//g;
}
if ($commandline{mode} =~ /^my-([^\-.]+)/) {
my $param = $commandline{mode};
$param =~ s/\-/::/g;
push(@modes, [$param, $commandline{mode}, undef, 'my extension']);
} elsif ((! grep { $commandline{mode} eq $_ } map { $_->[1] } @modes) &&
(! grep { $commandline{mode} eq $_ } map { defined $_->[2] ? @{$_->[2]} : () } @modes)) {
printf "UNKNOWN - mode %s\n", $commandline{mode};
print_usage();
exit 3;
}
my %params = (
timeout => $TIMEOUT,
mode => (
map { $_->[0] }
grep {
($commandline{mode} eq $_->[1]) ||
( defined $_->[2] && grep { $commandline{mode} eq $_ } @{$_->[2]})
} @modes
)[0],
cmdlinemode => $commandline{mode},
method => $commandline{method} ||
$ENV{NAGIOS__SERVICEMSSQL_METH} ||
$ENV{NAGIOS__HOSTMSSQL_METH} || 'dbi',
hostname => $commandline{hostname} ||
$ENV{NAGIOS__SERVICEMSSQL_HOST} ||
$ENV{NAGIOS__HOSTMSSQL_HOST},
username => $commandline{username} ||
$ENV{NAGIOS__SERVICEMSSQL_USER} ||
$ENV{NAGIOS__HOSTMSSQL_USER},
password => $commandline{password} ||
$ENV{NAGIOS__SERVICEMSSQL_PASS} ||
$ENV{NAGIOS__HOSTMSSQL_PASS},
port => $commandline{port} ||
$ENV{NAGIOS__SERVICEMSSQL_PORT} ||
$ENV{NAGIOS__HOSTMSSQL_PORT},
server => $commandline{server} ||
$ENV{NAGIOS__SERVICEMSSQL_SERVER} ||
$ENV{NAGIOS__HOSTMSSQL_SERVER},
currentdb => $commandline{currentdb} ||
$ENV{NAGIOS__SERVICEMSSQL_CURRENTDB} ||
$ENV{NAGIOS__HOSTMSSQL_CURRENTDB},
warningrange => $commandline{warning},
criticalrange => $commandline{critical},
dbthresholds => $commandline{dbthresholds},
absolute => $commandline{absolute},
lookback => $commandline{lookback},
tablespace => $commandline{tablespace},
database => $commandline{database},
datafile => $commandline{datafile},
basis => $commandline{basis},
selectname => $commandline{name} || $commandline{tablespace} || $commandline{datafile},
regexp => $commandline{regexp},
name => $commandline{name},
name2 => $commandline{name2} || $commandline{name},
sqleval => $commandline{sqleval},
sqlname => $commandline{sqlname},
sqlinfo => $commandline{sqlinfo},
units => $commandline{units},
eyecandy => $commandline{eyecandy},
statefilesdir => $STATEFILESDIR,
verbose => $commandline{verbose},
report => $commandline{report},
);
my $server = undef;
$server = DBD::MSSQL::Server->new(%params);
$server->nagios(%params);
$server->calculate_result();
$nagios_message = $server->{nagios_message};
$nagios_level = $server->{nagios_level};
$perfdata = $server->{perfdata};
printf "%s - %s", $ERRORCODES{$nagios_level}, $nagios_message;
printf " | %s", $perfdata if $perfdata;
printf "\n";
exit $nagios_level;

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