Only load monitors for our server if ZM_SERVER_ID is specified
This commit is contained in:
parent
e318c3bf37
commit
51af432468
|
@ -119,10 +119,10 @@ my $retval = 0;
|
||||||
if ( $command eq "state" )
|
if ( $command eq "state" )
|
||||||
{
|
{
|
||||||
Info( "Updating DB: $state->{Name}\n" );
|
Info( "Updating DB: $state->{Name}\n" );
|
||||||
my $sql = "select * from Monitors order by Id asc";
|
my $sql = $Config{ZM_SERVER_ID} ? 'SELECT * FROM Monitors WHERE ServerId=? ORDER BY Id ASC' : 'SELECT * FROM Monitors ORDER BY Id ASC';
|
||||||
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() );
|
||||||
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() )
|
||||||
{
|
{
|
||||||
|
@ -228,10 +228,10 @@ if ( $command =~ /^(?:start|restart)$/ )
|
||||||
zmMemTidy();
|
zmMemTidy();
|
||||||
runCommand( "zmdc.pl startup" );
|
runCommand( "zmdc.pl startup" );
|
||||||
|
|
||||||
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() );
|
||||||
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() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue