Commit | Line | Data |
---|---|---|
d3a684ee JR |
1 | # Trigger notification exemple |
2 | ||
3 | ## Description | |
4 | This exemple is made-up of three executables. | |
5 | ||
6 | ### `notification-client` | |
7 | ||
8 | ``` | |
9 | Usage: notification-client TRIGGER_NAME | |
10 | ``` | |
11 | ||
12 | A simple client that subscribes to the notifications emitted by the `TRIGGER_NAME` trigger. | |
13 | ||
14 | ### `instrumented-app` | |
15 | ||
16 | An application that emits the `trigger_exemple:my_event` event every 2 seconds. | |
17 | ||
18 | ### `demo.sh` | |
19 | ||
20 | This script adds a trigger named `demo_trigger` which emits a notification when the user-space `trigger_exemple:my_event` event occurs. | |
21 | ||
22 | Once the trigger has been setup, the notification-client is launched to print all notifications emitted by the `demo_trigger` trigger. | |
23 | ||
24 | ## Building | |
25 | ||
26 | Simply run the included Makefile. | |
27 | ||
28 | ## Running the exemple | |
29 | ||
30 | 1) Launch a session daemon using: | |
31 | ``` | |
32 | $ lttng-sessiond | |
33 | ``` | |
34 | 2) Launch the `demo.sh` script | |
35 | 3) Launch the `instrumented-app` | |
36 | ||
37 | The following output should be produced: | |
38 | ||
39 | ``` | |
40 | $ ./demo.sh | |
41 | Registering a notification trigger named "demo_trigger" for the trigger_exemple:my_event user-space event | |
42 | Trigger registered successfully. | |
43 | Subscribed to notifications of trigger "demo_trigger" | |
44 | [02-14-2020] 18:13:34.779766 - Received notification of event rule trigger "demo_trigger" | |
45 | [02-14-2020] 18:13:36.779888 - Received notification of event rule trigger "demo_trigger" | |
46 | [02-14-2020] 18:13:38.780514 - Received notification of event rule trigger "demo_trigger" | |
47 | [02-14-2020] 18:13:40.780656 - Received notification of event rule trigger "demo_trigger" | |
48 | ``` | |
49 | ||
50 | ``` | |
51 | $ ./instrumented-app | |
52 | [02-14-2020] 18:13:34.779433 - Tracing event "trigger_exemple:my_event" | |
53 | [02-14-2020] 18:13:36.779693 - Tracing event "trigger_exemple:my_event" | |
54 | [02-14-2020] 18:13:38.780010 - Tracing event "trigger_exemple:my_event" | |
55 | [02-14-2020] 18:13:40.780286 - Tracing event "trigger_exemple:my_event" | |
56 | ``` |