From 56a942ea84cee51da25283665b1e008b775bb020 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 20 Sep 2016 09:17:30 +0100 Subject: [PATCH] Restart squid if any statistics counters have wrapped --- cookbooks/squid/recipes/default.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cookbooks/squid/recipes/default.rb b/cookbooks/squid/recipes/default.rb index 917834eb2..def3d9187 100644 --- a/cookbooks/squid/recipes/default.rb +++ b/cookbooks/squid/recipes/default.rb @@ -62,6 +62,16 @@ service "squid" do subscribes :reload, "template[/etc/resolv.conf]" end +log "squid-restart" do + message "Restarting squid due to counter wraparound" + notifies :restart, "service[squid]" + only_if do + IO.popen(["squidclient", "--host=127.0.0.1", "--port=80", "mgr:counters"]) do |io| + io.each.grep(/^[a-z][a-z_.]+ = -[0-9]+$/).count > 0 + end + end +end + munin_plugin "squid_cache" munin_plugin "squid_delay_pools" munin_plugin "squid_delay_pools_noreferer" -- 2.39.5