Git Product home page Git Product logo

turbot / steampipe-plugin-pagerduty Goto Github PK

View Code? Open in Web Editor NEW
4.0 12.0 3.0 515 KB

Use SQL to instantly query resources from PagerDuty. Open source CLI. No DB required.

Home Page: https://hub.steampipe.io/plugins/turbot/pagerduty

License: Apache License 2.0

Makefile 0.15% PLSQL 0.22% Go 99.63%
postgresql steampipe steampipe-plugin sql postgresql-fdw pagerduty-api hacktoberfest backup etl sqlite

steampipe-plugin-pagerduty's Introduction

image

PagerDuty Plugin for Steampipe

Use SQL to query infrastructure services, teams, escalation policies and more from your PagerDuty account.

Quick start

Install the plugin with Steampipe:

steampipe plugin install pagerduty

Configure your credentials and config file.

Run a query:

select
  name,
  id,
  status
from
  pagerduty_service
where
  status = 'disabled';

Engines

This plugin is available for the following engines:

Engine Description
Steampipe The Steampipe CLI exposes APIs and services as a high-performance relational database, giving you the ability to write SQL-based queries to explore dynamic data. Mods extend Steampipe's capabilities with dashboards, reports, and controls built with simple HCL. The Steampipe CLI is a turnkey solution that includes its own Postgres database, plugin management, and mod support.
Postgres FDW Steampipe Postgres FDWs are native Postgres Foreign Data Wrappers that translate APIs to foreign tables. Unlike Steampipe CLI, which ships with its own Postgres server instance, the Steampipe Postgres FDWs can be installed in any supported Postgres database version.
SQLite Extension Steampipe SQLite Extensions provide SQLite virtual tables that translate your queries into API calls, transparently fetching information from your API or service as you request it.
Export Steampipe Plugin Exporters provide a flexible mechanism for exporting information from cloud services and APIs. Each exporter is a stand-alone binary that allows you to extract data using Steampipe plugins without a database.
Turbot Pipes Turbot Pipes is the only intelligence, automation & security platform built specifically for DevOps. Pipes provide hosted Steampipe database instances, shared dashboards, snapshots, and more.

Developing

Prerequisites:

Clone:

git clone https://github.com/turbot/steampipe-plugin-pagerduty.git
cd steampipe-plugin-pagerduty

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/pagerduty.spc

Try it!

steampipe query
> .inspect pagerduty

Further reading:

Open Source & Contributing

This repository is published under the Apache 2.0 (source code) and CC BY-NC-ND (docs) licenses. Please see our code of conduct. We look forward to collaborating with you!

Steampipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #steampipe on Slack →

Want to help but don't know where to start? Pick up one of the help wanted issues:

steampipe-plugin-pagerduty's People

Contributors

cbruno10 avatar dependabot[bot] avatar janritter avatar misraved avatar subhajit97 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

coop182 arruw

steampipe-plugin-pagerduty's Issues

Allow filtering for service_ids or team_ids in table pagerduty_incident

Is your feature request related to a problem? Please describe.
When querying longer time ranges (e.g. last 14 days) in a PagerDuty account with a lot of services and high amount of total incidents, the query takes a lot of time (last 30 days = 25 minutes).

Describe the solution you'd like
The PagerDuty API allows additional filter parameters like service ids or team ids which could limit the requested amount of data and therefore the query runtime significantly. I would like to implement the additional filter parameters so they are used when the user adds a where clause for team id and / or service id to the query

Additional context
I would be happy to also implement the options to filter by service id or team id, but not sure how this could be achieved with the current table structure, since service and team infos are json objects in the results without a dedicated team_id or service_id column.

Add table pagerduty_incident_log

References
Add any related links that will help us understand the resource, including vendor documentation, related GitHub issues, and Go SDK documentation.

Add table pagerduty_service_integration

References
Add any related links that will help us understand the resource, including vendor documentation, related GitHub issues, and Go SDK documentation.

