Code Monkey home page Code Monkey logo

public-support-scripts's Introduction

PagerDuty Public Support Scripts

This is a collection of miscellaneous scripts that the PagerDuty Support Team has written and collected over time. Their purpose is to perform specific, limited-scope tasks through the REST API that cannot (as of the time that they are written) be performed through the PagerDuty UI.

This README shall serve as both a set of instructions on the usage of these scripts and a description of how this repository is to be maintained and organized.

Contents

Howto

Each of the directories within this repository describes a task in snake_case carried out by the script(s).

In each of these directories shall be the script(s) that carry out the task, plus documentation on usage.

Each script can be run as a standalone program, i.e.:

./name-of-script.lang <options>

As opposed to requiring it to be run as follows, although it is also an option:

<interpreter> name-of-script.lang <options>

If including the command line flag -h, the script shall print out instructions for usage ("helptext").

The directory shall also contain a file README.md containing any additional usage instructions that cannot be included in the helptext and/or historical information about the origin of the script (i.e. original author/source) and how it has been used / can be used.

Installing Dependencies

In some cases, scripts will require additional software modules or libraries in order to run.

Python Scripts

If the script is written in Python, the directory shall include a file requirements.txt, which can be used to install dependencies with pip as follows:

pip install -r ./requirements.txt

The program pip must be installed in the local operating system in order to perform this type of dependency installation.

More information on requirements files can be found in the pip documentation, at pip.pypa.io.

Ruby Scripts

If the script is written in Ruby, the directory shall include a file Gemfile specifying gem dependencies that can be used to install them using the bundle command.

Rubygems will need to installed in the local operating system in order to perform this type of dependency installation.

More information on gemfiles and Bundle can be found here: bundler.io/gemfile.html

Contributing

In addition to following each of the above conventions, i.e. residing in its own directory, each script shall begin with a "shebang" line as follows:

#!/usr/bin/env <interpreter>

where <interpreter> is the language command (i.e. ruby, python, perl etc.). Specific versions of interpreters (i.e. Python 2.7 or Python 3) shall be specified in the name of the executable. If the generic name is used (i.e. python), the script should be written such that it is compatible with the widest possible range of versions that might be available on any given operating system.

License and Copyright

Copyright (c) 2016, PagerDuty All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of [project] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

public-support-scripts's People

Contributors

ambulatorymerperson avatar andrasaid avatar andrecloutier-pd avatar arupchak avatar ashleyabrooks avatar cmrberry avatar danjeffs avatar deconstrained avatar dependabot[bot] avatar ehlerorngard avatar elisetab avatar ethanmsl avatar j-vizcaino avatar jade-pd avatar jadepaoletta avatar josefgoodyear avatar julianeon avatar katkasian avatar kimko avatar lfepp avatar mdcollins05 avatar pzhuravlenkopd avatar ryanhoskin avatar rykener avatar seongwang-pd avatar sesshoumaru404 avatar shivinder avatar waqasahmad avatar waqaspd avatar wrfeng avatar

Stargazers

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

Watchers

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

public-support-scripts's Issues

SSL Issue

When running the delete maintenance windows script, I'm getting a SSL issue when connecting. We are running Netskope which inspects all traffic outboud. I suspect this might be the cause.
Also, when running the create script, I was able to set the validate SSL=false. That worked.

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.pagerduty.com', port=443): Max retries exceeded with url: /maintenance_windows?limit=100&total=1&filter=future&offset=0 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)')))

Cannot delete user

Traceback (most recent call last):
File "./user_deprovision.py", line 520, in
main(args)
File "./user_deprovision.py", line 467, in main
args.prompt_del, args.auto_resolve, args.backup)
File "./user_deprovision.py", line 327, in delete_user
escalation_policies[e]['id'],
UnboundLocalError: local variable 'e' referenced before assignment

import users script needs improved logging

when encountering errors in the script, the saved logs do not indicate which users had the errors raised. This means one must look through the logs on stdout to determine where the problem was from

refactor & document overrides_bulk_operations

No documentation on what it wants.
Is based on this repo.
Which documents what it wants in internal comments:

# Script to override all on-call schedules for a vacationing user with another user for the given time period
# CLI Usage: ./create_vacation_overrides api_key vacationing_user_name overriding_user_name vacation_start_date vacation_end_date
#   api_key: PagerDuty API access token
#   vacationing_user_name: Full name of the user going on vacation - must be in quotes
#   overriding_user_name: Full name of the user overriding the vacationing user
#   vacation_start_date: Date on which the vacation starts
#   vacation_end_date: Date on which the vacation ends

As we're planning a progressive refactor and documentation it may be most efficient to refactor and document this as part of that effort.


meh, slash here's a stop-gap:

get_overrides
description:
"Gets all overrides in a schedule and export to a CSV file. The first column of output will be the schedule ID and the second should be the override ID, and the third will be a column identifying the user and time."

--api-key: "REST API key"
--csv-file: "Output CSV file. Data will begin in the very first row; no column names."
--start: "Start date of search"
--end: "End date of search"
--schedules': "IDs of schedules in which to find overrides. If unspecified, all schedules will be included."


vacation_overrides
For a given user going on vacation, and another given user who will fill their shoes while away, create overrides on all the vacationing user's schedules, such that the replacement user covers all the shifts that the vacationing user will be gone.

--vacationer: "Login email address of the user who is going on vacation."
--substitute: "Login email address of the user who is covering the shifts of the vacationing user."
--api-key: "PagerDuty REST API key to use for operations."
--start: "Start date of the vacation."
--end: "End date of the vacation."
--schedules: "IDs of schedules in which to create overrides. If unspecified, all schedules will be included."


mass_delete_overrides
Deletes overrides listed in a CSV file. The first column should be the schedule ID and the second should be the override ID. More columns can be included after the first.
--api-key: "REST API key"
--csv-file: "Path to input CSV file. Data should begin in the very first row; no column names."

enable_all_extensions: provide secure(r) api-key hand-off

convert api-key intake to either use .env or interactive intake that isn't part of shell command history.

This is principally a security vulnerability for remote work. But common location of command history also makes it a slightly raised vulnerability for local work.

This is not an emergency security flaw, but it is counter to best practices for cli key handoff.

api-keys visible in command history

(^ NOTE: the displayed keys are deleted keys.)

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.