> For the complete documentation index, see [llms.txt](https://asus-isg-aidc.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asus-isg-aidc.gitbook.io/guide/latest/cli/commandreference/hardwaresensor.md).

# Hardware Sensor

| Developer | Last modified |
| --------- | ------------- |
| AIDC Team | 2026/07/06    |

## Table of Contents

* [1. Overview](#overview)
* [2. Source Modes](#source-modes)
* [3. Common Flags](#common-flags)
* [4. Subcommands](#subcommands)
* [5. Usage Examples](#usage-examples)

***

## 1. Overview <a href="#overview" id="overview"></a>

{% hint style="warning" %}
**⚠️ Prerequisite: `aidc-cli init` required first**

This command depends on settings saved by [`aidc-cli init`](/guide/latest/cli/commandreference/init.md). Before running it, make sure you have completed:

* [`aidc-cli init inventory`](/guide/latest/cli/commandreference/init.md#inventory) — render the node inventory from `aidc.csv`
* SSH access to the nodes — [`aidc-cli deploy install`](/guide/latest/cli/commandreference/deploy.md) sets this up during OS deployment; for nodes that already have an OS, run [`aidc-cli deploy access-key`](/guide/latest/cli/commandreference/deploy.md) or fill the `password` column in `aidc.csv`
* [`aidc-cli init bmc-set`](/guide/latest/cli/commandreference/init.md#bmc-configuration) — save the BMC credentials

For the full setup sequence, see the [Getting Started](/guide/latest/cli/gettingstarted.md) guide.
{% endhint %}

The `hwsensor` command monitors hardware sensor data from target nodes. The current command model uses four sensor-focused subcommands and a `--source` flag to choose between in-band collection and BMC Redfish collection when both are supported.

```bash
aidc-cli hwsensor <subcommand> [flags]
```

***

## 2. Source Modes <a href="#source-modes" id="source-modes"></a>

| Subcommand    | Purpose                                   | Supported Sources   | Default Source |
| ------------- | ----------------------------------------- | ------------------- | -------------- |
| `temperature` | Monitor temperature sensor data           | `inband`, `redfish` | `inband`       |
| `power`       | Monitor power sensor data                 | `inband`, `redfish` | `inband`       |
| `fan`         | Monitor fan sensor data                   | `redfish` only      | `redfish`      |
| `all`         | Monitor all available Redfish sensor data | `redfish` only      | `redfish`      |

{% hint style="info" %}
The older `temperature-redfish`, `power-redfish`, `fan-redfish`, and `all-redfish` command forms are no longer used. Use the `--source` flag on the current subcommands instead.
{% endhint %}

***

## 3. Common Flags <a href="#common-flags" id="common-flags"></a>

All `hwsensor` subcommands share the following flags:

| Flag           | Short | Required |        Default        | Description                                                                                                       |
| -------------- | :---: | :------: | :-------------------: | ----------------------------------------------------------------------------------------------------------------- |
| `--source`     |   —   |     ❌    | Depends on subcommand | Sensor source. `temperature` / `power`: `inband` (default) or `redfish`; `fan` / `all`: `redfish` only (default). |
| `--interval`   |  `-I` |     ❌    |          `15`         | Seconds between requests. Must be greater than `0`.                                                               |
| `--times`      |   —   |     ❌    |          `20`         | Number of collection iterations. Must be greater than `0`.                                                        |
| `--background` |  `-b` |     ❌    |        `false`        | Run the monitoring task in background mode.                                                                       |

{% hint style="info" %}
`--interval` and `--times` are measured in seconds for all current `hwsensor` subcommands.
{% endhint %}

***

## 4. Subcommands <a href="#subcommands" id="subcommands"></a>

### 4.1 `temperature` — Monitor Temperature Sensor Data

Collects temperature readings from the selected source.

```bash
aidc-cli hwsensor temperature [--source <inband|redfish>] [-I <seconds>] [--times <count>] [-b]
```

### 4.2 `power` — Monitor Power Sensor Data

Collects power readings from the selected source.

```bash
aidc-cli hwsensor power [--source <inband|redfish>] [-I <seconds>] [--times <count>] [-b]
```

### 4.3 `fan` — Monitor Fan Sensor Data

Collects fan readings through BMC Redfish.

```bash
aidc-cli hwsensor fan [-I <seconds>] [--times <count>] [-b]
```

### 4.4 `all` — Monitor All Redfish Sensor Data

Collects all available Redfish sensor data in one run.

```bash
aidc-cli hwsensor all [-I <seconds>] [--times <count>] [-b]
```

***

## 5. Usage Examples <a href="#usage-examples" id="usage-examples"></a>

```bash
# Monitor temperature with the default in-band source
aidc-cli hwsensor temperature

# Monitor temperature through Redfish every 5 seconds for 12 iterations
aidc-cli hwsensor temperature --source redfish -I 5 --times 12

# Monitor power in background mode
aidc-cli hwsensor power -I 10 --times 30 -b

# Monitor fan sensors through Redfish
aidc-cli hwsensor fan -I 3 --times 20

# Collect all Redfish sensor data from specific nodes only
aidc-cli hwsensor all -I 2 --times 15 -l node01,node02
```
