Monitor machine performance metrics

You can use the viam-telegraf-sensor module to capture and monitor the following metrics about the performance of individual machines or your entire fleet:

  • 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

Prerequisites

Install telegraf. Click to see instructions.

On macOS, you must also install telegraf by running brew install telegraf in your terminal before using this module.

If you are on another operating system, telegraf will be installed automatically for you.

A running machine connected to the Viam app. Click to see instructions.
Add a new machine in the Viam app. Then follow the setup instructions to install viam-server on the computer you’re using for your project and connect to the Viam app. Wait until your machine has successfully connected.

Add the telegraf-sensor

1. Add the performance metrics sensor

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.

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. For example:

{
  "disable_kernel": true
}

3. Test the sensor

Save the configuration.

Now, click Test at the bottom of the sensor configuration card to view the readings. You can also see readings on the CONTROL tab.

Test panel with readings displayed.

Configure the data management service

To capture the data from your configured sensor, you need to add the data management service and configure it to capture and sync the sensor data:

1. Add the data management service

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

Select the data management / RDK service and click Create. You can leave the default data sync interval of 0.1 minutes to sync every 6 seconds. Also leave both Capturing and Syncing toggles in the “on” position.

2. Configure data capture on the telegraf sensor

Return to your telegrafsensor’s configuration card.

In the Data capture section, click Add method.

From the Method dropdown select Readings. Set the Frequency to 0.05 Hz to capture readings once every 20 seconds.

Sensor readings capture configuration.

Save your config.

View synced data

Click the menu in the upper-right corner of the sensor configuration card. Select View captured data. If you do not immediately see data, wait a minute for the data to be captured and synced at the intervals you specified, then refresh the page.

View of sensor data

Stop data capture

If this is a test project, make sure you stop data capture to avoid charges for a large amount of unwanted data.

In the Data capture section of your sensor’s configuration, toggle the switch to Off.

Click the Save button in the top right corner of the page to save your config.

Next steps

The data you obtain about your machines is associated with metadata about the machine and time of capture. Once you have captured data about your machines, you can query your captured data with any tools that with SQL or MQL or visualize your data with tools like Grafana:

Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.