In addition to node groups, Environments allow you to segment nodes into groups via their common role. While a node can belong to many Node Groups at the same time, a node can only belong to a single Environment. If you have an application that has near identical nodes spanning across multiple Environments in your own infrastructure, for example development, UAT, staging, pre-production and production, you should place nodes into their corresponding Environment.
Creating an Environment
Every UpGuard Core account comes with a Default Environment. When nodes are added into UpGuard they are automatically assigned into the Default Environment, unless a rule has been configured that says otherwise (see Node Rules below).
To create a new Environment, navigate to Discover > Monitored and then locate the Add Environment button on the left panel. In the screenshot below, we already have a Production and Staging Environment in addition to the Default Environment.
Enter a name for the Environment and an optional short description. You can also enter node rules here which allow nodes to be automatically added to this Environment when they are added or when this Environment is created. Please refer to the Node Rules section below for examples and assignment logic and exceptions. Click Create Environment to create the new Environment.
When nodes are added, they are automatically assigned to the Default Environment. A node rule allows nodes to be directed and grouped into a custom Environment based on the name of the node matching a particular regular expression. You can list multiple regular expression patterns, one per line.
Node rules behave as follows:
- When a node is added, node rules from all Environments are checked against the name of the node in an arbitrary order and the node is assigned to the Environment with the first match. If no match is found, the node is assigned to the Default Environment.
- When an Environment is created, any nodes that match any of the new Environment’s node rules are pulled into that Environment, but only if they were assigned to the Default Environment before. No nodes are moved into this new Environment from a non-Default Environment.
- When an Environment’s node rules are edited, if any nodes in the Default Environment suddenly match any of the new rules then they are moved into this Environment. No nodes from non-Default Environments are moved, even if they match the new rule set.
Example Node Rules
To match all nodes that contain the string
To match nodes that have a name beginning with
To match nodes that have a name ending with a two digit number, use:
For information about grouping nodes using Node Groups, please refer to our guide on Node Groups.
For information around using variables to define the slight differences between nodes in each Environment, please refer to our guide on How to use Environment Variable Overrides.