centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 273 forks source link

[cloud::azure::web::appservice::plugin] --mode=io-operations : metric name does not exist #4739

Open FreshardF opened 10 months ago

FreshardF commented 10 months ago

plugin version => 20220518-070245

the script try fetch not exiting metrics => iootheroperationspersecond and iootherbytespersecond

debug Output: == Info: Trying 51.138.208.143... == Info: Connected to management.azure.com (51.138.208.143) port 443 (#0) == Info: Initializing NSS with certpath: sql:/etc/pki/nssdb == Info: CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none == Info: SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 == Info: Server certificate: == Info: subject: CN=management.azure.com,O=Microsoft Corporation,L=Redmond,ST=WA,C=US == Info: start date: Aug 25 17:38:07 2023 GMT == Info: expire date: Jun 27 23:59:59 2024 GMT == Info: common name: management.azure.com == Info: issuer: CN=Microsoft Azure TLS Issuing CA 05,O=Microsoft Corporation,C=US => Send header: GET /subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Web/sites/XXX/providers/microsoft.insights/metrics?api-version=2018-01-01&metricnames=iowritebytespersecond%2Ciowriteoperationspersecond%2Ciootheroperationspersecond%2Cioreadbytespersecond%2Ciootherbytespersecond%2Cioreadoperationspersecond&aggregation=Total&timespan=2023-11-16T15%3A33%3A47Z%2F2023-11-16T15%3A48%3A47Z&interval=PT5M HTTP/1.1 Host: management.azure.com Accept:application/json Authorization:Bearer XXX

=> Recv header: HTTP/1.1 400 Bad Request => Recv header: Cache-Control: no-cache => Recv header: Pragma: no-cache => Recv header: Content-Length: 492 => Recv header: Content-Type: application/json; charset=utf-8 => Recv header: Expires: -1 => Recv header: x-ms-correlation-request-id: 53bdfb82-bdef-4780-aa19-6b7646930d26 => Recv header: x-ms-ratelimit-remaining-subscription-reads: 11996 => Recv header: Request-Context: appId=cid-v1:4d8c174d-ad60-4f27-bd4a-f2b698f8e26c => Recv header: x-ms-request-id: {53bdfb82-bdef-4780-aa19-6b7646930d26} => Recv header: Strict-Transport-Security: max-age=31536000; includeSubDomains => Recv header: x-ms-routing-request-id: FRANCECENTRAL:20231116T154847Z:53bdfb82-bdef-4780-aa19-6b7646930d26 => Recv header: X-Content-Type-Options: nosniff => Recv header: Date: Thu, 16 Nov 2023 15:48:47 GMT => Recv header: => Recv data: {"code":"BadRequest","message":"Failed to find metric configuration for provider: Microsoft.Web, resource Type: sites, metric: iootheroperationspersecond, Valid metrics: CpuTime,Requests,BytesReceived,BytesSent,Http101,Http2xx,Http3xx,Http401,Http403,Http404,Http406,Http4xx,Http5xx,MemoryWorkingSet,AverageMemoryWorkingSet,AverageResponseTime,HttpResponseTime,IoReadBytesPerSecond,IoWriteBytesPerSecond,IoReadOperationsPerSecond,IoWriteOperationsPerSecond,HealthCheckStatus,FileSystemUsage"} == Info: Connection #0 to host management.azure.com left intact Message : Failed to find metric configuration for provider: Microsoft.Web, resource Type: sites, metric: iootheroperationspersecond, Valid metrics: CpuTime,Requests,BytesReceived,BytesSent,Http101,Http2xx,Http3xx,Http401,Http403,Http404,Http406,Http4xx,Http5xx,MemoryWorkingSet,AverageMemoryWorkingSet,AverageResponseTime,HttpResponseTime,IoReadBytesPerSecond,IoWriteBytesPerSecond,IoReadOperationsPerSecond,IoWriteOperationsPerSecond,HealthCheckStatus,FileSystemUsage

omercier commented 9 months ago

Hi, If I understand the issue correctly, neither iootheroperationspersecond nor iootherbytespersecond metrics are available any longer. Would you consider rewriting this code block

    my $metrics_mapping = {
        'iootherbytespersecond' => {
            'output' => 'IO Other Bytes Per Second',
            'label'  => 'other-bytes',
            'nlabel' => 'appservice.bytes.other.bytespersecond',
            'unit'   => 'B/s',
            'min'    => '0',
            'max'    => ''
        },
        'iootheroperationspersecond' => {
            'output' => 'IO Other Operations Per Second',
            'label'  => 'other-operations',
            'nlabel' => 'appservice.operations.other.bytespersecond',
            'unit'   => 'B/s',
            'min'    => '0',
            'max'    => ''
        },
        'ioreadbytespersecond' => {
            'output' => 'IO Read Bytes Per Second',
            'label'  => 'read-bytes',
            'nlabel' => 'appservice.bytes.read.bytespersecond',
            'unit'   => 'B/s',
            'min'    => '0',
            'max'    => ''
        },

with this one

    my $metrics_mapping = {
        'ioreadbytespersecond' => {
            'output' => 'IO Read Bytes Per Second',
            'label'  => 'read-bytes',
            'nlabel' => 'appservice.bytes.read.bytespersecond',
            'unit'   => 'B/s',
            'min'    => '0',
            'max'    => ''
        },

(in short, remove the declaration of iootheroperationspersecond and iootherbytespersecond metrics from the code) and tell me if it solves the issue?

lucie-dubrunfaut commented 3 months ago

Hello :)

@FreshardF, were you able to test @omercier 's proposed solution in the plugin mode?