Skip to content

Commit

Permalink
Merge pull request flyingcircusio#1035 from flyingcircusio/phil/FC-36…
Browse files Browse the repository at this point in the history
…891_varnish-monitoring

Fix varnish monitoring 2.0
  • Loading branch information
ctheune authored Dec 4, 2024
2 parents f8dfc32 + 9c8485b commit a9a4582
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nixos/roles/webproxy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ in
};
varnish_http = {
notification = "varnish port 8008 HTTP response";
command = "check_http -H localhost -p 8008 -c 10 -w 3 -t 20 -e HTTP";
command = "${pkgs.writeShellScript "check-varnish-http" ''
ADDRS=$(${cfg.package}/bin/varnishadm debug.listen_address | awk '/([0-9.]+\.)+/ { print $2":"$3; }')
for ADDR in $ADDRS; do
host=$(echo $ADDR | cut -d ":" -f 1)
port=$(echo $ADDR | cut -d ":" -f 2)
echo "checking host '$host' on port '$port'"
${pkgs.monitoring-plugins}/bin/check_http -H $host -p $port -c 10 -w 3 -t 20 -e HTTP
done
''}";
};
};

Expand Down
6 changes: 6 additions & 0 deletions nixos/services/varnish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ in {
http_address = mkOption {
type = types.str;
default = "*:8008";
description = ''
The http address for the varnish service to listen on.
Unix sockets can technically be used for varnish, but are not currently supported on the FCIO platform due to monitoring constraints.
Multiple addressess can be specified in a comma-separated fashion in the form of `address[:port][,address[:port][...]`.
See `varnishd(1)` for details.
'';
};
virtualHosts = mkOption {
type = types.attrsOf (types.submodule ({ name, config, ... }: {
Expand Down

0 comments on commit a9a4582

Please sign in to comment.