Opsweekly is a tool developed by Etsy to generate weekly oncall support reports.
Copy the alerta.php
file to providers/oncall
or another path in
the PHP include path and follow the configuration steps below.
Global Config:
base_url
: The path to your Alerta API, e.g. https://api.alerta.ioapikey
: 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
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" => "[email protected]",
"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"
),
);
Returns 0 or more notifications as array()
- Each notification should have the following keys:
time
: alert 'createTime' attributehostname
: alert 'environment' and 'resource' attributesservice
: alert 'event' attributeoutput
: alert 'service' and 'text' attributesstate
: alert 'severity' attribute eg. 'critical', 'major', 'minor', 'warning', 'normal'
To test, run:
$ php -f test.php
- https://github.com/etsy/opsweekly
- https://github.com/etsy/opsweekly/tree/master/providers/oncall#writing-an-on-call-provider
Copyright (c) 2015 Nick Satterly. Available under the MIT License.