|
| 1 | +Dynmon service |
| 2 | +============== |
| 3 | + |
| 4 | +Dynmon is a transparent service that allows the dynamic injection of eBPF code in the linux kernel, enabling the monitoring of the network traffic and the collection and exportation of custom metrics. |
| 5 | + |
| 6 | +This service exploits the capabilities of Polycube to replace the eBPF code running in the dataplane and the use of eBPF maps to share data between the control plane and the data plane. |
| 7 | + |
| 8 | +Features |
| 9 | +-------- |
| 10 | +- Transparent service, can be attached to any network interface and Polycube services |
| 11 | +- Support for the injection of any eBPF code at runtime |
| 12 | +- Support for eBPF maps content exportation through the REST interface as metrics |
| 13 | +- Support for two different exportation formats: JSON and OpenMetrics |
| 14 | + |
| 15 | +Limitations |
| 16 | +----------- |
| 17 | +- The OpenMetrics format does not support complex data structures, hence the maps are exported only if their value type is a simple type (structs and unions are not supported) |
| 18 | +- The OpenMetrics Histogram and Summary metrics are not yet supported |
| 19 | + |
| 20 | +How to use |
| 21 | +---------- |
| 22 | + |
| 23 | + |
| 24 | +Creating the service |
| 25 | +^^^^^^^^^^^^^^^^^^^^ |
| 26 | +:: |
| 27 | + |
| 28 | + #create the dynmon service instance |
| 29 | + polycubectl dynmon add monitor |
| 30 | + |
| 31 | + |
| 32 | +Configuring the data plane |
| 33 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 34 | +In order to configure the dataplane of the service, a configuration JSON object must be sent to the control plane; this action cannot be done through the **polycubectl** tool as it does not handle complex inputs. |
| 35 | + |
| 36 | +To send the data plane configuration to the control plane it is necessary to exploit the REST interface of the service, applying a ``PUT`` request to the ``/dataplane`` endpoint. |
| 37 | + |
| 38 | +Configuration examples can be found in the *examples* directory. |
| 39 | + |
| 40 | + |
| 41 | +Attaching to a interface |
| 42 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 43 | +:: |
| 44 | + |
| 45 | + # Attach the service to a network interface |
| 46 | + polycubectl attach monitor eno0 |
| 47 | + |
| 48 | + # Attach the service to a cube port |
| 49 | + polycubectl attach monitor br1:toveth1 |
| 50 | + |
| 51 | + |
| 52 | +Collecting metrics |
| 53 | +^^^^^^^^^^^^^^^^^^ |
| 54 | +To collect the metrics of the service, two endpoints have been defined to enable the two possible exportation formats: |
| 55 | + |
| 56 | +- JSON format |
| 57 | + |
| 58 | + :: |
| 59 | + |
| 60 | + polycubectl monitor metrics show |
| 61 | + |
| 62 | +- OpenMetrics format |
| 63 | + |
| 64 | + :: |
| 65 | + |
| 66 | + polycubectl monitor open-metrics show |
| 67 | + |
| 68 | + |
| 69 | +Dynmon Injector Tool |
| 70 | +-------------------- |
| 71 | + |
| 72 | +This tool allows the creation and the manipulation of a `dynmon` cube without using the standard `polycubectl` CLI. |
| 73 | + |
| 74 | +Install |
| 75 | +^^^^^^^ |
| 76 | +Some dependencies are required for this tool to run: |
| 77 | +:: |
| 78 | + pip install -r requirements.txt |
| 79 | + |
| 80 | + |
| 81 | +Running the tool |
| 82 | +^^^^^^^^^^^^^^^^ |
| 83 | +:: |
| 84 | + |
| 85 | + Usage: `dynmon_injector.py [-h] [-a ADDRESS] [-p PORT] [-v] cube_name peer_interface path_to_dataplane` |
| 86 | + |
| 87 | + positional arguments: |
| 88 | + cube_name indicates the name of the cube |
| 89 | + peer_interface indicates the network interface to connect the cube to |
| 90 | + path_to_dataplane indicates the path to the json file which contains the new dataplane configuration |
| 91 | + which contains the new dataplane code and the metadata associated to the exported metrics |
| 92 | + |
| 93 | + optional arguments: |
| 94 | + -h, --help show this help message and exit |
| 95 | + -a ADDRESS, --address ADDRESS set the polycube daemon ip address (default: localhost) |
| 96 | + -p PORT, --port PORT set the polycube daemon port (default: 9000) |
| 97 | + -v, --version show program's version number and exit |
| 98 | + |
| 99 | + |
| 100 | +Usage examples |
| 101 | +^^^^^^^^^^^^^^ |
| 102 | +:: |
| 103 | + |
| 104 | + basic usage: |
| 105 | + ./dynmon_injector.py monitor_0 eno1 ../examples/packet_counter.json |
| 106 | + |
| 107 | + setting custom ip address and port to contact the polycube daemon: |
| 108 | + ./dynmon_injector.py -a 10.0.0.1 -p 5840 monitor_0 eno1 ../examples/packet_counter.json |
| 109 | + |
| 110 | + |
| 111 | +This tool creates a new `dynmon` cube with the given configuration and attaches it to the selected interface. |
| 112 | + |
| 113 | +If the monitor already exists, the tool checks if the attached interface is the same used previously; if not, it detaches the cube from the previous interface and attaches it to the new one; then, the selected dataplane is injected. |
0 commit comments