aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 1d166773e874857d16d1006e5afa3786d1468cd8 (plain)
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
109
110
111
112
113
# agl-service-xds-monitoring

An AGL binding used to control collected data. Those data may come from
`agl-low-collector` or from AGL `supervision`.

**UNDER DEVELOPMENT - this binding is not fully functional, it's a proof of concept for now**

## Setup

```bash
git clone https://gerrit.automotivelinux.org/gerrit/apps/agl-service-xds-monitoring
cd agl-server-xds-monitoring
```

## Build  for AGL

```bash
#setup your build environment
. /xdt/sdk/environment-setup-aarch64-agl-linux
#build your application
./conf.d/autobuild/agl/autobuild package
```

## Build for 'native' Linux distros (Fedora, openSUSE, Debian, Ubuntu, ...)

```bash
./conf.d/autobuild/linux/autobuild package
```

You can also use binary package from OBS: [opensuse.org/LinuxAutomotive][opensuse.org/LinuxAutomotive]

## Test

### Native setup

Here are commands used to build and setup some AGL services/bindings in order to test on `xds` service natively on a Linux host.

#### Build

```bash
cd $ROOT_DIR/agl-service-xds-monitoring
./conf.d/autobuild/linux/autobuild build
```

#### Run services/bindings

```bash
# Setup supervisor to supervise AGL system
afs-supervisor --port 1712 --token HELLO --ws-server=unix:/tmp/supervisor -vv

# Start harvester to save data in a TSDB
cd $ROOT_DIR/agl-service-harvester
afb-daemon --port=1234 --name=afb-harvester --workdir=./build/package --ldpaths=lib --roothttp=htdocs  --token= --tracereq=common --ws-server unix:/tmp/harvester -vv

# Start XDS collector to control supervisor
cd $ROOT_DIR/agl-service-xds-monitoring
afb-daemon --port=2222 --name=afb-xds --workdir=./build/package --ldpaths=lib --roothttp=htdocs  --token= --ws-client=unix:/tmp/supervisor --ws-client=unix:/tmp/harvester -vvv
```

**Example 1** : Demo based on simple helloworld AGL service

``` bash
cd $ROOT_DIR/app-framework-binder
afb-daemon -t '' -p 5555 -M --roothttp test --ws-server unix:ave --name test_server -vvv
afb-daemon -t '' -p 4444 -M --roothttp test --no-ldpaths --ws-client unix:ave --name test_client -vvv

# Get bindings list
afb-client-demo --raw 'localhost:2222/api?token=1977&uuid=magic' xds list | jq .response[].pid

# Request monitoring of socket "unix:ave"
afb-client-demo 'localhost:2222/api?token=HELLO&uuid=c' xds trace/start '{"ws":"unix:ave"}'

# Call ping verb of hello api (should be spy by supervision/monitoring)
afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello ping

# Same call some other verbs of hello api
afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventadd '{"tag":"x","name":"event"}'
afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventsub '{"tag":"x"}'
afb-client-demo 'localhost:5555/api?token=toto&uuid=magic' hello eventpush '{"tag":"x","data":true}'

# Dump data from TSDB
influx -database 'agl-garner' -execute 'show series'
influx -database 'agl-garner' -execute 'select * from "xds/supervisor/trace"'

# Stop monitoring
afb-client-demo 'localhost:2222/api?token=HELLO&uuid=c' xds trace/stop
```

**Example 2**: Demo based on AGL mockup services

```bash
# Monitor AGL mockup services
cd $ROOT_DIR/agl-services-mockup && start_agl_mockup.sh 1
# ... at this point script stop and wait user...

# In another shell, execute following commands to request monitoring of can_emul and gps_emul sockets
afb-client-demo 'localhost:2222/api?token=HELLO&uuid=c' xds trace/start '{"ws":"can_emul"}'
afb-client-demo 'localhost:2222/api?token=HELLO&uuid=c' xds trace/start '{"ws":"gps_emul"}'

# Press any key in 1 shell to continue start_agl_mockup.sh script

# Dump data from TSDB
influx -database 'agl-garner' -execute 'select * from "xds/supervisor/trace"'

# Drop data
# influx -database 'agl-garner' -execute 'drop measurement "xds/supervisor/trace"'
```

## Deploy

### AGL

TBD