Only load the monitors for our server

This commit is contained in:
Isaac Connor 2015-07-15 16:24:01 -04:00
parent b8888b9d55
commit ca9a391d62
1 changed files with 2 additions and 2 deletions

View File

@ -74,14 +74,14 @@ sleep( START_DELAY );
my $dbh = zmDbConnect(); my $dbh = zmDbConnect();
my $sql = "select * from Monitors"; my $sql = $Config{ZM_SERVER_ID} ? 'SELECT * FROM Monitors WHERE ServerId=?' : 'SELECT * FROM Monitors';
my $sth = $dbh->prepare_cached( $sql ) my $sth = $dbh->prepare_cached( $sql )
or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
while( 1 ) while( 1 )
{ {
my $now = time(); my $now = time();
my $res = $sth->execute() my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () )
or Fatal( "Can't execute: ".$sth->errstr() ); or Fatal( "Can't execute: ".$sth->errstr() );
while( my $monitor = $sth->fetchrow_hashref() ) while( my $monitor = $sth->fetchrow_hashref() )
{ {