Skip to content

[storage::dell::me4::restapi::plugin] - mode(interfaces): Cannot decode response with host-phy-statistics requests #5911

@Lanxor

Description

@Lanxor

Bug report

Quick description

The API request /api/show/host-phy-statistics returns a 400 Bad Request error because it is not available on the Dell SAN.

How to reproduce

  • Version of the plugin: RPM RedHat9
    • Name : centreon-plugin-Hardware-Storage-Dell-Me4-Restapi
    • Version : 20251200
    • Release : 1.el9
    • Architecture : noarch
  • Information about the monitored resource: Dell PowerVault ME5024 v1.2.1.1
  • Command line:
/lib/centreon/plugins/centreon_dell_me4_restapi.pl \
    --plugin=storage::dell::me4::restapi::plugin \
    --hostname='XXX' \
    --api-username='XXX' \
    --api-password='XXX' \
    --port='443' \
    --proto='https' \
    --insecure \
    --digest-sha256 \
    --mode interfaces

Expected result

OK: All interfaces are ok

Actual result

Short :

UNKNOWN: Cannot decode response (add --debug option to display returned content)

Debug :

UNKNOWN: Cannot decode response (add --debug option to display returned content)
======> request send
GET https://--REDACTED--/api/login/--REDACTED--
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Datatype: json

======> response done
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Length: 346
Content-Type: application/json; charset="utf-8"
Client-Date: --REDACTED--
Client-Peer: --REDACTED--
Client-Response-Num: 1
Client-SSL-Cert-Issuer: --REDACTED--
Client-SSL-Cert-Subject: --REDACTED--
Client-SSL-Cipher: --REDACTED--
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Command-Status: --REDACTED--
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data:; base-uri 'self'; object-src 'self'
Strict-Transport-Security: max-age=31536000;
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1

{
"status":[--REDACTED--]
}
======> request send
GET https://--REDACTED--/api/set/cli-parameters/locale/English
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Datatype: json
SessionKey: --REDACTED--

======> response done
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset="utf-8"
Client-Date: --REDACTED--
Client-Peer: --REDACTED--
Client-Response-Num: 2
Client-SSL-Cert-Issuer: --REDACTED--
Client-SSL-Cert-Subject: --REDACTED--
Client-SSL-Cipher: --REDACTED--
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data:; base-uri 'self'; object-src 'self'
Strict-Transport-Security: max-age=31536000;
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1

{
"status":[--REDACTED--]
}
======> request send
GET https://--REDACTED--/api/show/ports
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Datatype: json
SessionKey: --REDACTED--

======> response done
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset="utf-8"
Client-Date: --REDACTED--
Client-Peer: --REDACTED--
Client-Response-Num: 3
Client-SSL-Cert-Issuer: --REDACTED--
Client-SSL-Cert-Subject: --REDACTED--
Client-SSL-Cipher: --REDACTED--
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data:; base-uri 'self'; object-src 'self'
Strict-Transport-Security: max-age=31536000;
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1

{
"port":[--REDACTED--]
}
======> request send
GET https://--REDACTED--/api/show/host-port-statistics
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Datatype: json
SessionKey: --REDACTED--

======> response done
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Type: application/json; charset="utf-8"
Client-Date: --REDACTED--
Client-Peer: --REDACTED--
Client-Response-Num: 4
Client-SSL-Cert-Issuer: --REDACTED--
Client-SSL-Cert-Subject: --REDACTED--
Client-SSL-Cipher: --REDACTED--
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data:; base-uri 'self'; object-src 'self'
Strict-Transport-Security: max-age=31536000;
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1

{
"host-port-statistics":[ --REDACTED-- ]
}
======> request send
GET https://--REDACTED--/api/show/host-phy-statistics
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Datatype: json
SessionKey: --REDACTED--

======> response done
HTTP/1.1 400 Bad Request
Cache-Control: no-cache, no-store, must-revalidate
Connection: keep-alive
Content-Type: text/html; charset="utf-8"
Client-Date: --REDACTED--
Client-Peer: --REDACTED--
Client-Response-Num: 5
Client-SSL-Cert-Issuer:--REDACTED--
Client-SSL-Cert-Subject: --REDACTED--
Client-SSL-Cipher: --REDACTED--
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data:; base-uri 'self'; object-src 'self'
Strict-Transport-Security: max-age=31536000;
Title: 400 Bad Request
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
</BODY></HTML>

We would like to add an option to the plugin that allows skipping the retrieval of statistics from the /api/show/host-phy-statistics endpoint.

Here is my proposal

https://github.com/centreon/centreon-plugins/blob/develop/src/storage/dell/me4/restapi/mode/interfaces.pm#L154

      $options{options}->add_options(arguments => {
          'filter-port-name:s' => { name => 'filter_port_name' },
          'omit-phy-statistics' => { name => 'omit_phy_statistics' }
      });

https://github.com/centreon/centreon-plugins/blob/develop/src/storage/dell/me4/restapi/mode/interfaces.pm#L174

      if (!$self->{option_results}->{omit_phy_statistics}) {
        $result_logical_interfaces = $options{custom}->request_api(method => 'GET', url_path =>  '/api/show/host-phy-statistics');
      }

https://github.com/centreon/centreon-plugins/blob/develop/src/storage/dell/me4/restapi/mode/interfaces.pm#L208

      if (!$self->{option_results}->{omit_phy_statistics} && defined($result_logical_interfaces) && defined($result_logical_interfaces->{'sas-host-phy-statistics'})) {
          foreach (@{$result_logical_interfaces->{'sas-host-phy-statistics'}}) {
              next if (!defined($self->{ports}->{ $_->{port} }));

              $self->{ports}->{ $_->{port} }->{interfaces}->{ $_->{phy} } = {
                  display => $_->{phy},
                  disparity_errors => int($_->{'disparity-errors'}),
                  invalid_dwords => int($_->{'invalid-dwords'}),
                  lost_dwords => int($_->{'lost-dwords'})
              };
          }
      }

I’ll submit a PR to better showcase my proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions