2017 © Pedro Peláez
 

library pagerduty

A Laravel notification channel for sending PagerDuty events.

image

laravel-notification-channels/pagerduty

A Laravel notification channel for sending PagerDuty events.

  • Saturday, May 13, 2017
  • by laravel-notification-channels
  • Repository
  • 5 Watchers
  • 2 Stars
  • 141 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 281 % Grown

The README.md

PagerDuty Event notifications channel for Laravel

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads, (*1)

This package makes it easy to send notification events to PagerDuty with Laravel 11.x+, (*2)

Contents

Installation

You can install the package via composer:, (*3)

composer require laravel-notification-channels/pagerduty

Usage

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

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., (*5)

This method needs to return the Integration Key for the service and integration to which you want to send the event., (*6)

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

PagerDuty Setup

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

Creating a new integration, (*8)

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

List of Integrations with Keys, (*10)

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., (*11)

Usage

Notification::route('PagerDuty', '[my integration key]')->notify(new BasicNotification);

When using Notification::route be sure to reference 'PagerDuty' as the Channel., (*12)

Changelog

Please see CHANGELOG for more information what has changed recently., (*13)

Testing

bash $ composer test, (*14)

Security

If you discover any security related issues, please email lwaite@gmail.com instead of using the issue tracker., (*15)

Contributing

Please see CONTRIBUTING for details., (*16)

Credits

License

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

The Versions

13/05 2017

dev-master

9999999-dev https://github.com/laravel-notification-channels/pagerduty

A Laravel notification channel for sending PagerDuty events.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel pagerduty notifications alerting laravel-package notification-channel