Add trigger on event rule matches application example
[lttng-tools.git] / doc / examples / trigger-condition-event-matches / demo.sh
CommitLineData
595ed92e
JR
1#!/bin/bash
2#
3# Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4#
5# SPDX-License-Identifier: MIT
6
7EVENT_NAME=trigger_example:my_event
8TRIGGER_NAME=demo_trigger
9TRIGGER_NAME_CAPTURE=demo_trigger_capture
10
11if ! lttng list > /dev/null 2>&1; then
12 echo "Could not connect to session daemon, are you sure it is running?"
13 exit 1
14fi
15
16echo "Registering a notification trigger named \"$TRIGGER_NAME\" for the $EVENT_NAME user-space event"
17lttng add-trigger --name $TRIGGER_NAME \
18 --condition event-rule-matches \
19 --domain=user \
20 --name=$EVENT_NAME \
21 --action notify
22
23
24echo "Registering a notification trigger named \"$TRIGGER_NAME_CAPTURE\" for the $EVENT_NAME user-space event with payload capture"
25lttng add-trigger --name $TRIGGER_NAME_CAPTURE \
26 --condition event-rule-matches \
27 --domain=user \
28 --name=$EVENT_NAME \
29 --capture 'iteration' \
30 --capture 'does_not_exist' \
31 --capture '$ctx.vtid' \
32 --capture '$ctx.procname'\
33 --action notify
34
35./notification-client $TRIGGER_NAME $TRIGGER_NAME_CAPTURE
This page took 0.023601 seconds and 4 git commands to generate.