Introducing a new PagerDuty CLI

Hi there!

My name is Martin Stone, and I’m a PagerDuty Solution Architect. I want to share a little side project that I’ve been working on for while, because it’s starting to get pretty useful. It’s a new command line interface (CLI) for PagerDuty.

There are lots of ways to interact with PagerDuty programmatically, but I wanted to make something that was user-focused, easy to install, and easy to use for common PagerDuty tasks. Among other things, it’s good at user and admin tasks like “acknowledge and snooze all my incidents,” “put a bunch of services into maintenance mode,” “output a CSV of some or all users,” and so on. It’s super easy to install and get started.

My PagerDuty CLI is open source and it’s implemented in TypeScript using the oclif framework.

I wrote a user guide that covers installation and gives some examples; you can find that here. The source (and a complete listing of available commands) is published here.

I’m sure I don’t need to tell you that this is just third party contributed software, it’s not endorsed or supported by PagerDuty, and you’re using it at your own risk. But I’m telling you anyway because those are the facts :slight_smile:

I hope you check it out and let me know what you think - together we can make something really great!

8 Likes

This is great work, thanks for sharing!

Is this implemented in PagerDuty’s Terraform provider as the underlying client?

Hello Rishav,

This is still a side project and is not endorsed or supported by PagerDuty. So it is not implemented in PagerDuty’s Terraform provider.

I hope that helps.

Regards,

Great.

Hope it will be added to this page to help PagerDuty users to find it more easily: https://developer.pagerduty.com/docs/tools-libraries/client-libraries/

Hello Sebastien,

This is still a side project. As Martin did mention, it is just a third party contributed software and not endorsed or supported by PagerDuty. Once it goes Live, it will sure be placed in a public place for visibility.
Meanwhile, it will sit in the Community space as it is now in order to get feedback on it.

I hope that helps.

Cheers,

Hi @chiedu,

I missed your answer. But as I’m looking again at the PagerDuty CLI, I hope you (or any other Dutonian) will be able to share info for it on a visible place.
You mentioned it’s not supported by the company. Yes, as PHP API library but it’s available (and support clearly mentioned) there: https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTg2-api-client-libraries

Regards,
Sébastien

Hi @martin -

Can you please help me to get the Pagerduty CLI .PY file for below output -

List of Incident

  • Incident Number
  • Incident created date and time
  • Incident Ack by
  • Incident Ack Date and Time
  • Incident Resolve by
  • Incident Resolve Date and time
  • Incident Notes

For Specific Escalation Policy
For Specific Date or duration

Hi Vishal,

It’s a little bit more work because the incident record itself does not have information about the acknowledgers and resolvers, but here’s a Python script that does the work of stitching that information together from the incident log entries:

You would just need to make a couple of trivial changes to add incident number and filter on a specific escalation policy. Let me know if you need any additional help to do that.

Thanks!
Martin

Thanks @martin.

Currently I am using below format to run the script to get the PD report output. Below file I am using as .py but uploaded as .txt format here.

user-tags.txt (1.0 KB)

py path\File_name.py --output_file path\File_name.csv

Can you please share something similar, if possible.

Hi @vishal.garg,

I am not entirely sure what you are asking, but to get script I provided, you can:

In unix/linux/macos, you would then open a terminal in the directory where you saved the file, make the file executable with chmod +x basic_incident_details.py and then run it with some example arguments with ./basic_incident_details.py -o incidents.csv --start "30 days ago" --end now

It looks like you’re using Microsoft Windows; I am not able to advise you on how to run Python scripts on Windows in general, but I do know that it is possible. You would use the same kinds of arguments as I provided above.

Please let me know if I can help any further…

Thanks,
Martin

Thanks @martin, Appreciate your help as always. I will share the results.