GithubHelp home page GithubHelp logo

cytopia / check_php Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 3.0 61 KB

[sh] Nagios plugin for PHP to check for startup errors, missing modules, wrong php.ini configurations and PHP updates.

License: MIT License

Shell 100.00%

check_php's People

Contributors

cytopia avatar mariosteinitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

check_php's Issues

Alternative modules/blacklist/config check arguments syntax

This is a suggestion to improve usability of the check_php's plugin for Icinga2 users:

Whereas the startup and update checks work as expected and can be configured easily as custom check command, it proves almost impossible to creating a working CheckCommand definition for module, blacklist and config checks without loads of custom programming and workarounds. An argument can easily be created with multiple occurrences, but then it can only have one value, not two or three.

Therefore, it is desirable to having an option telling the script, that the multi-argument options are concatenated using a divider char (e.g. |) .

Then the command

$ ./check_php -m "mysql" "e" -m "intl" "w"

could be aliased by

$ ./check_php -d -m "mysql|e" -m "intl|w"

Or setting checks like

$ ./check_php -c "memory_limit" "256M" "w" -c "opcache.enable" "1" "w"

could be aliased by

$ ./check_php -d -c "memory_limit|256M|w" -c "opcache.enable|1|w"

Which is far easier to achieve using default commands / arguments in Icinga2.

Issue with php 7.1

Hi,

With php 7.1 it gives warnings about updates

[WARN] PHP 7.1.0 has warnings: Updates available | 'OK'=0;;;0;1 'Errors'=0;1;1;0;1 'Warnings'=1;1;;0;1 'Unknown'=0;;;0;1
[WARNING] No PHP Version found online. Your version: 7.1.0

Would it be possible to avoid this somehow? Not very good if you just upgraded and get errors :)

PS: Do you have an icinga2 check command by any chance ? :)

Allow passing in PHP binary path

This is to suggest to allow passing in the path to the PHP binary to use (e.g. by adding an optional -p parameter).

Background: We're using your script on some web servers having multiple PHP versions available that can be used for our virtual hosts. Each version is placed within an /opt/php/MAYOR.MINOR.PATCH folder, whereas the latest MAYOR.MINOR version on the system has an according symlink and is the default version used for most virtual hosts.

Now we'd love to check all MAYOR.MINOR versions on the server for possible security patches available, by e.g. calling your script like check_php -p /opt/php/5.6/bin/php -u w.

check_php potentially doesn't see startup errors

Hi,

Depending on the ini used the startup errors don't show. I have this situation by default with cPanel php and easyapache4. With the current version it simply says no errors while I had errors!

Changing this part of the code fixed it and will (most likely) always catch the errors:

# Make sure not to display any errors to stdout
# and store them in a variable to output it in a formated way.
check_startup_errors() {
	CMD="$PHP -d display_errors=stderr -d display_startup_errors=1 -v 3>&1 1>&2 2>&3 1>/dev/null"

Version check not working as expected

Neither sort -u, nor sort -u -r within the latest PHP version check is working reliably.

As native sort will see e.g. 7.0.9 higher than 7.0.22.

Newer versions of sort feature a -V argument for version string sort. However, this argument might not be available on all Unix shells running the script.

Alternatively, the version number string should be split at the dots using the -t option of sort. Then the keys may be defined and sorted numerical using the -n option.

too new

check_php -u w
[WARNING] PHP Version 5.6.38 too new. Latest: 5.6.37.

check_php -V
Version: check_php 0.7 (2017-03-28)
Author: cytopia [email protected] (0x695128A2)
License: MIT

Increase number of fetched versions on update check

While it is desirable to always using up-to-date PHP versions, some servers still run with legacy versions that might get security patches even they aren't supported anymore.

Therefore, the script should fetch a longer version history when doing the version update checks, not only the latest two version updates.

(Increase the max=2 URL parameter to like max=50 or so.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.