change some default behaviour for nodeexporter and cadvisor modes

This commit is contained in:
Colin Gagnaire 2019-02-04 17:36:23 +01:00
parent 28678fe9a3
commit d7c8f4e578
5 changed files with 13 additions and 10 deletions

View File

@ -108,7 +108,7 @@ sub check_options {
}
$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 {
@ -120,11 +120,11 @@ sub manage_selection {
'cpu="total",' .
$self->{option_results}->{container} . ',' .
$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} . '",' .
$self->{option_results}->{container} . ',' .
$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});
foreach my $result (@{$results}) {

View File

@ -131,7 +131,7 @@ sub check_options {
}
$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 {
@ -143,7 +143,7 @@ sub manage_selection {
'mode="idle",' .
$self->{option_results}->{instance} . ',' .
$self->{option_results}->{cpu} .
$self->{extra_filter} . '}[1m])) * 100' ],
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100' ],
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
foreach my $result (@{$results}) {

View File

@ -258,7 +258,7 @@ sub check_options {
}
$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 {
@ -270,7 +270,7 @@ sub manage_selection {
$self->{option_results}->{instance} . ',' .
$self->{option_results}->{cpu} . ',' .
$self->{option_results}->{type} .
$self->{extra_filter} . '}[1m])) * 100' ],
$self->{extra_filter} . '}[' . $self->{prom_step} . '])) * 100' ],
timeframe => $self->{prom_timeframe}, step => $self->{prom_step});
foreach my $result (@{$results}) {

View File

@ -154,7 +154,7 @@ sub check_options {
$self->{metrics} = {
'total' => "^node_memory_MemTotal.*",
'available' => "^node_memory_MemAvailable.*",
'available' => "^node_memory_MemFree.*",
'cached' => "^node_memory_Cached.*",
'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$'
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
=cut

View File

@ -153,7 +153,7 @@ sub new {
{
"instance:s" => { name => 'instance', default => 'instance=~".*"' },
"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 => '%' },
"free" => { name => 'free' },
"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>
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>