Coder Social home page Coder Social logo

oopsgenie's Introduction

OpsGenie Alert Classifier

Helpful functions for analyzing an export of OpsGenie alerts and collecting useful data on them.

Functions

  • Clean (--clean cloumn1 column2 ...)
    • Specify rows from a *raw.csv file into a *clean.csv file
    • Remove (--remove keyword1 keyword2 ...)
      • A keyword to filter each cleaned row against. Matches on any value in the 'Message' column.
  • Count (--count column)
    • Count the number of alerts matching a specified column name. Passing a column name of "all" will return the total count of alerts
    • Limit (--limit limit)
      • Limit the number of results returned, ordered by count highest to lowest
    • Time Interval Filtering (--interval hour1 hour2)
      • An interval to filter the "CreatedAtDate" hour of each alert. This can be added to count.
    • Keyword matching (--match keyword)
      • A keyword to filter the specified --count column against
    • Minutes between update (--update-minutes minutes)
      • A filter matching alerts that update within x minutes (between "CreatedAt" and "UpdatedAt" timestamps)
    • Output file (--outfile filename)
      • A file to output the results of --count
  • Fuzzy Count (--fuzzy-count column)
    • Count the number of alerts for a specified column name using fuzzy matching.
    • Threshold (--threshold threshold)
      • A threshold of tolerance for fuzzy matching on your --fuzzy-count. This is based on Levenshtein Distance; Default to 90.
    • Remove Numbers (--remove-numbers boolean)
      • Remove numbers from the alert alias before performing fuzzy matching in --count. This defaults to False and should be used in conjunction with the fuzzy threshold flag.
    • Alias Strip List File (--alias-strip-list csv)
      • Remove strings from the alert alias before performing matching in --fuzzy-count. Input for this flag is a csv without headers that contains a single column of strings to strip out of the alias (e.g. server names).

Future functionality

  • Implement matplotlib (or some other package) graphing for alerts over time
  • Wrap oopsgenie into a pip installable CLI tool

Running

This requires Python3

pip install virtualenv
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

Usage Examples:

# Clean alert-data-raw.csv to only include the columns "Alias", "CreatedAtDate", and "Teams" (creates alert-data-clean.csv)
python oopsgenie.py alert-data-raw.csv --clean Alias CreatedAtDate Teams

# Clean alert-data-raw.csv to only include the column "Alias", "CreatedAtDate", and "Teams" but exclude any message containing "staging"
python oopsgenie.py alert-data-raw.csv --clean Alias CreatedAtDate Teams --remove staging

# Get a count of all alerts
python oopsgenie.py alert-data-raw.csv --count

# Get a count of alerts grouped by the column "Alias"
python oopsgenie.py alert-data-raw.csv --count Alias

# Get a count of alerts grouped by the column "Alias" with server names stripped out
python oopsgenie.py alert-data-raw.csv --count Alias --alias-strip-list server_names.csv

# Get a count of alerts grouped by the column "Alias" and with a fuzzy matching threshold of 80%
python oopsgenie.py alert-data-raw.csv --fuzzy-count Alias --threshold 80

# Get a count of alerts grouped by the column "Alias" and with a fuzzy matching threshold of 90% and numbers removed from the alias before the fuzzy matching
python oopsgenie.py alert-data-raw.csv --fuzzy-count Alias --threshold 90 --remove-numbers True

# Get a count of all alerts grouped by the column "Alias" that are created between the hours of 04 and 13 (UTC)
python oopsgenie.py alert-data-raw.csv --count Alias --interval 4 13

# Get a count of all alerts grouped by the column "Alias" that match the keyword "gdpr"
python oopsgenie.py alert-data-raw.csv --count Alias --match gdpr

# Get a count of all alerts grouped by the column "Alias" that updated within 5 minutes of creation
python oopsgenie.py alert-data-raw.csv --count Alias --update-minutes 5

# Get a count of alerts grouped by the column "Alias" and store in a file named "alias-count.csv
python oopsgenie.py alert-data-raw.csv --count Alias --outfile alias-count.csv

oopsgenie's People

Contributors

dianaabishop avatar tlugger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

glqstrauss

oopsgenie's Issues

Add matplotlib graphing for alerts over time

It would be nice to have a --graph flag to follow alerts over time. This should take a matching column (Alias, Message, etc) and graph by hour/day/week/month using CreatedAtDate

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.