From c3b419e6042eb97d55ff51c2b47063c47d753e07 Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Wed, 8 Dec 2021 14:00:50 +0100 Subject: [PATCH] fix(prometheus/direct) : mode container-status - add ready container state management (#3295) --- .../cloud/prometheus/direct/kubernetes/mode/containerstatus.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centreon-plugins/cloud/prometheus/direct/kubernetes/mode/containerstatus.pm b/centreon-plugins/cloud/prometheus/direct/kubernetes/mode/containerstatus.pm index 03461203f..39a1ed370 100644 --- a/centreon-plugins/cloud/prometheus/direct/kubernetes/mode/containerstatus.pm +++ b/centreon-plugins/cloud/prometheus/direct/kubernetes/mode/containerstatus.pm @@ -183,7 +183,7 @@ sub manage_selection { $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{perf} = $result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}; $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{restarts} = ${$result->{value}}[1] if ($result->{metric}->{__name__} =~ /restarts/); $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{state} = ${$result->{value}}[1] if ($result->{metric}->{__name__} =~ /ready/); - $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{status} = $result->{metric}->{__name__} if ($result->{metric}->{__name__} =~ /running|terminated|waiting/ && ${$result->{value}}[1] == 1); + $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{status} = $result->{metric}->{__name__} if ($result->{metric}->{__name__} =~ /ready|running|terminated|waiting/ && ${$result->{value}}[1] == 1); $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{reason} = ""; $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{reason} = $result->{metric}->{reason} if ($result->{metric}->{__name__} =~ /reason/ && ${$result->{value}}[1] == 1); $self->{containers}->{$result->{metric}->{$self->{labels}->{pod}} . "_" . $result->{metric}->{$self->{labels}->{container}}}->{namespace} = $result->{metric}->{namespace};