Chapter 5. Red Hat Insights tagging overview

You can add descriptive tags to systems managed by Red Hat Insights, allowing you to add contextual markers to individual systems then filter by those tags in the Insights application to find unique or related systems. This functionality can be especially valuable when deploying Insights at scale, with many hundreds or thousands of systems under Insights management.

Note

The initial release of tagging is supported by Red Hat Insights Inventory and the Advisor service.

Prerequisites

The following prerequisites and conditions must be met to use the tagging feature in Red Hat Insights:

  • Root permissions, or their equivalent, are required to add to or change the tags.yaml file.
  • The Red Hat Insights client is installed and registered on each system.

5.1. Creating tags and tags.yaml

This section includes more information about creating tags and using the tags.yaml file.

5.1.1. Tag structure

Tags use a namespace/key=value paired structure.

  • Namespace. The namespace is the name of the ingestion point, insights-client, and cannot be changed. The tags.yaml file is abstracted from the namespace, which is injected by the client before upload.
  • Key. The key can be a user-chosen key or a predefined key from the system. You can use a mix of capitalization, letters, numbers, symbols and whitespace.
  • Value. Define your own descriptive string value. You can use a mix of capitalization, letters, numbers, symbols and whitespace.

5.1.2. The tags.yaml file

User-defined tags are added to the /etc/insights-client/tags.yaml file. You can add any number of key=value pairs to tags.yaml, as needed. The YAML syntax makes the contents easy to understand and modify.

Running insights-client --group=eastern-sap creates the tagging configuration file, /etc/insights-client/tags.yaml and adds the entry group: eastern-sap. The following example of a tags.yaml file shows additional tags added for the group “eastern-sap.”

Note

You can use any mix of capitalization, letters, numbers, symbols, and whitespace when creating key=value pairs.

Example

# tags
---
group: eastern-sap
name: Jane Example
contact: jexample@corporate.com
Zone: eastern time zone
Location:
- gray_rack
- basement
Application: SAP

5.2. Adding tags to systems

The easiest way to start adding tags to tags.yaml is by using insights-client --group=<name-you-choose>, which performs the following actions:

  1. Creates the etc/insights-client/tags.yaml file
  2. Adds the group key and <name-you-choose> value to tags.yaml
  3. Uploads a fresh archive from the system to cloud.redhat.com so that the new tag is immediately visible along with your latest results

After creating the initial group tag, can add additional tags as needed by editing tags.yaml.

The following procedure shows how to create the initial group, as well as the tags.yaml file, then verify the tag in the Insights inventory.

Procedure

  1. Run the following command, adding your group name after --group=:
[root@server ~]# insights-client --group=<name-you-choose>

Verification steps

  1. Navigate to Red Hat Insights > Inventory and log in if necessary.
  2. Click the Filters dropdown menu and select Tags.

    inv filter tags

  3. In the search box, click the down arrow and select one of the tags or enter the name of the tag.

    Note

    You can search by the tag key or value.

  4. Find your system among the results and verify that the tag icon is darkened and shows a number representing the number of tags applied to the system. inv system tags
  5. Click the tag to see each of the tags applied to that system.

5.3. Editing tags.yaml to add or change tags

After creating the group tag, you can edit the contents of tags.yaml to add or modify tags, as needed. You to add multiple, filterable tags to a system.

Procedure

  1. Using the command line, open the tag configuration file for editing.

    [root@server ~]# vi /etc/insights-client/tags.yaml
  2. Edit content or add additional key=value pairs as needed. The following example shows how you can organize tags.yaml when adding multiple tags to a system.

    # tags
    ---
    group: eastern-sap
    location: Boston
    description:
    - RHEL8
    - SAP
    key 4: value
    Note

    Add as many key=value pairs as you need. Use a mix of capitalization, letters, numbers, symbols, and whitespace.

  3. Save your changes and close the editor.
  4. Generate an upload to Insights.

    [root@server ~]# insights-client

Verification steps

  1. Navigate to Red Hat Insights > Inventory and log in if necessary.
  2. Click the Filters dropdown menu and select Tags.
  3. In the search box, click the down arrow and select one of the tags or enter the name of the tag and select it.

    Note

    You can search by the tag key or value.

  4. Find your system among the results.
  5. Verify that the tag icon is darkened and shows a number representing the number of tags applied to the system.
  6. Click the tag to see each of the tags applied to that system.