This project provides a Python script to create and manage PagerDuty incidents from Visual TOM. The script uses the PagerDuty Events API v2 to trigger incidents with customizable severity levels, components, and custom details.
No Support and No Warranty are provided by Absyss SAS for this project and related material. The use of this project's files is at your own risk.
Absyss SAS assumes no liability for damage caused by the usage of any of the files offered here via this Github repository.
Consultings days can be requested to help for the implementation.
- Visual TOM 7.1 or greater
- PagerDuty account with Events API v2 enabled
- PagerDuty service with integration key (routing key)
- Python 3.10 or greater
- Python requests library (
pip install requests)
The script can be customized to fit your needs for PagerDuty incident fields. You can find the available fields in the PagerDuty Events API v2 documentation.
You need to replace YOUR_ROUTING_KEY with your actual PagerDuty integration key.
- Copy the template configuration file:
cp config.template.py config.py
- Edit the config.py file with your PagerDuty routing key and default values
- Create an alarm in Visual TOM to trigger the script (example below for a job to be adapted)
python3 FULL_PATH_TO_SCRIPT/PagerDuty_CreateIncident.py --summary "Job {VT_JOB_FULLNAME} has failed" --severity "critical" --component "job-execution" --source "vtom" --customDetails '{"job_name": "{VT_JOB_FULLNAME}", "error_code": "JOB_FAILED"}'
The script uses a configuration file (config.py) that should not be committed to version control. Use the provided config.template.py as a starting point:
# PagerDuty configuration
pagerduty_events_url = "https://events.pagerduty.com/v2/enqueue"
routing_key = "your-routing-key-here" # Replace with your actual PagerDuty routing key
# Default values
default_severity = "critical"
default_component = "system"
default_source = "vtom-script"| Parameter | Required | Description |
|---|---|---|
--summary |
Yes | Summary of the incident |
--routingKey |
No | PagerDuty routing key (overrides config) |
--severity |
No | Severity level (critical, error, warning, info) |
--component |
No | Component affected |
--group |
No | Responsible group |
--class |
No | Incident class |
--source |
No | Source of the incident |
--customDetails |
No | Custom details (JSON string) |
This project is licensed under the Apache 2.0 License - see the LICENSE file for details
Absyss SAS has adopted the Contributor Covenant as its Code of Conduct, and we expect project participants to adhere to it. Please read the full text so that you can understand what actions will and will not be tolerated.