enh prometheus help messages
This commit is contained in:
parent
d45b4de0da
commit
84f929bd9f
|
@ -100,6 +100,7 @@ sub new {
|
|||
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /running/ || %{state} !~ /ready/' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -236,10 +237,25 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'status')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- ready: ^kube_pod_container_status_ready$
|
||||
- running: ^kube_pod_container_status_running$
|
||||
- terminated: ^kube_pod_container_status_terminated$
|
||||
- terminated_reason: ^kube_pod_container_status_terminated_reason$
|
||||
- waiting: ^kube_pod_container_status_waiting$
|
||||
- waiting_reason: ^kube_pod_container_status_waiting_reason$
|
||||
- restarts: ^kube_pod_container_status_restarts_total$
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='status'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -231,10 +231,20 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'status')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- desired: ^kube_daemonset_status_desired_number_scheduled$
|
||||
- current: ^kube_daemonset_status_current_number_scheduled$
|
||||
- available: ^kube_daemonset_status_number_available$
|
||||
- unavailable: ^kube_daemonset_status_number_unavailable$
|
||||
- up_to_date: ^kube_daemonset_updated_number_scheduled$
|
||||
- ready: ^kube_daemonset_status_number_ready$
|
||||
- misscheduled: ^kube_daemonset_status_number_misscheduled$
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -214,10 +214,18 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'status')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- desired: ^kube_deployment_spec_replicas$
|
||||
- current: ^kube_deployment_status_replicas$
|
||||
- available: ^kube_deployment_status_replicas_available$
|
||||
- unavailable: ^kube_deployment_status_replicas_unavailable$
|
||||
- up_to_date: ^kube_deployment_status_replicas_updated$
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -205,10 +205,19 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'status')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- status: ^kube_namespace_status_phase$
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='status'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -258,10 +258,22 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'status')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- status: ^kube_node_status_condition$
|
||||
- unschedulable: ^kube_node_spec_unschedulable$
|
||||
- capacity: ^kube_node_status_capacity_pods$
|
||||
- allocatable: ^kube_node_status_allocatable_pods$
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='status'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -71,10 +71,12 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"cpu-attribute:s" => { name => 'cpu_attribute', default => 'cpu="total"' },
|
||||
"container:s" => { name => 'container', default => 'container_name!~".*POD.*"' },
|
||||
"pod:s" => { name => 'pod', default => 'pod_name=~".*"' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -117,7 +119,7 @@ sub manage_selection {
|
|||
$self->{containers} = {};
|
||||
|
||||
my $results = $options{custom}->query_range(queries => [ 'label_replace((irate({__name__=~"' . $self->{metrics}->{usage} . '",' .
|
||||
'cpu="total",' .
|
||||
$self->{option_results}->{cpu_attribute} . ',' .
|
||||
$self->{option_results}->{container} . ',' .
|
||||
$self->{option_results}->{pod} .
|
||||
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100, "__name__", "usage", "", "")',
|
||||
|
@ -152,6 +154,10 @@ Check containers CPU usage and throttled.
|
|||
|
||||
=over 8
|
||||
|
||||
=item B<--cpu-attribute>
|
||||
|
||||
Set the cpu attribute to match element (Must be a PromQL filter, Default: 'cpu="total"')
|
||||
|
||||
=item B<--container>
|
||||
|
||||
Filter on a specific container (Must be a PromQL filter, Default: 'container_name!~".*POD.*"')
|
||||
|
@ -178,10 +184,20 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'usage', 'throttled')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- throttled: ^container_cpu_cfs_throttled_seconds_total.*
|
||||
- usage: ^container_cpu_usage_seconds_total.*
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='throttled'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -159,10 +159,14 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'load')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- load: ^container_cpu_load_average_10s$
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -175,6 +175,7 @@ sub new {
|
|||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -298,11 +299,24 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'limits',
|
||||
'usage', 'working', 'cache', 'rss', 'swap'.)
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- limits: ^container_spec_memory_limit_bytes.*
|
||||
- usage: ^container_memory_usage_bytes.*
|
||||
- working: ^container_memory_working_set_bytes.*
|
||||
- cache: ^container_memory_cache.*
|
||||
- rss: ^container_memory_rss.*
|
||||
- swap: ^container_memory_swap.*
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='usage'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -270,10 +270,15 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'used', 'limit')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- used: ^container_fs_usage_bytes.*
|
||||
- limit: ^container_fs_limit_bytes.*
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -203,10 +203,14 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'tasks_state')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- tasks_state: ^container_tasks_state$
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -99,6 +99,7 @@ sub new {
|
|||
"cpu:s" => { name => 'cpu', default => 'cpu=~".*"' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -200,10 +201,19 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'cpu')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- cpu: ^node_cpu.*
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='node'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -226,6 +226,7 @@ sub new {
|
|||
"type:s" => { name => 'type', default => 'mode=~".*"' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -340,10 +341,19 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'cpu')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- cpu: ^node_cpu.*
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='wait'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -83,6 +83,7 @@ sub new {
|
|||
"instance:s" => { name => 'instance', default => 'instance=~".*"' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -175,10 +176,21 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'load1', 'load5', 'load15')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- load1: ^node_load1$
|
||||
- load5: ^node_load5$
|
||||
- load15: ^node_load15$
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='load15'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -143,6 +143,7 @@ sub new {
|
|||
"units:s" => { name => 'units', default => '%' },
|
||||
"extra-filter:s@" => { name => 'extra_filter' },
|
||||
"metric-overload:s@" => { name => 'metric_overload' },
|
||||
"filter-counters:s" => { name => 'filter_counters' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -245,13 +246,25 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'total', 'available', 'cached', 'buffer')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
By default, 'node_memory_MemFree' node's metric will be used for 'available' metric as it is
|
||||
more commonly used for now. The best being to use 'node_memory_MemAvailable' in the future.
|
||||
|
||||
Default :
|
||||
|
||||
- total: ^node_memory_MemTotal.*
|
||||
- available: ^node_memory_MemFree.*
|
||||
- cached: ^node_memory_Cached.*
|
||||
- buffer: ^node_memory_Buffers.*
|
||||
|
||||
=item B<--filter-counters>
|
||||
|
||||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='usage'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -267,10 +267,15 @@ Example : --extra-filter='name=~".*pretty.*"'
|
|||
|
||||
=item B<--metric-overload>
|
||||
|
||||
Overload default metrics name (Can be multiple, metric can be 'free', 'size')
|
||||
Overload default metrics name (Can be multiple)
|
||||
|
||||
Example : --metric-overload='metric,^my_metric_name$'
|
||||
|
||||
Default :
|
||||
|
||||
- free: ^node_filesystem_free.*
|
||||
- size: ^node_filesystem_size.*
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
|
@ -161,8 +161,6 @@ sub query_range {
|
|||
my $uri = URI::Encode->new({encode_reserved => 1});
|
||||
|
||||
foreach my $query (@{$options{queries}}) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Query range: '/query_range?query=%s&start=%s&end=%s&step=%s'",
|
||||
$query, $start_time, $end_time, $options{step}), debug => 1);
|
||||
my $result = $self->get_endpoint(url_path => '/query_range?query=' . $uri->encode($query) .
|
||||
'&start=' . $start_time . '&end=' . $end_time . '&step=' . $options{step});
|
||||
push @{$data}, @{$result->{result}};
|
||||
|
@ -178,7 +176,6 @@ sub query {
|
|||
my $uri = URI::Encode->new({encode_reserved => 1});
|
||||
|
||||
foreach my $query (@{$options{queries}}) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Query: '/query?query=%s'", $query), debug => 1);
|
||||
my $result = $self->get_endpoint(url_path => '/query?query=' . $uri->encode($query));
|
||||
push @{$data}, @{$result->{result}};
|
||||
}
|
||||
|
@ -190,6 +187,10 @@ sub get_endpoint {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->settings;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Query URL: '" . $self->{proto} . "://" . $self->{hostname} .
|
||||
$self->{url_path} . $options{url_path} . "'", debug => 1);
|
||||
|
||||
my $response = $self->{http}->request(url_path => $self->{url_path} . $options{url_path});
|
||||
|
||||
my $content;
|
||||
|
|
Loading…
Reference in New Issue