Use labels to organize devices
Use labels to organize, filter, and group your edge devices in Red Hat Edge Manager.
Viewing devices and their labels by using the Flight Control CLI
View devices and their associated labels. You can use labels to organize your devices and device fleets.
Complete the following steps:
- View devices in your inventory by using the
-o wideoption:flightctl get devices -o wideSee the following example output:
NAME ALIAS OWNER SYSTEM UPDATED APPLICATIONS LAST SEEN LABELS <device1_name> <none> <none> Online Up-to-date <none> 3 seconds ago region=eu-west-1,site=factory-berlin <device2_name> <none> <none> Online Up-to-date <none> 1 minute ago region=eu-west-1,site=factory-madrid - View devices in your inventory with a specific label or set of labels by using the
-l <key=value>option:flightctl get devices -l site=factory-berlin -o wideSee the following example output:
NAME ALIAS OWNER SYSTEM UPDATED APPLICATIONS LAST SEEN LABELS <device1_name> <none> <none> Online Up-to-date <none> 3 seconds ago region=eu-west-1,site=factory-berlin
Updating labels by using the CLI
Update labels on your devices by using the CLI. Complete the following steps:
- Export the current definition of the device into a file by running the following command:
flightctl get device/<device1_name> -o yaml > my_device.yaml - Use your preferred editor to edit the
my_device.yamlfile. See the following example:apiVersion: flightctl.io/v1alpha1 kind: Device metadata: labels: some_key: some_value some_other_key: some_other_value name: <device1_name> spec: [...] - Save the file and apply the updated device definition by running the following command:
flightctl apply -f my_device.yaml - Verify that the changes are applied by running the following command:
flightctl get devices -o wideSee the following example output:
NAME ALIAS OWNER SYSTEM UPDATED APPLICATIONS LAST SEEN LABELS <device1_name> <none> <none> Online Up-to-date <none> 3 minutes ago some_key=some_value,some_other_key=some_other_value <device2_name> <none> <none> Online Up-to-date <none> 4 minutes ago region=eu-west-1,site=factory-madrid