├── .gitignore ├── .perl-version ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── MACOS.md ├── README.md ├── check_apache_status.pl ├── debian ├── changelog ├── compat ├── control ├── copyright ├── docs ├── rules ├── source │ └── format └── watch └── netways-plugins-apache_status.spec /.gitignore: -------------------------------------------------------------------------------- 1 | .swp 2 | -------------------------------------------------------------------------------- /.perl-version: -------------------------------------------------------------------------------- 1 | 5.18.4 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lennart Betz 2 | Sylvia van Os 3 | William David Haines 4 | Yves Vogl 5 | mdicss <43135155+mdicss@users.noreply.github.com> 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [1.4.3](https://github.com/lbetz/check_apache_status/tree/1.4.3) (2023-04-14) 4 | [Full Changelog](https://github.com/lbetz/check_apache_status/compare/v1.4.2...1.4.3) 5 | 6 | **Implemented enhancements:** 7 | 8 | - Rename RPM package name [\#15](https://github.com/lbetz/check_apache_status/pull/15) ([lbetz](https://github.com/lbetz)) 9 | - Feature/debpkg [\#14](https://github.com/lbetz/check_apache_status/pull/14) ([lbetz](https://github.com/lbetz)) 10 | 11 | **Fixed bugs:** 12 | 13 | - Extend status?auto to get the whole Scoreboard [\#13](https://github.com/lbetz/check_apache_status/pull/13) ([mdicss](https://github.com/mdicss)) 14 | 15 | ## [v1.4.2](https://github.com/lbetz/check_apache_status/tree/v1.4.2) (2020-04-20) 16 | [Full Changelog](https://github.com/lbetz/check_apache_status/compare/1.4.1...v1.4.2) 17 | 18 | **Fixed bugs:** 19 | 20 | - fix for SSLv3 errors, from https://stackoverflow.com/a/51128762 [\#12](https://github.com/lbetz/check_apache_status/pull/12) ([willhaines](https://github.com/willhaines)) 21 | - Fix no\_validate [\#11](https://github.com/lbetz/check_apache_status/pull/11) ([TheLastProject](https://github.com/TheLastProject)) 22 | 23 | ## [1.4.1](https://github.com/lbetz/check_apache_status/tree/1.4.1) (2017-11-19) 24 | [Full Changelog](https://github.com/lbetz/check_apache_status/compare/1.4.0...1.4.1) 25 | 26 | **Fixed bugs:** 27 | 28 | - Detect Idle Waits [\#9](https://github.com/lbetz/check_apache_status/issues/9) 29 | - fix \#9 detect idle waits [\#10](https://github.com/lbetz/check_apache_status/pull/10) ([lbetz](https://github.com/lbetz)) 30 | 31 | ## [1.4.0](https://github.com/lbetz/check_apache_status/tree/1.4.0) (2017-10-14) 32 | [Full Changelog](https://github.com/lbetz/check_apache_status/compare/1.3.0...1.4.0) 33 | 34 | **Implemented enhancements:** 35 | 36 | - Exit plugin with CRITICAL if no response [\#3](https://github.com/lbetz/check_apache_status/issues/3) 37 | 38 | **Closed issues:** 39 | 40 | - Open slots threshold not working correctly [\#4](https://github.com/lbetz/check_apache_status/issues/4) 41 | - Thresholds do not work properly [\#7](https://github.com/lbetz/check_apache_status/issues/7) 42 | - "Use of uninitialized value in sprintf" in Performance.pm [\#5](https://github.com/lbetz/check_apache_status/issues/5) 43 | 44 | **Merged pull requests:** 45 | 46 | - Feature/add more metrics [\#8](https://github.com/lbetz/check_apache_status/pull/8) ([ghost](https://github.com/ghost)) 47 | - Proposed fix for \#5 [\#6](https://github.com/lbetz/check_apache_status/pull/6) ([ghost](https://github.com/ghost)) 48 | 49 | ## [1.3.0](https://github.com/lbetz/check_apache_status/tree/1.3.0) (2017-06-06) 50 | [Full Changelog](https://github.com/lbetz/check_apache_status/compare/1.2.0...1.3.0) 51 | 52 | ## [1.2.0](https://github.com/lbetz/check_apache_status/tree/1.2.0) (2017-02-17) 53 | **Closed issues:** 54 | 55 | - Hostname verification when using HTTPS [\#2](https://github.com/lbetz/check_apache_status/issues/2) 56 | - use Monitoring::Plugin; SyntaxError: invalid syntax [\#1](https://github.com/lbetz/check_apache_status/issues/1) 57 | 58 | 59 | 60 | \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /MACOS.md: -------------------------------------------------------------------------------- 1 | # Steps to setup a local test environment on macOS 2 | 3 | - Install plenv 4 | ```brew install plenv``` 5 | ```brew install perl-build``` 6 | 7 | Add this to ~/.bash_profile 8 | 9 | ```if which plenv > /dev/null; then eval "$(plenv init -)"; fi``` 10 | 11 | Install plenv-contrib: 12 | 13 | ```git clone git://github.com/miyagawa/plenv-contrib.git ~/.plenv/plugins/plenv-contrib/´´´ 14 | 15 | - Install Perl 5.18.4 16 | ```plenv install 5.18.4``` 17 | 18 | - Install cpanm 19 | ```plenv install-cpanm``` 20 | 21 | 22 | - Install CPAN modules 23 | ```cpanm Monitoring::Plugin``` 24 | ```cpanm LWP::UserAgent``` 25 | ```cpanm HTTP::Status``` 26 | 27 | 28 | For SSL support: 29 | 30 | ```brew install openssl``` 31 | ```cpanm Net::SSLeay``` 32 | ```LWP::Protocol::https``` 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # check_apache_status.pl 2 | 3 | Plugin for Icinga, Nagios and Shinken to check the Apache httpd status. 4 | 5 | If the Apache httpd status page is accessible then this plugin checks for following metrics: 6 | 7 | - open slots 8 | - busy workers 9 | - idle workers 10 | - requests per second 11 | - bytes per second 12 | - bytes per request 13 | 14 | 15 | 16 | ## Command Line Options 17 | 18 | Usage: check_apache_status.pl [OPTIONS] 19 | 20 | -?, --usage 21 | 22 | Print usage information 23 | 24 | -h, --help 25 | 26 | Print detailed help screen 27 | 28 | -V, --version 29 | 30 | Print version information 31 | 32 | --extra-opts=[section][@file] 33 | 34 | Read options from an ini file. See https://www.monitoring-plugins.org/doc/extra-opts.html 35 | for usage and examples. 36 | 37 | -H, --hostname=STRING 38 | 39 | hostname or ip address to check 40 | 41 | -p, --port=INTEGER 42 | 43 | port, default 80 (http) or 443 (https) 44 | 45 | -U, --username 46 | 47 | username for basic auth, requires password 48 | 49 | -P, password 50 | 51 | password for basic auth, requires username 52 | 53 | -u, --uri=STRING 54 | 55 | uri, default /server-status 56 | 57 | -s, --ssl 58 | 59 | use https instead of http 60 | 61 | -N, --no\_validate 62 | 63 | do not validate the SSL certificate chain 64 | 65 | -R, --unreachable 66 | 67 | CRITICAL if socket timed out or http code >= 500 68 | 69 | -w, --warning=STRING 70 | 71 | warning threshold 72 | 73 | -c, --critical=STRING 74 | 75 | critical threshold 76 | 77 | -t, --timeout=INTEGER 78 | 79 | Seconds before plugin times out (default: 15) 80 | 81 | -v, --verbose 82 | 83 | Show details for command-line debugging (can repeat up to 3 times) 84 | 85 | 86 | 87 | ## Threshold and ranges 88 | 89 | A threshold is a [range](https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT) with an alert level (either WARNING or CRITICAL). 90 | Thresholds will be set comma separated in the following order: 91 | 92 | - open slots 93 | - busy workers 94 | - idle workers 95 | - requests per second 96 | - bytes per second 97 | - bytes per request 98 | 99 | A range is defined as a start and end point (inclusive) on a numeric scale (possibly negative or positive infinity). 100 | 101 | This is the generalised format for ranges: 102 | 103 | ```[@]start:end``` 104 | 105 | ### Notes 106 | 107 | - start ≤ end 108 | - start and ":" is not required if start=0 109 | - if range is of format "start:" and end is not specified, assume end is infinity 110 | - to specify negative infinity, use "~" 111 | - alert is raised if metric is outside start and end range (inclusive of endpoints) 112 | - if range starts with "@", then alert if inside this range (inclusive of endpoints) 113 | 114 | ### Examples 115 | 116 | 117 | Setting non for one of them is also possible. The following example sets the threshold for _busy workers_ to WARNING for at least 10 _busy workers_ and CRITICAL to at least of 25 _busy workers_: 118 | 119 | ```check_apache_status.pl -H localhost -w ,10,,,, -c ,25,,,,``` 120 | 121 | To additionally set the threshold for _open_slots_ to WARNING when at or below 10 and CRITICAL when at or below 5: 122 | 123 | ```check_apache_status.pl -H localhost -w 10:,10,,,, -c 5:,25,,,,``` 124 | -------------------------------------------------------------------------------- /check_apache_status.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | 4 | use Monitoring::Plugin; 5 | use Monitoring::Plugin::Getopt; 6 | use Monitoring::Plugin::Threshold; 7 | use LWP::UserAgent; 8 | use HTTP::Status qw(:constants :is status_message); 9 | 10 | our $VERSION = '1.4.3'; 11 | 12 | our ( $plugin, $option ); 13 | 14 | $plugin = Monitoring::Plugin->new( shortname => '' ); 15 | 16 | 17 | $options = Monitoring::Plugin::Getopt->new( 18 | usage => 'Usage: %s [OPTIONS]', 19 | version => $VERSION, 20 | url => 'https://github.com/lbetz/check_apache_status', 21 | blurb => 'Check apache server status', 22 | ); 23 | 24 | $options->arg( 25 | spec => 'hostname|H=s', 26 | help => 'hostname or ip address to check', 27 | required => 1, 28 | ); 29 | 30 | $options->arg( 31 | spec => 'port|p=i', 32 | help => 'port, default 80 (http) or 443 (https)', 33 | required => 0, 34 | ); 35 | 36 | $options->arg( 37 | spec => 'uri|u=s', 38 | help => 'uri, default /server-status?auto', 39 | required => 0, 40 | default => '/server-status?auto', 41 | ); 42 | 43 | $options->arg( 44 | spec => 'username|U=s', 45 | help => 'username for basic auth', 46 | required => 0, 47 | ); 48 | 49 | $options->arg( 50 | spec => 'password|P=s', 51 | help => 'password for basic auth', 52 | required => 0, 53 | ); 54 | 55 | $options->arg( 56 | spec => 'ssl|s', 57 | help => 'use https instead of http', 58 | required => 0, 59 | ); 60 | 61 | $options->arg( 62 | spec => 'no_validate|N', 63 | help => 'do not validate the SSL certificate chain', 64 | required => 0, 65 | ); 66 | 67 | $options->arg( 68 | spec => 'warning|w=s', 69 | help => 'warning threshold', 70 | required => 0, 71 | ); 72 | 73 | $options->arg( 74 | spec => 'critical|c=s', 75 | help => 'critical threshold', 76 | required => 0, 77 | ); 78 | 79 | $options->arg( 80 | spec => 'unreachable|R', 81 | help => 'CRITICAL if socket timed out or http code >= 500', 82 | required => 0, 83 | ); 84 | 85 | $options->getopts(); 86 | 87 | # if socket timed out or http code >= 500 88 | my $unreachable = 'UNKNOWN'; 89 | if (defined($options->unreachable)) { 90 | $unreachable = 'CRITICAL'; 91 | } 92 | 93 | alarm $options->timeout; 94 | # override default alarm handler 95 | $SIG{ALRM} = sub { 96 | $plugin->die( 97 | sprintf("plugin timed out (timeout %ss)", 98 | $options->timeout), $unreachable); 99 | }; 100 | 101 | 102 | my @warning = split(",", $options->warning); 103 | my @critical = split(",", $options->critical); 104 | 105 | $threshold_OpenSlots = Monitoring::Plugin::Threshold->set_thresholds( 106 | warning => $warning[0], 107 | critical => $critical[0], 108 | ); 109 | $threshold_BusyWorkers = Monitoring::Plugin::Threshold->set_thresholds( 110 | warning => $warning[1], 111 | critical => $critical[1], 112 | ); 113 | $threshold_IdleWorkers = Monitoring::Plugin::Threshold->set_thresholds( 114 | warning => $warning[2], 115 | critical => $critical[2], 116 | ); 117 | $threshold_ReqPerSec = Monitoring::Plugin::Threshold->set_thresholds( 118 | warning => $warning[3], 119 | critical => $critical[3], 120 | ); 121 | $threshold_BytesPerSec = Monitoring::Plugin::Threshold->set_thresholds( 122 | warning => $warning[4], 123 | critical => $critical[4], 124 | ); 125 | $threshold_BytesPerReq = Monitoring::Plugin::Threshold->set_thresholds( 126 | warning => $warning[5], 127 | critical => $critical[5], 128 | ); 129 | 130 | ## Username without password 131 | $plugin->nagios_exit( UNKNOWN, 'If you specify an username, you have to set a password too!') if ( ($options->username ne '') && ($options->password eq '') ); 132 | 133 | ## Password without username 134 | $plugin->nagios_exit( UNKNOWN, 'If you specify a password, you have to set an username too!') if ( ($options->username eq '') && ($options->password ne '') ); 135 | 136 | ## Set account 137 | if ( ($options->username ne '') && ($options->password ne '') ) { 138 | $account = $options->username.':'.$options->password.'@'; 139 | } 140 | 141 | my $ua = LWP::UserAgent->new( protocols_allowed => ['http','https'], timeout => 15); 142 | $ua->ssl_opts ( SSL_cipher_list => '' ); 143 | 144 | if (defined($options->no_validate)) { 145 | $ua->ssl_opts ( verify_hostname => 0 ); 146 | $ua->ssl_opts ( SSL_verify_mode => 0 ); 147 | } 148 | 149 | if (defined($options->ssl)) { 150 | $proto = 'https://'; 151 | } else { 152 | $proto = "http://"; 153 | } 154 | 155 | if (defined($options->port)) { 156 | $request = HTTP::Request->new(GET => $proto.$account.$options->hostname.':'.$options->port.$options->uri.'?auto'); 157 | } else { 158 | $request = HTTP::Request->new(GET => $proto.$account.$options->hostname.$options->uri.'?auto'); 159 | } 160 | 161 | $response = $ua->request($request); 162 | 163 | if ($response->is_success) { 164 | 165 | unless ($response->content =~ /(?s).*ReqPerSec:\s([0-9\.]+).*BytesPerSec:\s([0-9\.]+).*BusyWorkers:\s([0-9]+).*IdleWorkers:\s([0-9]+).*Scoreboard:\s(\S*)/) { 166 | $plugin->plugin_exit( UNKNOWN, "No status information found at ".$response->base ); 167 | } 168 | 169 | $ReqPerSec = $1; 170 | $BytesPerSec = $2; 171 | $BusyWorkers = $3; 172 | $IdleWorkers = $4; 173 | $OpenSlots = ($5 =~ tr/[._]//); 174 | 175 | $response->content =~ /(?s).*BytesPerReq:\s([0-9\.]+)/; 176 | $BytesPerReq = $1; 177 | unless ($BytesPerReq) { 178 | $BytesPerReq = 0; 179 | } 180 | 181 | $output = 'OpenSlots:'.$OpenSlots.' BusyWorkers:'.$BusyWorkers.' IdleWorkers:'.$IdleWorkers. 182 | ' ReqPerSec:'.$ReqPerSec.' BytesPerSec:'.$BytesPerSec.' BytesPerReq:'.$BytesPerReq; 183 | 184 | $plugin->add_perfdata( 185 | label => 'OpenSlots', 186 | value => $OpenSlots, 187 | uom => q{}, 188 | threshold => $threshold_OpenSlots, 189 | ); 190 | 191 | $plugin->add_perfdata( 192 | label => 'BusyWorkers', 193 | value => $BusyWorkers, 194 | uom => q{}, 195 | threshold => $threshold_BusyWorkers, 196 | ); 197 | 198 | $plugin->add_perfdata( 199 | label => 'IdleWorkers', 200 | value => $IdleWorkers, 201 | uom => q{}, 202 | threshold => $threshold_IdleWorkers, 203 | ); 204 | 205 | $plugin->add_perfdata( 206 | label => 'ReqPerSec', 207 | value => $ReqPerSec, 208 | uom => q{}, 209 | threshold => $threshold_ReqPerSec, 210 | ); 211 | 212 | $plugin->add_perfdata( 213 | label => 'BytesPerSec', 214 | value => $BytesPerSec, 215 | uom => B, 216 | threshold => $threshold_BytesPerSec, 217 | ); 218 | 219 | $plugin->add_perfdata( 220 | label => 'BytesPerReq', 221 | value => $BytesPerReq, 222 | uom => B, 223 | threshold => $threshold_BytesPerReq, 224 | ); 225 | 226 | 227 | my @thresholds = ( 228 | $threshold_OpenSlots->get_status($OpenSlots), 229 | $threshold_BusyWorkers->get_status($BusyWorkers), 230 | $threshold_IdleWorkers->get_status($IdleWorkers), 231 | $threshold_ReqPerSec->get_status($ReqPerSec), 232 | $threshold_BytesPerSec->get_status($BytesPerSec), 233 | $threshold_BytesPerReq->get_status($BytesPerReq) 234 | ); 235 | 236 | my $status = 0; 237 | foreach(@thresholds) { 238 | if ($_ > $status) { 239 | $status = $_; 240 | } 241 | } 242 | 243 | $plugin->nagios_exit( $status, $output ); 244 | 245 | } elsif ( $response->code >= HTTP_INTERNAL_SERVER_ERROR ) { 246 | $plugin->plugin_exit( $unreachable, $response->status_line ); 247 | } else { 248 | $plugin->plugin_exit( UNKNOWN, $response->status_line ); 249 | } 250 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | nagios-plugins-apache-status (1.4.3-1) stable; urgency=medium 2 | 3 | * release 1.4.3 4 | 5 | -- Lennart Betz Fri, 14 Apr 2023 10:15:09 +0200 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 11 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: netways-plugins-apache-status 2 | Section: contrib 3 | Priority: optional 4 | Maintainer: Lennart Betz 5 | Build-Depends: debhelper (>= 11) 6 | Standards-Version: 4.1.3 7 | Homepage: https://github.com/lbetz/check_apache_status 8 | 9 | Package: netways-plugins-apache-status 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends}, procps, libmonitoring-plugin-perl, 12 | liblwp-protocol-https-perl 13 | Description: Monitoring Plugins - check_apache_status.pl 14 | Checks against the apache status site. 15 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This work was packaged for Debian by: 2 | 3 | Lennart Betz on Mon, 01 Mar 2021 4 | 5 | It was downloaded from: 6 | 7 | https://github.com/lbetz/check_apache_status 8 | 9 | Upstream Author(s): 10 | 11 | Lennart Betz 12 | Sylvia van Os 13 | 14 | Copyright: 15 | 16 | Copyright (C) 2016-2021 Lennart Betz 17 | 18 | License: 19 | 20 | GPL 3 21 | 22 | The Debian packaging is: 23 | 24 | Copyright (C) 2021 Lennart Betz 25 | 26 | and is licensed under the GPL version 3, 27 | see "/usr/share/common-licenses/GPL-3". 28 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | MACOS.md 3 | CHANGELOG.md 4 | LICENSE 5 | AUTHORS 6 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | export DH_VERBOSE = 1 3 | export DEST=$$(pwd)/debian/netways-plugins-apache-status 4 | 5 | override_dh_auto_install: 6 | mkdir -p ${DEST}/usr/lib/nagios/plugins 7 | install -m755 check_apache_status.pl ${DEST}/usr/lib/nagios/plugins/ 8 | 9 | %: 10 | dh $@ 11 | 12 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=4 2 | opts="mode=git, gitmode=full" \ 3 | https://github.com/lbetz/check_apache_status refs/tags/v@ANY_VERSION@ 4 | -------------------------------------------------------------------------------- /netways-plugins-apache_status.spec: -------------------------------------------------------------------------------- 1 | # spec file for package check_apache_status.pl 2 | 3 | %define lname check_apache_status 4 | 5 | Name: netways-plugins-apache-status 6 | Summary: Nagios Plugins - check_apache_status.pl 7 | Version: 1.4.3 8 | Url: http://github.com/lbetz/check_apache_status 9 | License: GPL-2.0+ 10 | Group: System/Monitoring 11 | Source0: %{lname}-%{version}.tar.gz 12 | Provides: netways-plugins-apache-status = %{version}-%{release} 13 | Obsoletes: nagios-plugins-apache_status < %{version}-%{release} 14 | Requires: perl(Monitoring::Plugin) 15 | Requires: perl(LWP::UserAgent) 16 | Requires: perl(Data::Dumper) 17 | 18 | %if 0%{?suse} 19 | Release: 1 20 | BuildRequires: nagios-rpm-macros 21 | BuildRoot: %{_tmppath}/%{name}-%{version}-build 22 | %endif 23 | 24 | %if 0%{?fedora} || 0%{?rhel} || 0%{?centos} 25 | Release: 1%{?dist} 26 | Requires: nagios-common 27 | %endif 28 | 29 | %if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 30 | Requires: perl(LWP::Protocol::https) 31 | %endif 32 | 33 | %description 34 | Checks against the apache status site. 35 | 36 | %prep 37 | %setup -q -n %{lname}-%{version} 38 | 39 | %install 40 | %{__mkdir_p} %{buildroot}/%{_libdir}/nagios/plugins 41 | %{__install} -m755 check_apache_status.pl %{buildroot}/%{_libdir}/nagios/plugins/ 42 | 43 | %clean 44 | rm -rf %buildroot 45 | 46 | %files -n nagios-plugins-apache_status 47 | %defattr(-,root,root) 48 | %doc MACOS.md CHANGELOG.md LICENSE AUTHORS 49 | # avoid build dependecy of nagios - own the dirs 50 | %if 0%{?suse_version} 51 | %dir %{_libdir}/nagios 52 | %dir %{_libdir}/nagios/plugins 53 | %endif 54 | %{_libdir}/nagios/plugins/check_apache_status.pl 55 | 56 | %changelog 57 | * Fri Apr 14 2023 Lennart Betz 1.4.3-1 58 | - Bugfix release version 1.4.3 59 | - fix #13 Extend status?auto to get the whole Scoreboard 60 | - Rename package to netways-plugins-apache-status 61 | - Add docs 62 | * Mon Apr 20 2020 Lennart Betz 1.4.2-1 63 | - Bugfix release version 1.4.2 64 | - fix #12 fix for SSLv3 errors 65 | * Sun Nov 19 2017 Lennart Betz 1.4.1-1 66 | - Bugfix release version 1.4.1 67 | - fix #9 detect idle waits 68 | * Thu Oct 12 2017 Yves Vogl 1.4.0-1 69 | - feature version 1.4.0 70 | - feature: added requests per second, bytes per second, bytes per request as metrics 71 | - feature: Improved error handling and documentation 72 | * Tue May 06 2017 Lennart Betz 1.3.0-1 73 | - feature version 1.3.0 74 | - feature add option unreacheable 75 | * Fri Feb 17 2017 Lennart Betz 1.2.0-1 76 | - feature version 1.2.0 77 | - feature add option no_validate 78 | - fix projekt website url in spec 79 | * Thu Jan 19 2017 Lennart Betz 1.1.0-1 80 | - feature version 1.1.0 81 | - LWP::Protocol::https is required on redhat 82 | * Mon Apr 29 2016 Lennart Betz 1.0.0-1 83 | - initial setup 84 | --------------------------------------------------------------------------------