Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Decoding Junos Telemetry Interface Data With UNIX Utilities

    You can use UNIX utilities to decode Junos Telemetry Interface data on a server, or collector, that is streaming data from a Juniper Networks device. The example in this section shows you how to decode a single packet of streamed data.

    Preparing the Collector to Decode Data

    This example requires the following:

    • UNIX OS with the Netcat (nc) utility.
    • Protocol buffers compiler.
    • Junos Telemetry Interface protocol buffers files.

    This procedure shows how to prepare the collector to decode data using the Ubuntu OS.

    1. Install the Netcat utility.
      sudo apt-get install netcat
    2. Install the protocol buffers compiler.
      sudo apt-get install protobuf-compiler
    3. Install the protocol buffers developer’s library.
      sudo apt-get install libprotobuf-dev
    4. Verify that the library files are installed.
      ls /usr/include/google/protobuf/descriptor.proto
      /usr/include/google/protobuf/descriptor.proto
    5. Download and install the latest version of the Junos Telemetry interface protocol buffers files.

      From a Web browser, navigate to the All Junos Platforms software download URL on the Juniper Networks page: http://www.juniper.net/support/downloads/. After you select the name of the Junos OS platform and the release number, go to the Tools section and download the Junos Telemetry Interface Data Model Files package.

      tar –xvzf junos-telemetry-interface-15.1F6.9.tgz
      junos-telemetry-interface/telemetry_top.proto
      junos-telemetry-interface/logical_port.proto
      junos-telemetry-interface/lsp_mon.proto
      junos-telemetry-interface/firewall.proto
      junos-telemetry-interface/lsp_stats.proto
      junos-telemetry-interface/port.proto
      junos-telemetry-interface/NOTICE
      junos-telemetry-interface/license.txt

      Note: Be sure to note the location of the extracted files.

    Decoding Data on the Collector

    This procedure shows you how to capture data, decode raw data, and use the protocol buffers files to decode data.

    To decode data:

    1. Capture the data.

      Run netcat on a destination streaming telemetry server, or collector, in UDP listener mode to store all incoming datagrams into a file. Use the destination port number configured in streaming-server profile on your Juniper Networks device.

      nc -ul 0.0.0.0 20000 > data.gpb

      Note: This command stores datagrams into a file named data.gpb. Run this program to capture data. When you want to stop receiving data, stop with the program by sending the break signal (Control + C)

    2. Decode raw data.

      Note: This step is optional. It is not required if you know the encoded message type of the data.

      Decode the message from the data.gpb file.

      protoc --decode_raw  < ../data.gpb
      1: "hillrock:160.1.1.25"
      2: 0
      4: "S1:/junos/system/linecard/interface/logical/usage/:/junos/system/linecard/interface/logical/usage/:PFE"
      5: 65265
      6: 1477686534474
      7: 1
      8: 1
      101 {
        2636 {
          7 {
            1 {
              1: "et-0/0/4:2.32767"
              2: 1477642750
              3: 813
              4 {
                12: 0x37363732332e3165
              }
      
      .
      .
      .

      The next nested structure under 2636 identifies the sensor type. The numerical value 2636 identifies the JuniperNetworksSensor message, which is defined in the telemetry_top.proto file. In this example, the numerical identifier 7 corresponds to the LogicalPort message defined in the logical_port.proto file. Use this information in the next step to generate more detailed output.

    3. Decode the message to include field names.

      Run the protocol buffers compiler with the decode option. Additionally, specify the top-level message type (TelemetryStream) and the file with the message definition, logical_port.proto. You must also include the Goggle protocol buffers (gpb) library.

      protoc --decode TelemetryStream logical_port.proto -I /usr/include -I .  < data.gpb
      system_id: "hillrock:160.1.1.25"
      component_id: 0
      sensor_name: "S1:/junos/system/linecard/interface/logical/usage/:/junos/system/linecard/interface/logical/usage/:PFE"
      sequence_number: 65268
      timestamp: 1477686536484
      version_major: 1
      version_minor: 1
      enterprise {
        [juniperNetworks] {
          [jnprLogicalInterfaceExt] {
            interface_info {
              if_name: "et-0/0/4:2.32767"
              init_time: 1477642750
              snmp_if_index: 813
              parent_ae_name: "ae1.32767"
              ingress_stats {
                if_packets: 0
                if_octets: 0
              }
              egress_stats {
                if_packets: 0
                if_octets: 0
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/7:3.0"
              init_time: 1477642750
              snmp_if_index: 520
              parent_ae_name: "ae0.0"
              ingress_stats {
                if_packets: 61203309
                if_octets: 6487548454
              }
              egress_stats {
                if_packets: 87416547
                if_octets: 9266153982
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.0"
              init_time: 1477642750
              snmp_if_index: 2512
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214806
              }
              egress_stats {
                if_packets: 26247215
                if_octets: 2781829290
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.1"
              init_time: 1477642750
              snmp_if_index: 2522
              ingress_stats {
                if_packets: 26266249
                if_octets: 2784214972
              }
              egress_stats {
                if_packets: 26249115
                if_octets: 2781935590
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.2"
              init_time: 1477642750
              snmp_if_index: 2523
              ingress_stats {
                if_packets: 26266248
                if_octets: 2784214912
              }
              egress_stats {
                if_packets: 26249106
                if_octets: 2781935086
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.3"
              init_time: 1477642750
              snmp_if_index: 2524
              ingress_stats {
                if_packets: 26266248
                if_octets: 2784214820
              }
              egress_stats {
                if_packets: 26248520
                if_octets: 2781902320
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.4"
              init_time: 1477642750
              snmp_if_index: 2525
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214760
              }
              egress_stats {
                if_packets: 26247302
                if_octets: 2781834112
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.5"
              init_time: 1477642750
              snmp_if_index: 2526
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214760
              }
              egress_stats {
                if_packets: 26247209
                if_octets: 2781828904
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.6"
              init_time: 1477642750
              snmp_if_index: 2527
              ingress_stats {
                if_packets: 26266248
                if_octets: 2784214820
              }
              egress_stats {
                if_packets: 26247196
                if_octets: 2781828226
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.7"
              init_time: 1477642750
              snmp_if_index: 2528
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214760
              }
              egress_stats {
                if_packets: 26247203
                if_octets: 2781828618
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.8"
              init_time: 1477642750
              snmp_if_index: 2529
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214760
              }
              egress_stats {
                if_packets: 26247225
                if_octets: 2781829850
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.9"
              init_time: 1477642750
              snmp_if_index: 2530
              ingress_stats {
                if_packets: 26266247
                if_octets: 2784214760
              }
              egress_stats {
                if_packets: 26247209
                if_octets: 2781828954
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.32767"
              init_time: 1477642750
              snmp_if_index: 648
              ingress_stats {
                if_packets: 4
                if_octets: 240
              }
              egress_stats {
                if_packets: 0
                if_octets: 0
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/4:2.32767"
              init_time: 1477642750
              snmp_if_index: 813
              parent_ae_name: "ae1.32767"
              ingress_stats {
                if_packets: 0
                if_octets: 0
              }
              egress_stats {
                if_packets: 0
                if_octets: 0
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/7:3.0"
              init_time: 1477642750
              snmp_if_index: 520
              parent_ae_name: "ae0.0"
              ingress_stats {
                if_packets: 61206122
                if_octets: 6487846632
              }
              egress_stats {
                if_packets: 87420567
                if_octets: 9266580102
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.0"
              init_time: 1477642750
              snmp_if_index: 2512
              ingress_stats {
                if_packets: 26267458
                if_octets: 2784343172
              }
              egress_stats {
                if_packets: 26248420
                if_octets: 2781957020
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.1"
              init_time: 1477642750
              snmp_if_index: 2522
              ingress_stats {
                if_packets: 26267460
                if_octets: 2784343338
              }
              egress_stats {
                if_packets: 26250320
                if_octets: 2782063320
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.2"
              init_time: 1477642750
              snmp_if_index: 2523
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343278
              }
              egress_stats {
                if_packets: 26250311
                if_octets: 2782062816
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.3"
              init_time: 1477642750
              snmp_if_index: 2524
              ingress_stats {
                if_packets: 26267460
                if_octets: 2784343292
              }
              egress_stats {
                if_packets: 26249725
                if_octets: 2782030050
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.4"
              init_time: 1477642750
              snmp_if_index: 2525
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343232
              }
              egress_stats {
                if_packets: 26248507
                if_octets: 2781961842
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.5"
              init_time: 1477642750
              snmp_if_index: 2526
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343232
              }
              egress_stats {
                if_packets: 26248414
                if_octets: 2781956634
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.6"
              init_time: 1477642750
              snmp_if_index: 2527
              ingress_stats {
                if_packets: 26267460
                if_octets: 2784343292
              }
              egress_stats {
                if_packets: 26248401
                if_octets: 2781955956
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.7"
              init_time: 1477642750
              snmp_if_index: 2528
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343232
              }
              egress_stats {
                if_packets: 26248408
                if_octets: 2781956348
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.8"
              init_time: 1477642750
              snmp_if_index: 2529
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343232
              }
              egress_stats {
                if_packets: 26248430
                if_octets: 2781957580
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.9"
              init_time: 1477642750
              snmp_if_index: 2530
              ingress_stats {
                if_packets: 26267459
                if_octets: 2784343232
              }
              egress_stats {
                if_packets: 26248414
                if_octets: 2781956684
              }
              op_state {
                operational_status: "up"
              }
            }
            interface_info {
              if_name: "et-0/0/13:0.32767"
              init_time: 1477642750
              snmp_if_index: 648
              ingress_stats {
                if_packets: 4
                if_octets: 240
              }
              egress_stats {
                if_packets: 0
                if_octets: 0
              }
              op_state {
                operational_status: "up"
              }
            }
          }
        }
      }
      

    Modified: 2017-10-03