Table: pagerduty_ruleset_rule - Query PagerDuty Ruleset Rules using SQL
PagerDuty Ruleset Rules are a part of the incident management service within PagerDuty that allows you to define and manage rules for incident notifications. It provides a way to set up and manage rules for various incident scenarios, including specific conditions and actions. PagerDuty Ruleset Rules help you stay informed about the incident management rules and take appropriate actions when predefined conditions are met.
Table Usage Guide
The pagerduty_ruleset_rule
table provides insights into Ruleset Rules within PagerDuty's incident management service. As a DevOps engineer, explore rule-specific details through this table, including conditions, actions, and associated ruleset data. Utilize it to uncover information about rules, such as those with specific conditions and actions, the relationships between rules, and the verification of rule actions.
Examples
Basic info
Explore the status of different rules within your PagerDuty ruleset to understand which are currently in use and which are disabled. This can aid in streamlining your incident management process by ensuring only necessary rules are active.
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rule;
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rule;
List disabled rules
Explore which rules within your PagerDuty ruleset are currently disabled. This can be beneficial in understanding and managing the active rules and alerts in your system.
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rulewhere disabled;
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rulewhere disabled = 1;
Count event rules per ruleset
Assess the number of event rules within each ruleset to better understand their complexity and manageability. This is useful for optimizing ruleset configurations and enhancing system efficiency.
select rs.id as ruleset_id, count(r.id)from pagerduty_ruleset as rs left join pagerduty_ruleset_rule as r on rs.id = r.ruleset_idgroup by rs.id;
select rs.id as ruleset_id, count(r.id)from pagerduty_ruleset as rs left join pagerduty_ruleset_rule as r on rs.id = r.ruleset_idgroup by rs.id;
List rules without any priority
Explore which PagerDuty rules lack a set priority, helping to identify potential gaps in your incident management process. This is beneficial in ensuring all rules are appropriately prioritized for effective incident response.
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rulewhere actions -> 'priority' is null;
select id, ruleset_id, disabled, selffrom pagerduty_ruleset_rulewhere json_extract(actions, '$.priority') is null;
Schema for pagerduty_ruleset_rule
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
actions | jsonb | A set of actions that defines when an event matches this rule, the actions that will be taken to change the resulting alert and incident. | |
catch_all | boolean | Indicates whether the Event Rule is the last Event Rule of the Ruleset that serves as a catch-all. It has limited functionality compared to other rules and always matches. | |
conditions | jsonb | A set of information defined the conditions resulting alert and incident. | |
disabled | boolean | Indicates whether the Event Rule is disabled and would therefore not be evaluated. | |
id | text | = | The ID of the event rule. |
position | bigint | Position/index of the Event Rule in the Ruleset. Starting from position 0 (the first rule), rules are evaluated one-by-one until a matching rule is found. | |
ruleset_id | text | = | The ID of the ruleset. |
self | text | The API show URL at which the object is accessible. | |
time_frame | jsonb | Time-based conditions for limiting when the rule is active. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- pagerduty
You can pass the configuration to the command with the --config
argument:
steampipe_export_pagerduty --config '<your_config>' pagerduty_ruleset_rule