Added --set_disabled_and_standby to CLI
This commit is contained in:
parent
823b32ac63
commit
87fa7a7125
|
@ -28,6 +28,7 @@ use Socket qw(inet_ntoa inet_aton);
|
|||
use Sys::Syslog;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use LWP::UserAgent;
|
||||
use threads;
|
||||
|
||||
# New in 3.2. Used to sendmail internally, without external scripts
|
||||
# use Module::Loaded;
|
||||
|
|
|
@ -136,6 +136,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_cluster_agent', '<id_agent> <id_cluster>', 'Deleting cluster agent');
|
||||
help_screen_line('--delete_cluster_item', '<id_item>', 'Deleting cluster item');
|
||||
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
|
||||
help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status');
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
|
||||
|
@ -6125,6 +6126,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 1, 0);
|
||||
cli_migration_agent();
|
||||
}
|
||||
elsif ($param eq '--set_disabled_and_standby') {
|
||||
param_check($ltotal, 3, 1);
|
||||
cli_set_disabled_and_standby();
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Invalid option '$param'.\n\n";
|
||||
$param = '';
|
||||
|
@ -6710,3 +6715,22 @@ sub cli_get_cluster_status() {
|
|||
print "\n0\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Set an agent disabled and with standby.
|
||||
# Related option: --set_disabled_and_standby
|
||||
##############################################################################
|
||||
|
||||
sub cli_set_disabled_and_standby() {
|
||||
my ($id, $id_node, $value) = @ARGV[2..4];
|
||||
$id_node = 0 unless defined($id_node);
|
||||
$value = 1 unless defined($value); #Set to disabled by default
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call(
|
||||
$conf, 'set', 'disabled_and_standby', $id, $id_node, $value
|
||||
);
|
||||
|
||||
my $exit_code = (defined($result) && "$result" eq "1") ? "1" : "0";
|
||||
print "\n$exit_code\n";
|
||||
}
|
Loading…
Reference in New Issue