Skip to content

Commit

Permalink
Show alert timezone (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnest authored Dec 21, 2023
1 parent 2a87b82 commit f21537d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
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

0 comments on commit f21537d

Please sign in to comment.