From 079f570c78e5d9ea1db193da224af0b91a365b44 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Fri, 14 Jun 2013 18:23:50 -0700 Subject: [PATCH] Clear some states if no services are enabled. --- bin/pt-agent | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/pt-agent b/bin/pt-agent index 3b50c7c0..6537a726 100755 --- a/bin/pt-agent +++ b/bin/pt-agent @@ -6285,6 +6285,16 @@ sub get_services { } elsif ( !scalar @$curr_services && !scalar keys %$prev_services ) { $logger->warning("No services are enabled for this agent"); + + # Remove these state that no longer matter if there are no services. + if ( $state->{mysql_restarted} ) { + $state->{last_uptime} = 0; + $state->{last_uptime_check} = 0; + delete $state->{mysql_restarted}; + } + if ( $state->{all_services_are_stopped} ) { + delete $state->{all_services_are_stopped}; + } } else { if ( $state->{all_services_are_stopped} ) {