diff --git a/scripts/zmwatch.pl.in b/scripts/zmwatch.pl.in index 2fc1b26be..54964d3b0 100644 --- a/scripts/zmwatch.pl.in +++ b/scripts/zmwatch.pl.in @@ -108,17 +108,17 @@ UPDATE Monitors INNER JOIN ( Monitors.WeekEventDiskSpace = E.WeekEventDiskSpace, Monitors.MonthEvents = E.MonthEvents, Monitors.MonthEventDiskSpace = E.MonthEventDiskSpace - WHERE Id=? `; my $eventcounts_sth = $dbh->prepare_cached( $eventcounts_sql ); while( 1 ) { + $eventcounts_sth->execute( ) or Error( "Can't execute: ".$eventcounts_sth->errstr() ); + my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () ) or Fatal( "Can't execute: ".$sth->errstr() ); while( my $monitor = $sth->fetchrow_hashref() ) { - $eventcounts_sth->execute( $$monitor{Id} ) or Error( "Can't execute: ".$eventcounts_sth->errstr() ); my $now = time(); next if $monitor->{Function} eq 'None'; @@ -212,14 +212,13 @@ while( 1 ) { } # end if check analysis daemon # Prevent open handles building up if we have connect to shared memory zmMemInvalidate( $monitor ); # Close our file handle to the zmc process we are about to end - - } # end foreach monitor - $eventcounts_sth->finish(); sleep( $Config{ZM_WATCH_CHECK_INTERVAL} ); } # end while (1) +$eventcounts_sth->finish(); + Info( "Watchdog exiting\n" ); exit(); 1;