Code Monkey home page Code Monkey logo

pagerdutyphp's Introduction

Pagerduty PHP

- A PHP library of handy functions utilising the Pagerduty API.


* What's included?

pagerduty.php - The file which has all the functions that can be used. I say all, so far I only have two, and both relate to getting the current person on call. 
pagerdutycron.php - A script designed to run from cron that will either ping irccat or send an email (or both) when the person on call in your rotations changes. 
timeago.php - A support function provided by alex at nyoc dot net. 

* How do I use it? 

You need to enter some basic configuration information into pagerduty.php before you can use it, relating to your login and your schedules. 

After you've done this, you are free to include pagerduty.php and use the functions in the file. Keep reading for info on other files.

* Using with irccat

If you already use the IRC bot irccat (https://github.com/RJ/irccat) you can ask irccat who is on call for a given rotation by including it in your command handler like so:

    case 'opsoncall':
        include_once("pagerduty.php");
        printPersonOnCallAt("ops", $allargs);
        break;

This will allow anyone to query the Pagerduty schedule to find out who is on call now (no args) or at a specfied time (passed through string-to-time, so vaguely intelligent). 

For example:
<laurie> ?opsoncall
<irccat> Bob Robertson is on call from 2 days ago until 4 days from now
<laurie> ?opsoncall next week
<irccat> Dave Davidson is on call from 4 days from now until 11 days from now


* pagerdutycron.php

Setup is fairly simple; there are a few configuration options at the top of the file relating to whether you want to send an email, or send a message to irccat, or both, and where to send those messages. 
After you've done that, run it by hand once to ensure everything works as planned, and then set it up in cron to run as often as you please (for example, 1 minute). 

When it detects a change in rotation, it will perform your selected action to alert the relevant parties. 

For example, in IRC:
<irccat> On call person for ops is now Dave Davidson until 7 days from now

pagerdutyphp's People

Contributors

lozzd avatar

Watchers

 avatar

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.