mirror of
https://github.com/alerta/alerta-contrib.git
synced 2025-03-14 20:52:46 +00:00
93 lines
2.5 KiB
Markdown
93 lines
2.5 KiB
Markdown
Opsweekly Integration
|
|
=====================
|
|
|
|
[Opsweekly](https://codeascraft.com/2014/06/19/opsweekly-measuring-on-call-experience-with-alert-classification/) is a tool developed by Etsy to generate weekly oncall support reports.
|
|
|
|
For help, join [](https://slack.alerta.dev)
|
|
|
|
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
|
|
----------
|
|
|
|
* https://github.com/etsy/opsweekly
|
|
* https://github.com/etsy/opsweekly/tree/master/providers/oncall#writing-an-on-call-provider
|
|
|
|
License
|
|
-------
|
|
|
|
Copyright (c) 2015 Nick Satterly. Available under the MIT License.
|