alerta_alerta-contrib/integrations/opsweekly
Nick Satterly 2a6632b78f Fix multiple linting errors 2023-03-21 00:15:34 +01:00
..
README.md Update READMEs 2020-11-20 22:39:32 +01:00
alerta.php Fix multiple linting errors 2023-03-21 00:15:34 +01:00
test.php add alerta oncall provider 2015-01-27 13:50:57 +00:00

README.md

Opsweekly Integration

Opsweekly is a tool developed by Etsy to generate weekly oncall support reports.

For help, join Slack chat

Installation

Copy the alerta.php file to providers/oncall or another path in the PHP include path and follow the configuration steps below.

Configuration

Global Config:

  • base_url: The path to your Alerta API, e.g. https://api.alerta.io
  • apikey: An API key created for Opsweekly in the Alerta console

Team Config:

  • alerta_search: The search filter that narrows down the results to the team. Variables: #logged_in_username# = The username of the person currently using opsweekly

Example

Modify the config.php file similar to the following:

$oncall_providers = array(
    "alerta" => array(
        "display_name" => "Alerta",
        "lib" => "providers/oncall/alerta.php",
        "options" => array(
            "base_url" => "http://api.alerta.io",
            "apikey" => "demo-key"
        ),
    ),
);
$teams = array(
    "opsweekly.alerta.io" => array(
        "root_url" => "/opsweekly",
        "display_name" => "Ops",
        "email_report_to" => "ops@mycompany.com",
        "database" => "opsweekly",
        "oncall" => array(
            "provider" => "alerta",
            "provider_options" => array(
                "alerta_search" => 'tags=watch:#logged_in_username#',
            ),
            "timezone" => "America/New_York",
            "start" => "friday 18:00",
            "end" => "friday 18:00",
        ),
        "weekly_hints" => array("jira", "github"),
        "irc_channel" => "#ops"
    ),
);

Report

Returns 0 or more notifications as array()

  • Each notification should have the following keys:
    • time: alert 'createTime' attribute
    • hostname: alert 'environment' and 'resource' attributes
    • service: alert 'event' attribute
    • output: alert 'service' and 'text' attributes
    • state: alert 'severity' attribute eg. 'critical', 'major', 'minor', 'warning', 'normal'

Testing

To test, run:

$ php -f test.php

References

License

Copyright (c) 2015 Nick Satterly. Available under the MIT License.