cDOT Environment Monitoring Using PowerShell

Environmental information, for example temperature, fan speed, etc., provide critical information about the health of your clustered Data ONTAP system. Depending on your version of ONTAP, you can query the environmental information different ways to find out the status.

With ZAPI version 1.21 and above (cDOT 8.2.3+) the environment-sensors-get-iter API exists, which makes it excessively easy to collect environmental information about the controllers. We can take the same approach with environmental sensors as performance information:

Querying ZAPI Directly

Using the Invoke-NcSystemApi cmdlet we can execute ZAPI directly. Don’t be intimidated by this, it’s quite easy! To view all of the sensor data, we can execute the Invoke-NcSystemApi cmdlet. Because the API is an iter it means that there is the potential for not all of the results to be returned at once, so we must iterate over the API until all of them are returned. The cluster knows where to start by using the “next-tag” item:

The $result variable now contains an array of XML objects with the results. PowerShell conveniently turns the ZAPI response (which is XML) into an object which can be accessed using the traditional dot notation. To view the returned data:

Which shows us a long list (depending on how many controllers you have). Here is a snippet from my cluster:

Finding the Desired Sensor(s)

Much like with performance reporting, there are three levels of detail:

  • Sensor Type
  • Sensor Name
  • Sensor Value(s)

To show the list of all the different sensor types we first query the API, as above, then we find all the unique sensor types:

This results in eight different sensors returned from my system.

For the full list we can simply look to the documentation:

  • “fan” – FAN RPM sensors
  • “thermal” – Temerature sensors
  • “voltage” – Voltage measurement sensors
  • “current” – Current measurement sensors
  • “battery-life” – Sensors report battery life
  • “discrete” – Discrete sensors
  • “fru” – FRU sensors
  • “nvmem” – Sensors on the NVMEM module
  • “counter” – Sensors report in counters
  • “minutes” – Sensors report by minutes
  • “percent” – Sensors report in percentage
  • “agent” – Sensors on or throught the Agent device
  • “unknown” – Unknown sensors

Going down to the next level, we want to find the sensor names for each type. Let’s look at an example using the thermal type:

The sensor type thermal has 14 sensors:

And, finally, we can get the value(s) we’re interested in:

Making It Better

Putting it all together we get this:

The result, for my cluster, looks like this:

Of course, this is all terribly inefficient since it collects all of the sensor information for each query…about 100 per node. We can narrow down the scope of each query using the API which will make things much faster. For example, we can limit the the sensor type and sensor name by modifying the ZAPI appropriately.

This results in a much faster call (about 2 seconds vs 12 seconds), and a lot less PowerShell for filtering out unwanted objects. The result is exactly the same as above, but only those 8 results are returned instead of the original 790, which means we don’t have to work as hard for the iteration either.

Please reach out to me using the comments below or the NetApp Community site with any questions about how to collect environmental information from your systems.

1 thought on “cDOT Environment Monitoring Using PowerShell

Leave a Reply