Fix HaproxyBackendDownMajor condition
- show in $value number of down backends
Change-Id: Ie300b9ace09100ef7171fd9b0ee91096ac8509ff
Related-bug: PROD-35685
diff --git a/haproxy/meta/prometheus.yml b/haproxy/meta/prometheus.yml
index 58e443b..7409622 100644
--- a/haproxy/meta/prometheus.yml
+++ b/haproxy/meta/prometheus.yml
@@ -51,8 +51,8 @@
description: "The {{ $labels.proxy }} back end on the {{ $labels.host }} node is down."
HaproxyBackendDownMajor:
if: >-
- 0.5 * avg(sum(haproxy_active_servers{type="server"}) by (host, proxy) + sum(haproxy_backup_servers{type="server"}) by (host, proxy)) by (proxy) >=
- avg(sum(haproxy_active_servers{type="backend"}) by (host, proxy) + sum(haproxy_backup_servers{type="backend"}) by (host, proxy)) by (proxy)
+ avg(sum(haproxy_active_servers{type="server"}) by (host, proxy) + sum(haproxy_backup_servers{type="server"}) by (host, proxy)) by (proxy) - avg(sum(haproxy_active_servers{type="backend"}) by (host, proxy) + sum(haproxy_backup_servers{type="backend"}) by (host, proxy)) by (proxy)
+ >= 0.5 * avg(sum(haproxy_active_servers{type="server"}) by (host, proxy) + sum(haproxy_backup_servers{type="server"}) by (host, proxy)) by (proxy)
labels:
severity: major
service: haproxy
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 05b2938..8f37b0c 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -39,7 +39,8 @@
log_info "Setting up Python virtualenv"
virtualenv $VENV_DIR
source ${VENV_DIR}/bin/activate
- python -m pip install salt${PIP_SALT_VERSION}
+ pip install -r test-requirements.txt
+ pip install salt${PIP_SALT_VERSION}
}
setup_mock_bin() {
diff --git a/tests/test-requirements.txt b/tests/test-requirements.txt
new file mode 100644
index 0000000..cf42007
--- /dev/null
+++ b/tests/test-requirements.txt
@@ -0,0 +1 @@
+msgpack<1.0.0