enh(plugin)cAdvisor plugin enhancements (#2855)
This commit is contained in:
parent
a239b7cb4e
commit
f795511e40
|
@ -46,7 +46,7 @@ sub new {
|
||||||
'hostname:s@' => { name => 'hostname' },
|
'hostname:s@' => { name => 'hostname' },
|
||||||
'port:s' => { name => 'port', default => 8080 },
|
'port:s' => { name => 'port', default => 8080 },
|
||||||
'proto:s' => { name => 'proto', default => 'http' },
|
'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' },
|
'credentials' => { name => 'credentials' },
|
||||||
'username:s' => { name => 'username' },
|
'username:s' => { name => 'username' },
|
||||||
'password:s' => { name => 'password' },
|
'password:s' => { name => 'password' },
|
||||||
|
@ -114,7 +114,7 @@ sub internal_api_list_nodes {
|
||||||
|
|
||||||
my $response = $self->{http}->request(
|
my $response = $self->{http}->request(
|
||||||
hostname => $options{node_name},
|
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 => '');
|
unknown_status => '', critical_status => '', warning_status => '');
|
||||||
my $nodes;
|
my $nodes;
|
||||||
eval {
|
eval {
|
||||||
|
@ -156,7 +156,7 @@ sub internal_api_list_containers {
|
||||||
|
|
||||||
my $response = $self->{http}->request(
|
my $response = $self->{http}->request(
|
||||||
hostname => $options{node_name},
|
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 => '');
|
unknown_status => '', critical_status => '', warning_status => '');
|
||||||
my $containers = [];
|
my $containers = [];
|
||||||
my $containers_ids;
|
my $containers_ids;
|
||||||
|
@ -212,7 +212,7 @@ sub internal_api_get_container_stats {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
my $response = $self->{http}->request(
|
my $response = $self->{http}->request(
|
||||||
hostname => $options{node_name},
|
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 => '');
|
unknown_status => '', critical_status => '', warning_status => '');
|
||||||
my $container_stats;
|
my $container_stats;
|
||||||
my $full_container_stats;
|
my $full_container_stats;
|
||||||
|
@ -337,7 +337,7 @@ Port used (Default: 8080)
|
||||||
|
|
||||||
Specify https if needed (Default: 'http')
|
Specify https if needed (Default: 'http')
|
||||||
|
|
||||||
=item B<--path>
|
=item B<--api-path>
|
||||||
|
|
||||||
Path used (Default: '/containers/docker')
|
Path used (Default: '/containers/docker')
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ sub set_counters {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
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;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
|
|
@ -59,7 +59,7 @@ sub set_counters {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
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;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
|
|
@ -80,7 +80,7 @@ sub set_counters {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
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;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
|
|
@ -66,7 +66,7 @@ sub set_counters {
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
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;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
@ -118,7 +118,7 @@ sub manage_selection {
|
||||||
name => $name,
|
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})) {
|
if (defined($first_stat->{network}->{interfaces})) {
|
||||||
foreach my $interface_index (0..(scalar(@{$first_stat->{network}->{interfaces}}) - 1)) {
|
foreach my $interface_index (0..(scalar(@{$first_stat->{network}->{interfaces}}) - 1)) {
|
||||||
$self->{containers_traffic}->{$name} = {
|
$self->{containers_traffic}->{$name} = {
|
||||||
|
|
Loading…
Reference in New Issue