Set up an alert¶
This page explains how to configure alert actions in config/alert.yaml for statistical, log watch, and HA events in KX Sensors.
You can generate alerts from either a statistical or log watch event arising from a watch entry, or from an HA event. You define the action taken when an alert is triggered in config/alert.yaml. If you do not define an alert action in this configuration object, the alert is only published to the KXS Monitor Dashboard.
Set up an HA alert¶
HA alerts are triggered when an HA event (usually, but not always, a failover) occurs. You set up the alert name for your HA alert in the monHaAlert attribute in config/systemParams.yaml. Then you create an alert entry of the same name in config/alert.yaml.
| Attribute | Description | Example |
|---|---|---|
| monHaAlert | Name of alert profile to use for HA event notifications to monitoring framework | haAlert |
Note
Only one HA alert configuration/URL is allowed per environment.
In config/alert.yaml you set up the alert profile for the HA alert, in which you specify the basic definition of the alert (name, action, template and params).
| Parameter | Description |
|---|---|
| name | The name of your HA alert profile as defined in config/systemParams.yaml |
| action | Must be unspecified (no action other than generating an alert entry in the MonAlert table) or http to notify a remote agent |
| template | The notification message for your alert, consisting of both text and context parameters to interpolate. For example, HDB memory breached at {ts} with the value of {name2}. |
| params | User-specified context information associated with the alert: {name1}:value1{name2}:value2.... If the alert action is http, the parameters must include the {url} property specifying the URL to notify. The parameters may include the msgFmt property; if not specified, JSON is assumed. |
| isEnabled | Whether or not the alert is enabled |
Statistical alert templates may reference the following context properties:
| Property | Description |
|---|---|
| proc | Process name |
| domain | Domain (node) name |
| ts | Timestamp of event |
| state | Alert severity |
| msg | Message text |
Log message alert templates may reference the following context properties:
| Property | Description |
|---|---|
| proc | Process name |
| domain | Domain (node) name |
| ts | Timestamp of event |
| state | Alert severity |
| lev | Log level |
| msg | Message text |
The HA alert template may reference the following context properties:
| Property | Description |
|---|---|
| proc | Process name |
| domain | Domain (node) name |
| ts | Timestamp of event |
| feedName | Feed name |
| feedID | Feed ID |
| fromNode | Former (pre-event) primary node |
| toNode | New (post-event) primary node |
| event | HA event |
| env | KX Sensors environment |
| msg | Message text |
Example config/alert.yaml showing an alert for an HA feed failover/failback:
name: haAlert
action: http
template: {event} of feed {feedID}/{feedName} from node {fromNode} to {toNode} at {ts}
params: {url}:www.yoursite.com
Set up a watch-based alert¶
A watch-based alert is an alert triggered by either a statistical watch or a log watch event. To set one up:
- Set up your watch in either
config/watch.yamlorconfig/logWatch.yaml. - Associate your watch with an action to take in
config/alert.yaml. You can associate multiple watches with a single alert entry if they share the same alert parameters.
Your alertName in config/watch.yaml or config/logWatch.yaml must match your name in config/alert.yaml.
For example, the following alert entry (alert1) is attached to two log watches (logWatch1 and logWatch2):
config/alert.yaml:
name: alert1
action:
template: "ts={ts} level={lev} process={proc} {msg}"
params: {url}:www.yoursite.com
config/logWatch.yaml:
logWatch:
values:
- name: logWatch1
description: My SDL log watch
alertName: alert1
level: error
facility: SDL
rptCount: 3
rptInterval: 300
alertStr:
- name: logWatch2
description: My RDB log watch
alertName: alert1
level: error
facility: RDB
rptCount: 3
rptInterval: 200
alertStr: