forked from Elastica/pd-trigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
109 lines (65 loc) · 3.16 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pd-trigger
==========
A lightweight, portable, and robust PagerDuty trigger utility.
--------------------------------------------------------------
The pd-trigger utility can be used to trigger PD incidents, straight from the
shell, or any program. pd-trigger is written in portable Bourne-ish sh(1),
implementing the the following Trigger API:
https://developer.pagerduty.com/documentation/integration/events/trigger
### Dependencies
pd-trigger depends on the *curl(1)* utility, but is otherwise quite portable.
The authors are using it on the following platforms:
- FreeBSD
- Debian/Ubuntu Linux
- OSX/Darwin
pd-trigger should work well on the following platforms as well,
- OpenBSD
- CentOS/RHEL
- NetBSD
- Illumos/Solaris
- DragonFlyBSD
Can be run from cron(1), called from other UNIX programs, and receive stdout
in pipes from other programs, as plain text.
### Installation
pd-trigger is a very self-contained utility, and can be installed a number
of different ways. A simple installer is included:
$ ./install
If you run the installer as root, it will attempt to install into
/usr/local/bin by default. If any other user, it will attempt to
install ~/bin for that user. There are ENV overrides to allow
changing install location, among other install details- read the
script for more info.
### Examples
prints help page,
$ pd-trigger -h
When successfully exiting, default output behavior is to print the unique ID
of the event to stdout, as well as printing out into syslog(1) via logger(1).
Basic event trigger, no configuration:
$ pd-trigger -r <API_routing_key>
To generate a config file (common use, to store an event routing_key):
$ pd-trigger -c >> /etc/pd-trigger.conf
# edit this file, add a PD event routing_key, and an
#event can be triggered by simply running the program,
$ pd-trigger
To trigger an alert message with a simple description,
$ pd-trigger Hello, world.
# or, same message via stdin,
$ echo "Hello, world." | pd-trigger
# or, the same message via explicit argument,
$ pd-trigger -s "Hello, world."
To add a Link to the alert message,
$ pd-trigger -u 'https://fqdn.tld/path' -s "Hello, world."
To ensure a new event is triggered (instead of appending to existing),
$ pd-trigger -i Some new message.
You may use the '-' character to ensure cli parameter description string
is separated from option arguments, for example:
$ pd-trigger -i -r 000000000 -v - Message which may have -c or other opt.
pd-trigger has more options which fully use the PagerDuty v2 API, which
makes this program flexible to use in your own scripts.
### Links
This utility is intended to conform to the PagerDuty v2 API trigger specification:
https://developer.pagerduty.com/api-reference/b3A6Mjc0ODI2Nw-send-an-event-to-pager-duty
Instructions for generating an API Integration Key for a given service:
https://support.pagerduty.com/docs/services-and-integrations#generate-a-new-integration-key
Alternatively, if you are looking for command line tools which do more than trigger events, be sure to check out the full-featured PagerDuty-CLI:
https://github.com/martindstone/pagerduty-cli/wiki/PagerDuty-CLI-User-Guide