2

Background

I'm using Azure-cli (version >2.3.1) to create IoT Edge deployments:

echo az iot edge deployment create --content $(iotDeploymentPath) --deployment-id $(deploymentId) --hub-name  ${hub} --priority $(priority) --target-condition "tags.location.place='$(env)'"

and for getting the metrics:

targetedCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id targetedCount  --hub-name ${hub})"
appliedCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id appliedCount  --hub-name ${hub})"
reportedSuccessfulCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id reportedSuccessfulCount   --hub-name ${hub})"

A few days ago, we got the following error message while trying to receive the deployment's metrics:

the metric 'targetedCount' is not defined in the device configuration $(deploymentId)

the metric 'appliedCount' is not defined in the device configuration $(deploymentId)

the metric 'reportedSuccessfulCount' is not defined in the device configuration $(deploymentId)

with the following depracation message:

This extension 'azure-cli-iot-ext' is deprecated and scheduled for removal. Please remove and add 'azure-iot' instead.

So I've installed 'azure-iot' instead of 'azure-cli-iot-ext', but now it seems like az iot edge deployment show-metric stopped working and keeps sending the error message mentioned above.

the metric 'targetedCount' is not defined in the device configuration $(deploymentId)

the metric 'appliedCount' is not defined in the device configuration $(deploymentId)

the metric 'reportedSuccessfulCount' is not defined in the device configuration $(deploymentId)

Question:

How can I get those metrics back without having the CLI deprecated extanstion version?

Chamberlain
  • 881
  • 5
  • 17
Livne Rosenblum
  • 196
  • 1
  • 12
  • When you say the `az iot edge deployment show-metric` "stopped working", what do you mean? Is there an error? – Matthijs van der Veer Aug 12 '20 at 11:34
  • I use the same in a pipeline and just looked at my logs and everything seems to be working. Is your pipeline passing the `deploymentId` parameter through properly? The error looks to be as though it cannot parse the parameter. – Martyn C Aug 12 '20 at 16:23

1 Answers1

1

Quoting Azure support team answer:

I just received an update from our Product Group. They have informed me that before azure-cli-iot-ext 0.8.7, iot edge deployment show-metric would only work against system metrics. After, an argument was introduced for the user to be able to switch between system and user metrics but to match iot hub configuration show-metric, the user metrics became the default (which carried over to azure-iot).

In addition, the PG member pointed out that all the metrics causing issues with appear to be system metrics. In that case, please try adding the --metric-type or –mt argument with value ‘system’.

For example:

az iot edge deployment show-metric -n myiothub -d mydeployment -m targetedCount --mt system

Livne Rosenblum
  • 196
  • 1
  • 12