Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 10-May-2020 | - | ||||
config_files/ | H | 10-May-2020 | - | 799 | 637 | |
file_modules/ | H | 10-May-2020 | - | 88 | 25 | |
kafka_modules/ | H | 10-May-2020 | - | 825 | 613 | |
protos/ | H | 10-May-2020 | - | 6,732 | 6,180 | |
utils/ | H | 10-May-2020 | - | 305 | 117 | |
zmq_modules/ | H | 10-May-2020 | - | 48 | 18 | |
CONFIG-KEYS.pmgrpcd | H A D | 10-May-2020 | 10.7 KiB | 239 | 236 | |
README.pmgrpcd | H A D | 10-May-2020 | 4.5 KiB | 119 | 94 | |
__init__.py | H A D | 10-May-2020 | 0 | 1 | 0 | |
cisco_pmgrpcd.py | H A D | 10-May-2020 | 9 KiB | 249 | 166 | |
config.py | H A D | 10-May-2020 | 2.1 KiB | 54 | 22 | |
export_pmgrpcd.py | H A D | 10-May-2020 | 5.5 KiB | 153 | 94 | |
huawei_pmgrpcd.py | H A D | 10-May-2020 | 8.9 KiB | 250 | 181 | |
kafka_receiver.py | H A D | 10-May-2020 | 1.8 KiB | 55 | 20 | |
lib_pmgrpcd.py | H A D | 10-May-2020 | 3.3 KiB | 110 | 60 | |
pmgrpcd.py | H A D | 10-May-2020 | 18.1 KiB | 540 | 424 | |
utils.py | H A D | 10-May-2020 | 1.3 KiB | 35 | 5 |
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