---
title: "Action: perform a Guardian action"
description: "Have Guardian act on its own inventory when an event happens."
product: "Guardian"
edition: "Classic"
type: "workflow"
url: "https://docs.cloudhouse.com/guardian/classic/control/events/actions/guardianaction/"
---
# Action: perform a Guardian action

Have Guardian act on its own inventory when an event happens. You can use this feature to automate maintenance of your node inventory. For example, you can define rules that automatically add newly detected nodes to appropriate node groups. Or, you can configure actions to perform certain scans when triggered, including node scans, node group scans, and environment scans.

Applies to: `Guardian Classic`

![Screenshot showing the Add Action page in Guardian for Performing a Guardian Action](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-action-overview.png)

!!! tip

    For an overview of actions in Guardian, including more options available to choose from, see [Actions](https://docs.cloudhouse.com/guardian/classic/control/events/actions/actions/index.md).

## Action settings

When configuring a Guardian action, the following settings are displayed:

**Action name** field
:   A unique name for the action. This name is how you will identify this action among all others configured in your Guardian instance, so ensure it is descriptive. For example, 'New Nodes to Windows Group' and not simply 'New Nodes'.

**Guardian Action** drop-down list
:   A list of available actions Guardian can take when this action is triggered, including:

    - 'Add Node to Group'.
    - 'Remove Node from Group'.
    - 'Delete Node'.
    - 'Move Node to Environment'.
    - 'Start Node Scan'.
    - 'Start Node Group Scan'.
    - 'Start Environment Scan'.

    !!! note

        The selection you make from this drop-down will display additional fields. Refer to the tables below for more information on what is required for your chosen action.

### Add node to group

This action lets you automatically add newly detected nodes to certain groups. For example, you could configure this action to automatically add new nodes running Windows operating systems to your Windows node group.

![Screenshot showing the Add Action page in Guardian for adding a node to a group](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-addnodetogroup.png)

When configuring an **Add Node to Group** action, the following fields are displayed:

**Node** field
:   The ID of the node you want to add to a group. In this field, you can input the variable `{{ node_id }}` to automatically use the ID of the node that triggered the action.

**Node Group** field
:   The ID of the node group you want to add the node to. You can find a node group's ID in the URL displayed when you are viewing that node group from the monitored tab. For example, in the URL `https://guardian-test.cloudhouse.com/node_groups#/1234?state=index`, '1234' is the node group ID.

### Remove node from group

This action lets you automatically remove nodes from certain groups. For example, if a node is moved from one physical region to another, you may want to remove it from a location-specific node group.

![Screenshot showing the Add Action page in Guardian for removing a node from a group](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-removenodefromgroup.png)

When configuring a **Remove Node from Group** action, the following fields are displayed:

**Node** field
:   The ID of the node you want to remove from a group. In this field, you can input the variable `{{ node_id }}` to automatically use the ID of the node that triggered the action.

**Node Group** field
:   The ID of the node group you want to remove the node from. You can find a node group's ID in the URL displayed when you are viewing that node group from the **Monitored** tab. For example, in the URL `https://guardian-test.cloudhouse.com/node_groups#/**1234**?state=index`, '1234' is the node group ID.

### Delete node

This action lets you automatically delete nodes if they are no longer needed. For example, if a node is no longer scanning or has failed a series of consecutive scans, you can configure this action to delete it from your inventory.

![Screenshot showing the Add Action page in Guardian for deleting a node](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-deletenode.png)

When configuring a **Delete Node** action, the following fields are displayed:

**Node** field
:   The ID of the node you want to delete. In this field, you can input the variable `{{ node_id }}` to automatically use the ID of the node that triggered the action.

### Move Node to Environment

This action lets you automatically move nodes from one environment to another. For example, if a node repeatedly fails scans or causes other issues, this action can move it from your production environment to an environment you have set up that is dedicated to investigating troublesome nodes.

![Screenshot showing the Add Action page in Guardian for moving a node to a different environment](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-movetoenvironment.png)

When configuring a **Move Node to Environment** action, the following fields are displayed:

**Node** field
:   The ID of the node you want to move. In this field, you can input the variable `{{ node_id }}` to automatically use the ID of the node that triggered the action.

**Environment** field
:   The name or ID of the environment you want to move the node to. You can find an environment's ID in the URL displayed when you are viewing that environment from the **Monitored** tab. For example, in the URL `https://guardian-test.cloudhouse.com/node_groups#/environments/**1234**?state=index`, '1234' is the environment ID.

### Start Node Scan

This action lets you automatically start a node scan. For example, if a specific change is detected within your Guardian instance that may pose a risk for a specific node (or nodes), this action can run a node scan immediately rather than waiting for the next scheduled scan.

![Screenshot showing the Add Action page in Guardian for starting a node scan](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-startnodescan.png)

When configuring a **Start Node Scan** action, the following fields are displayed:

**Node** field
:   The ID of the node you want to scan. In this field, you can input the variable `{{ node_id }}` to automatically use the ID of the node that triggered the action.

### Start Node Group Scan

This action lets you automatically start a node group scan. For example, if a specific change is detected within your Guardian instance that may pose a risk for a specific node group, this action can run a scan of the node group immediately rather than waiting for the next scheduled scan.

![Screenshot showing the Add Action page in Guardian for starting a node group scan](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-nodegroupscan.png)

When configuring a **Start Node Group Scan** action, the following fields are displayed:

**Node Group** field
:   The ID of the node group you want to scan. In this field, you can input the variable `{{ node_group }}` to automatically scan the node group that triggered the action.

### Start Environment Scan

This action lets you automatically start a scan of an environment. For example, if a specific change is detected within your Guardian instance that may pose a risk to your inventory, this action can run a scan of your environment rather than waiting for the next scheduled scan.

![Screenshot showing the Add Action page in Guardian for starting an environment scan](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/guardianaction/guardian-environmentscan.png)

When configuring a **Start Environment Scan** action, the following fields are displayed:

**Environment** field
:   The ID of the environment you want to scan. In this field, you can input the variable `{{ id }}` to automatically scan the environment relevant to the action.

## Add a Guardian action

You can configure a new **Guardian Action** to be triggered by any saved view in your Guardian instance. Each saved view represents a specific event determined using a query on the **Events** page. The saved view you select during this configuration determines the corresponding event that triggers your new action. For more information, see [Saved Views](https://docs.cloudhouse.com/guardian/classic/control/events/events/index.md#saved-views).

1. Navigate to the **Events** tab (**Control** > **Events**).
2. Click the **Saved Views** button at the top of the page. The Saved Views side panel is displayed.

    ![Screenshot showing the Guardian Events page with a border around the Saved Views button.](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/add-action-01.png)

3. Select the event you want to trigger your new action. The saved view for that event is displayed.
4. Click the **Actions** tab to display all existing actions configured for this event.
5. Click the **Add Action** button. The **Add New Action** page is displayed.

    ![Screenshot showing the Guardian Events page with a border around the Actinos tab and the Add Action button.](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/control/events/add-action-02.png)

6. Click **Perform a Guardian Action**. The required fields are displayed.
7. Select an action from the **Guardian Action** drop-down.
8. Complete the provided fields.

    !!! note

        The fields provided depend on the Guardian Action you selected in the previous step. For information regarding each field and what it requires, see the for your selected action above.

9. Click **Done**.

Now, a confirmation dialog is displayed and you are redirected to the **Actions** tab for your selected saved view. Here, you can view your new action. To disable, edit, or test the action, click the **Ellipsis** (![Ellipses](https://docs.cloudhouse.com/guardian/classic/assets/images/guardian/buttons/ellipses.png)) and select the appropriate option.
