• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..10-May-2020-

config_files/H10-May-2020-799637

file_modules/H10-May-2020-8825

kafka_modules/H10-May-2020-825613

protos/H10-May-2020-6,7326,180

utils/H10-May-2020-305117

zmq_modules/H10-May-2020-4818

CONFIG-KEYS.pmgrpcdH A D10-May-202010.7 KiB239236

README.pmgrpcdH A D10-May-20204.5 KiB11994

__init__.pyH A D10-May-20200 10

cisco_pmgrpcd.pyH A D10-May-20209 KiB249166

config.pyH A D10-May-20202.1 KiB5422

export_pmgrpcd.pyH A D10-May-20205.5 KiB15394

huawei_pmgrpcd.pyH A D10-May-20208.9 KiB250181

kafka_receiver.pyH A D10-May-20201.8 KiB5520

lib_pmgrpcd.pyH A D10-May-20203.3 KiB11060

pmgrpcd.pyH A D10-May-202018.1 KiB540424

utils.pyH A D10-May-20201.3 KiB355

README.pmgrpcd

1These are quickstart notes on how to install pmgrpcd.py and all of its
2dependencies. CONFIG-KEYS.pmgrpcd provides the documentation for all of
3pmgrpcd.py configuration parameters.
4
5Install pmgrpcd.py
6===================
7
8shell> mkdir -p /opt/pkg/
9shell> git clone https://github.com/pmacct/pmacct.git /opt/pkg/pmacct
10shell> ln -s /opt/pkg/pmacct/telemetry/decoders/v3 /opt/pkg/pmgrpcd
11shell> chmod 700 /opt/pkg/pmgrpcd/pmgrpcd.py
12
13Install protoc
14--------------
15Install system dependencies:
16
17shell> sudo yum install tar wget autoconf libtool automake gcc-c++ make git bzip2 curl unzip zlib zlib-devel -y [CentOS/RHEL]
18shell> sudo apt-get install tar wget autoconf libtool automake g++ make git bzip2 curl unzip zlib1g-dev [Debian/Ubuntu]
19
20Obtain and compile GPB code:
21
22shell> git clone https://github.com/protocolbuffers/protobuf.git /opt/pkg/protobuf
23shell> cd /opt/pkg/protobuf
24shell> ./autogen.sh
25shell> ./configure
26shell> make
27shell> make install
28shell> ldconfig
29
30shell> protoc --version
31
32Python interpreter
33------------------
34It is recommended to use Python >= 3.7 although the code would work
35with less recent Python 3 interpreters (ie. 3.5 and 3.6). The Command
36Line examples in the remainder of this document will assume the use of
37python3.7.
38
39Install Python dependencies
40---------------------------
41shell> python3.7 -m pip install -r requirements.txt
42
43Setup PYTHONPATH
44----------------
45This is an environment variable which you can set to add additional
46directories where python will look for modules and packages. Setting
47PYTHONPATH is required (for the time being) to look for .py files in
48sub-directories. The following example is based on bash shell:
49
50shell> PYTHONPATH=/opt/pkg/pmgrpcd/protos:/opt/pkg/pmgrpcd/zmq_modules:/opt/pkg/pmgrpcd/kafka_modukes:/opt/pkg/pmgrpcd/file_modules:/etc/pmacct/telemetry/pblib
51shell> export PYTHONPATH
52
53Compile grpc libs (L1)
54----------------------
55shell> mkdir -p /etc/pmacct/telemetry/pblib
56
57Copy gRPC .proto file(s) (ie. huawei-grpc-dialout.proto) to
58/etc/pmacct/telemetry/pblib (some sample .proto files for testing
59purposes are available in the protos/ directory and can be copied
60over).
61
62shell> cd /etc/pmacct/telemetry/pblib/
63shell> python3.7 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. huawei-grpc-dialout.proto
64shell> python3.7 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. cisco_grpc_dialout.proto
65
66Compile PB libs (L2/3)
67----------------------
68shell> cd /etc/pmacct/telemetry/pblib/
69shell> /usr/local/bin/protoc -I=. --python_out=. ./huawei-grpc-dialout.proto
70shell> /usr/local/bin/protoc -I=. --python_out=. ./cisco_grpc_dialout.proto
71shell> /usr/local/bin/protoc -I=. --python_out=. ./huawei-telemetry.proto
72shell> /usr/local/bin/protoc -I=. --python_out=. ./huawei-ifm.proto
73shell> /usr/local/bin/protoc -I=. --python_out=. ./huawei-devm.proto
74shell> /usr/local/bin/protoc -I=. --python_out=. ./openconfig-interfaces.proto
75
76First Run pmgrpcd.py
77--------------------
78shell> cd /opt/pkg/pmgrpcd && python3.7 ./pmgrpcd.py -h
79
80Scenario 1: ZMQ output to pmtelemetryd
81--------------------------------------
82Export of JSON-encoded Streaming Telemetry data to pmtelemetryd allows
83to quickly access all daemon features, ie. save to files, produce to
84Kafka, stream/log data out or dump at regular intervals, etc.
85
86The default configuration in config_files/telemetry.conf is suitable
87for this scenario. If collecting from Cisco 'cisco = True' should be
88set; if collecting from Huawei 'huawei = True' should be set. The
89configuration instructs pmgrpcd to listen for Streaming Telemetry data
90on port 10000 and export it via ZMQ on port 50000:
91
92shell> python3.7 ./pmgrpcd.py -N
93
94pmtelemetryd can be configured as follows to read data from a ZeroMQ on
95port 50000 and stream/log it to local files:
96
97telemetry_daemon_zmq_address: 127.0.0.1:50000
98telemetry_daemon_decoder: json
99!
100telemetry_daemon_msglog_file: /path/to/spool/telemetry-msglog-$peer_src_ip.json
101telemetry_daemon_msglog_output: json
102
103Or pmtelemetryd can be configured as follows to read data from a ZeroMQ
104on port 50000 and produce it to a Kafka broker:
105
106telemetry_daemon_zmq_address: 127.0.0.1:50000
107telemetry_daemon_decoder: json
108!
109telemetry_dump_kafka_broker_host: <Kafka broker IP address/hostname>
110telemetry_dump_kafka_broker_port: 9092
111telemetry_dump_kafka_topic: pmacct.streaming-telemetry.test
112telemetry_dump_refresh_time: 60
113
114Concluding notes
115----------------
116The default config being read is config_files/telemetry.conf .
117To learn more about all configuration directives see the document
118CONFIG-KEYS.pmgrpcd .
119