├── CENTREON_GRAPHICS.txt ├── tests ├── docker │ ├── phpfpm │ │ ├── app │ │ │ └── index.php │ │ ├── Dockerfile │ │ ├── conf │ │ │ └── www.conf │ │ └── build.sh │ └── nginx │ │ ├── classic │ │ ├── Dockerfile │ │ ├── certs │ │ │ ├── nginx-selfsigned.crt │ │ │ └── nginx-selfsigned.key │ │ └── conf │ │ │ ├── fastcgi_params.conf │ │ │ └── vhosts.conf │ │ ├── tls11 │ │ ├── Dockerfile │ │ ├── certs │ │ │ ├── nginx-selfsigned-bad.crt │ │ │ ├── nginx-selfsigned.crt │ │ │ ├── nginx-selfsigned-bad.key │ │ │ └── nginx-selfsigned.key │ │ └── conf │ │ │ ├── fastcgi_params.conf │ │ │ └── vhosts.conf │ │ ├── bad_ssl │ │ ├── Dockerfile │ │ ├── certs │ │ │ ├── nginx-selfsigned-bad.crt │ │ │ └── nginx-selfsigned-bad.key │ │ └── conf │ │ │ ├── fastcgi_params.conf │ │ │ └── vhosts.conf │ │ └── build.sh ├── build_dockers.sh └── test.sh ├── cpanfile ├── .travis.yml ├── .gitignore ├── CHANGELOG ├── check_phpfpm_status.icinga2.conf ├── README.md ├── check_phpfpm_status.pl └── LICENSE /CENTREON_GRAPHICS.txt: -------------------------------------------------------------------------------- 1 | TODO: 2 | -------------------------------------------------------------------------------- /tests/docker/phpfpm/app/index.php: -------------------------------------------------------------------------------- 1 | = 6.10'; 5 | requires 'LWP::Protocol::https', '0'; 6 | requires 'FCGI::Client::Connection', '0'; 7 | requires 'IO::Socket::INET', '0'; 8 | requires 'IO::Socket::SSL', '0'; 9 | requires 'Mozilla::CA', '0'; -------------------------------------------------------------------------------- /tests/docker/nginx/classic/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable 2 | COPY conf/vhosts.conf /etc/nginx/conf.d/vhosts.conf 3 | COPY conf/fastcgi_params.conf /etc/nginx/fastcgi_params.conf 4 | RUN rm /etc/nginx/conf.d/default.conf 5 | COPY certs/nginx-selfsigned.key /etc/nginx/ssl/server.key 6 | COPY certs/nginx-selfsigned.crt /etc/nginx/ssl/server.crt 7 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable 2 | COPY conf/vhosts.conf /etc/nginx/conf.d/vhosts.conf 3 | COPY conf/fastcgi_params.conf /etc/nginx/fastcgi_params.conf 4 | RUN rm /etc/nginx/conf.d/default.conf 5 | COPY certs/nginx-selfsigned.key /etc/nginx/ssl/server.key 6 | COPY certs/nginx-selfsigned.crt /etc/nginx/ssl/server.crt 7 | -------------------------------------------------------------------------------- /tests/docker/nginx/bad_ssl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:stable 2 | COPY conf/vhosts.conf /etc/nginx/conf.d/vhosts.conf 3 | COPY conf/fastcgi_params.conf /etc/nginx/fastcgi_params.conf 4 | RUN rm /etc/nginx/conf.d/default.conf 5 | COPY certs/nginx-selfsigned-bad.key /etc/nginx/ssl/server.key 6 | COPY certs/nginx-selfsigned-bad.crt /etc/nginx/ssl/server.crt 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | language: perl 5 | perl: 6 | - "5.24" 7 | - "5.22" 8 | - "5.14" 9 | - "5.10" 10 | - "5.8" 11 | before_install: 12 | - tests/build_dockers.sh 13 | # command to install dependencies 14 | install: 15 | - cpanm -n -q --skip-satisfied --installdeps . 16 | - chmod ugo+x tests/test.sh 17 | # command to run tests 18 | script: 19 | - tests/test.sh 20 | 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !Build/ 2 | .last_cover_stats 3 | /META.yml 4 | /META.json 5 | /MYMETA.* 6 | *.o 7 | *.bs 8 | 9 | # Devel::Cover 10 | cover_db/ 11 | 12 | # Devel::NYTProf 13 | nytprof.out 14 | 15 | # Dizt::Zilla 16 | /.build/ 17 | 18 | # Module::Build 19 | _build/ 20 | Build 21 | Build.bat 22 | 23 | # Module::Install 24 | inc/ 25 | 26 | # ExtUitls::MakeMaker 27 | /blib/ 28 | /_eumm/ 29 | /*.gz 30 | /Makefile 31 | /Makefile.old 32 | /MANIFEST.bak 33 | /pm_to_blib 34 | /*.zip 35 | -------------------------------------------------------------------------------- /tests/docker/phpfpm/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | cd "$(dirname "$0")" 4 | echo "******* Building" 5 | docker build -t phpfpm_alone . 6 | echo "****** remove old containers" 7 | docker rm -f cont_phpfpm_alone||/bin/true 8 | echo "******* Running" 9 | HOSTIP=`ip -4 addr show scope global dev docker0 | grep inet | awk '{print \$2}' | cut -d / -f 1` 10 | docker run --name cont_phpfpm_alone -p 9001:9000 -d phpfpm_alone 11 | echo "******* docker ps" 12 | docker ps 13 | # if you want to edit files in a running docker (for tests, do not forget to get your copy back in conf dir) 14 | #docker run -i -t --rm --volumes-from cont_phpfpm_alone --name cont_phpfpm_alonefiles debian /bin/bash 15 | -------------------------------------------------------------------------------- /tests/docker/nginx/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | cd "$(dirname "$0")" 4 | ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" 5 | echo "******* Building" 6 | cd classic 7 | docker build -t nginx_classic . 8 | cd ../tls11 9 | docker build -t nginx_tls11_only . 10 | cd ../bad_ssl 11 | docker build -t nginx_bad_ssl . 12 | cd .. 13 | echo "****** remove old containers" 14 | docker rm -f cont_nginx_classic||/bin/true 15 | docker rm -f cont_nginx_tls11_only||/bin/true 16 | docker rm -f cont_nginx_bad_ssl||/bin/true 17 | echo "******* Running" 18 | HOSTIP=`ip -4 addr show scope global dev docker0 | grep inet | awk '{print \$2}' | cut -d / -f 1` 19 | docker run --name cont_nginx_classic --add-host=dockerhost:${HOSTIP} -p 8801:80 -p 8443:443 -d nginx_classic 20 | docker run --name cont_nginx_tls11_only --add-host=dockerhost:${HOSTIP} -p 8802:80 -p 9443:443 -d nginx_tls11_only 21 | docker run --name cont_nginx_bad_ssl --add-host=dockerhost:${HOSTIP} -p 8803:80 -p 10443:443 -d nginx_bad_ssl 22 | echo "******* docker ps" 23 | docker ps 24 | # /etc/ssl/certs:/etc/ssl/certs -v /etc/ssl/private:/etc/ssl/private 25 | -------------------------------------------------------------------------------- /tests/docker/nginx/bad_ssl/certs/nginx-selfsigned-bad.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDnzCCAoegAwIBAgIJAJSOIlB+bkqIMA0GCSqGSIb3DQEBCwUAMGYxCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIDApTb21lLVN0YXRlMRIwEAYDVQQHDAlTb21ld2hlcmUx 4 | FDASBgNVBAoMC0V4YW1wbGUuY29tMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20w 5 | HhcNMTYxMjIyMTExNTI3WhcNMTcxMjIyMTExNTI3WjBmMQswCQYDVQQGEwJVUzET 6 | MBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK 7 | DAtFeGFtcGxlLmNvbTEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIIBIjANBgkq 8 | hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1XXYNXt4yK0SCiatv23D4skPzlhjcX4Y 9 | slDfTcjeSDSbqb0qG/uk1mbY4N11EwHMi0APsmZXvhN/DZbVZ5HhR4dFTEWPwqsF 10 | uUPLuM7oKvQClmsRe5wvoBAUeL9YTyPIvtU6pwzJTRUN/Hh8+Ocnjub64GiYm3HU 11 | 4xDypN7x8UdlK3XRahC6cwhsWcfGv6CNLab0iTFNK0GeKcWPgfq7kCuj0r3t+p+2 12 | iXKFYds2tndoQwrPgYSG1dm/SOxmUQNvGBYOL/797mUobCR0sAcOQRI+5+X4/w79 13 | VgqtlNjCda29TPD+uZZvc3LXwc2FBEllEHvOpwKlhsvG+K0qPSo1iQIDAQABo1Aw 14 | TjAdBgNVHQ4EFgQUKHv58e8QZphHzWEpYxvoxniZlLYwHwYDVR0jBBgwFoAUKHv5 15 | 8e8QZphHzWEpYxvoxniZlLYwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC 16 | AQEADhHBs9Anz2vbfUNkyGAtpey/sjRE0/7iAbn2hXXDCR+BQuZvwX+4LQuM5/7G 17 | ox8uhE25RlvBFEpZmvwczz2ixFzekaEFXaciNzSp/64gtwhMYHFrr/PZftVQdUqE 18 | EvYutGZhjvIuLmF1rN4L+y1uMepdY13TgkbFu2nZuCZjcJugsEfQVOeVkI3/nfXr 19 | LFatJXNWnUAPzTmHKMVOvlcPUeDi2xTQ9SH45t8faPTyD62TAis80LJRS23MMaAu 20 | HDgTgXUKzVJ5lrB6WJhlUt7/Lh/2zKuEvu49sKDQzIFMCqBYuXN3gp3QzDntWlIN 21 | 6VK0xmxMTHmdLHZskwQNOSht0A== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/certs/nginx-selfsigned-bad.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDnzCCAoegAwIBAgIJAJSOIlB+bkqIMA0GCSqGSIb3DQEBCwUAMGYxCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIDApTb21lLVN0YXRlMRIwEAYDVQQHDAlTb21ld2hlcmUx 4 | FDASBgNVBAoMC0V4YW1wbGUuY29tMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20w 5 | HhcNMTYxMjIyMTExNTI3WhcNMTcxMjIyMTExNTI3WjBmMQswCQYDVQQGEwJVUzET 6 | MBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYDVQQK 7 | DAtFeGFtcGxlLmNvbTEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIIBIjANBgkq 8 | hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1XXYNXt4yK0SCiatv23D4skPzlhjcX4Y 9 | slDfTcjeSDSbqb0qG/uk1mbY4N11EwHMi0APsmZXvhN/DZbVZ5HhR4dFTEWPwqsF 10 | uUPLuM7oKvQClmsRe5wvoBAUeL9YTyPIvtU6pwzJTRUN/Hh8+Ocnjub64GiYm3HU 11 | 4xDypN7x8UdlK3XRahC6cwhsWcfGv6CNLab0iTFNK0GeKcWPgfq7kCuj0r3t+p+2 12 | iXKFYds2tndoQwrPgYSG1dm/SOxmUQNvGBYOL/797mUobCR0sAcOQRI+5+X4/w79 13 | VgqtlNjCda29TPD+uZZvc3LXwc2FBEllEHvOpwKlhsvG+K0qPSo1iQIDAQABo1Aw 14 | TjAdBgNVHQ4EFgQUKHv58e8QZphHzWEpYxvoxniZlLYwHwYDVR0jBBgwFoAUKHv5 15 | 8e8QZphHzWEpYxvoxniZlLYwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC 16 | AQEADhHBs9Anz2vbfUNkyGAtpey/sjRE0/7iAbn2hXXDCR+BQuZvwX+4LQuM5/7G 17 | ox8uhE25RlvBFEpZmvwczz2ixFzekaEFXaciNzSp/64gtwhMYHFrr/PZftVQdUqE 18 | EvYutGZhjvIuLmF1rN4L+y1uMepdY13TgkbFu2nZuCZjcJugsEfQVOeVkI3/nfXr 19 | LFatJXNWnUAPzTmHKMVOvlcPUeDi2xTQ9SH45t8faPTyD62TAis80LJRS23MMaAu 20 | HDgTgXUKzVJ5lrB6WJhlUt7/Lh/2zKuEvu49sKDQzIFMCqBYuXN3gp3QzDntWlIN 21 | 6VK0xmxMTHmdLHZskwQNOSht0A== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/certs/nginx-selfsigned.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDpTCCAo2gAwIBAgIJAIiZPpk5EQmAMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIDApTb21lLVN0YXRlMRIwEAYDVQQHDAlTb21ld2hlcmUx 4 | FDASBgNVBAoMC0V4YW1wbGUuY29tMRswGQYDVQQDDBJwaHBmcG0uZXhhbXBsZS5j 5 | b20wHhcNMTYxMjIyMTExMzQwWhcNMTcxMjIyMTExMzQwWjBpMQswCQYDVQQGEwJV 6 | UzETMBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYD 7 | VQQKDAtFeGFtcGxlLmNvbTEbMBkGA1UEAwwScGhwZnBtLmV4YW1wbGUuY29tMIIB 8 | IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt6TdQoBe4wejOlZYKnGOsYir 9 | NXy9HqQQKbFQXjOTY9gZNG5oaipUpN4BUOh5SMn1Tj4TIutw0BwzTQVOEG4All4b 10 | 7lestpOHox9Kgulvx15vkbI+aL/YpYpjcHUxyACZK6FM187cFiqskn1/g/A44Pny 11 | O5azouRMix0TdHnK3cUYeCHDZZBb42adHTVFd0pv6xcTYmUWbv7r43oHZpbcA0Ti 12 | LWdAVcjbDw/AcfHvXawFD4SGVlEd0z0zK+kJRcQdg2m6aGik92UL9Jc73vmcF/KH 13 | sSdml2RTkFesWhn85uzHJ0DO8/zl6o+ho18jYiqt7IsL7VibdLrpLeaOP8uFLQID 14 | AQABo1AwTjAdBgNVHQ4EFgQUXrUE0zv/068nIqOPU0pXAT9x31owHwYDVR0jBBgw 15 | FoAUXrUE0zv/068nIqOPU0pXAT9x31owDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 16 | AQsFAAOCAQEAQYdLM9at2g+2VZuaAD7qbfFMvKIrB35q78McEigeEr0P2haHt82b 17 | UF1y+RH7Z9h3QPcwzdvMvnLByYUXkHl14dhnOsnKliSmz9PJqE3QtvAk4Z95hJPb 18 | II43DxRkhhcI8V2pdIT40tbK62k1QCi1/hn/mIrdhn5CIvDno/bR6w6QR2kUSY+/ 19 | 4Hyl3G+45cmEaNeIYdsAkT2tOsE0Hd+p3EyFr3adxe0rWv4OSDh/aji2Alkise21 20 | ooXBX2BXihX6V5DuGPX69pSpz2zk1b05s/MXj3aXV+uMrxdA3sZGrMgj8PPQGO1Z 21 | WJe6Ek5N2pyKFvzo15PzioQciwDaVeyssA== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tests/docker/nginx/classic/certs/nginx-selfsigned.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDpTCCAo2gAwIBAgIJAIiZPpk5EQmAMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIDApTb21lLVN0YXRlMRIwEAYDVQQHDAlTb21ld2hlcmUx 4 | FDASBgNVBAoMC0V4YW1wbGUuY29tMRswGQYDVQQDDBJwaHBmcG0uZXhhbXBsZS5j 5 | b20wHhcNMTYxMjIyMTExMzQwWhcNMTcxMjIyMTExMzQwWjBpMQswCQYDVQQGEwJV 6 | UzETMBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJU29tZXdoZXJlMRQwEgYD 7 | VQQKDAtFeGFtcGxlLmNvbTEbMBkGA1UEAwwScGhwZnBtLmV4YW1wbGUuY29tMIIB 8 | IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt6TdQoBe4wejOlZYKnGOsYir 9 | NXy9HqQQKbFQXjOTY9gZNG5oaipUpN4BUOh5SMn1Tj4TIutw0BwzTQVOEG4All4b 10 | 7lestpOHox9Kgulvx15vkbI+aL/YpYpjcHUxyACZK6FM187cFiqskn1/g/A44Pny 11 | O5azouRMix0TdHnK3cUYeCHDZZBb42adHTVFd0pv6xcTYmUWbv7r43oHZpbcA0Ti 12 | LWdAVcjbDw/AcfHvXawFD4SGVlEd0z0zK+kJRcQdg2m6aGik92UL9Jc73vmcF/KH 13 | sSdml2RTkFesWhn85uzHJ0DO8/zl6o+ho18jYiqt7IsL7VibdLrpLeaOP8uFLQID 14 | AQABo1AwTjAdBgNVHQ4EFgQUXrUE0zv/068nIqOPU0pXAT9x31owHwYDVR0jBBgw 15 | FoAUXrUE0zv/068nIqOPU0pXAT9x31owDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 16 | AQsFAAOCAQEAQYdLM9at2g+2VZuaAD7qbfFMvKIrB35q78McEigeEr0P2haHt82b 17 | UF1y+RH7Z9h3QPcwzdvMvnLByYUXkHl14dhnOsnKliSmz9PJqE3QtvAk4Z95hJPb 18 | II43DxRkhhcI8V2pdIT40tbK62k1QCi1/hn/mIrdhn5CIvDno/bR6w6QR2kUSY+/ 19 | 4Hyl3G+45cmEaNeIYdsAkT2tOsE0Hd+p3EyFr3adxe0rWv4OSDh/aji2Alkise21 20 | ooXBX2BXihX6V5DuGPX69pSpz2zk1b05s/MXj3aXV+uMrxdA3sZGrMgj8PPQGO1Z 21 | WJe6Ek5N2pyKFvzo15PzioQciwDaVeyssA== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/conf/fastcgi_params.conf: -------------------------------------------------------------------------------- 1 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 3 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 4 | fastcgi_param DOCUMENT_ROOT $document_root; 5 | fastcgi_param HOME $document_root; 6 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 7 | fastcgi_param PATH_INFO $fastcgi_path_info; 8 | fastcgi_param HOSTNAME $server_name; 9 | fastcgi_param QUERY_STRING $query_string; 10 | fastcgi_param REQUEST_METHOD $request_method; 11 | fastcgi_param CONTENT_TYPE $content_type; 12 | fastcgi_param CONTENT_LENGTH $content_length; 13 | fastcgi_param REQUEST_URI $request_uri; 14 | fastcgi_param DOCUMENT_URI $document_uri; 15 | fastcgi_param SERVER_PROTOCOL $server_protocol; 16 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 17 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | fastcgi_param REDIRECT_STATUS 200; 24 | fastcgi_buffers 256 4k; 25 | fastcgi_intercept_errors on; 26 | fastcgi_read_timeout 14400; 27 | fastcgi_send_timeout 60; 28 | fastcgi_index index.php; 29 | fastcgi_ignore_client_abort off; 30 | -------------------------------------------------------------------------------- /tests/docker/nginx/bad_ssl/conf/fastcgi_params.conf: -------------------------------------------------------------------------------- 1 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 3 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 4 | fastcgi_param DOCUMENT_ROOT $document_root; 5 | fastcgi_param HOME $document_root; 6 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 7 | fastcgi_param PATH_INFO $fastcgi_path_info; 8 | fastcgi_param HOSTNAME $server_name; 9 | fastcgi_param QUERY_STRING $query_string; 10 | fastcgi_param REQUEST_METHOD $request_method; 11 | fastcgi_param CONTENT_TYPE $content_type; 12 | fastcgi_param CONTENT_LENGTH $content_length; 13 | fastcgi_param REQUEST_URI $request_uri; 14 | fastcgi_param DOCUMENT_URI $document_uri; 15 | fastcgi_param SERVER_PROTOCOL $server_protocol; 16 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 17 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | fastcgi_param REDIRECT_STATUS 200; 24 | fastcgi_buffers 256 4k; 25 | fastcgi_intercept_errors on; 26 | fastcgi_read_timeout 14400; 27 | fastcgi_send_timeout 60; 28 | fastcgi_index index.php; 29 | fastcgi_ignore_client_abort off; 30 | -------------------------------------------------------------------------------- /tests/docker/nginx/classic/conf/fastcgi_params.conf: -------------------------------------------------------------------------------- 1 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 3 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 4 | fastcgi_param DOCUMENT_ROOT $document_root; 5 | fastcgi_param HOME $document_root; 6 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 7 | fastcgi_param PATH_INFO $fastcgi_path_info; 8 | fastcgi_param HOSTNAME $server_name; 9 | fastcgi_param QUERY_STRING $query_string; 10 | fastcgi_param REQUEST_METHOD $request_method; 11 | fastcgi_param CONTENT_TYPE $content_type; 12 | fastcgi_param CONTENT_LENGTH $content_length; 13 | fastcgi_param REQUEST_URI $request_uri; 14 | fastcgi_param DOCUMENT_URI $document_uri; 15 | fastcgi_param SERVER_PROTOCOL $server_protocol; 16 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 17 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | fastcgi_param REDIRECT_STATUS 200; 24 | fastcgi_buffers 256 4k; 25 | fastcgi_intercept_errors on; 26 | fastcgi_read_timeout 14400; 27 | fastcgi_send_timeout 60; 28 | fastcgi_index index.php; 29 | fastcgi_ignore_client_abort off; 30 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | version 1.1 Beta (12-2016) - current moving version 2 | * icinga2 configuration sample @BarbUk 3 | 4 | version 1.0 (23-12-2016) 5 | * Add a direct fascgi mode (without using an http proxy), only for tcp/ip sockets, not file sockets. 6 | * verifyhostname only available for LWP::UserAgent->VERSION >= 6.10 (fix #15) 7 | * remove utils.pm dependency (so remove also nagios lib paths) 8 | * rework --ssl, use TLSv1 by default, but you can alter that on the command line, 9 | add --cacert, --verifyhostname is now --verifyssl and still false by default 10 | (work by @regilero and @Auz) 11 | * add unit tests via travis on github 12 | 13 | version 0.11 Beta (01-2016) 14 | * add -x/ --verifyhostname SSL Hostname verification Option (@Vebryn) 15 | * add default path for icinga in lib 16 | 17 | version 0.10 Beta 18 | * fix critical and warning options arguments when first value is a dash 19 | * more documentation about IP; hostname and URI 20 | * document library path dependency (@salderma) 21 | * port variable fix (@slawekp) 22 | * some WARNINGs were sent as CRITICALs (max queue, max processes) 23 | * added default ubuntu paths for nagios lib (@ranzhe) 24 | * space separated perf data output, for better compatibility (@gummiboll) 25 | 26 | version 0.9 Beta 27 | * Added -S/--ssl option 28 | * Detect text/html response and exit on CRITICAL (not the good response) 29 | 30 | Version 0.3 31 | * warn and critical thresolds now contains 3 values (minimum idle process, max processes reached, max queue reached) 32 | * fixed max queue reached 33 | 34 | Version 0.2 35 | * add -s/--servname option, possibility to request by IP with a right Host HTTP header 36 | * add -d/--debug option 37 | 38 | Version 0.1 39 | * initial commit, work based on check_apache_status.pl by Dennis D. Spreen (dennis at spreendigital.de) 40 | -------------------------------------------------------------------------------- /tests/docker/nginx/bad_ssl/certs/nginx-selfsigned-bad.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDVddg1e3jIrRIK 3 | Jq2/bcPiyQ/OWGNxfhiyUN9NyN5INJupvSob+6TWZtjg3XUTAcyLQA+yZle+E38N 4 | ltVnkeFHh0VMRY/CqwW5Q8u4zugq9AKWaxF7nC+gEBR4v1hPI8i+1TqnDMlNFQ38 5 | eHz45yeO5vrgaJibcdTjEPKk3vHxR2UrddFqELpzCGxZx8a/oI0tpvSJMU0rQZ4p 6 | xY+B+ruQK6PSve36n7aJcoVh2za2d2hDCs+BhIbV2b9I7GZRA28YFg4v/v3uZShs 7 | JHSwBw5BEj7n5fj/Dv1WCq2U2MJ1rb1M8P65lm9zctfBzYUESWUQe86nAqWGy8b4 8 | rSo9KjWJAgMBAAECggEAc/62v9FZwEr0G5oLHpQqNymlMi8r0rd/+h4iSmWWDMyx 9 | rhpCMLSdTXjT79XH0c1PdngYT4x3r61uhFbrnn1SWwkx6hF+3n0K/jLOGJ4u4XB5 10 | m32RIYetBaDXTwpDlbXPV4wNdEtpdD61u/VJjAQopen0eE++ZfIEimNiR59y//Ya 11 | I0kqhEeGXi3Jrci+ycJq4L2HbLwaSCb3tTrtOiGiEjl34O2jGviprqmS02bH+etF 12 | rc5fl8PUcp0BFQF5ACx8bEgUaQ4ioZQ2C3NUcOdXsRatV9742Tlw1RRDb/ysRLEr 13 | waQKoRFHxK9hqoikA7N9fobCWqL97SPRpz4F3eDWRQKBgQD9zpdF/DEWQLGwhgQH 14 | AK3XCzAVN1UBCVsdwM6XfBw7e02BW6IhJKwPz9/FWcWe9LBBoyiWnM7DoQW5YUWw 15 | cwJn4BB0XC2882sh2BQ0SpNpB9kBzpHHdyo9COUCXf0yhwdLD877dDaGFjncsP6B 16 | fHnp/dHMR/j+ulfgKlxrn46rHwKBgQDXTgI8hOIhkHDbeTsms5bGTNgZ7L6yDCsJ 17 | Y/bX5cnTN1qM7COVvVVNARpgiLdWAcY70Lp3tFueXrCsOs1vKFfCTFqter/WsBFP 18 | xAk8iNH1vqbZ7IzXCOpzfzTVJHCypkY70R8irvcruGup2+vmZL3s4RsEzE5NxQAO 19 | Fwrqc34yVwKBgQCtFHksjLKczjlee8W7UMc74rFDhpw9PLgaLiW0QDqwhYFxOZ/y 20 | oiOEFOowluuhXpPj7vP64axO1DwnEyKHFacKV05hS4sVU5o3VjdRAZpNAcEG7muT 21 | brwrKymg15+XGWXr1jf8Wl/kSLvkt/6XJt+sph6wBFTUwRa0E6865XBRWQKBgH4u 22 | yN7BHmp/ZbUrCsC21fGoDaq79lMREJPzUzLbCHrSYS5gIsbabMixkczrs08jwRND 23 | VFVdjah2ZGK8H7Q615wW9bngS9g93hd6k9M3eJ3mu5DSswQ/xHAmKEeWkLoS+uyJ 24 | tg60rkWgUvD84/dmKW1PzG72chngEBUx6gLX5ykHAoGBAN45V8xByPA+dpcr3lOZ 25 | CHjUx6tEKMhA8ImBATiUCbJm/6+l/abRMg+08978sgZFkgJvXcPiBoWVosOxoHHw 26 | +8oBGYhp+2wXx6h0DGLiSq4ihWCulBc7y4H+FnQ+aq5VMyXm5EQbY56Aso/rBAnm 27 | K/3hSgUskQW0rxP8rBeIKB2R 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /tests/docker/nginx/classic/certs/nginx-selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC3pN1CgF7jB6M6 3 | VlgqcY6xiKs1fL0epBApsVBeM5Nj2Bk0bmhqKlSk3gFQ6HlIyfVOPhMi63DQHDNN 4 | BU4QbgCWXhvuV6y2k4ejH0qC6W/HXm+Rsj5ov9ilimNwdTHIAJkroUzXztwWKqyS 5 | fX+D8Djg+fI7lrOi5EyLHRN0ecrdxRh4IcNlkFvjZp0dNUV3Sm/rFxNiZRZu/uvj 6 | egdmltwDROItZ0BVyNsPD8Bx8e9drAUPhIZWUR3TPTMr6QlFxB2DabpoaKT3ZQv0 7 | lzve+ZwX8oexJ2aXZFOQV6xaGfzm7McnQM7z/OXqj6GjXyNiKq3siwvtWJt0uukt 8 | 5o4/y4UtAgMBAAECggEBAIVySNIVRF5HY4Z1zfVxtVYu0PK6JRdJ8vDJB3Scl+L6 9 | 2j3uaPOUtRNku6IWfGO3Vgk4NGGworand2PlkfeAZ+7cjgFhNoEprWuMxnFgvjgq 10 | 2HoQAyfNGNoaOO40Sythu+wndxZvHCEDe4mrpmiyvDJHjo1ckkaxDSodw9Bk3FTP 11 | szlLEk1sx9DOugp0FdBNHUvt7iFVwuzE68jJ38ypvMhH83ZnyzTkChUgtihkZzQ4 12 | zsVz94k7PqU5lwSBalP3Id1Lk6i11SAIRly2CymufnIQlYmyuSOmT1GJArnhFBRt 13 | GccEP64wDCj2xr6M+Qkybf5Dh937j23OWH9cVGy5PQECgYEA6uxarWnKkvlGGOaC 14 | GCM/hferGdsKUME+huT+iOvmAouztsflzpIVWmRknnjT8N16GxslRF2E1NToOA8h 15 | Wk4mABOkp+VxKLGDZfaxREQgfoavc+wwsEfahNNtVsRFGbkyZSUZ30InqpHQwtZQ 16 | DbSZam3S4ILwhyTgVUck/bVuUe0CgYEAyB6+ZVGQ5Ll5r9y5JHphp+2WjH1Uariz 17 | zq80n/4yCwuyf9QS87Q8ARJWT3Bhrg6/zTnpY1N8GUGL7xN3nDA7Ab6s2a4AMzmt 18 | QZI2iWQw+m4HzZnL7zK70meoRdHCYo4W2h6ArAvdOpEwclNxpG4np41EqhO6lMUC 19 | hZfe6/I0mEECgYEA5WrWDt3uX2OiCfUp/OqHQYwhgsl/JGfjaRa+X/aHk9rcMVa7 20 | 3OSah8Dc5km3KFURxuDWnxH5A2O8N+rGtor030RPm0sdHBFm8a9dY/5oAUgEld+F 21 | mNFC3E4hTAe2N629QjteLcJMPG3UAkIKwaep3t7LfkdBH6lqjr1AqaeBye0CgYBB 22 | 4614mpSEWnUwbBIhapIAwn9RHmrPAKVjJdjD3OQJMv7Ai8j5qJwhFjKI0U24C28n 23 | WSv44iH4BtbWDqjRKigjeO5cdafnNdRPxJ5kOjLOIbA8B6lXxnKE4lBLPLctz+7C 24 | PkzLWNSsVeWHnuXJ5+LyjdbP0NMb7InaBpkFQqgCgQKBgQDDD3XBBDfXnqfH+vki 25 | yTa9evWAyDhDvMWmZfx4xGZyvBRhgz1w1VO6h7j0tgOf7NxKHs7hbwI9x7c/mxw6 26 | BVNNQVknsRu9AWB1rORpfppTbINnJmL+UCULDj4k85Ghh5YYdU+eGlH440LxvdDg 27 | g53cHHOxBml2UmhyLLjUvLOYgw== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/certs/nginx-selfsigned-bad.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDVddg1e3jIrRIK 3 | Jq2/bcPiyQ/OWGNxfhiyUN9NyN5INJupvSob+6TWZtjg3XUTAcyLQA+yZle+E38N 4 | ltVnkeFHh0VMRY/CqwW5Q8u4zugq9AKWaxF7nC+gEBR4v1hPI8i+1TqnDMlNFQ38 5 | eHz45yeO5vrgaJibcdTjEPKk3vHxR2UrddFqELpzCGxZx8a/oI0tpvSJMU0rQZ4p 6 | xY+B+ruQK6PSve36n7aJcoVh2za2d2hDCs+BhIbV2b9I7GZRA28YFg4v/v3uZShs 7 | JHSwBw5BEj7n5fj/Dv1WCq2U2MJ1rb1M8P65lm9zctfBzYUESWUQe86nAqWGy8b4 8 | rSo9KjWJAgMBAAECggEAc/62v9FZwEr0G5oLHpQqNymlMi8r0rd/+h4iSmWWDMyx 9 | rhpCMLSdTXjT79XH0c1PdngYT4x3r61uhFbrnn1SWwkx6hF+3n0K/jLOGJ4u4XB5 10 | m32RIYetBaDXTwpDlbXPV4wNdEtpdD61u/VJjAQopen0eE++ZfIEimNiR59y//Ya 11 | I0kqhEeGXi3Jrci+ycJq4L2HbLwaSCb3tTrtOiGiEjl34O2jGviprqmS02bH+etF 12 | rc5fl8PUcp0BFQF5ACx8bEgUaQ4ioZQ2C3NUcOdXsRatV9742Tlw1RRDb/ysRLEr 13 | waQKoRFHxK9hqoikA7N9fobCWqL97SPRpz4F3eDWRQKBgQD9zpdF/DEWQLGwhgQH 14 | AK3XCzAVN1UBCVsdwM6XfBw7e02BW6IhJKwPz9/FWcWe9LBBoyiWnM7DoQW5YUWw 15 | cwJn4BB0XC2882sh2BQ0SpNpB9kBzpHHdyo9COUCXf0yhwdLD877dDaGFjncsP6B 16 | fHnp/dHMR/j+ulfgKlxrn46rHwKBgQDXTgI8hOIhkHDbeTsms5bGTNgZ7L6yDCsJ 17 | Y/bX5cnTN1qM7COVvVVNARpgiLdWAcY70Lp3tFueXrCsOs1vKFfCTFqter/WsBFP 18 | xAk8iNH1vqbZ7IzXCOpzfzTVJHCypkY70R8irvcruGup2+vmZL3s4RsEzE5NxQAO 19 | Fwrqc34yVwKBgQCtFHksjLKczjlee8W7UMc74rFDhpw9PLgaLiW0QDqwhYFxOZ/y 20 | oiOEFOowluuhXpPj7vP64axO1DwnEyKHFacKV05hS4sVU5o3VjdRAZpNAcEG7muT 21 | brwrKymg15+XGWXr1jf8Wl/kSLvkt/6XJt+sph6wBFTUwRa0E6865XBRWQKBgH4u 22 | yN7BHmp/ZbUrCsC21fGoDaq79lMREJPzUzLbCHrSYS5gIsbabMixkczrs08jwRND 23 | VFVdjah2ZGK8H7Q615wW9bngS9g93hd6k9M3eJ3mu5DSswQ/xHAmKEeWkLoS+uyJ 24 | tg60rkWgUvD84/dmKW1PzG72chngEBUx6gLX5ykHAoGBAN45V8xByPA+dpcr3lOZ 25 | CHjUx6tEKMhA8ImBATiUCbJm/6+l/abRMg+08978sgZFkgJvXcPiBoWVosOxoHHw 26 | +8oBGYhp+2wXx6h0DGLiSq4ihWCulBc7y4H+FnQ+aq5VMyXm5EQbY56Aso/rBAnm 27 | K/3hSgUskQW0rxP8rBeIKB2R 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/certs/nginx-selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC3pN1CgF7jB6M6 3 | VlgqcY6xiKs1fL0epBApsVBeM5Nj2Bk0bmhqKlSk3gFQ6HlIyfVOPhMi63DQHDNN 4 | BU4QbgCWXhvuV6y2k4ejH0qC6W/HXm+Rsj5ov9ilimNwdTHIAJkroUzXztwWKqyS 5 | fX+D8Djg+fI7lrOi5EyLHRN0ecrdxRh4IcNlkFvjZp0dNUV3Sm/rFxNiZRZu/uvj 6 | egdmltwDROItZ0BVyNsPD8Bx8e9drAUPhIZWUR3TPTMr6QlFxB2DabpoaKT3ZQv0 7 | lzve+ZwX8oexJ2aXZFOQV6xaGfzm7McnQM7z/OXqj6GjXyNiKq3siwvtWJt0uukt 8 | 5o4/y4UtAgMBAAECggEBAIVySNIVRF5HY4Z1zfVxtVYu0PK6JRdJ8vDJB3Scl+L6 9 | 2j3uaPOUtRNku6IWfGO3Vgk4NGGworand2PlkfeAZ+7cjgFhNoEprWuMxnFgvjgq 10 | 2HoQAyfNGNoaOO40Sythu+wndxZvHCEDe4mrpmiyvDJHjo1ckkaxDSodw9Bk3FTP 11 | szlLEk1sx9DOugp0FdBNHUvt7iFVwuzE68jJ38ypvMhH83ZnyzTkChUgtihkZzQ4 12 | zsVz94k7PqU5lwSBalP3Id1Lk6i11SAIRly2CymufnIQlYmyuSOmT1GJArnhFBRt 13 | GccEP64wDCj2xr6M+Qkybf5Dh937j23OWH9cVGy5PQECgYEA6uxarWnKkvlGGOaC 14 | GCM/hferGdsKUME+huT+iOvmAouztsflzpIVWmRknnjT8N16GxslRF2E1NToOA8h 15 | Wk4mABOkp+VxKLGDZfaxREQgfoavc+wwsEfahNNtVsRFGbkyZSUZ30InqpHQwtZQ 16 | DbSZam3S4ILwhyTgVUck/bVuUe0CgYEAyB6+ZVGQ5Ll5r9y5JHphp+2WjH1Uariz 17 | zq80n/4yCwuyf9QS87Q8ARJWT3Bhrg6/zTnpY1N8GUGL7xN3nDA7Ab6s2a4AMzmt 18 | QZI2iWQw+m4HzZnL7zK70meoRdHCYo4W2h6ArAvdOpEwclNxpG4np41EqhO6lMUC 19 | hZfe6/I0mEECgYEA5WrWDt3uX2OiCfUp/OqHQYwhgsl/JGfjaRa+X/aHk9rcMVa7 20 | 3OSah8Dc5km3KFURxuDWnxH5A2O8N+rGtor030RPm0sdHBFm8a9dY/5oAUgEld+F 21 | mNFC3E4hTAe2N629QjteLcJMPG3UAkIKwaep3t7LfkdBH6lqjr1AqaeBye0CgYBB 22 | 4614mpSEWnUwbBIhapIAwn9RHmrPAKVjJdjD3OQJMv7Ai8j5qJwhFjKI0U24C28n 23 | WSv44iH4BtbWDqjRKigjeO5cdafnNdRPxJ5kOjLOIbA8B6lXxnKE4lBLPLctz+7C 24 | PkzLWNSsVeWHnuXJ5+LyjdbP0NMb7InaBpkFQqgCgQKBgQDDD3XBBDfXnqfH+vki 25 | yTa9evWAyDhDvMWmZfx4xGZyvBRhgz1w1VO6h7j0tgOf7NxKHs7hbwI9x7c/mxw6 26 | BVNNQVknsRu9AWB1rORpfppTbINnJmL+UCULDj4k85Ghh5YYdU+eGlH440LxvdDg 27 | g53cHHOxBml2UmhyLLjUvLOYgw== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /tests/docker/nginx/classic/conf/vhosts.conf: -------------------------------------------------------------------------------- 1 | # Default vhost, without php support 2 | server { 3 | listen 80 default; 4 | server_name _; 5 | 6 | index index.html index.htm; 7 | 8 | location / { 9 | root /usr/share/nginx/html; 10 | add_header X-Default-VH 1; 11 | } 12 | 13 | # redirect server error pages to the static page /50x.html 14 | # 15 | error_page 500 502 503 504 /50x.html; 16 | location = /50x.html { 17 | root /usr/share/nginx/html; 18 | } 19 | } 20 | 21 | # targeted vhost, with php support 22 | server { 23 | listen 80; 24 | server_name phpfpm.example.com; 25 | 26 | index index.php; 27 | 28 | location / { 29 | 30 | location = /check-status { 31 | include fastcgi_params.conf; 32 | fastcgi_pass dockerhost:9001; 33 | } 34 | location ~ \.php$ { 35 | include fastcgi_params.conf; 36 | fastcgi_pass dockerhost:9001; 37 | } 38 | 39 | root /usr/share/nginx/html; 40 | add_header X-Default-VH 0; 41 | try_files $uri $uri/ =404; 42 | } 43 | 44 | # redirect server error pages to the static page /50x.html 45 | # 46 | error_page 500 502 503 504 /50x.html; 47 | location = /50x.html { 48 | root /usr/share/nginx/html; 49 | } 50 | } 51 | 52 | # targeted vhost, with php support, HTTPS mode 53 | server { 54 | listen 443; 55 | server_name phpfpm.example.com; 56 | 57 | ssl on; 58 | ssl_certificate /etc/nginx/ssl/server.crt; 59 | ssl_certificate_key /etc/nginx/ssl/server.key; 60 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 61 | ssl_ciphers HIGH:!aNULL:!MD5; 62 | 63 | index index.php; 64 | 65 | location / { 66 | 67 | location = /check-status { 68 | include fastcgi_params.conf; 69 | fastcgi_pass dockerhost:9001; 70 | } 71 | location ~ \.php$ { 72 | include fastcgi_params.conf; 73 | fastcgi_pass dockerhost:9001; 74 | } 75 | 76 | root /usr/share/nginx/html; 77 | add_header X-Default-VH 0; 78 | try_files $uri $uri/ =404; 79 | } 80 | 81 | # redirect server error pages to the static page /50x.html 82 | # 83 | error_page 500 502 503 504 /50x.html; 84 | location = /50x.html { 85 | root /usr/share/nginx/html; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /tests/docker/nginx/bad_ssl/conf/vhosts.conf: -------------------------------------------------------------------------------- 1 | # Default vhost, without php support 2 | server { 3 | listen 80 default; 4 | server_name _; 5 | 6 | index index.html index.htm; 7 | 8 | location / { 9 | root /usr/share/nginx/html; 10 | add_header X-Default-VH 1; 11 | } 12 | 13 | # redirect server error pages to the static page /50x.html 14 | # 15 | error_page 500 502 503 504 /50x.html; 16 | location = /50x.html { 17 | root /usr/share/nginx/html; 18 | } 19 | } 20 | 21 | # targeted vhost, with php support 22 | server { 23 | listen 80; 24 | server_name phpfpm.example.com; 25 | 26 | index index.php; 27 | 28 | location / { 29 | 30 | location = /check-status { 31 | include fastcgi_params.conf; 32 | fastcgi_pass dockerhost:9001; 33 | } 34 | location ~ \.php$ { 35 | include fastcgi_params.conf; 36 | fastcgi_pass dockerhost:9001; 37 | } 38 | 39 | root /usr/share/nginx/html; 40 | add_header X-Default-VH 0; 41 | try_files $uri $uri/ =404; 42 | } 43 | 44 | # redirect server error pages to the static page /50x.html 45 | # 46 | error_page 500 502 503 504 /50x.html; 47 | location = /50x.html { 48 | root /usr/share/nginx/html; 49 | } 50 | } 51 | 52 | # targeted vhost, with php support, HTTPS mode 53 | server { 54 | listen 443; 55 | server_name phpfpm.example.com; 56 | 57 | ssl on; 58 | ssl_certificate /etc/nginx/ssl/server.crt; 59 | ssl_certificate_key /etc/nginx/ssl/server.key; 60 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 61 | ssl_ciphers HIGH:!aNULL:!MD5; 62 | 63 | 64 | index index.php; 65 | 66 | location / { 67 | 68 | location = /check-status { 69 | include fastcgi_params.conf; 70 | fastcgi_pass dockerhost:9001; 71 | } 72 | location ~ \.php$ { 73 | include fastcgi_params.conf; 74 | fastcgi_pass dockerhost:9001; 75 | } 76 | 77 | root /usr/share/nginx/html; 78 | add_header X-Default-VH 0; 79 | try_files $uri $uri/ =404; 80 | } 81 | 82 | # redirect server error pages to the static page /50x.html 83 | # 84 | error_page 500 502 503 504 /50x.html; 85 | location = /50x.html { 86 | root /usr/share/nginx/html; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /tests/docker/nginx/tls11/conf/vhosts.conf: -------------------------------------------------------------------------------- 1 | # Default vhost, without php support 2 | server { 3 | listen 80 default; 4 | server_name _; 5 | 6 | index index.html index.htm; 7 | 8 | location / { 9 | root /usr/share/nginx/html; 10 | add_header X-Default-VH 1; 11 | } 12 | 13 | # redirect server error pages to the static page /50x.html 14 | # 15 | error_page 500 502 503 504 /50x.html; 16 | location = /50x.html { 17 | root /usr/share/nginx/html; 18 | } 19 | } 20 | 21 | # targeted vhost, with php support 22 | server { 23 | listen 80; 24 | server_name phpfpm.example.com; 25 | 26 | index index.php; 27 | 28 | location / { 29 | 30 | location = /check-status { 31 | include fastcgi_params.conf; 32 | fastcgi_pass dockerhost:9001; 33 | } 34 | location ~ \.php$ { 35 | include fastcgi_params.conf; 36 | fastcgi_pass dockerhost:9001; 37 | } 38 | 39 | root /usr/share/nginx/html; 40 | add_header X-Default-VH 0; 41 | try_files $uri $uri/ =404; 42 | } 43 | 44 | # redirect server error pages to the static page /50x.html 45 | # 46 | error_page 500 502 503 504 /50x.html; 47 | location = /50x.html { 48 | root /usr/share/nginx/html; 49 | } 50 | } 51 | 52 | # targeted vhost, with php support, HTTPS mode 53 | server { 54 | listen 443; 55 | server_name phpfpm.example.com; 56 | 57 | ssl on; 58 | ssl_certificate /etc/nginx/ssl/server.crt; 59 | ssl_certificate_key /etc/nginx/ssl/server.key; 60 | ssl_protocols TLSv1.1; 61 | ssl_ciphers ALL:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; 62 | 63 | index index.php; 64 | 65 | location / { 66 | 67 | location = /check-status { 68 | include fastcgi_params.conf; 69 | fastcgi_pass dockerhost:9001; 70 | } 71 | location ~ \.php$ { 72 | include fastcgi_params.conf; 73 | fastcgi_pass dockerhost:9001; 74 | } 75 | 76 | root /usr/share/nginx/html; 77 | add_header X-Default-VH 0; 78 | try_files $uri $uri/ =404; 79 | } 80 | 81 | # redirect server error pages to the static page /50x.html 82 | # 83 | error_page 500 502 503 504 /50x.html; 84 | location = /50x.html { 85 | root /usr/share/nginx/html; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /check_phpfpm_status.icinga2.conf: -------------------------------------------------------------------------------- 1 | object CheckCommand "phpfpm" { 2 | import "plugin-check-command" 3 | command = [ PluginDir + "/check_phpfpm_status" ] 4 | 5 | arguments = { 6 | "-H" = { 7 | value = "$phpfpm_hostname$" 8 | description = "name or IP address of host to check" 9 | } 10 | "-p" = { 11 | value = "$phpfpm_port$" 12 | description = "Http port, or Fastcgi port when using --fastcgi" 13 | } 14 | "-u" = { 15 | value = "$phpfpm_url$" 16 | description = "Specific URL (only the path part of it in fact) to use, instead of the default /fpm-status" 17 | } 18 | "-s" = { 19 | value = "$phpfpm_servername$" 20 | description = "ServerName, (host header of HTTP request) use it if you specified an IP in -H to match the good Virtualhost in your target" 21 | } 22 | "-f" = { 23 | value = "$phpfpm_fastcgi$" 24 | description = "Connect directly to php-fpm via network or local socket, using fastcgi protocol instead of HTTP." 25 | } 26 | "-U" = { 27 | value = "$phpfpm_user$" 28 | description = "Username for basic auth" 29 | } 30 | "-P" = { 31 | value = "$phpfpm_pass$" 32 | description = "Password for basic auth" 33 | } 34 | "-r" = { 35 | value = "$phpfpm_realm$" 36 | description = "Realm for basic auth" 37 | } 38 | "-d" = { 39 | value = "$phpfpm_debug$" 40 | description = "Debug mode (show http request response)" 41 | } 42 | "-t" = { 43 | value = "$phpfpm_timeout$" 44 | description = "timeout in seconds (Default: 15)" 45 | } 46 | "-S" = { 47 | value = "$phpfpm_ssl$" 48 | description = "Wether we should use HTTPS instead of HTTP. Note that you can give some extra parameters to this settings. Default value is 'TLSv1' but you could use things like 'TLSv1_1' or 'TLSV1_2' (or even 'SSLv23:!SSLv2:!SSLv3' for old stuff)." 49 | } 50 | "-x" = { 51 | value = "$phpfpm_verifyssl$" 52 | description = "verify certificate and hostname from ssl cert, default is 0 (no security), set it to 1 to really make SSL peer name and certificater checks." 53 | } 54 | "-X" = { 55 | value = "$phpfpm_cacert$" 56 | description = "Full path to the cacert.pem certificate authority used to verify ssl certificates (use with --verifyssl). if not given the cacert from Mozilla::CA cpan plugin will be used." 57 | } 58 | "-w" = { 59 | value = "$phpfpm_warn$" 60 | description = "MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED number of available workers, or max states reached that will cause a warning. -1 for no warning" 61 | } 62 | "-c" = { 63 | value = "$phpfpm_critical$" 64 | description = "MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED number of available workers, or max states reached that will cause an error, -1 for no CRITICAL" 65 | } 66 | } 67 | vars.phpfpm_hostname = "$address$" 68 | } 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CHECK_PHPFPM_STATUS 2 | 3 | Nagios check checking the fpm-status page report from php-fpm. Tracking Idle processes, max processes reached and process queue. 4 | 5 | Support of http, https and fastgi direct mode. 6 | 7 | You can use this script to draw some graphics (perfparse). 8 | 9 | PHP-FPM Monitor for Nagios version 1.1 10 | 11 | GPL licence, (c)2012 Leroy Regis 12 | 13 | [![Build Status](https://api.travis-ci.org/regilero/check_phpfpm_status.svg?branch=master)](https://api.travis-ci.org/regilero/check_phpfpm_status.svg?branch=master) 14 | 15 | # Installation 16 | 17 | ## Dependencies 18 | 19 | You need **perl**. 20 | 21 | If you use the script to request the php status page from a web service (usual 22 | case) you'll need the perl library, LWP::UserAgent (`apt-get install liblwp-protocol-https-perl` on Debian) 23 | 24 | If you request the php status page without http support, directly in fastcgi, (that's not the usual case) you 25 | will need the FCGI::Client CPAN library. On debian: 26 | 27 | sudo perl -MCPAN -e shell 28 | install Bundle::CPAN 29 | reload cpan 30 | install FCGI::Client 31 | 32 | If you have **cpanm** installed, and only if you experience problems, you can 33 | install all potential dependencies by running (maybe with sudo for global install) : 34 | 35 | cpanm -n --skip-satisfied --installdeps . 36 | 37 | This command uses the cpanfile provided with this script to list dependencies. 38 | You may not have this file, as the check_phpfpm_status.pl script is quite standalone, 39 | but you can find this file, and the tests files on the github page of the project. 40 | https://github.com/regilero/check_phpfpm_status 41 | 42 | ## Install of this script 43 | 44 | 1. Copy check_phpfpm_status.pl to the server's nagios plugins directory. 45 | 2. Ensure the script has execution rights 46 | 47 | ## Icinga2 configuration 48 | 49 | Copy `check_phpfpm_status.icinga2.conf` to the icinga2 zone. 50 | 51 | Define a new service for all Linux hosts with `vars.phpfpm`, for example: 52 | 53 | ``` 54 | apply Service "PHP-fpm process" { 55 | import "generic-service" 56 | check_command = "phpfpm" 57 | vars.phpfpm_user = "user" 58 | vars.phpfpm_pass = "pass" 59 | vars.phpfpm_url = "/status" 60 | vars.phpfpm_critical = "0,2,5" 61 | command_endpoint = host.vars.client_endpoint 62 | assign where host.vars.client_endpoint && host.vars.os == "Linux" && host.vars.phpfpm 63 | } 64 | ``` 65 | 66 | # Script Documentation 67 | 68 | ``` 69 | Usage: ./check_phpfpm_status.pl -H [-p ] [-s servername] [-t ] [-w -c ] [-V] [-d] [-f] [-u ] [-U user -P pass -r realm] 70 | -h, --help 71 | print this help message 72 | -H, --hostname=HOST 73 | name or IP address of host to check 74 | -p, --port=PORT 75 | Http port, or Fastcgi port when using --fastcgi 76 | -u, --url=URL 77 | Specific URL (only the path part of it in fact) to use, instead of the default "/fpm-status" 78 | -s, --servername=SERVERNAME 79 | ServerName, (host header of HTTP request) use it if you specified an IP in -H to match the good Virtualhost in your target 80 | -f, --fastcgi 81 | Connect directly to php-fpm via network or local socket, using fastcgi protocol instead of HTTP. 82 | -U, --user=user 83 | Username for basic auth 84 | -P, --pass=PASS 85 | Password for basic auth 86 | -r, --realm=REALM 87 | Realm for basic auth 88 | -d, --debug 89 | Debug mode (show http request response) 90 | -t, --timeout=INTEGER 91 | timeout in seconds (Default: 15) 92 | -S, --ssl 93 | Wether we should use HTTPS instead of HTTP. Note that you can give some extra parameters to this settings. Default value is 'TLSv1' 94 | but you could use things like 'TLSv1_1' or 'TLSV1_2' (or even 'SSLv23:!SSLv2:!SSLv3' for old stuff). 95 | -x, --verifyssl, --verifyhostname 96 | verify certificate and hostname from ssl cert, default is 0 (no security), set it to 1 to really make SSL peer name and certificater checks. 97 | 'verifyhostname' is the old deprecated name of this option. 98 | -X, --cacert 99 | Full path to the cacert.pem certificate authority used to verify ssl certificates (use with --verifyssl). 100 | if not given the cacert from Mozilla::CA cpan plugin will be used. 101 | -w, --warn=MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED 102 | number of available workers, or max states reached that will cause a warning 103 | -1 for no warning 104 | -c, --critical=MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED 105 | number of available workers, or max states reached that will cause an error 106 | -1 for no CRITICAL 107 | -V, --version 108 | prints version number 109 | 110 | Note : 111 | 3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds 112 | - MIN_AVAILABLE_PROCESSES: Working with the number of available (Idle) and working process (Busy). 113 | Generating WARNING and CRITICAL if you do not have enough Idle processes. 114 | - PROC_MAX_REACHED: the fpm-status report will show us how many times the max processes were reached sinc start, 115 | this script will record how many time this happended since last check, letting you fix thresolds for alerts 116 | - QUEUE_MAX_REACHED: the php-fpm report will show us how many times the max queue was reached since start, 117 | this script will record how many time this happended since last check, letting you fix thresolds for alerts 118 | 119 | Examples: 120 | 121 | This will lead to CRITICAL if you have 0 Idle process, or you have reached the max processes 2 times between last check, 122 | or you have reached the max queue len 5 times. A Warning will be reached for 1 Idle process only: 123 | 124 | check_phpfpm_status.pl -H 10.0.0.10 -u /foo/my-fpm-status -s mydomain.example.com -t 8 -w 1,-1,-1 -c 0,2,5 125 | 126 | this will generate WARNING and CRITICAL alerts only on the number of times you have reached the max process: 127 | 128 | check_phpfpm_status.pl -H 10.0.0.10 -u /foo/my-fpm-status -s mydomain.example.com -t 8 -w -1,10,-1 -c -1,20,-1 129 | 130 | theses two equivalents will not generate any alert (if the php-fpm page is reachable) but could be used for graphics: 131 | 132 | check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com -w -1,-1,-1 -c -1,-1,-1 133 | check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com 134 | 135 | And this one is a basic starting example : 136 | 137 | check_phpfpm_status.pl -H 127.0.0.1 -s nagios.example.com -w 1,1,1 -c 0,2,2 138 | 139 | All these examples used an HTTP proxy (like Nginx or Apache) in front of php-fpm. If php-fpm is listening on a tcp/ip socket 140 | you can also make a direct request on this port (9000 by default) using the fastcgi protocol. You'll need the FastCGI client 141 | tools enabled in Perl (check the README) and the command would use the -f or --fastcgi option (note that SSL or servername 142 | options are useless in this mode). 143 | This can be especially usefull if you use php-fpm in an isolated env, without the HTTP proxy support (like in a docker container): 144 | 145 | check_phpfpm_status.pl -H 127.0.0.1 --fastcgi -p 9002 -w 1,1,1 -c 0,2,2 146 | 147 | HTTPS/SSL: 148 | 149 | Adding --ssl you can reach an https host: 150 | 151 | check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com --ssl 152 | 153 | Check --verify-ssl (false by defaut) --cacert and --sl for more options, like below 154 | (note that certificate checks never wortked on my side, add -d for full debug and 155 | tell me if it worked for you, you may need up to date CPAN adn openSSL libs) 156 | 157 | check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com --ssl TLSv1_2 --verify-ssl 1 --cacert /etc/ssl/cacert.pem 158 | ``` 159 | 160 | # LICENSE 161 | 162 | GNU GPL v3 163 | -------------------------------------------------------------------------------- /tests/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ok=0; 3 | nok=0; 4 | 5 | PORT_PHPFPM=9001 6 | PORT_NGINX_CLASSIC=8801 7 | PORT_NGINX_CLASSICSSL=8443 8 | PORT_NGINX_TLS11=9443 9 | PORT_NGINX_BADSSL=10443 10 | 11 | function test_last_check_code() { 12 | 13 | if [ "x${TEST_CODE}" == "x${EXPECTED_CODE}" ]; then 14 | return 0 15 | else 16 | echo " ^^^^" 2>&1 17 | echo " \=> FAILED TEST : last Check result ("${TEST_CODE}") is not the expected one ("${EXPECTED_CODE}")" 2>&1 18 | echo " **** FAILURE **************************************************" 19 | echo "" 20 | return 1 21 | fi 22 | } 23 | 24 | function test_last_check_text() { 25 | if [ "x${TEST_TEXT}" == "x" ]; then 26 | echo " ^^^^" 2>&1 27 | echo " \=> FAILED TEST : no output" 2>&1 28 | echo " **** FAILURE **************************************************" 29 | echo "" 30 | return 1 31 | fi 32 | if [[ ${TEST_TEXT} == *${EXPECTED_TEXT}* ]]; then 33 | echo "Yep" 34 | return 0 35 | else 36 | echo " ^^^^" 2>&1 37 | echo " \=> FAILED TEST : last Check result ("${TEST_TEXT}") is not the expected one ("${EXPECTED_TEXT}")" 2>&1 38 | echo " **** FAILURE **************************************************" 39 | echo "" 40 | return 1 41 | fi 42 | } 43 | 44 | function test_result() { 45 | test_last_check_code 46 | if [ "x${?}" == "x0" ]; then 47 | test_last_check_text 48 | if [ "x${?}" == "x0" ]; then 49 | echo " \=> TEST is OK ("${TEST_CODE}" == "${EXPECTED_CODE}") and text contains '${EXPECTED_TEXT}'" 50 | echo "" 51 | let ok+=1 52 | return 0 53 | fi 54 | fi 55 | let nok+=1 56 | return 1 57 | } 58 | 59 | function run_test() { 60 | EXPECTED_CODE=$1 61 | echo "TESTING: "$TEST 62 | TEST_TEXT="" 63 | TEST_CODE=-1 64 | TEST_TEXT=`${TEST}` 65 | TEST_CODE=${?} 66 | # debug 67 | echo ${TEST_TEXT} 68 | # now check everything was as expected 69 | test_result 70 | } 71 | 72 | echo " ------------------------------------------------------------------------" 73 | echo " FASTCGI MODE" 74 | echo " ------------------------------------------------------------------------" 75 | echo 76 | echo " * Checking required args in fastcgi mode -------------------------------" 77 | TEST="./check_phpfpm_status.pl --fastcgi" 78 | EXPECTED_TEXT="-H host argument required" 79 | run_test 3 80 | 81 | echo " * Checking phpfpm in fastcgi mode --------------------------------------" 82 | TEST="./check_phpfpm_status.pl -H 127.0.0.1 -p ${PORT_PHPFPM} -u /check-status --fastcgi" 83 | EXPECTED_TEXT="PHP-FPM OK" 84 | run_test 0 85 | 86 | echo " * Request the phpinfo page, -will fail the check -----------------------" 87 | TEST="./check_phpfpm_status.pl -H 127.0.0.1 -p ${PORT_PHPFPM} -u /usr/src/app/index.php --fastcgi" 88 | EXPECTED_TEXT="it's an HTML page" 89 | run_test 2 90 | 91 | echo " * Checking phpfpm in fastcgi mode, we should have name of the pool------" 92 | TEST="./check_phpfpm_status.pl -H 127.0.0.1 -p ${PORT_PHPFPM} -u /check-status --fastcgi" 93 | EXPECTED_TEXT="PHP-FPM OK - www" 94 | run_test 0 95 | 96 | echo " ------------------------------------------------------------------------" 97 | echo " HTTP MODE" 98 | echo " ------------------------------------------------------------------------" 99 | echo 100 | echo 101 | echo " * Checking required args in http mode ----------------------------------" 102 | TEST="./check_phpfpm_status.pl" 103 | EXPECTED_TEXT="-H host argument required" 104 | run_test 3 105 | 106 | echo " * Checking phpfpm in http mode : no server name, should fail ----------" 107 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s -u /check-status" 108 | EXPECTED_TEXT="400 Bad Request" 109 | run_test 2 110 | 111 | echo " * Checking phpfpm in http mode : bad server name, should fail ----------" 112 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s doesnotexists.example.com -u /check-status" 113 | EXPECTED_TEXT="404 Not Found" 114 | run_test 2 115 | 116 | echo " * Checking phpfpm in http mode : right server name ---------------------" 117 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s phpfpm.example.com -u /check-status" 118 | EXPECTED_TEXT="PHP-FPM OK - www" 119 | run_test 0 120 | 121 | echo " * Checking phpfpm in http mode : right server name, bad url-------------" 122 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s phpfpm.example.com -u /checkstatus" 123 | EXPECTED_TEXT="404 Not Found" 124 | run_test 2 125 | 126 | echo " ------------------------------------------------------------------------" 127 | echo " MISC OPTIONS" 128 | echo " ------------------------------------------------------------------------" 129 | echo " * Checking help option -------------------------------------------------" 130 | TEST="./check_phpfpm_status.pl -h" 131 | EXPECTED_TEXT="3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds" 132 | run_test 3 133 | 134 | echo " * Checking help option -------------------------------------------------" 135 | TEST="./check_phpfpm_status.pl --help" 136 | EXPECTED_TEXT="This will lead to CRITICAL if you have 0 Idle process" 137 | run_test 3 138 | 139 | echo " * Checking version option ----------------------------------------------" 140 | TEST="./check_phpfpm_status.pl -V" 141 | EXPECTED_TEXT="check_phpfpm_status.pl version : 1.1" 142 | run_test 3 143 | 144 | echo " * Checking version option ----------------------------------------------" 145 | TEST="./check_phpfpm_status.pl --version" 146 | EXPECTED_TEXT="check_phpfpm_status.pl version : 1.1" 147 | run_test 3 148 | 149 | #FIXME: TODO 150 | #echo " * Checking user/password/realm HTTP Auth -------------------------------------" 151 | #TEST="./check_phpfpm_status.pl -H 127.0.0.1 -U foo -P bar -r zorg -p ${PORT_NGINX_CLASSIC} -s phpfpm.example.com -u /checkstatus" 152 | #EXPECTED_TEXT="PHP-FPM OK - www" 153 | #run_test 0 154 | 155 | # FIXME: test timeout also? 156 | 157 | echo " ------------------------------------------------------------------------" 158 | echo " THRESOLDS" 159 | echo " ------------------------------------------------------------------------" 160 | echo 161 | 162 | BASE_TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s phpfpm.example.com -u /check-status" 163 | 164 | echo " * Checking phpfpm in http mode : bad thresolds v1a ---------------------" 165 | TEST=${BASE_TEST}" -w 1,1,3 -c 0,2,2" 166 | EXPECTED_TEXT="Check warning and critical values for MaxQueue (3rd part of thresold), warning level must be < crit level" 167 | run_test 3 168 | 169 | echo " * Checking phpfpm in http mode : bad thresolds v1b ---------------------" 170 | TEST=${BASE_TEST}" -w 1,1,3 -c 0,2,3" 171 | EXPECTED_TEXT="Check warning and critical values for MaxQueue (3rd part of thresold), warning level must be < crit level" 172 | run_test 3 173 | 174 | echo " * Checking phpfpm in http mode : bad thresolds v2a ---------------------" 175 | TEST=${BASE_TEST}" -w 1,3,1 -c 0,2,2" 176 | EXPECTED_TEXT="Check warning and critical values for MaxProcesses (2nd part of thresold), warning level must be < crit level" 177 | run_test 3 178 | 179 | echo " * Checking phpfpm in http mode : bad thresolds v2b ---------------------" 180 | TEST=${BASE_TEST}" -w 1,3,1 -c 0,3,2" 181 | EXPECTED_TEXT="Check warning and critical values for MaxProcesses (2nd part of thresold), warning level must be < crit level" 182 | run_test 3 183 | 184 | echo " * Checking phpfpm in http mode : bad thresolds v3a ---------------------" 185 | TEST=${BASE_TEST}" -w 0,1,1 -c 1,2,2" 186 | EXPECTED_TEXT="Check warning and critical values for IdleProcesses (1st part of thresold), warning level must be > crit level" 187 | run_test 3 188 | 189 | echo " * Checking phpfpm in http mode : bad thresolds v3b ---------------------" 190 | TEST=${BASE_TEST}" -w 1,1,1 -c 1,2,2" 191 | EXPECTED_TEXT="Check warning and critical values for IdleProcesses (1st part of thresold), warning level must be > crit level" 192 | run_test 3 193 | 194 | echo " * Checking phpfpm in http mode : Idle OK -------------------------------" 195 | TEST=${BASE_TEST}" -w -1,-1,-1 -c 0,20,20" 196 | EXPECTED_TEXT="PHP-FPM OK - www" 197 | run_test 0 198 | 199 | echo " * Checking phpfpm in http mode : Idle should warn ---------------------" 200 | TEST=${BASE_TEST}" -w 10,-1,-1 -c 0,20,20" 201 | EXPECTED_TEXT="PHP-FPM WARNING - Idle workers are low" 202 | run_test 1 203 | 204 | echo " * Checking phpfpm in http mode : Idle should be critical ---------------" 205 | TEST=${BASE_TEST}" -w 20,-1,-1 -c 10,20,20" 206 | EXPECTED_TEXT="PHP-FPM CRITICAL - Idle workers are critically low" 207 | run_test 2 208 | 209 | echo " ------------------------------------------------------------------------" 210 | echo " HTTPS MODE" 211 | echo " ------------------------------------------------------------------------" 212 | echo 213 | 214 | echo " * Checking phpfpm in https mode, https on http port failure--------------" 215 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSIC} -s phpfpm.example.com -u /check-status --ssl" 216 | EXPECTED_TEXT="500 Can't connect to phpfpm.example.com" 217 | run_test 2 218 | 219 | echo " * Checking phpfpm in https mode, no peer check -------------------------" 220 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSICSSL} -s phpfpm.example.com -u /check-status --ssl" 221 | EXPECTED_TEXT="PHP-FPM OK - www" 222 | run_test 0 223 | 224 | # This one will work because we do not check the SSL certificate by default 225 | # this container has a certificate with a wrong peer name 226 | echo " * Checking phpfpm in https mode, no peer check on bad ssl --------------" 227 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_BADSSL} -s phpfpm.example.com -u /check-status --ssl" 228 | EXPECTED_TEXT="PHP-FPM OK - www" 229 | run_test 0 230 | 231 | echo " * Checking phpfpm in https mode, peer check failure on bad ssl ---------" 232 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_BADSSL} -s phpfpm.example.com -u /check-status --ssl --verifyssl 1" 233 | EXPECTED_TEXT="(certificate verify failed)" 234 | run_test 2 235 | 236 | # FIXME: Arrgh: currently I cannot get ssl verifications working... 237 | echo " * Checking https mode, request google, just for the certs part ---------" 238 | TEST="./check_phpfpm_status.pl -t 15 -H www.google.com -u /wont-work --ssl --verifyssl 1" 239 | EXPECTED_TEXT="PHP-FPM CRITICAL - 404 Not Found" 240 | echo " \=> SKIPPED: this test does not work currently" 241 | echo 242 | #run_test 2 243 | 244 | # FIXME: Arrgh: currently I cannot get ssl verifications working... 245 | echo " * Checking phpfpm in https mode, verifyssl ok on classical -------------" 246 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSICSSL} -s phpfpm.example.com -u /check-status --ssl --verifyssl 1" 247 | EXPECTED_TEXT="PHP-FPM OK - www" 248 | echo " \=> SKIPPED: this test does not work currently" 249 | echo 250 | #run_test 0 251 | 252 | echo " * Checking phpfpm in https mode, bad SSL versions failure --------------" 253 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_CLASSICSSL} -s phpfpm.example.com -u /check-status --ssl SSLV3" 254 | EXPECTED_TEXT="500 Can't connect to phpfpm.example.com" 255 | run_test 2 256 | 257 | echo " * Checking phpfpm in https mode, bad TLS1.2 versions ok in TLS1.1 only server" 258 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_TLS11} -s phpfpm.example.com -u /check-status --ssl TLSv1_2" 259 | EXPECTED_TEXT="500 Can't connect to phpfpm.example.com" 260 | run_test 2 261 | 262 | echo " * Checking phpfpm in https mode, ok TLS1.1 in TLS1.1 only server server -" 263 | TEST="./check_phpfpm_status.pl -t 15 -H 127.0.0.1 -p ${PORT_NGINX_TLS11} -s phpfpm.example.com -u /check-status --ssl TLSv1_1" 264 | EXPECTED_TEXT="PHP-FPM OK - www" 265 | run_test 0 266 | 267 | echo 268 | echo "**** FINAL TESTS STATUS ****" 269 | echo " TESTS OK: ${ok}" 270 | echo " FAILED TESTS: ${nok}" 271 | if [ "x${nok}" == "x0" ]; then 272 | echo "++++ SUCCESS ++++" 2>&1 273 | exit 0 274 | else 275 | echo "---- FAILURE ---- (${nok} fail(s))" 2>&1 276 | exit 1 277 | fi -------------------------------------------------------------------------------- /check_phpfpm_status.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # check_phpfpm_status.pl 3 | # Version : 1.1 4 | # Author : regis.leroy at makina-corpus.com 5 | # based on previous apache status work by Dennis D. Spreen (dennis at spreendigital.de) 6 | # Based on check_apachestatus.pl v1.4 by 7 | # De Bodt Lieven (Lieven.DeBodt at gmail.com) 8 | # Karsten Behrens (karsten at behrens dot in) 9 | # Geoff McQueen (geoff.mcqueen at hiivesystems dot com ) 10 | # Dave Steinberg (dave at redterror dot net) 11 | # Licence : GNU GPL v3 - http://www.fsf.org/licenses/gpl.txt 12 | # 13 | # help : ./check_phpfpm_status.pl -h 14 | # 15 | # issues & updates: http://github.com/regilero/check_phpfpm_status 16 | use strict; 17 | use warnings; 18 | use Getopt::Long; 19 | use Time::HiRes qw(gettimeofday tv_interval); 20 | use Digest::MD5 qw(md5 md5_hex); 21 | 22 | # --------------------------------------------------------------------------- 23 | package main; 24 | 25 | # ensure all outputs are in UTF-8 26 | binmode(STDOUT, ":utf8"); 27 | 28 | # Globals 29 | my $Version= '1.1'; 30 | my $Name= $0; 31 | 32 | my $o_host= undef; # hostname 33 | my $o_help= undef; # want some help ? 34 | my $o_port= undef; # port 35 | my $o_url= undef; # url to use, if not the default 36 | my $o_user= undef; # user for auth 37 | my $o_pass= ''; # password for auth 38 | my $o_realm= ''; # password for auth 39 | my $o_version= undef; # print version 40 | my $o_warn_p_level= -1; # Min number of idle workers that will cause a warning 41 | my $o_crit_p_level= -1; # Min number of idle workersthat will cause an error 42 | my $o_warn_q_level= -1; # Number of Max Queue Reached that will cause a warning 43 | my $o_crit_q_level= -1; # Number of Max Queue Reached that will cause an error 44 | my $o_warn_m_level= -1; # Number of Max Processes Reached that will cause a warning 45 | my $o_crit_m_level= -1; # Number of Max Processes Reached that will cause an error 46 | my $o_timeout= 15; # Default 15s Timeout 47 | my $o_warn_threshold= undef; # warning thresholds entry 48 | my $o_crit_threshold= undef; # critical thresholds entry 49 | my $o_debug= undef; # debug mode 50 | my $o_fastcgi= undef; # direct fastcgi mode (without an http->fastcgi proxy) 51 | my $o_servername= undef; # ServerName (host header in http request) 52 | my $o_https= undef; # SSL (HTTPS) mode 53 | my $o_verify_ssl= 0; # SSL verification, False by default 54 | my $o_cacert_file= undef; # Path to cacert.pem file 55 | 56 | my $TempPath= '/tmp/'; # temp path 57 | my $MaxUptimeDif= 60*30; # Maximum uptime difference (seconds), default 30 minutes 58 | 59 | my $phpfpm= 'PHP-FPM'; # Could be used to store version also 60 | 61 | # functions 62 | sub show_versioninfo { print "$Name version : $Version\n"; } 63 | 64 | sub print_usage { 65 | print "Usage: $Name -H [-p ] [-s servername] [-t ] [-w -c ] [-V] [-d] [-f] [-u ] [-U user -P pass -r realm]\n"; 66 | } 67 | sub nagios_exit { 68 | my ( $nickname, $status, $message, $perfdata , $silent) = @_; 69 | my %STATUSCODE = ( 70 | 'OK' => 0, 71 | 'WARNING' => 1, 72 | 'CRITICAL' => 2, 73 | 'UNKNOWN' => 3, 74 | 'PENDING' => 4, 75 | ); 76 | if(!defined($silent)) { 77 | my $output = undef; 78 | $output .= sprintf('%1$s %2$s - %3$s', $nickname, $status, $message); 79 | if ($perfdata) { 80 | $output .= sprintf('|%1$s', $perfdata); 81 | } 82 | $output .= chr(10); 83 | print $output; 84 | } 85 | exit $STATUSCODE{$status}; 86 | } 87 | 88 | # Get the alarm signal 89 | $SIG{'ALRM'} = sub { 90 | nagios_exit($phpfpm,"CRITICAL","ERROR: Alarm signal (Nagios timeout)"); 91 | }; 92 | 93 | sub help { 94 | print "PHP-FPM Monitor for Nagios version ",$Version,"\n"; 95 | print "GPL licence, (c)2012 Leroy Regis\n\n"; 96 | print_usage(); 97 | print < \$o_help, 'help' => \$o_help, 194 | 'd' => \$o_debug, 'debug' => \$o_debug, 195 | 'f' => \$o_fastcgi, 'fastcgi' => \$o_fastcgi, 196 | 'H:s' => \$o_host, 'hostname:s' => \$o_host, 197 | 's:s' => \$o_servername, 'servername:s' => \$o_servername, 198 | 'S:s' => \$o_https, 'ssl:s' => \$o_https, 199 | 'u:s' => \$o_url, 'url:s' => \$o_url, 200 | 'U:s' => \$o_user, 'user:s' => \$o_user, 201 | 'P:s' => \$o_pass, 'pass:s' => \$o_pass, 202 | 'r:s' => \$o_realm, 'realm:s' => \$o_realm, 203 | 'p:i' => \$o_port, 'port:i' => \$o_port, 204 | 'V' => \$o_version, 'version' => \$o_version, 205 | 'w=s' => \$o_warn_threshold, 'warn=s' => \$o_warn_threshold, 206 | 'c=s' => \$o_crit_threshold, 'critical=s' => \$o_crit_threshold, 207 | 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, 208 | 'x:i' => \$o_verify_ssl, 'verifyhostname:i' => \$o_verify_ssl, 209 | 'verifyssl:i' => \$o_verify_ssl, 210 | 'X:s' => \$o_cacert_file, 'cacert:s' => \$o_cacert_file, 211 | ); 212 | 213 | if (defined ($o_help)) { 214 | help(); 215 | nagios_exit($phpfpm,"UNKNOWN","leaving","",1); 216 | } 217 | if (defined($o_version)) { 218 | show_versioninfo(); 219 | nagios_exit($phpfpm,"UNKNOWN","leaving","",1); 220 | }; 221 | 222 | if (defined($o_warn_threshold)) { 223 | ($o_warn_p_level,$o_warn_m_level,$o_warn_q_level) = split(',', $o_warn_threshold); 224 | } else { 225 | $o_warn_threshold = 'undefined' 226 | } 227 | if (defined($o_crit_threshold)) { 228 | ($o_crit_p_level,$o_crit_m_level,$o_crit_q_level) = split(',', $o_crit_threshold); 229 | } else { 230 | $o_crit_threshold = 'undefined' 231 | } 232 | if (defined($o_fastcgi) && defined($o_https)) { 233 | nagios_exit($phpfpm,"UNKNOWN","You cannot use both --fastcgi and --ssl options, we do not use http (nor https) when we use direct fastcgi access!"); 234 | } 235 | if (defined($o_debug)) { 236 | print("\nDEBUG thresholds: \nWarning: ($o_warn_threshold) => Min Idle: $o_warn_p_level Max Reached :$o_warn_m_level MaxQueue: $o_warn_q_level"); 237 | print("\nCritical ($o_crit_threshold) => : Min Idle: $o_crit_p_level Max Reached: $o_crit_m_level MaxQueue : $o_crit_q_level\n"); 238 | } 239 | if ((defined($o_warn_p_level) && defined($o_crit_p_level)) && 240 | (($o_warn_p_level != -1) && ($o_crit_p_level != -1) && ($o_warn_p_level <= $o_crit_p_level)) ) { 241 | nagios_exit($phpfpm,"UNKNOWN","Check warning and critical values for IdleProcesses (1st part of threshold), warning level must be > crit level!"); 242 | } 243 | if ((defined($o_warn_m_level) && defined($o_crit_m_level)) && 244 | (($o_warn_m_level != -1) && ($o_crit_m_level != -1) && ($o_warn_m_level >= $o_crit_m_level)) ) { 245 | nagios_exit($phpfpm,"UNKNOWN","Check warning and critical values for MaxProcesses (2nd part of threshold), warning level must be < crit level!"); 246 | } 247 | if ((defined($o_warn_q_level) && defined($o_crit_q_level)) && 248 | (($o_warn_q_level != -1) && ($o_crit_q_level != -1) && ($o_warn_q_level >= $o_crit_q_level)) ) { 249 | nagios_exit($phpfpm,"UNKNOWN","Check warning and critical values for MaxQueue (3rd part of threshold), warning level must be < crit level!"); 250 | } 251 | # Check compulsory attributes 252 | if (!defined($o_host)) { 253 | print_usage(); 254 | nagios_exit($phpfpm,"UNKNOWN","-H host argument required"); 255 | } 256 | } 257 | 258 | ########## MAIN ########## 259 | 260 | # warning capture: avoid extra line added on output by warnings (like deprecation warning in FastCGI code) 261 | local $SIG{__WARN__} = sub { 262 | if (defined ($o_debug)) { 263 | my $warn = shift; 264 | print "\nDEBUG: Perl warning message captured: $warn"; 265 | } 266 | }; 267 | 268 | check_options(); 269 | 270 | my $override_ip = $o_host; 271 | my $timing0 = [gettimeofday]; 272 | my $response = undef; 273 | my $url = undef; 274 | 275 | if (!defined($o_url)) { 276 | $o_url='/fpm-status'; 277 | } else { 278 | # ensure we have a '/' as first char 279 | $o_url = '/'.$o_url unless $o_url =~ m(^/) 280 | } 281 | 282 | if (defined($o_fastcgi)) { 283 | # -- FASTCGI 284 | eval "use FCGI::Client::Connection;"; 285 | nagios_exit($phpfpm,"UNKNOWN","You need to install FCGI::Client::Connection CPAN module for this feature: " . $@) if $@; 286 | eval "use IO::Socket::INET;"; 287 | nagios_exit($phpfpm,"UNKNOWN","You need to install IO::Socket::INET CPAN module for this feature: " . $@) if $@; 288 | 289 | if (!defined($o_port)) { 290 | $o_port = 9000; 291 | } 292 | my $sock = IO::Socket::INET->new( 293 | PeerAddr => $override_ip, 294 | PeerPort => $o_port, 295 | ); 296 | if (!$sock) { 297 | nagios_exit($phpfpm,"CRITICAL", "Cannot connect to $override_ip : $o_port !"); 298 | } 299 | my $fastcgiClient = FCGI::Client::Connection->new(sock => $sock); 300 | $url = $o_url; 301 | my $sname = undef; 302 | if (defined($o_servername)) { 303 | $sname= $o_servername; 304 | } else { 305 | $sname = $o_host; 306 | } 307 | my ( $stdout, $stderr ) = $fastcgiClient->request( 308 | +{ 309 | GATEWAY_INTERFACE => 'FastCGI/1.0', 310 | REQUEST_METHOD => 'GET', 311 | QUERY_STRING => '', 312 | SCRIPT_FILENAME => $url, 313 | SCRIPT_NAME => $url, 314 | }, 315 | '' 316 | ); 317 | if (defined ($o_debug)) { 318 | print "\nDEBUG: FASTCGI requested url\n"; 319 | print $url; 320 | print "\nDEBUG: FASTCGI response: STDERR\n"; 321 | print $stderr; 322 | } 323 | $response = fcgi_response->new($stdout, $o_debug); 324 | } else { 325 | # -- HTTP 326 | eval "use LWP::UserAgent;"; 327 | nagios_exit($phpfpm,"UNKNOWN","You need to install LWP::UserAgent CPAN module for this feature: " . $@) if $@; 328 | #use LWP::UserAgent; 329 | 330 | my $proto='http://'; 331 | if(defined($o_https)) { 332 | if ($o_https eq "") { 333 | $o_https = 'TLSv1'; 334 | } 335 | $proto='https://'; 336 | if (defined($o_port) && $o_port!=443) { 337 | if (defined ($o_debug)) { 338 | print "\nDEBUG: Notice: port is defined at $o_port and not 443, check you really want that in SSL mode! \n"; 339 | } 340 | } 341 | } 342 | 343 | if (defined($o_servername)) { 344 | if (!defined($o_port)) { 345 | $url = $proto . $o_servername . $o_url; 346 | } else { 347 | $url = $proto . $o_servername . ':' . $o_port . $o_url; 348 | } 349 | } else { 350 | if (!defined($o_port)) { 351 | $url = $proto . $o_host . $o_url; 352 | } else { 353 | $url = $proto . $o_host . ':' . $o_port . $o_url; 354 | } 355 | } 356 | 357 | if (defined ($o_debug)) { 358 | print "\nDEBUG: HTTP url: \n"; 359 | print $url; 360 | } 361 | 362 | my %lwp_opts = ( 363 | timeout => $o_timeout 364 | ); 365 | 366 | if(defined($o_https)) { 367 | 368 | use IO::Socket::SSL qw( SSL_VERIFY_NONE SSL_VERIFY_PEER ); 369 | if (defined ($o_debug)) { 370 | $ENV{HTTPS_DEBUG} = 1; 371 | use Data::Dumper; 372 | eval "use IO::Socket::SSL qw( debug3 SSL_VERIFY_NONE SSL_VERIFY_PEER )"; die $@ if $@; 373 | } else { 374 | $ENV{HTTPS_DEBUG} = 0; 375 | } 376 | 377 | $lwp_opts{'protocols_allowed'} = ['https']; 378 | 379 | my %ssl_opts = ( 380 | PeerAddr => $override_ip, 381 | ); 382 | 383 | $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = $o_verify_ssl; 384 | $ssl_opts{"verify_hostname"} = $o_verify_ssl; 385 | $ssl_opts{"SSL_verifycn_name"} = $o_verify_ssl; 386 | # 'TLSv1' by default, but could be things like 'SSLv3' or 'TLSv1_2', etc. 387 | $ssl_opts{"SSL_version"} = $o_https; 388 | #$ssl_opts{"SSL_verifycn_scheme"} = 'www'; 389 | 390 | if (defined($o_servername)) { 391 | $ssl_opts{"SSL_hostname"} = $o_servername; 392 | } 393 | if (not $o_verify_ssl) { 394 | # seems the verify_hostname parameters is not enough 395 | $ssl_opts{"SSL_verify_mode"} = SSL_VERIFY_NONE; 396 | } else { 397 | 398 | if (!defined($o_cacert_file)) { 399 | eval "use Mozilla::CA;"; 400 | nagios_exit($phpfpm,"UNKNOWN","You need to install Mozilla::CA CPAN module for this feature, or use --cacert option: " . $@) if $@; 401 | $o_cacert_file = Mozilla::CA::SSL_ca_file(); 402 | } 403 | #$ssl_opts{"SSL_ca_path"} = '/usr/share/ca-certificates/mozilla/'; 404 | #$ENV{'HTTPS_CA_DIR'} = '/usr/share/ca-certificates/mozilla/'; 405 | #$ENV{'PERL_LWP_SSL_CA_PATH'} = '/usr/share/ca-certificates/mozilla/'; 406 | $ENV{'HTTPS_CA_FILE'} = $o_cacert_file; 407 | $ENV{'PERL_LWP_SSL_CA_FILE'} = $o_cacert_file; 408 | $ssl_opts{"SSL_ca_file"} = $o_cacert_file; 409 | $ssl_opts{"SSL_verify_mode"} = SSL_VERIFY_PEER; 410 | } 411 | IO::Socket::SSL::set_ctx_defaults(%ssl_opts); 412 | 413 | if (LWP::UserAgent->VERSION >= 6.10) { 414 | $lwp_opts{"ssl_opts"} = \%ssl_opts; 415 | } 416 | } else { 417 | $lwp_opts{'protocols_allowed'} = ['http']; 418 | } 419 | 420 | if (defined ($o_debug)) { 421 | print Dumper \%lwp_opts; 422 | } 423 | my $ua = LWP::UserAgent->new(%lwp_opts); 424 | 425 | # we need to enforce the HTTP request is made to the Nagios Host IP and 426 | # not on the DNS related IP for that domain 427 | @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( PeerAddr => $override_ip ); 428 | 429 | # this prevent 'used only once' warning in -w mode 430 | my $ua_settings = @LWP::Protocol::http::EXTRA_SOCK_OPTS; 431 | 432 | my $req = HTTP::Request->new( GET => $url ); 433 | 434 | if (defined($o_servername)) { 435 | $req->header('Host' => $o_servername); 436 | } 437 | if (defined($o_user)) { 438 | $req->authorization_basic($o_user, $o_pass); 439 | } 440 | 441 | if (defined ($o_debug)) { 442 | print "\nDEBUG: HTTP request: \n"; 443 | print "IP used (better if it's an IP):" . $override_ip . "\n"; 444 | print $req->as_string; 445 | } 446 | 447 | $response = $ua->request($req); 448 | if (defined ($o_debug)) { 449 | print "\nDEBUG: HTTP response: \n"; 450 | print $response->as_string; 451 | } 452 | } 453 | 454 | my $timeelapsed = tv_interval($timing0, [gettimeofday]); 455 | 456 | my $InfoData = ''; 457 | my $PerfData = ''; 458 | 459 | my $webcontent = undef; 460 | if ($response->is_success) { 461 | 462 | $webcontent=$response->decoded_content( charset_strict=>1, raise_error => 1, alt_charset => 'none' ); 463 | if (defined ($o_debug)) { 464 | print "\nDEBUG: HTTP response:"; 465 | print $response->status_line; 466 | print "\nContent-Type => ".$response->header('Content-Type'); 467 | print "\n"; 468 | print $webcontent; 469 | } 470 | if ($response->header('Content-Type') =~ m/text\/html/) { 471 | nagios_exit($phpfpm,"CRITICAL", "We have a response page for our request, but it's an HTML page, quite certainly not the status report of php-fpm"); 472 | } 473 | # example of response content expected: 474 | #pool: foobar 475 | #process manager: dynamic 476 | #start time: 31/Jan/2012:08:18:45 +0000 477 | #start since: 845 478 | #accepted conn: 7 479 | #listen queue: 0 480 | #max listen queue: 0 481 | #listen queue len: 0 482 | #idle processes: 2 483 | #active processes: 2 484 | #total processes: 4 485 | #max active processes: 2 486 | #max children reached: 0 487 | 488 | my $Pool = ''; 489 | if($webcontent =~ m/pool: (.*?)\n/) { 490 | $Pool = $1; 491 | $Pool =~ s/^\s+|\s+$//g; 492 | #$phpfpm .= "-".$Pool; 493 | } 494 | 495 | my $Uptime = 0; 496 | if($webcontent =~ m/start since: (.*?)\n/) { 497 | $Uptime = $1; 498 | $Uptime =~ s/^\s+|\s+$//g; 499 | } 500 | 501 | my $AcceptedConn = 0; 502 | if($webcontent =~ m/accepted conn: (.*?)\n/) { 503 | $AcceptedConn = $1; 504 | $AcceptedConn =~ s/^\s+|\s+$//g; 505 | } 506 | 507 | my $ActiveProcesses= 0; 508 | if($webcontent =~ m/(.*)?\nactive processes: (.*?)\n/) { 509 | $ActiveProcesses = $2; 510 | $ActiveProcesses =~ s/^\s+|\s+$//g; 511 | } 512 | 513 | my $TotalProcesses= 0; 514 | if($webcontent =~ m/total processes: (.*?)\n/) { 515 | $TotalProcesses = $1; 516 | $TotalProcesses =~ s/^\s+|\s+$//g; 517 | } 518 | 519 | my $IdleProcesses= 0; 520 | if($webcontent =~ m/idle processes: (.*?)\n/) { 521 | $IdleProcesses = $1; 522 | $IdleProcesses =~ s/^\s+|\s+$//g; 523 | } 524 | 525 | my $MaxActiveProcesses= 0; 526 | if($webcontent =~ m/max active processes: (.*?)\n/) { 527 | $MaxActiveProcesses = $1; 528 | $MaxActiveProcesses =~ s/^\s+|\s+$//g; 529 | } 530 | 531 | my $MaxChildrenReached= 0; 532 | if($webcontent =~ m/max children reached: (.*?)\n/) { 533 | $MaxChildrenReached = $1; 534 | $MaxChildrenReached =~ s/^\s+|\s+$//g; 535 | } 536 | 537 | my $ListenQueue= 0; 538 | if($webcontent =~ m/\nlisten queue: (.*?)\n/) { 539 | $ListenQueue = $1; 540 | $ListenQueue =~ s/^\s+|\s+$//g; 541 | } 542 | 543 | my $ListenQueueLen= 0; 544 | if($webcontent =~ m/listen queue len: (.*?)\n/) { 545 | $ListenQueueLen = $1; 546 | $ListenQueueLen =~ s/^\s+|\s+$//g; 547 | } 548 | 549 | my $MaxListenQueue= 0; 550 | if($webcontent =~ m/max listen queue: (.*?)\n/) { 551 | $MaxListenQueue = $1; 552 | $MaxListenQueue =~ s/^\s+|\s+$//g; 553 | } 554 | # Debug 555 | if (defined ($o_debug)) { 556 | print ("\nDEBUG Parse results => Pool:" . $Pool . "\nAcceptedConn:" . $AcceptedConn . "\nActiveProcesses:" . $ActiveProcesses . " TotalProcesses :".$TotalProcesses . " IdleProcesses :" .$IdleProcesses . "\nMaxActiveProcesses :" . $MaxActiveProcesses . " MaxChildrenReached :" . $MaxChildrenReached . "\nListenQueue :" . $ListenQueue . " ListenQueueLen : " .$ListenQueueLen . " MaxListenQueue: " . $MaxListenQueue ."\n"); 557 | } 558 | 559 | my $TempFile = $TempPath.$o_host.'_check_phpfpm_status'.md5_hex($url); 560 | my $FH; 561 | 562 | my $LastUptime = 0; 563 | my $LastAcceptedConn = 0; 564 | my $LastMaxChildrenReached = 0; 565 | my $LastMaxListenQueue = 0; 566 | if ((-e $TempFile) && (-r $TempFile) && (-w $TempFile)) 567 | { 568 | open ($FH, '<',$TempFile) or nagios_exit($phpfpm,"UNKNOWN","unable to read temporary data from :".$TempFile); 569 | $LastUptime = <$FH>; 570 | $LastAcceptedConn = <$FH>; 571 | $LastMaxChildrenReached = <$FH>; 572 | $LastMaxListenQueue = <$FH>; 573 | close ($FH); 574 | if (defined ($o_debug)) { 575 | print ("\nDEBUG: data from temporary file:\n"); 576 | print ("LastUptime: $LastUptime LastAcceptedConn: $LastAcceptedConn LastMaxChildrenReached: $LastMaxChildrenReached LastMaxListenQueue: $LastMaxListenQueue \n"); 577 | } 578 | } 579 | 580 | open ($FH, '>'.$TempFile) or nagios_exit($phpfpm,"UNKNOWN","unable to write temporary data in :".$TempFile); 581 | print $FH "$Uptime\n"; 582 | print $FH "$AcceptedConn\n"; 583 | print $FH "$MaxChildrenReached\n"; 584 | print $FH "$MaxListenQueue\n"; 585 | close ($FH); 586 | 587 | my $ReqPerSec = 0; 588 | my $Accesses = 0; 589 | my $MaxChildrenReachedNew = 0; 590 | my $MaxListenQueueNew = 0; 591 | # check only if this counter may have been incremented 592 | # but not if it may have been too much incremented 593 | # and something should have happened in the server 594 | if ( ($Uptime>$LastUptime) 595 | && ($Uptime-$LastUptime<$MaxUptimeDif) 596 | && ($AcceptedConn>=$LastAcceptedConn) 597 | && ($MaxListenQueue>=$LastMaxListenQueue) 598 | && ($MaxChildrenReached>=$LastMaxChildrenReached)) { 599 | $ReqPerSec = ($AcceptedConn-$LastAcceptedConn)/($Uptime-$LastUptime); 600 | $Accesses = ($AcceptedConn-$LastAcceptedConn); 601 | $MaxChildrenReachedNew = ($MaxChildrenReached-$LastMaxChildrenReached); 602 | $MaxListenQueueNew = ($MaxListenQueue-$LastMaxListenQueue); 603 | } 604 | 605 | $InfoData = sprintf ("%s, %.3f sec. response time, Busy/Idle %d/%d," 606 | ." (max: %d, reached: %d), ReqPerSec %.1f, " 607 | ."Queue %d (len: %d, reached: %d)" 608 | ,$Pool,$timeelapsed, $ActiveProcesses, $IdleProcesses 609 | ,$MaxActiveProcesses,$MaxChildrenReachedNew 610 | ,$ReqPerSec,$ListenQueue,$ListenQueueLen,$MaxListenQueueNew); 611 | 612 | $PerfData = sprintf ("Idle=%d Busy=%d MaxProcesses=%d MaxProcessesReach=%d " 613 | ."Queue=%d MaxQueueReach=%d QueueLen=%d ReqPerSec=%f" 614 | ,($IdleProcesses),($ActiveProcesses),($MaxActiveProcesses) 615 | ,($MaxChildrenReachedNew),($ListenQueue),($MaxListenQueueNew) 616 | ,($ListenQueueLen),$ReqPerSec); 617 | # first all critical exists by priority 618 | if (defined($o_crit_q_level) && (-1!=$o_crit_q_level) && ($MaxListenQueueNew >= $o_crit_q_level)) { 619 | nagios_exit($phpfpm,"CRITICAL", "Max queue reached is critically high " . $InfoData,$PerfData); 620 | } 621 | if (defined($o_crit_m_level) && (-1!=$o_crit_m_level) && ($MaxChildrenReachedNew >= $o_crit_m_level)) { 622 | nagios_exit($phpfpm,"CRITICAL", "Max processes reached is critically high " . $InfoData,$PerfData); 623 | } 624 | if (defined($o_crit_p_level) && (-1!=$o_crit_p_level) && ($IdleProcesses <= $o_crit_p_level)) { 625 | nagios_exit($phpfpm,"CRITICAL", "Idle workers are critically low " . $InfoData,$PerfData); 626 | } 627 | # Then WARNING exits by priority 628 | if (defined($o_warn_q_level) && (-1!=$o_warn_q_level) && ($MaxListenQueueNew >= $o_warn_q_level)) { 629 | nagios_exit($phpfpm,"WARNING", "Max queue reached is high " . $InfoData,$PerfData); 630 | } 631 | if (defined($o_warn_m_level) && (-1!=$o_warn_m_level) && ($MaxChildrenReachedNew >= $o_warn_m_level)) { 632 | nagios_exit($phpfpm,"WARNING", "Max processes reached is high " . $InfoData,$PerfData); 633 | } 634 | if (defined($o_warn_p_level) && (-1!=$o_warn_p_level) && ($IdleProcesses <= $o_warn_p_level)) { 635 | nagios_exit($phpfpm,"WARNING", "Idle workers are low " . $InfoData,$PerfData); 636 | } 637 | 638 | nagios_exit($phpfpm,"OK",$InfoData,$PerfData); 639 | 640 | } else { 641 | nagios_exit($phpfpm,"CRITICAL", $response->status_line); 642 | } 643 | 644 | # --------------------------------------------------------------------------- 645 | # Adding a small parser for response coming in fastcgi mode 646 | # to have some methods with same signature as the response from LWP::UserAgent 647 | package fcgi_response; 648 | 649 | sub new() { 650 | my ($class) = shift; 651 | my ($raw) = shift; 652 | my ($debug) = shift; 653 | 654 | my @parts = split /\r\n\r\n/, $raw; 655 | my @headers = split /\r\n/, $parts[0]; 656 | my $body = $parts[1]; 657 | 658 | #if (defined ($debug)) { 659 | # print "\nDEBUG FCGI Resp HEADERS:\n"; 660 | # print join("\r\n",@headers); 661 | # print "\nDEBUG FCGI Resp BODY:\n"; 662 | # print $body; 663 | #} 664 | 665 | my $self = { 666 | "raw" => $raw, 667 | "headrs" => [@headers], 668 | "body" => $body, 669 | "debug" => $debug, 670 | }; 671 | 672 | bless($self, $class); 673 | 674 | return $self; 675 | } 676 | 677 | sub is_success() { 678 | my ($self) = shift; 679 | return not $self->status_line() 680 | } 681 | sub status_line() { 682 | my ($self) = shift; 683 | return $self->header('Status'); 684 | } 685 | sub decoded_content() { 686 | my ($self) = shift; 687 | # we do not, in fact, apply any decoding 688 | return $self->{body} 689 | } 690 | sub header() { 691 | my ($self) = shift; 692 | my ($seek) = shift; 693 | 694 | for my $i (0 .. $#{$self->{headrs}}) { 695 | my $line = $self->{headrs}[$i]; 696 | my @parts = split /:/, $line; 697 | if (lc $parts[0] eq lc $seek) { 698 | if (defined($self->{debug})) { 699 | print "\nDEBUG: header $seek found => " . $parts[1]; 700 | } 701 | return $parts[1]; 702 | } 703 | } 704 | return 0; 705 | } 706 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------