enh(plugin)cAdvisor plugin enhancements (#2855)

This commit is contained in:
Simon Bomm 2021-06-07 09:57:09 +02:00 committed by GitHub
parent a239b7cb4e
commit f795511e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -46,7 +46,7 @@ sub new {
'hostname:s@' => { name => 'hostname' },
'port:s' => { name => 'port', default => 8080 },
'proto:s' => { name => 'proto', default => 'http' },
'path:s' => { name => 'path', default => '/containers/docker/' },
'api-path:s' => { name => 'api_path', default => '/containers/docker/' },
'credentials' => { name => 'credentials' },
'username:s' => { name => 'username' },
'password:s' => { name => 'password' },
@ -114,7 +114,7 @@ sub internal_api_list_nodes {
my $response = $self->{http}->request(
hostname => $options{node_name},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{path},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{api_path},
unknown_status => '', critical_status => '', warning_status => '');
my $nodes;
eval {
@ -156,7 +156,7 @@ sub internal_api_list_containers {
my $response = $self->{http}->request(
hostname => $options{node_name},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{path},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{api_path},
unknown_status => '', critical_status => '', warning_status => '');
my $containers = [];
my $containers_ids;
@ -212,7 +212,7 @@ sub internal_api_get_container_stats {
my ($self, %options) = @_;
my $response = $self->{http}->request(
hostname => $options{node_name},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{path} . '/' . $options{container_id},
url_path => '/api/' . $self->{option_results}->{api_version} . $self->{option_results}->{api_path} . '/' . $options{container_id},
unknown_status => '', critical_status => '', warning_status => '');
my $container_stats;
my $full_container_stats;
@ -337,7 +337,7 @@ Port used (Default: 8080)
Specify https if needed (Default: 'http')
=item B<--path>
=item B<--api-path>
Path used (Default: '/containers/docker')

View File

@ -133,7 +133,7 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {

View File

@ -59,7 +59,7 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {

View File

@ -80,7 +80,7 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {

View File

@ -66,7 +66,7 @@ sub set_counters {
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
@ -118,7 +118,7 @@ sub manage_selection {
name => $name,
};
my $name = defined($self->{option_results}->{use_name}) ? $name : $container_id;
$name = defined($self->{option_results}->{use_name}) ? $name : $container_id;
if (defined($first_stat->{network}->{interfaces})) {
foreach my $interface_index (0..(scalar(@{$first_stat->{network}->{interfaces}}) - 1)) {
$self->{containers_traffic}->{$name} = {