Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show alert timezone #37

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ Using the opsreview tool, you can quickly compile a report on recent alerts for
```
> python pull_alerts.py

Time: Tuesday, January 19 - 9:19 AM
Time: Tuesday, January 19 - 9:19 AM +0000
Service: api
Description: Failing API alarm: CRON failure
URL: https://subdomain.pagerduty.com/incidents/ABC123
Notes:
['[email protected]: #a - Re-ran CRON']

Time: Tuesday, January 19 - 12:03 PM
Time: Tuesday, January 19 - 12:03 PM +0000
Service: api
Description: Failing API alarm: CPU percent > 10
URL: https://subdomain.pagerduty.com/incidents/ABC124
Notes:
['[email protected]: #na - Temporary spike in CPU, no action taken. Alert is too sensitive.']

Time: Tuesday, January 19 - 1:35 PM
Time: Tuesday, January 19 - 1:35 PM +0000
Service: www
Description: Failing WWW alarm: 5XX percent > 5
URL: https://subdomain.pagerduty.com/incidents/ABC125
Expand Down Expand Up @@ -57,3 +57,9 @@ Run the script.
```bash
python pull_alerts.py
```

## Timezone
By default, local timezone is used to print alert time. To change default timezone use `TZ` environment variable:
```bash
TZ=UTC python pull_alerts.py
```
2 changes: 1 addition & 1 deletion pull_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class FormattedIncident(object):
def pretty_output(self):
return u'Time: {}\nService: {}\nDescription: {}\nURL: {}\nNotes:\n{}\n'.format(
self.created_on.strftime('%A, %B %-d - %-I:%M %p'),
self.created_on.strftime('%A, %B %-d - %-I:%M %p %z'),
self.service,
self.description,
self.url,
Expand Down
Loading