Git Product home page Git Product logo

pagerduty's Introduction

PagerDuty Event notifications channel for Laravel 5.3

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send notification events to PagerDuty with Laravel 5.3.

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/pagerduty

Usage

Now you can use the channel in your via() method inside the Notification class.

use NotificationChannels\PagerDuty\PagerDutyChannel;
use NotificationChannels\PagerDuty\PagerDutyMessage;
use Illuminate\Notifications\Notification;

class SiteProblem extends Notification
{
    public function via($notifiable)
    {
        return [PagerDutyChannel::class];
    }

    public function toPagerDuty($notifiable)
    {
        return PagerDutyMessage::create()
            ->setSummary('There was an error with your site in the {$notifiable->service} component.');
    }
}

In order to let your Notification know which Integration should receive the event, add the routeNotificationForPagerDuty method to your Notifiable model.

This method needs to return the Integration Key for the service and integration to which you want to send the event.

public function routeNotificationForPagerDuty()
{
    return '99dc10c97a6e43c387bbc4f877c794ef';
}

PagerDuty Setup

On a PagerDuty Service of your choice, create a new Integration using the Events API v2.

Creating a new integration

The Integration Key listed for your new integration is what you need to set in the routeNotificationForPagerDuty() method.

List of Integrations with Keys

Available Message methods

  • resolve(): Sets the event type to resolve to resolve issues.
  • setDedupKey(''): Sets the dedup_key (required when resolving).
  • setSummary(''): Sets a summary message on the event.
  • setSource(''): Sets the event source; defaults to the hostname.
  • setSeverity(''): Sets the event severity; defaults to critical.
  • setTimestamp(''): Sets the timestamp of the event.
  • setComponent(''): Sets the component of the event.
  • setGroup(''): Sets the group of the event.
  • setClass(''): Sets the class.
  • addCustomDetail('', ''): Adds a key/value pair to the custom_detail of the event.

See the PagerDuty v2 Events API documentation for more information about what these options will do.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

pagerduty's People

Contributors

lukewaite avatar lukewaite-intouch avatar

Watchers

James Cloos 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.