From: BarbUk <julien.virey@gmail.com>
Date: Sat, 22 Dec 2018 09:51:27 +0000 (+0400)
Subject: Add phpfpm-status CheckCommand definition
X-Git-Tag: v2.11.0-rc1~264^2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dae69dc49b2651971063aa6ea76b9710c65086ed;p=icinga2

Add phpfpm-status CheckCommand definition
---

diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md
index e8f48ab28..136bc326a 100644
--- a/doc/10-icinga-template-library.md
+++ b/doc/10-icinga-template-library.md
@@ -5415,3 +5415,28 @@ haproxy_url             | **Required.** URL of the HAProxy csv statistics page.
 haproxy_timeout         | **Optional.** Seconds before plugin times out (default: 10)
 haproxy_warning         | **Optional.** Warning request time threshold (in seconds)
 haproxy_critical        | **Optional.** Critical request time threshold (in seconds)
+
+#### phpfpm_status <a id="plugin-contrib-command-phpfpm_status"></a>
+
+The [check_phpfpm_status](http://github.com/regilero/check_phpfpm_status) plugin,
+uses the `php-fpm` status page to monitor php-fpm.
+
+Custom attributes passed as [command parameters](03-monitoring-basics.md#command-passing-parameters):
+
+Name                      | Description
+--------------------------|----------------------------------------------------------------------------------
+phpfpm\_status\_hostname  | **Required.** name or IP address of host to check
+phpfpm\_status\_port      | **Optional.** Http port, or Fastcgi port when using --fastcgi
+phpfpm\_status\_url       | **Optional.** Specific URL (only the path part of it in fact) to use, instead of the default /fpm-status
+phpfpm\_status\_servername| **Optional.** ServerName, (host header of HTTP request) use it if you specified an IP in -H to match the good Virtualhost in your target
+phpfpm\_status\_fastcgi   | **Optional.** If set, connect directly to php-fpm via network or local socket, using fastcgi protocol instead of HTTP.
+phpfpm\_status\_user      | **Optional.** Username for basic auth
+phpfpm\_status\_pass      | **Optional.** Password for basic auth
+phpfpm\_status\_realm     | **Optional.** Realm for basic auth
+phpfpm\_status\_debug     | **Optional.** If set, debug mode (show http request response)
+phpfpm\_status\_timeout   | **Optional.** timeout in seconds (Default: 15)
+phpfpm\_status\_ssl       | **Optional.** 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).
+phpfpm\_status\_verifyssl | **Optional.** If set, 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.
+phpfpm\_status\_cacert    | **Optional.** 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.
+phpfpm\_status\_warn      | **Optional.** 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
+phpfpm\_status\_critical  | **Optional.** 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
diff --git a/itl/plugins-contrib.d/web.conf b/itl/plugins-contrib.d/web.conf
index 73266e3b1..cccadefc1 100644
--- a/itl/plugins-contrib.d/web.conf
+++ b/itl/plugins-contrib.d/web.conf
@@ -618,3 +618,74 @@ object CheckCommand "haproxy" {
 		}
 	}
 }
+
+object CheckCommand "phpfpm_status" {
+	import "plugin-check-command"
+	command = [ PluginDir + "/check_phpfpm_status" ]
+
+	arguments = {
+		"-H" = {
+			value = "$phpfpm_status_hostname$"
+			description = "name or IP address of host to check"
+			required = true
+		}
+		"-p" = {
+			value = "$phpfpm_status_port$"
+			description = "Http port, or Fastcgi port when using --fastcgi"
+		}
+		"-u" = {
+			value = "$phpfpm_status_url$"
+			description = "Specific URL (only the path part of it in fact) to use, instead of the default /fpm-status"
+		}
+		"-s" = {
+			value = "$phpfpm_status_servername$"
+			description = "ServerName, (host header of HTTP request) use it if you specified an IP in -H to match the good Virtualhost in your target"
+		}
+		"-f" = {
+			set_if = "$phpfpm_status_fastcgi$"
+			description = "Connect directly to php-fpm via network or local socket, using fastcgi protocol instead of HTTP."
+		}
+		"-U" = {
+			value = "$phpfpm_status_user$"
+			description = "Username for basic auth"
+		}
+		"-P" = {
+			value = "$phpfpm_status_pass$"
+			description = "Password for basic auth"
+		}
+		"-r" = {
+			value = "$phpfpm_status_realm$"
+			description = "Realm for basic auth"
+		}
+		"-d" = {
+			set_if = "$phpfpm_status_debug$"
+			description = "Debug mode (show http request response)"
+		}
+		"-t" = {
+			value = "$phpfpm_status_timeout$"
+			description = "timeout in seconds (Default: 15)"
+		}
+		"-S" = {
+			set_if = "$phpfpm_status_ssl$"
+			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)."
+		}
+		"-x" = {
+			set_if = "$phpfpm_status_verifyssl$"
+			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."
+		}
+		"-X" = {
+			value = "$phpfpm_status_cacert$"
+			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."
+		}
+		"-w" = {
+			value = "$phpfpm_status_warn$"
+			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"
+		}
+		"-c" = {
+			value = "$phpfpm_status_critical$"
+			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"
+		}
+	}
+
+	vars.phpfpm_status_hostname = "$address$"
+}