git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish')
-rwxr-xr-xnagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish35
1 files changed, 35 insertions, 0 deletions
diff --git a/nagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish b/nagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish
new file mode 100755
index 0000000..cd373aa
--- /dev/null
+++ b/nagios-plugins-contrib-24.20190301~bpo9+1/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 2>/dev/null
+
+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 2>/dev/null
+systemctl start varnish.service 2>/dev/null
+
+/usr/lib/nagios/plugins/check_varnish -p MAIN.pools -w 1: -c 1:
+exit $?
+