SG SealGrid Athena Docs

Automatic Tagging Rules

A tagging rule tags agents for you. Each rule tests one field — a scan result or a plain inventory field — with a comparison, and asserts a single tag on every device that matches. Instead of hand-tagging machines, you describe the group once (“every agent with less than 20 GB free disk”) and Athena keeps the membership current as inventory changes. Because the tag lands in the same pool as manual tags, you can immediately target it with Commands, Deployment Packages, Scheduled Jobs and Monitors.

One rule = one condition = one tag

A rule has no “else” branch and no priority ordering — it either asserts its tag on a device or it does not. To assign several tags, or to test several conditions, create several rules. Conditions are evaluated on the server against the inventory and scan results agents have already reported, so a rule tags (and untags) offline machines too.

Which field a rule tests#

Every rule lives in one of two field universes. Which one it uses depends on whether you attach a scan definition:

UniverseWhen it appliesField tested
Scan field You attach a scan definition to the rule. A value returned by that scan when it runs on the agent — for example the free space a disk scan reports. Athena stores the result and the rule tests it.
Agent / inventory field No scan definition is attached. A plain field from the agent record — for example DomainName or OsVersion — with no scan involved.
A device with no data for the field is skipped

In both universes, an agent that has reported nothing for the tested field is skipped entirely — never tagged and never untagged. A rule with a “does not equal” style condition therefore won’t sweep in machines that simply haven’t run the scan yet; they show up as skipped in the preview (below), not as matches.

Comparison operators#

A condition is field → operator → value. Any of the ten operators can be used with any field:

OperatorMeaning
equalsThe field equals the value.
does not equalThe field is different from the value.
containsThe value appears somewhere in the field.
does not containThe value does not appear in the field.
starts withThe field begins with the value.
ends withThe field ends with the value.
is greater thanNumeric: the field is above the value.
is less thanNumeric: the field is below the value.
is greater than or equal toNumeric: the field is at or above the value.
is less than or equal toNumeric: the field is at or below the value.

Create a rule in the console#

Open Settings → Monitoring → Tagging Rules. The section lists every rule with its Name, Condition, Tag, Matches (how many agents currently carry the tag from this rule), Last Evaluated and an Enabled toggle. Choose New Rule to open the editor and fill in:

FieldWhat it does
Rule NameOperator-facing name. Required.
DescriptionOptional free text describing what the rule detects.
FieldThe field to test, chosen from the catalogue of available agent and scan fields. Required.
OperatorOne of the comparisons above.
ValueThe value the field is compared against. Required.
Target TagThe tag to assign. Existing tags are suggested as you type; a brand-new tag can simply be typed. Required.
EnabledWhether the rule starts asserting its tag immediately. Rules are enabled by default.
Preview the match count before you save

The editor has a Preview match count action that answers “how many agents would this condition tag right now?” from stored data only — nothing is written. A result of 0 usually means a wrong field, operator or value. The preview also reports how many agents were skipped because they have no data for the field; a large skip count generally means the scan hasn’t run fleet-wide yet, not that the condition is wrong. Creating rules and editing them requires the Admin role; the preview is available to Operator or Admin.

Saving a rule queues a background fleet sweep and returns immediately; the tag appears on matching devices once the sweep lands. The row’s Matches count and Last Evaluated time refresh when it finishes — there is no live progress bar, so re-open the section to see the result.

Re-evaluate, enable, disable, delete#

Rules re-evaluate automatically as inventory and scans update, but each row also has a Re-evaluate action, and the section header has Re-evaluate All (which sweeps every enabled rule). Both queue a whole-fleet sweep and never block.

Disabling is an immediate kill switch

Turning a rule off retracts its tag from every device it tagged, at once — so any Command, Deployment Package, Scheduled Job or Monitor aimed at that tag stops reaching those machines immediately. Deleting a rule does the same and removes the rule. Both actions ask for confirmation and show the blast radius (“this will remove the ‘tag’ tag from N agents”) first. Check the Matches count before you confirm.

Manual tags are never touched

Auto tags and manual tags share the same tag pool, but Athena tracks which rule asserted each auto tag separately. Disabling or deleting a rule only removes what that rule asserted; if the same tag was also typed manually on a device, or asserted by another rule, it stays. On a device’s detail page, tags are marked Manual, Rule or Both — rule-asserted tags are read-only there and can’t be removed by hand.

Manage rules via the REST API#

The same rule lifecycle is available under /api/tagging-rules. Reading rules requires a Helpdesk (or higher) token; the preview and field catalogue require Operator or Admin; creating, editing, enabling/disabling, deleting and forcing a re-evaluation require Admin.

Method & pathPurpose
GET /api/tagging-rulesList every rule (enabled or not).
GET /api/tagging-rules/{id}Read one rule with its latest match count and last-evaluated time.
POST /api/tagging-rulesCreate a rule. Queues a fleet sweep.
PUT /api/tagging-rules/{id}Update a rule. Any omitted field is left unchanged.
POST /api/tagging-rules/{id}/enabledEnable or disable a rule.
DELETE /api/tagging-rules/{id}Delete a rule and retract its auto-assigned tags.
POST /api/tagging-rules/{id}/evaluateQueue a whole-fleet re-evaluation of one rule.
POST /api/tagging-rules/evaluateQueue a re-evaluation of every enabled rule.
POST /api/tagging-rules/previewCount how many agents a draft condition would tag — persists nothing.
GET /api/tagging-rules/fieldsThe catalogue of fields a rule may test.
GET /api/tagging-rules/tagsThe fleet-wide pool of known tag names, for typeahead.

A scan-field rule attaches a scanDefinitionId; an agent/inventory-field rule omits it, so fieldName is the field path. The operator value is the numeric operator code (for example 0 for equals, 7 for is-less-than):

// Tag every device with less than 20 GB free (scan-field rule)
POST /api/tagging-rules
{
  "name": "Low Disk Space",
  "scanDefinitionId": "550e8400-e29b-41d4-a716-446655440000",
  "fieldName": "FreeGB",
  "operator": 7,
  "value": "20",
  "tag": "LowDisk",
  "isEnabled": true
}

// Tag every domain-joined device (agent-field rule — no scanDefinitionId)
POST /api/tagging-rules
{
  "name": "Domained",
  "fieldName": "DomainName",
  "operator": 0,
  "value": "corp.local",
  "tag": "Domained"
}

Updates use patch semantics: send only the fields you want to change, and a null field is left as-is. Editing the threshold on a rule therefore never renames its tag. A rule cannot be switched between the scan and agent/inventory universes by an update — that’s a delete-and-recreate.

Manage rules via PowerShell#

The Athena PowerShell module wraps the same endpoints. Operators use readable operator names such as LessThan and Equals.

# Scan-field rule: the disk scan runs on the agent, the threshold is checked on the server
New-AthenaTaggingRule -Name "Low Disk Space" -ScanDefinitionId $scanDefId `
    -FieldName "FreeGB" -Operator LessThan -Value "20" -Tag "LowDisk"

# Agent-field rule: no -ScanDefinitionId, so -FieldName IS the agent field path
New-AthenaTaggingRule -Name "Domain joined" -FieldName "DomainName" `
    -Operator Equals -Value "corp.local" -Tag "Domained"

# Park a rule disabled — it asserts nothing until enabled
New-AthenaTaggingRule -Name "Servers" -FieldName "OsVersion" -Operator Contains `
    -Value "Server" -Tag "Server" -Disabled

List rules, and read back their evaluation stats (there is no live progress stream — poll the rule to see a sweep land):

# All rules, or just the enabled ones that assign a given tag
Get-AthenaTaggingRule
Get-AthenaTaggingRule -EnabledOnly -Tag "LowDisk"

# Raise a threshold; -Value never renames the tag
Set-AthenaTaggingRule -Id $ruleId -Value "50"

# Disable a rule — retracts its auto-assigned tags; manual tags are untouched
Set-AthenaTaggingRule -Id $ruleId -Enabled $false

# Force a re-evaluation, then read the result back
Invoke-AthenaTaggingRuleEvaluation -Id $ruleId
Start-Sleep 5
Get-AthenaTaggingRule -Id $ruleId | Select-Object Name, MatchingAgentCount, LastEvaluatedAt

# Delete a rule (retracts its tags). -Force skips the confirmation prompt
Remove-AthenaTaggingRule -Id $ruleId -Force

Where auto tags flow#

An auto tag is indistinguishable from a manual one everywhere a tag is consumed — matching is case-insensitive, and a device needs only one matching tag. That means a single tagging rule can keep a whole workflow current:

WhereHow the auto tag is used
FilteringGet-AthenaAgent -Tag "LowDisk" returns every device the rule tagged.
CommandsInvoke-AthenaCommand -TargetTags "LowDisk" runs against the current members.
DeploymentsNew-AthenaDeployment -TargetTags @("Domained") rolls out to the tagged group.
Scheduled jobsNew-AthenaScheduledJob -TargetTags @("Server") aims a recurring job at the group.
MonitorsA monitor targeted by tag covers whichever devices the rule currently tags.
Related pages

See Agent Tags for typing tags by hand, Scans for defining the scans that supply scan-field values, and Collections for grouping devices another way.