Simple CLI that update users in Slack user groups based on OpsGenie on-call schedules.
Note: It's intended to be run as a cron job.
DISTURBED_OPSGENIE_API_KEY
: API key used to fetch schedules in OpsGenie.- It needs
Read
andConfiguration Access
access rights. - You can read this page to learn how to create an API key.
- It needs
DISTURBED_SLACK_API_TOKEN
: Bot Token used to fetch users, user groups and update use groups.DISTURBED_CONFIG_FILE
[not required]: Path to the configuration file. Defaults toconfig.yaml
.DISTURBED_LOG_LEVEL
[not required]: Logging level to use in the project.- It's based on Python's logging levels.
schedules_mapping:
# Schedule name in OpsGenie to fetch who's on-call.
- schedule_name: ''
# User group name in Slack to be updated based on the OpsGenie schedule.
user_group_name: ''
# Optional. Overrides OpsGenie schedules based on the given config.
overrides:
# Email of the user that's on-call.
- user_email: ''
# Current time (in the given timezone) must be within the given time range. Format: HH:MM:SS.
timezone: ''
starts_on: ''
ends_on: ''
# Optional. Defaults to all_days.
# Days that should be considered to override. Possible values:
# - all_days
# - weekdays
# - weekends
repeats_on: ''
# Update the user group in Slack with the given users instead of the one that's on-call.
replace_by:
- ''
Example
config.yaml
schedules_mapping:
- schedule_name: product
user_group_name: 'product-oncall'
- schedule_name: sre
user_group_name: 'sre-oncall'
overrides:
- user_email: [email protected]
timezone: 'America/Fortaleza'
starts_on: '23:00:00'
ends_on: '01:00:00'
repeats_on: weekdays
replace_by:
- [email protected]
There is a Docker image you can use to run this project.
e.g.,
docker run \
-e DISTURBED_OPSGENIE_API_KEY='<api-key>' \
-e DISTURBED_SLACK_API_TOKEN='<bot-token>' \
-v ./config.yaml:/app/config.yaml \
ghcr.io/hpedrorodrigues/disturbed_cli:<version>
Helm chart is available here.