[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 01/02: Choose random varnish ports.
Bernd Zeimetz
bernd at bzed.de
Tue Jan 3 17:12:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
bzed pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.
commit 53b89900f8398e95dcc409a10cd91bb0fd05d0a5
Author: Bernd Zeimetz <bernd at bzed.de>
Date: Tue Jan 3 17:55:25 2017 +0100
Choose random varnish ports.
Otherwise test jobs running in parallel will fail.
---
debian/tests/control | 5 +++--
debian/tests/test_check_varnish | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/debian/tests/control b/debian/tests/control
index 3b181bd..be17baa 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -18,5 +18,6 @@ Test-Command: /usr/lib/nagios/plugins/check_libs
Depends: libmonitoring-plugin-perl | libnagios-plugin-perl, @
Test-Command: /usr/lib/nagios/plugins/check_uptime -f
-Depends: varnish, @
-Test-Command: service varnish restart 2>/dev/null && /usr/lib/nagios/plugins/check_varnish -p MAIN.pools -w 1: -c 1:
+Depends: varnish, systemd, @
+Restrictions: needs-root
+Tests: test_check_varnish
diff --git a/debian/tests/test_check_varnish b/debian/tests/test_check_varnish
new file mode 100755
index 0000000..9d2fc87
--- /dev/null
+++ b/debian/tests/test_check_varnish
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+VARNISH_PORT=$(( ($RANDOM % 60000) + 1024 ))
+API_PORT=$(( ($RANDOM % 60000) + 1024 ))
+
+systemctl stop varnish.service
+
+cat > /etc/systemd/system/varnish.service << __EOF__
+
+[Unit]
+Description=Varnish HTTP accelerator
+Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd
+
+[Service]
+Type=simple
+LimitNOFILE=131072
+LimitMEMLOCK=82000
+ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a localhost:${VARNISH_PORT} -T localhost:${API_PORT} -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,50m
+ExecReload=/usr/share/varnish/reload-vcl
+ProtectSystem=full
+ProtectHome=true
+PrivateTmp=true
+PrivateDevices=true
+
+[Install]
+WantedBy=multi-user.target
+
+__EOF__
+
+systemctl daemon-reload
+systemctl start varnish.service
+
+/usr/lib/nagios/plugins/check_varnish -p MAIN.pools -w 1: -c 1:
+exit $?
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git
More information about the Pkg-nagios-changes
mailing list