enh azure custom mode (#1189)
This commit is contained in:
parent
305d79c255
commit
2f1bb20417
|
@ -42,6 +42,7 @@ sub new {
|
|||
if (!defined($options{noptions})) {
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"subscription:s" => { name => 'subscription' },
|
||||
"timeframe:s" => { name => 'timeframe' },
|
||||
"interval:s" => { name => 'interval' },
|
||||
"aggregation:s@" => { name => 'aggregation' },
|
||||
|
@ -101,6 +102,8 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
|
||||
$self->{subscription} = (defined($self->{option_results}->{subscription})) ? $self->{option_results}->{subscription} : undef;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -112,6 +115,7 @@ sub azure_get_metrics_set_cmd {
|
|||
my $cmd_options = "monitor metrics list --metrics '" . join('\' \'', @{$options{metrics}}) . "' --start-time $options{start_time} --end-time $options{end_time} " .
|
||||
"--interval $options{interval} --aggregation '" . join('\' \'', @{$options{aggregations}}) . "' --output json --resource '$options{resource}' " .
|
||||
"--resource-group '$options{resource_group}' --resource-type '$options{resource_type}' --resource-namespace '$options{resource_namespace}'";
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -188,6 +192,7 @@ sub azure_list_resources_set_cmd {
|
|||
my $cmd_options = "resource list --namespace '$options{namespace}' --resource-type '$options{resource_type}' --output json";
|
||||
$cmd_options .= " --location '$options{location}'" if (defined($options{location}) && $options{location} ne '');
|
||||
$cmd_options .= " --resource-group '$options{resource_group}'" if (defined($options{resource_group}) && $options{resource_group} ne '');
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -227,6 +232,7 @@ sub azure_list_vm_sizes_set_cmd {
|
|||
return if (defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '');
|
||||
|
||||
my $cmd_options = "vm list-sizes --location '$options{location}' --output json";
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -268,6 +274,7 @@ sub azure_list_vms_set_cmd {
|
|||
my $cmd_options = "vm list --output json";
|
||||
$cmd_options .= " --resource-group '$options{resource_group}'" if (defined($options{resource_group}) && $options{resource_group} ne '');
|
||||
$cmd_options .= " --show-details" if (defined($options{show_details}));
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -307,6 +314,7 @@ sub azure_list_groups_set_cmd {
|
|||
return if (defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '');
|
||||
|
||||
my $cmd_options = "group list --output json";
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -346,6 +354,7 @@ sub azure_list_deployments_set_cmd {
|
|||
return if (defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '');
|
||||
|
||||
my $cmd_options = "group deployment list --resource-group '$options{resource_group}' --output json";
|
||||
$cmd_options .= " --subscription '$self->{subscription}'" if (defined($self->{subscription}) && $self->{subscription} ne '');
|
||||
|
||||
return $cmd_options;
|
||||
}
|
||||
|
@ -406,6 +415,10 @@ For futher informations, visit https://docs.microsoft.com/en-us/cli/azure/instal
|
|||
|
||||
=over 8
|
||||
|
||||
=item B<--subscription>
|
||||
|
||||
Set Azure subscription (Required if logged to several subscriptions).
|
||||
|
||||
=item B<--timeframe>
|
||||
|
||||
Set timeframe in seconds (i.e. 3600 to check last hour).
|
||||
|
@ -414,9 +427,9 @@ Set timeframe in seconds (i.e. 3600 to check last hour).
|
|||
|
||||
Set interval of the metric query (Can be : PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H, PT24H).
|
||||
|
||||
=item B<--aggregations>
|
||||
=item B<--aggregation>
|
||||
|
||||
Set monitor aggregations (Can be: 'minimum', 'maximum', 'average', 'total').
|
||||
Set monitor aggregation (Can be multiple, Can be: 'minimum', 'maximum', 'average', 'total').
|
||||
|
||||
=item B<--zeroed>
|
||||
|
||||
|
|
Loading…
Reference in New Issue