X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=doc%2Fexamples%2Ftrigger-on-event%2FREADME.md;fp=doc%2Fexamples%2Ftrigger-on-event%2FREADME.md;h=2c184f72753709a0a669f1fa645edd895b5958aa;hp=0000000000000000000000000000000000000000;hb=1831ae68b70dece8e9b847081526495adbbf05e5;hpb=25357057de5ae4dd2a572e8f9b893c1b90cbd60a diff --git a/doc/examples/trigger-on-event/README.md b/doc/examples/trigger-on-event/README.md new file mode 100644 index 000000000..2c184f727 --- /dev/null +++ b/doc/examples/trigger-on-event/README.md @@ -0,0 +1,56 @@ +# Trigger notification exemple + +## Description +This exemple is made-up of three executables. + +### `notification-client` + +``` +Usage: notification-client TRIGGER_NAME +``` + +A simple client that subscribes to the notifications emitted by the `TRIGGER_NAME` trigger. + +### `instrumented-app` + +An application that emits the `trigger_exemple:my_event` event every 2 seconds. + +### `demo.sh` + +This script adds a trigger named `demo_trigger` which emits a notification when the user-space `trigger_exemple:my_event` event occurs. + +Once the trigger has been setup, the notification-client is launched to print all notifications emitted by the `demo_trigger` trigger. + +## Building + +Simply run the included Makefile. + +## Running the exemple + +1) Launch a session daemon using: + ``` + $ lttng-sessiond + ``` +2) Launch the `demo.sh` script +3) Launch the `instrumented-app` + +The following output should be produced: + +``` +$ ./demo.sh +Registering a notification trigger named "demo_trigger" for the trigger_exemple:my_event user-space event +Trigger registered successfully. +Subscribed to notifications of trigger "demo_trigger" +[02-14-2020] 18:13:34.779766 - Received notification of event rule trigger "demo_trigger" +[02-14-2020] 18:13:36.779888 - Received notification of event rule trigger "demo_trigger" +[02-14-2020] 18:13:38.780514 - Received notification of event rule trigger "demo_trigger" +[02-14-2020] 18:13:40.780656 - Received notification of event rule trigger "demo_trigger" +``` + +``` +$ ./instrumented-app +[02-14-2020] 18:13:34.779433 - Tracing event "trigger_exemple:my_event" +[02-14-2020] 18:13:36.779693 - Tracing event "trigger_exemple:my_event" +[02-14-2020] 18:13:38.780010 - Tracing event "trigger_exemple:my_event" +[02-14-2020] 18:13:40.780286 - Tracing event "trigger_exemple:my_event" +```