Skip to main content

Hi,

I have an issue with this command :

/usr/lib64/nagios/plugins/centreon_plugins.pl --plugin cloud::azure::management::monitor::plugin \
--custommode='api' \
--mode='get-metrics' \
--subscription=xxx \
--tenant=xxx \
--client-id=xxx \
--client-secret=xxx \
--resource=xxx \
--resource-group=xxx \
--resource-namespace=microsoft.insights/components \
--resource-type= \
--metric=requests/failed \
--aggregation=Count \
--interval=PT30M \
--filter-dimension="request/resultCode sw '42'" \
--warning-metric=1 --critical-metric=5

When there are no hits, i get:
UNKNOWN: No metric found (Are the filters properly set?)

Can't find any option to get OK instead of UNKNOWN when the filter is empty.

Hi,

Did you try --zeroed option ?


Hi,

Same result…

 

 


Hi,

I have the same problem. The --zeroed option  doesn't seem to work. I have the latest version :

 


Hi,

the --zeroed option should not be the solution. I guess there has been a change in Azure’s API that require the plugin to be updated.

Can you send the output when using the --debug option? Warning: sensitive data may be present, make sure you’re not sharing private IP addresses or anything. 


The output :

UNKNOWN: No metric found (Are the filters properly set?)
== Info: Uses proxy env variable no_proxy == 'localhost, 127.0.0.1, XXXXXXXX'
== Info:   Trying xxxx:xxxx...
== Info: Connected to xxxxx (xxxxx) port xxxx (#0)
== Info: allocate connect buffer!
== Info: Establish HTTP proxy tunnel to management.azure.com:443
=> Send header: CONNECT management.azure.com:443 HTTP/1.1
Host: management.azure.com:443
Proxy-Connection: Keep-Alive

=> Recv header: HTTP/1.1 200 Connection established
=> Recv header:
== Info: Proxy replied 200 to CONNECT request
== Info: CONNECT phase completed!
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info:  CAfile: /etc/pki/tls/certs/ca-bundle.crt
== Info: TLSv1.0 (OUT), TLS header, Certificate Status (22):
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
== Info: CONNECT phase completed!
== Info: CONNECT phase completed!
== Info: TLSv1.2 (IN), TLS header, Certificate Status (22):
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
== Info: TLSv1.2 (OUT), TLS header, Finished (20):
== Info: TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
== Info: TLSv1.2 (OUT), TLS header, Certificate Status (22):
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
== Info: TLSv1.2 (IN), TLS header, Finished (20):
== Info: TLSv1.2 (IN), TLS header, Certificate Status (22):
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
== Info: TLSv1.2 (IN), TLS header, Unknown (23):
== Info: TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
== Info: TLSv1.3 (IN), TLS handshake, Certificate (11):
== Info: TLSv1.3 (IN), TLS handshake, CERT verify (15):
== Info: TLSv1.3 (IN), TLS handshake, Finished (20):
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
== Info: TLSv1.3 (OUT), TLS handshake, Finished (20):
== Info: SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
== Info: ALPN, server accepted to use h2
== Info: Server certificate:
== Info:  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=edge.management.azure.com
== Info:  start date: Sep  3 03:18:42 2024 GMT
== Info:  expire date: Aug 29 03:18:42 2025 GMT
== Info:  subjectAltName: host "management.azure.com" matched cert's "management.azure.com"
== Info:  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 03
== Info:  SSL certificate verify ok.
== Info: Using HTTP2, server supports multi-use
== Info: Connection state changed (HTTP/2 confirmed)
== Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
== Info: Using Stream ID: 1 (easy handle 0x55e4b5579eb0)
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
=> Send header: GET /subscriptions/XXXXXXXXXXXXXXXXXXXXX/resourceGroups/XXXXXXXXXXX/providers//Microsoft.CognitiveServices/accounts/xxxxxxxxxxx/providers/microsoft.insights/metrics?api-version=2018-01-01&metricnames=Latency&aggregation=Average&timespan=2024-11-19T15%3A11%3A30Z%2F2024-11-19T15%3A41%3A30Z&interval=PT15M HTTP/2
Host: management.azure.com
authorization:Bearer XXXXXXXXXXXXXXXXXXXXX
accept:application/json

== Info: TLSv1.2 (IN), TLS header, Unknown (23):
== Info: TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
== Info: TLSv1.2 (IN), TLS header, Unknown (23):
== Info: TLSv1.2 (OUT), TLS header, Unknown (23):
== Info: TLSv1.2 (IN), TLS header, Unknown (23):
== Info: TLSv1.2 (IN), TLS header, Unknown (23):
=> Recv header: HTTP/2 200
=> Recv header: cache-control: no-cache
=> Recv header: pragma: no-cache
=> Recv header: content-length: 744
=> Recv header: content-type: application/json; charset=utf-8
=> Recv header: expires: -1
=> Recv header: x-ms-correlation-request-id: xxxxxxxxxx
=> Recv header: x-ms-ratelimit-remaining-subscription-resource-requests: 999
=> Recv header: request-context: appId=xxxxxxxxxxxxxxx
=> Recv header: x-ms-request-id: xxxxxxxxxxxxxxxxxx
=> Recv header: strict-transport-security: max-age=31536000; includeSubDomains
=> Recv header: x-ms-routing-request-id: SWITZERLANDWEST:20241119T154130Z:f022af37-0e62-4dea-a9b9-34965b5f214b
=> Recv header: x-content-type-options: nosniff
=> Recv header: x-cache: CONFIG_NOCACHE
=> Recv header: x-msedge-ref: Ref A: 39A7132C18B24F65827E7B66E6F9BC4DDEEE Ref B: AMS2345432608033 Ref C: 2024-11-19T15:41:30Z
=> Recv header: date: Tue, 19 Nov 2024 15:41:30 GMT
=> Recv header:
=> Recv data: {"cost":29,"timespan":"2024-11-19T15:11:30Z/2024-11-19T15:41:30Z","interval":"PT15M","value":,{"id":"/subscriptions/xxxxxxxx/resourceGroups/xxxxxx/providers/Microsoft.CognitiveServices/accounts/xxxxx/providers/Microsoft.Insights/metrics/Latency","type":"Microsoft.Insights/metrics","name":{"value":"Latency","localizedValue":"Latency"},"displayDescription":"Latency in milliseconds. Do not use for Azure OpenAI service.","unit":"MilliSeconds","timeseries":e{"metadatavalues":a],"data":]{"timeStamp":"2024-11-19T15:11:00Z"},{"timeStamp":"2024-11-19T15:26:00Z"}]}],"errorCode":"Success"}],"namespace":"Microsoft.CognitiveServices/accounts","resourceregion":"francecentral"}
== Info: TLSv1.2 (IN), TLS header, Unknown (23):
== Info: Connection #0 to host XXXXXX left intact

