git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/debian/tests/test_check_varnish
blob: cd373aa01ccfa2cc7a91b9013131902548ae6f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 $?