Configuring monitors and alerts with the Alerting APIs
- Required role
-
You must have administration privileges in Cloud Pak for Data. API authentication uses an authorization token with administration privileges.
- Authentication
-
To use the Alerting APIs, you must authenticate to Cloud Pak for Data. See Generating an API authorization token. See also Get authorization token in the Cloud Pak for Data Platform API.
Methods
- Browse events
-
View all events
Returns a list of events that are recorded by the monitor and associated event type. The historical data for each event lists severity of the referenced resource at the time the monitor cron job collected its state. This list can be filtered to return only events of a specific severity.
For more information, see View all events.
View alerted events
Returns a list of events by monitor that have promoted alerts and are in the snooze period, which you can filter by a specific event type.
For more information, see View alerted events.
- Configure monitor and alert rules
-
Configure monitor schedule
Updates the schedule for the diagnostics monitor or a custom monitor. Monitors must be scheduled as a cron job. By default, the cron job for the default monitor, diagnostics, is scheduled to run every 10 minutes.
For more information, see Configure monitor schedule.
Configure event type
You can edit configuration details for a particular event type for a monitor.
For more information, see Configure event type.
Configure alert rules
Configures rules for critical and warning events, including the snooze period and whether an alert is needed when an incident corrects itself.
For more information, see Configure alert rules.
- Configure alert forwarding
-
Configure email recipients
Configures alerts to be sent as email. You can configure a connection to your SMTP server in
.For more information, see Register SMTP configuration.
See also Enabling email notifications.
Configure SNMP
Configures alerts to be sent as traps by using SNMP (simple network management protocol). SNMP is a standard protocol for collecting and organizing information about managed devices or services. It returns management data in the form of variables that are defined in managed information base (MIB) files.
- Use
GET
to retrieve the current SNMP configuration.For more information, see Get SNMP configuration.
- Use
POST
to update the SNMP configuration.For more information, see Configure SNMP.
Configure Slack
Configures alerts to be set as messages in a Slack channel. To enable Slack alerts, an administrator must provide a webhook URL, which can be set up to receive notifications on a channel. Use
GET
to retrieve the current Slack configuration. UsePOST
to update the Slack webhook URL.For more information, see Get Slack configuration.
- Use
- Get a list of monitors, profiles, or alert types
-
Get a list of monitors
Lists all registered monitors and associated event types. The default monitor is
diagnostics
.For more information, see Get a list of monitors, profiles, or alert types.
For example, use the following command, which specifies
extension_point_id=zen_alert_monitor
.curl -X GET \ -k 'https://<my-deployment-url>/zen-data/v1/extensions?extension_point_id=zen_alert_monitor' \ -H 'Authorization: Bearer <authorization-token>'
Get a list of alert types or rules
Lists all alert types or rules, which define when alerts need to send. The default alert type is
platform
.For more information, see Get a list of monitors, profiles, or alert types.
For example, use the following command, which specifies
extension_point_id=zen_alert_type
.curl -X GET \ -k 'https://<my-deployment-url>/zen-data/v1/extensions?extension_point_id=zen_alert_type' \ -H 'Authorization: Bearer <authorization-token>'
Get a list of alert profiles
Lists all registered alert profiles to enable or disable a certain type of alert (SMTP, SNMP, or Slack). Also provides metadata for the alert methods, including the list of email addresses that are registered to receive alerts.
For more information, see Get a list of monitors, profiles, or alert types.
For example, use the following command, which specifies
extension_point_id=zen_alert_profile
.curl -X GET \ -k 'https://<my-deployment-url>/zen-data/v1/extensions?extension_point_id=zen_alert_profile' \ -H 'Authorization: Bearer <authorization-token>'
- Delete monitoring events or metrics records
-
Delete monitoring events
Deletes events that are older than a specified number of days. By default, events are stored for three days.
For more information, see Delete monitoring events.
Delete metrics records
Delete metrics records that are older than a specified number of days. By default, metrics are stored for 30 days.
For more information, see Delete metrics records.