update event stat counts for all monitors at once

This commit is contained in:
Isaac Connor committed 2018-01-07 14:20:17 -05:00
1 parent 727bde752f
commit baa360cd3d
1 file changed
+4 -5
+4 -5
View File
@@ -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;