change some default behaviour for nodeexporter and cadvisor modes
This commit is contained in:
parent
28678fe9a3
commit
d7c8f4e578
|
@ -108,7 +108,7 @@ sub check_options {
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||||
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "1m";
|
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "5m";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -120,11 +120,11 @@ sub manage_selection {
|
||||||
'cpu="total",' .
|
'cpu="total",' .
|
||||||
$self->{option_results}->{container} . ',' .
|
$self->{option_results}->{container} . ',' .
|
||||||
$self->{option_results}->{pod} .
|
$self->{option_results}->{pod} .
|
||||||
$self->{extra_filter} . '}[1m])) * 100, "__name__", "usage", "", "")',
|
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100, "__name__", "usage", "", "")',
|
||||||
'label_replace((irate({__name__=~"' . $self->{metrics}->{throttled} . '",' .
|
'label_replace((irate({__name__=~"' . $self->{metrics}->{throttled} . '",' .
|
||||||
$self->{option_results}->{container} . ',' .
|
$self->{option_results}->{container} . ',' .
|
||||||
$self->{option_results}->{pod} .
|
$self->{option_results}->{pod} .
|
||||||
$self->{extra_filter} . '}[1m])) * 100, "__name__", "throttled", "", "")' ],
|
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100, "__name__", "throttled", "", "")' ],
|
||||||
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
||||||
|
|
||||||
foreach my $result (@{$results}) {
|
foreach my $result (@{$results}) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ sub check_options {
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||||
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "1m";
|
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "5m";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -143,7 +143,7 @@ sub manage_selection {
|
||||||
'mode="idle",' .
|
'mode="idle",' .
|
||||||
$self->{option_results}->{instance} . ',' .
|
$self->{option_results}->{instance} . ',' .
|
||||||
$self->{option_results}->{cpu} .
|
$self->{option_results}->{cpu} .
|
||||||
$self->{extra_filter} . '}[1m])) * 100' ],
|
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100' ],
|
||||||
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
||||||
|
|
||||||
foreach my $result (@{$results}) {
|
foreach my $result (@{$results}) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ sub check_options {
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
$self->{prom_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||||
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "1m";
|
$self->{prom_step} = defined($self->{option_results}->{step}) ? $self->{option_results}->{step} : "5m";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
|
@ -270,7 +270,7 @@ sub manage_selection {
|
||||||
$self->{option_results}->{instance} . ',' .
|
$self->{option_results}->{instance} . ',' .
|
||||||
$self->{option_results}->{cpu} . ',' .
|
$self->{option_results}->{cpu} . ',' .
|
||||||
$self->{option_results}->{type} .
|
$self->{option_results}->{type} .
|
||||||
$self->{extra_filter} . '}[1m])) * 100' ],
|
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100' ],
|
||||||
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
|
||||||
|
|
||||||
foreach my $result (@{$results}) {
|
foreach my $result (@{$results}) {
|
||||||
|
|
|
@ -154,7 +154,7 @@ sub check_options {
|
||||||
|
|
||||||
$self->{metrics} = {
|
$self->{metrics} = {
|
||||||
'total' => "^node_memory_MemTotal.*",
|
'total' => "^node_memory_MemTotal.*",
|
||||||
'available' => "^node_memory_MemAvailable.*",
|
'available' => "^node_memory_MemFree.*",
|
||||||
'cached' => "^node_memory_Cached.*",
|
'cached' => "^node_memory_Cached.*",
|
||||||
'buffer' => "^node_memory_Buffers.*",
|
'buffer' => "^node_memory_Buffers.*",
|
||||||
};
|
};
|
||||||
|
@ -249,6 +249,9 @@ Overload default metrics name (Can be multiple, metric can be 'total', 'availabl
|
||||||
|
|
||||||
Example : --metric-overload='metric,^my_metric_name$'
|
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.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
|
@ -153,7 +153,7 @@ sub new {
|
||||||
{
|
{
|
||||||
"instance:s" => { name => 'instance', default => 'instance=~".*"' },
|
"instance:s" => { name => 'instance', default => 'instance=~".*"' },
|
||||||
"mountpoint:s" => { name => 'mountpoint', default => 'mountpoint=~".*"' },
|
"mountpoint:s" => { name => 'mountpoint', default => 'mountpoint=~".*"' },
|
||||||
"fstype:s" => { name => 'fstype', default => 'fstype=~"overlay"' },
|
"fstype:s" => { name => 'fstype', default => 'fstype!~"linuxfs|rootfs|tmpfs"' },
|
||||||
"units:s" => { name => 'units', default => '%' },
|
"units:s" => { name => 'units', default => '%' },
|
||||||
"free" => { name => 'free' },
|
"free" => { name => 'free' },
|
||||||
"extra-filter:s@" => { name => 'extra_filter' },
|
"extra-filter:s@" => { name => 'extra_filter' },
|
||||||
|
@ -241,7 +241,7 @@ Filter on a specific mountpoint (Must be a PromQL filter, Default: 'mountpoint=~
|
||||||
|
|
||||||
=item B<--fstype>
|
=item B<--fstype>
|
||||||
|
|
||||||
Filter on a specific fstype (Must be a PromQL filter, Default: 'fstype=~"overlay"')
|
Filter on a specific fstype (Must be a PromQL filter, Default: 'fstype!~"linuxfs|rootfs|tmpfs"')
|
||||||
|
|
||||||
=item B<--units>
|
=item B<--units>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue