# Automation Rules
Fairwinds Insights can automate certain actions within Insights. For instance you could create Automation Rules to:
- Set Assignee, Resolution and Severity level for Action Items that match a certain pattern
- Create Action Item exceptions for resources in a cluster or namespace
- Send a Slack message when certain Action Items are detected in clusters
# Creating Automation Rules
# Using the Insights UI
- Visit your organization's
Automation
page - Click the
Create Custom Rule
button
You'll see a sample Rule that modifies the description of low severity Action Items. This should give you a quick sense for how to write Automation Rules for Insights.
Insights also comes with several templates for Automation Rules which you can modify as needed. To view these templates:
- Visit your organization's
Automation
page - Click the
Create From Template
button
# Using the Insights CLI
To manage rules in an infrastructure-as-code repository, you can use the Insights command-line interface (CLI). Check out Automation Rules with the CLI for more information.
# Writing Automation Rules
Insights Automation Rules are written in JavaScript. The main input is ActionItem
, which contains
information about the issue detected.
For example, we can set the Assignee for certain Action Items:
if (ActionItem.ResourceNamespace === 'api') {
ActionItem.AssigneeEmail = '[email protected]';
}
if (ActionItem.ResourceLabels['app'] === 'polaris') {
ActionItem.AssigneeEmail = '[email protected]';
}
# Automation Rule Input
For the ActionItem
input, the following fields are available:
Category
Cluster
EventType
IsNew
NamespaceAnnotations
NamespaceLabels
ReportType
ResourceAnnotations
ResourceKind
ResourceLabels
ResourceName
ResourceNamespace
ResourceContainer
Severity
To determine the ReportType
and EventType
of a certain Action Item:
- Visit your organizations
Policy
page - Click on a Policy in the table
- Look up the
Report
andEvent Type
of the Policy

# Editable Fields
The following fields for ActionItem
can be edited:
AssigneeEmail
- String - email address of the Assignee in InsightsCategory
- String - valid values areEfficiency
,Reliability
orSecurity
Description
- String - description of the Action ItemRemediation
- String - remediation for the Action ItemResolution
- Constant - valid values areWILL_NOT_FIX_RESOLUTION
orWORKING_AS_INTENDED_RESOLUTION
Severity
- Constant - valid values areCRITICAL_SEVERITY
,HIGH_SEVERITY
,MEDIUM_SEVERITY
,LOW_SEVERITY
Title
- String - title of the Action Item