Monitor device resources

You can configure resource monitors for device resources and create alerts when the utilization of resources crosses a defined threshold. When the agent alerts the Red Hat Edge Manager service, the service sets the device status to degraded or error, depending on the severity level.

Resource monitors take the following parameters:

Table 1. Resource monitor parameters
Parameter Description

MonitorType

The resource to monitor. The CPU, Memory, and Disk resources are currently supported.

SamplingInterval

The interval in which the monitor samples usage, specified as a positive integer followed by a time unit: s for seconds, m for minutes, h for hours.

AlertRules

A list of alert rules.

Path

For Disk monitor only. The absolute path to the directory to monitor. Utilization reflects the file system that contains the path, even if the defined path is not a mount point.

Alert rules take the following parameters:

Table 2. Alert rule parameters
Parameter Description

Severity

The severity of the alert rule can be Info, Warning, or Critical. Only one alert rule is allowed for each severity level and monitor.

Duration

The duration that resource usage is measured and averaged over when sampling, specified as a positive integer followed by a time unit: s for seconds, m for minutes, h for hours. The duration must be smaller than the sampling interval.

Percentage

The usage threshold that triggers the alert, as percentage value. The value ranges from 0 to 100 without the % sign.

Description

A human-readable description of the alert. Add details about the alert to help with debugging. By default, the alert description is load is above >% for more than.

Monitoring device resources using the CLI

Monitor the resources of your device through the CLI, providing you with the tools and commands to track performance and troubleshoot issues.

Complete the following steps:

  • Add resource monitors in the spec.resources section of the device specification. For example, add the following monitor for your disk:
    apiVersion: flightctl.io/v1alpha1
    kind: Device
    metadata:
      name: <device_name>
    spec:
      resources:
      - monitorType: Disk
        samplingInterval: 5s
        path: /application_data
        alertRules:
        - severity: Warning
          duration: 30m
          percentage: 75
          description: Disk space for application data is >75% full for over 30m.
        - severity: Critical
          duration: 10m
          percentage: 90
          description: Disk space for application data is >90% full over 10m.