Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS 3243: DOCS-3243: Use sbc-hwmonitor sensor #3893

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/build/configure/conditional-data-ingested.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/build/configure/trigger-create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/how-tos/telegraf-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/services/data/sensor-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 63 additions & 59 deletions docs/manage/troubleshoot/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,60 +38,48 @@ You can also configure alerts on any other machine data, for more information on

## Data meets condition

The following steps let you configure the [`viam-telegraf-sensor`](https://app.viam.com/module/viam/viam-telegraf-sensor) to monitor the following metrics about the performance of individual machines or your entire fleet:
The following steps let you configure [`sbc-hwmonitor`](https://app.viam.com/module/rinzlerlabs/sbc-hwmonitor) sensors to monitor different metrics about a machine, such as:

- **Wireless Signal Strength and Quality**: Signal level, link quality, and noise level
- **Memory Usage**: Memory statistics, including total available memory, used percentage, and specifics on various types of memory (cached, free, slab, etc.)
- **CPU Usage**: CPU usage across different states (user, system, idle, etc.)
- **Disk I/O**: Metrics on read and write operations, including bytes transferred and operation times
- **Network Traffic**: Detailed network statistics, including bytes sent and received, packet information, and error counts, providing a deep dive into a device's network performance
- `memory_monitor`: Memory stats for the SBC.
- `cpu_monitor`: Reports per-core and overall usage percentages.
- `temperature`: Reports the temperature of various temperature sensors.

### Prerequisites
{{% expand "On macOS use telegraf instead. Click to see more info." %}}

{{% expand "A running machine connected to the Viam app. Click to see instructions." %}}
[`sbc-hwmonitor`](https://app.viam.com/module/rinzlerlabs/sbc-hwmonitor) is not supported on macOS.
You can use the [`telegraf`](https://app.viam.com/module/viam/viam-telegraf-sensor) sensor instead.

{{% snippet "setup.md" %}}
You must also install telegraf by running `brew install telegraf` in your terminal before using this module.

{{% /expand%}}

{{% expand "Install telegraf. Click to see instructions." %}}
### Prerequisites

On macOS, you must also install telegraf by running `brew install telegraf` in your terminal before using this module.
{{% expand "A running machine connected to the Viam app. Click to see instructions." %}}

If you are on another operating system, telegraf will be installed automatically for you.
{{% snippet "setup.md" %}}

{{% /expand%}}

{{< alert title="Note" color="note" >}}
You must run `viam-server` with `sudo` to monitor machine performance metrics.
{{< /alert >}}

### Add performance sensor

{{< table >}}
{{% tablestep link="/operate/reference/module-configuration/#modular-resource-configuration-details" %}}
**1. Add the performance metrics sensor**
**1. Add the performance metrics sensors**

On your machine's **CONFIGURE** page, click the **+** icon next to your machine part in the left-hand menu and select **Component**.

Search for and add the `viam:viam-sensor:telegrafsensor` model provided by the [`viam-telegraf-sensor` module](https://app.viam.com/module/viam/viam-telegraf-sensor).
Search for and add the `hwmonitor:cpu_monitor` model provided by the [`sbc-hwmonitor`](https://app.viam.com/module/rinzlerlabs/sbc-hwmonitor).

{{% /tablestep %}}

<!-- markdownlint-disable-file MD034 -->

{{% tablestep link="https://github.com/viamrobotics/viam-telegraf-sensor" %}}
{{% tablestep link="https://github.com/rinzlerlabs/viam-sbc-hwmonitor" %}}
**2. (Optional) Customize the sensor configuration**

To enable or disable specific metrics, add them to the attributes configuration.
You can find a list of configurable attributes in the [module README](https://github.com/viamrobotics/viam-telegraf-sensor).
For example:

```json
{
"disable_kernel": true
}
```
Add additional sensors for any other metrics you want to track.
You can find a list of the sensors the [`sbc-hwmonitor`](https://app.viam.com/module/rinzlerlabs/sbc-hwmonitor) module provides in the [module README](https://github.com/rinzlerlabs/viam-sbc-hwmonitor).

{{% /tablestep %}}
{{% tablestep %}}
Expand Down Expand Up @@ -123,9 +111,9 @@ Also leave both **Capturing** and **Syncing** toggles in the "on" position.

{{% /tablestep %}}
{{% tablestep %}}
**2. Configure data capture on the telegraf sensor**
**2. Configure data capture on the sensor**

Return to your `telegrafsensor`'s configuration card.
Return to your sensor's configuration card.

In the **Data capture** section, click **Add method**.

Expand Down Expand Up @@ -166,7 +154,7 @@ If you do not immediately see data, wait a minute for the data to be captured an
Next, add any conditions.

These can include a key, a value, and a logical operator.
For example, a trigger configured to fire when data is captured from the motor `motor-1`'s `IsPowered` method when `is_on` is equal to `True`:
For example, a trigger configured to fire when data is captured from the sensor `cpu-monitor`'s `Readings` method when `cpu` is greater than to `50`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, a trigger configured to fire when data is captured from the sensor `cpu-monitor`'s `Readings` method when `cpu` is greater than to `50`:
For example, a trigger configured to fire when data is captured from the sensor `cpu-monitor`'s `Readings` method when `cpu` is greater than `50`:


{{<imgproc src="/build/configure/conditional-data-ingested.png" resize="x400" declaredimensions=true alt="Example conditional data ingestion trigger with a condition." >}}

Expand Down Expand Up @@ -327,9 +315,9 @@ Examples:
"condition": {
"evals": [
{
"operator": "lt",
"operator": "gt",
"value": {
"Line-Neutral AC RMS Voltage": 130
"cpu": 50
}
}
]
Expand All @@ -341,14 +329,16 @@ This eval would trigger for the following sensor reading:
```json {class="line-numbers linkable-line-numbers"}
{
"readings": {
"Line-Neutral AC RMS Voltage": 100
"cpu": 80
}
}
```

{{% /tab %}}
{{% tab name="2 levels of nesting" %}}

If you are using a different sensor, you may want to trigger on nested data:

```json {class="line-numbers linkable-line-numbers"}
"condition": {
"evals": [
Expand Down Expand Up @@ -446,29 +436,19 @@ To configure your trigger by using **JSON** mode instead of **Builder** mode, pa
{
"components": [
{
"name": "local",
"model": "pi",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": []
},
{
"name": "my_temp_sensor",
"model": "bme280",
"type": "sensor",
"namespace": "rdk",
"name": "cpu-monitor",
"api": "rdk:component:sensor",
"model": "rinzlerlabs:hwmonitor:cpu_monitor",
"attributes": {},
"depends_on": [],
"service_configs": [
{
"type": "data_manager",
"attributes": {
"capture_methods": [
{
"method": "Readings",
"additional_params": {},
"capture_frequency_hz": 0.017
"capture_frequency_hz": 0.05,
"additional_params": {}
}
]
}
Expand Down Expand Up @@ -563,12 +543,24 @@ To configure your trigger by using **JSON** mode instead of **Builder** mode, pa
{
"components": [
{
"name": "local",
"model": "pi",
"type": "board",
"namespace": "rdk",
"name": "cpu-monitor",
"api": "rdk:component:sensor",
"model": "rinzlerlabs:hwmonitor:cpu_monitor",
"attributes": {},
"depends_on": []
"service_configs": [
{
"type": "data_manager",
"attributes": {
"capture_methods": [
{
"method": "Readings",
"capture_frequency_hz": 0.05,
"additional_params": {}
}
]
}
}
]
}
],
"triggers": [
Expand Down Expand Up @@ -655,12 +647,24 @@ To configure your trigger by using **JSON** mode instead of **Builder** mode, pa
{
"components": [
{
"name": "local",
"model": "pi",
"type": "board",
"namespace": "rdk",
"name": "cpu-monitor",
"api": "rdk:component:sensor",
"model": "rinzlerlabs:hwmonitor:cpu_monitor",
"attributes": {},
"depends_on": []
"service_configs": [
{
"type": "data_manager",
"attributes": {
"capture_methods": [
{
"method": "Readings",
"capture_frequency_hz": 0.05,
"additional_params": {}
}
]
}
}
]
}
],
"triggers": [
Expand Down
Loading