Reputation: 133
I am new to Azure IOT edge and have been following few documentations on collecting metrics using metric collector module(mcr.microsoft.com/azureiotedge-metrics-collector).
I am following option 2, from this documentation.
I have done all the necessary configurations as per this doc and I am receiving metrics from edgeAgent, but not from edgeHub. The error says connection refused.
I am using a Linux VM as an IOT edge device. The upload target for my case is 'IoTMessage'. Hence LogAnalytics values are left empty. I have taken this example file as reference.
Am I missing something here to make it work?
I have already tried edgeHub doesn't expose metrics solution, but no luck.
logs below
[2022-03-25 09:24:08.635 INF] Starting periodic operation Scrape and Upload Metrics...
[2022-03-25 09:24:08.636 INF] Scraping endpoint http://edgeHub:9600/metrics
[2022-03-25 09:24:08.637 INF] Scraping endpoint http://edgeAgent:9600/metrics
[2022-03-25 09:24:08.641 ERR] Error scraping endpoint http://edgeHub:9600/metrics - System.Net.Http.HttpRequestException: Connection refused
---> System.Net.Sockets.SocketException (111): Connection refused
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Azure.Devices.Edge.Azure.Monitor.MetricsScraper.ScrapeEndpoint(String endpoint, CancellationToken cancellationToken) in /home/vsts/work/1/s/edge-modules/azure-monitor/src/MetricsScraper.cs:line 72
[2022-03-25 09:24:08.642 INF] Scraping finished, received 0 metrics from endpoint http://edgeHub:9600/metrics
[2022-03-25 09:24:08.645 INF] Scraping finished, received 171 metrics from endpoint http://edgeAgent:9600/metrics
Upvotes: 0
Views: 522
Reputation: 133
For my case, the issue was with older version of edge hub module which I had. Once I deployed the latest version (1.2.8), I was able to receive metrics at both the endpoint.
If there's still connection refused error, this solution can also be tried.
please make sure adding route to edge hub something like this
"FromMetricsCollectorToUpstream": "FROM /messages/modules/<Name_Of_Your MetricsCollector_Module>/outputs/* INTO $upstream",
Upvotes: 0