turbot/pagerduty
steampipe plugin install pagerduty

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,
self
from
pagerduty_ruleset_rule;
select
id,
ruleset_id,
disabled,
self
from
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,
self
from
pagerduty_ruleset_rule
where
disabled;
select
id,
ruleset_id,
disabled,
self
from
pagerduty_ruleset_rule
where
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_id
group 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_id
group 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,
self
from
pagerduty_ruleset_rule
where
actions -> 'priority' is null;
select
id,
ruleset_id,
disabled,
self
from
pagerduty_ruleset_rule
where
json_extract(actions, '$.priority') is null;

Schema for pagerduty_ruleset_rule

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
actionsjsonbA 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_allbooleanIndicates 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.
conditionsjsonbA set of information defined the conditions resulting alert and incident.
disabledbooleanIndicates whether the Event Rule is disabled and would therefore not be evaluated.
idtext=The ID of the event rule.
positionbigintPosition/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_idtext=The ID of the ruleset.
selftextThe API show URL at which the object is accessible.
time_framejsonbTime-based conditions for limiting when the rule is active.
titletextTitle 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