Recompile plugin with steampipe-plugin-sdk v4.1.4 and Go version 1.19

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Fix `title` column reference in `pagerduty_incident` and `pagerduty_incident_log` table

Describe the bug
In table pagerduty_incident and pagerduty_incident_log, the reference used for title column seems incorrect. Hence, the value comes as null.

Steampipe version (steampipe -v)
Example: v0.16.0

Plugin version (steampipe plugin list)
Example: v0.1.0

To reproduce
Run any query against the above-mentioned tables, and check the title column value.

Expected behavior
title should contain the value, i.e. ID or Summary.

Additional context
Add any other context about the problem here.

Simple query to pagerduty_incident table fails

Describe the bug

Query:

SELECT id, summary FROM pagerduty_incident WHERE created_at >= '2022-09-28' ORDER BY created_at DESC
Error: HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002) (SQLSTATE HV000)

Plugin Logs:

2022-09-29 16:35:52.100 UTC [ERROR] steampipe-plugin-pagerduty.plugin: [ERROR] 1664469241413: pagerduty_incident.listPagerDutyIncidents: query_error="HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)"
2022-09-29 16:35:52.100 UTC [WARN]  steampipe-plugin-pagerduty.plugin: [WARN]  1664469241413: doList callHydrateWithRetries (pagerduty-1664469241413) returned err HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)
2022-09-29 16:35:52.100 UTC [WARN]  steampipe-plugin-pagerduty.plugin: [WARN]  1664469241413: QueryData StreamError HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002) (pagerduty-1664469241413)
2022-09-29 16:35:52.100 UTC [WARN]  steampipe-plugin-pagerduty.plugin: [WARN]  1664469241413: streamRows for pagerduty-1664469241413 - execution has failed (HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)) - calling queryCache.AbortSet
2022-09-29 16:35:52.100 UTC [WARN]  steampipe-plugin-pagerduty.plugin: [WARN]  1664469241413: executeForConnection pagerduty returned error HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)
2022-09-29 16:35:52.100 UTC [WARN]  steampipe-plugin-pagerduty.plugin: [WARN]  1664469241413: error channel received HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)

Database Logs:

2022-09-29 16:35:52.100 UTC [WARN]  hub: stream receive error rpc error: code = Unknown desc = HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002) (0xc0004f81a0)
2022-09-29 16:35:52.101 UTC [5657] ERROR:  rpc error: code = Unknown desc = HTTP response failed with status code 400, message: Arguments Caused Error (code: 2002)
2022-09-29 16:35:52.101 UTC [5657] STATEMENT:  select id, summary FROM pagerduty_incident WHERE created_at >= '2022-09-28' ORDER BY created_at DESC

Steampipe version (steampipe -v)

steampipe version 0.16.0

Plugin version (steampipe plugin list)

+--------------------------------------------------+---------+-------------+
| Name                                             | Version | Connections |
+--------------------------------------------------+---------+-------------+
| hub.steampipe.io/plugins/turbot/aws@latest       | 0.78.0  | aws         |
| hub.steampipe.io/plugins/turbot/jira@latest      | 0.6.0   | jira        |
| hub.steampipe.io/plugins/turbot/okta@latest      | 0.8.0   | okta        |
| hub.steampipe.io/plugins/turbot/pagerduty@latest | 0.2.1   | pagerduty   |
| hub.steampipe.io/plugins/turbot/steampipe@latest | 0.6.0   | steampipe   |
| local/battlestar                                 | local   | battlestar  |
+--------------------------------------------------+---------+-------------+

To reproduce
Steps to reproduce the behavior (please include relevant code and/or commands).

Expected behavior
List of incidents is returned.

Additional context
It takes a minute or so for query to fails.

Add table pagerduty_vendor

References
Add any related links that will help us understand the resource, including vendor documentation, related GitHub issues, and Go SDK documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.