And the log for  this alert :

 


@Mike there seems to be no average value in the returned JSON:

n
{
"id": "/subscriptions/xxxxxxxx/resourceGroups/xxxxxx/providers/Microsoft.CognitiveServices/accounts/xxxxx/providers/Microsoft.Insights/metrics/Latency",
"type": "Microsoft.Insights/metrics",
"name": {
"value": "Latency",
"localizedValue": "Latency"
},
"displayDescription": "Latency in milliseconds. Do not use for Azure OpenAI service.",
"unit": "MilliSeconds",
"timeseries": "
{
"metadatavalues": "],
"data": "
{
"timeStamp": "2024-11-19T15:11:00Z"
},
{
"timeStamp": "2024-11-19T15:26:00Z"
}
]
}
],
"errorCode": "Success"
}
]

Maybe the resource on the base of which the data is produced was stopped or unavailable between 15:11 and 15:26?


Maybe the resource on the base of which the data is produced was stopped or unavailable between 15:11 and 15:26?

That's what I'm having trouble with, the resource stops, but that's normal operation. Sometimes I get more than a hundred alerts in unknown state when everything is fine.


What do you mean by “that's normal operation”?

If there are planned outages, then you should either customize the check period for these services, or declared scheduled downtimes.


The “resources” switch off when they are not being used, which is normal.... but unpredictable.


Reply