WIP: Meta disable groups CLI
This commit is contained in:
parent
b2ea3d1d7a
commit
dfc599b2d8
|
@ -375,6 +375,31 @@ sub pandora_disable_group ($$$) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if(is_metaconsole($conf) == 1) {
|
||||
my $servers = enterprise_hook('get_metaconsole_setup_servers',[$dbh]);
|
||||
my @servers_id = split(',',$servers);
|
||||
use Data:Dumper;
|
||||
print Dumper()
|
||||
foreach my $server (@servers_id) {
|
||||
my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
|
||||
|
||||
if ($group == 0){
|
||||
# Extract all the names of the pandora agents if it is for all = 0.
|
||||
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente');
|
||||
}
|
||||
else {
|
||||
# Extract all the names of the pandora agents if it is for group.
|
||||
@agents_bd = get_db_rows ($dbh_metaconsole, 'SELECT id_agente FROM tagente WHERE id_grupo = ?', $group);
|
||||
}
|
||||
|
||||
foreach my $id_agent (@agents_bd) {
|
||||
# Call the API.
|
||||
$result = api_call(
|
||||
$conf, 'set', 'disabled_and_standby', $id_agent, $server, 1
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($group == 0){
|
||||
# Extract all the names of the pandora agents if it is for all = 0.
|
||||
@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
|
||||
|
@ -399,6 +424,7 @@ sub pandora_disable_group ($$$) {
|
|||
'1'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue