From 5109f7f788eb349bc816295a6b815ab85e168611 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Thu, 20 Dec 2018 14:39:15 +0400 Subject: [PATCH] Add haproxy CheckCommand definition Haproxy plugin check haproxy csv statistics page and reports response time and backends sessions count --- doc/10-icinga-template-library.md | 26 +++++++++++++++++++++++++ itl/plugins-contrib.d/web.conf | 32 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index 3ff76f7f4..17e9c1e0d 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -5388,3 +5388,29 @@ uptime | How long the cache has been running (in seconds) ratio | The cache hit ratio expressed as a percentage of hits to hits + misses. Default thresholds are 95 and 90. usage | Cache file usage as a percentage of the total cache space. +#### haproxy + +The [check_haproxy](https://salsa.debian.org/nagios-team/pkg-nagios-plugins-contrib/blob/master/check_haproxy/check_haproxy) plugin, +also available in the [monitoring-plugins-contrib](https://packages.debian.org/nagios-plugins-contrib) on debian, +uses the `haproxy` csv statistics page to monitor [haproxy](http://www.haproxy.org/) response time. The plugin outputa performance data for backends sessions and statistics response time. + +This plugin need to access the csv statistics page. You can configure it in haproxy by adding a new frontend: +``` +frontend stats + bind 127.0.0.1:80 + stats enablestats + stats uri /stats +``` + +The statistics page will be available at `http://127.0.0.1/stats;csv;norefresh`. + +Custom attributes passed as [command parameters](03-monitoring-basics.md#command-passing-parameters): + +Name | Description +------------------------|---------------------------------------------------------------------------------- +haproxy_username | **Optional.** Username for HTTP Auth +haproxy_password | **Optional.** Password for HTTP Auth +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) diff --git a/itl/plugins-contrib.d/web.conf b/itl/plugins-contrib.d/web.conf index 458de5a57..73266e3b1 100644 --- a/itl/plugins-contrib.d/web.conf +++ b/itl/plugins-contrib.d/web.conf @@ -586,3 +586,35 @@ object CheckCommand "varnish" { } } +object CheckCommand "haproxy" { + import "plugin-check-command" + command = [ PluginDir + "/check_haproxy" ] + + arguments = { + "--username" = { + value = "$haproxy_username$" + description = "Username for HTTP Auth" + } + "--password" = { + value = "$haproxy_password$" + description = "Password for HTTP Auth" + } + "--url" = { + value = "$haproxy_url$" + description = "URL of the HAProxy csv statistics page" + required = true + } + "--timeout" = { + value = "$haproxy_timeout$" + description = "Seconds before plugin times out (default: 10)" + } + "-w" = { + value = "$haproxy_warning$" + description = "Warning request time threshold (in seconds)" + } + "-c" = { + value = "$haproxy_critical$" + description = "Critical request time threshold (in seconds)" + } + } +} -- 2.40.0