diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..67db858 --- /dev/null +++ b/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6488724 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# fluent-plugin-udp-native-sensors + +## Overview + +This plugin is designed to parse the Juniper Native sensors data. +Juniper Native sensor data are Google Protobuf messages sent over UDP. Hence this plugin should be used with UDP input plugin. + +Data from all the sensors are emitted with same tag. So if you want to distinguish data from different sensors, then `rewrite_tag_filter` should be used. +What this means is, in case if you want to store the data in databases, by default all the data will be stored in single table/measurement. +If you want the data to be stored separately per sensor, then you have to use `rewrite_tag_filter` plugin. Configs examples are given below. + +## Installation + +Download the plugin from `https://git.juniper.net/vijaygadde/fluent-plugin-udp-native-sensors` +Change directory to `/fluent-plugin-udp-native-sensors` +Build using `gem build fluent-plugin-udp-native-sensors.gemspec` +Install using `gem install fluent-plugin-udp-native-sensors-0.0.1.gem` + + +## Configuration + +### Usage + + +``` + + @type udp + tag juniperNetworks + format juniper_udp_native + port 22000 + bind 0.0.0.0 + + + + @type rewrite_tag_filter + rewriterule1 sensor_name (.+) ${tag}.$1 + +``` + +### Debug + +On starting td-agent, Logging supported like below. + +``` +2017-09-12 10:50:44 +0530 [debug]: plugin/parser_juniper_udp_native.rb:63:parse: Extract sensor data from etina:60.60.60.1 with output structured i +2017-09-12 10:50:44 +0530 [debug]: plugin/parser_juniper_udp_native.rb:70:parse: ============================================================== +2017-09-12 10:50:44 +0530 [debug]: plugin/parser_juniper_udp_native.rb:75:parse: jnpr_qmon_ext={"queue_monitor_element_info"=>[{"if_name"=>"xe-2/0/1", ...... +2017-09-12 10:50:44 +0530 [debug]: plugin/parser_juniper_udp_native.rb:76:parse: ============================================================== + +``` + +## TODO + +Pull requests are very welcome!! + +## Copyright + +Copyright : Copyright (c) 2012- Kentaro Yoshida (@yoshi_ken) +License : Apache License, Version 2.0 + diff --git a/lib/cmerror.pb.rb b/lib/cmerror.pb.rb index ab14e32..cdc49c0 100644 --- a/lib/cmerror.pb.rb +++ b/lib/cmerror.pb.rb @@ -1,54 +1,58 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Error < ::Protobuf::Message; end class Cmerror < ::Protobuf::Message; end ## # Message Fields # class Error optional :string, :identifier, 1, :".telemetry_options" => { :is_key => true } optional :string, :description, 2 optional :string, :help, 3 optional :string, :scope, 4 optional :string, :category, 5 optional :uint32, :action, 6 optional :string, :severity, 7 optional :uint32, :threshold, 8 optional :uint32, :limit, 9 optional :uint32, :raising_threshold, 10 optional :uint32, :clearing_threshold, 11 optional :uint32, :module_id, 12 optional :uint32, :component_id, 13 optional :uint32, :error_code, 14 optional :string, :error_source_type, 15 end class Cmerror repeated ::Error, :error_item, 1 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Cmerror, :".jnpr_cmerror_ext", 20, :extension => true end diff --git a/lib/cmerror_data.pb.rb b/lib/cmerror_data.pb.rb index 5391c58..7b9e79e 100644 --- a/lib/cmerror_data.pb.rb +++ b/lib/cmerror_data.pb.rb @@ -1,52 +1,56 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class ErrorData < ::Protobuf::Message; end class CmerrorData < ::Protobuf::Message; end ## # Message Fields # class ErrorData optional :string, :identifier, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :count, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :last_updated, 3, :".telemetry_options" => { :is_timestamp => true } optional :bool, :is_enabled, 4 optional :uint32, :module_id, 5 optional :uint32, :component_id, 6 optional :uint32, :error_code, 7 optional :string, :error_source_type, 8 optional :uint32, :occur_count, 9, :".telemetry_options" => { :is_counter => true } optional :uint32, :cleared_count, 10, :".telemetry_options" => { :is_counter => true } optional :uint64, :last_cleared_at, 11, :".telemetry_options" => { :is_timestamp => true } optional :uint32, :action_count, 12, :".telemetry_options" => { :is_counter => true } optional :uint64, :last_action_taken_at, 13, :".telemetry_options" => { :is_timestamp => true } end class CmerrorData repeated ::ErrorData, :error_item, 1 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::CmerrorData, :".jnpr_cmerror_data_ext", 21, :extension => true end diff --git a/lib/cpu_memory_utilization.pb.rb b/lib/cpu_memory_utilization.pb.rb index 05b7b1c..9bc15a4 100644 --- a/lib/cpu_memory_utilization.pb.rb +++ b/lib/cpu_memory_utilization.pb.rb @@ -1,53 +1,57 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class CpuMemoryUtilization < ::Protobuf::Message; end class CpuMemoryUtilizationSummary < ::Protobuf::Message; end class CpuMemoryUtilizationPerApplication < ::Protobuf::Message; end ## # Message Fields # class CpuMemoryUtilization repeated ::CpuMemoryUtilizationSummary, :utilization, 1 end class CpuMemoryUtilizationSummary optional :string, :name, 1 optional :uint64, :size, 2 optional :uint64, :bytes_allocated, 3 optional :int32, :utilization, 4 repeated ::CpuMemoryUtilizationPerApplication, :application_utilization, 5 end class CpuMemoryUtilizationPerApplication optional :string, :name, 1 optional :uint64, :bytes_allocated, 2 optional :uint64, :allocations, 3 optional :uint64, :frees, 4 optional :uint64, :allocations_failed, 5 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::CpuMemoryUtilization, :".cpu_memory_util_ext", 1, :extension => true end diff --git a/lib/fabric.pb.rb b/lib/fabric.pb.rb index bbf4293..2dd321a 100644 --- a/lib/fabric.pb.rb +++ b/lib/fabric.pb.rb @@ -1,85 +1,89 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Fabric_message < ::Protobuf::Message class Sensor_location < ::Protobuf::Enum define :Linecard, 1 define :Switch_Fabric, 2 end end class Edge_stats < ::Protobuf::Message class Identifier_type < ::Protobuf::Enum define :Switch_Fabric, 1 define :Linecard, 2 end end class Class_stats < ::Protobuf::Message; end class Counters < ::Protobuf::Message; end ## # Message Fields # class Fabric_message repeated ::Edge_stats, :edges, 1 optional ::Fabric_message::Sensor_location, :location, 2, :".telemetry_options" => { :is_key => true } end class Edge_stats optional ::Edge_stats::Identifier_type, :source_type, 1, :".telemetry_options" => { :is_key => true } optional :uint32, :source_slot, 2, :".telemetry_options" => { :is_key => true } optional :uint32, :source_pfe, 3, :".telemetry_options" => { :is_key => true } optional ::Edge_stats::Identifier_type, :destination_type, 4, :".telemetry_options" => { :is_key => true } optional :uint32, :destination_slot, 5, :".telemetry_options" => { :is_key => true } optional :uint32, :destination_pfe, 6, :".telemetry_options" => { :is_key => true } repeated ::Class_stats, :class_stats, 7 end class Class_stats optional :string, :priority, 1, :".telemetry_options" => { :is_key => true } optional ::Counters, :transmit_counts, 2 end class Counters optional :uint64, :packets, 1, :".telemetry_options" => { :is_counter => true } optional :uint64, :bytes, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :packets_per_second, 3, :".telemetry_options" => { :is_gauge => true } optional :uint64, :bytes_per_second, 4, :".telemetry_options" => { :is_gauge => true } optional :uint64, :drop_packets, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :drop_bytes, 6, :".telemetry_options" => { :is_counter => true } optional :uint64, :drop_packets_per_second, 7, :".telemetry_options" => { :is_gauge => true } optional :uint64, :drop_bytes_per_second, 8, :".telemetry_options" => { :is_gauge => true } optional :uint64, :queue_depth_average, 9, :".telemetry_options" => { :is_gauge => true } optional :uint64, :queue_depth_current, 10, :".telemetry_options" => { :is_gauge => true } optional :uint64, :queue_depth_peak, 11, :".telemetry_options" => { :is_gauge => true } optional :uint64, :queue_depth_maximum, 12, :".telemetry_options" => { :is_gauge => true } optional :uint64, :error_packets, 13, :".telemetry_options" => { :is_counter => true } optional :uint64, :error_packets_per_second, 14, :".telemetry_options" => { :is_gauge => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Fabric_message, :".fabricMessageExt", 2, :extension => true end diff --git a/lib/firewall.pb.rb b/lib/firewall.pb.rb index e696d79..5bad69c 100644 --- a/lib/firewall.pb.rb +++ b/lib/firewall.pb.rb @@ -1,83 +1,87 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Firewall < ::Protobuf::Message; end class FirewallStats < ::Protobuf::Message; end class MemoryUsage < ::Protobuf::Message; end class CounterStats < ::Protobuf::Message; end class PolicerStats < ::Protobuf::Message; end class ExtendedPolicerStats < ::Protobuf::Message; end class HierarchicalPolicerStats < ::Protobuf::Message; end ## # Message Fields # class Firewall repeated ::FirewallStats, :firewall_stats, 1 end class FirewallStats required :string, :filter_name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :timestamp, 2, :".telemetry_options" => { :is_timestamp => true } repeated ::MemoryUsage, :memory_usage, 3 repeated ::CounterStats, :counter_stats, 4 repeated ::PolicerStats, :policer_stats, 5 repeated ::HierarchicalPolicerStats, :hierarchical_policer_stats, 6 end class MemoryUsage required :string, :name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :allocated, 2, :".telemetry_options" => { :is_gauge => true } end class CounterStats required :string, :name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :packets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :bytes, 3, :".telemetry_options" => { :is_counter => true } end class PolicerStats required :string, :name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :out_of_spec_packets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :out_of_spec_bytes, 3, :".telemetry_options" => { :is_counter => true } optional ::ExtendedPolicerStats, :extended_policer_stats, 4 end class ExtendedPolicerStats optional :uint64, :offered_packets, 1, :".telemetry_options" => { :is_counter => true } optional :uint64, :offered_bytes, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :transmitted_packets, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :transmitted_bytes, 4, :".telemetry_options" => { :is_counter => true } end class HierarchicalPolicerStats required :string, :name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :premium_packets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :premium_bytes, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :aggregate_packets, 4, :".telemetry_options" => { :is_counter => true } optional :uint64, :aggregate_bytes, 5, :".telemetry_options" => { :is_counter => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Firewall, :".jnpr_firewall_ext", 6, :extension => true end diff --git a/lib/fluent/plugin/parser_juniper_udp_native.rb b/lib/fluent/plugin/parser_juniper_udp_native.rb index c940247..de95b7d 100644 --- a/lib/fluent/plugin/parser_juniper_udp_native.rb +++ b/lib/fluent/plugin/parser_juniper_udp_native.rb @@ -1,101 +1,105 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + require 'juniper_telemetry_udp_lib.rb' require 'protobuf' require 'telemetry_top.pb.rb' require 'port.pb.rb' require 'lsp_stats.pb.rb' require 'logical_port.pb.rb' require 'firewall.pb.rb' require 'cpu_memory_utilization.pb.rb' require 'qmon.pb.rb' require 'cmerror.pb.rb' require 'cmerror_data.pb.rb' require 'fabric.pb.rb' require 'inline_jflow.pb.rb' require 'lsp_mon.pb.rb' require 'npu_utilization.pb.rb' require 'npu_memory_utilization.pb.rb' require 'port_exp.pb.rb' require 'packet_stats.pb.rb' require 'optics.pb.rb' require 'port.pb.rb' require 'socket' require 'json' module Fluent class TextParser class JuniperJtiParser < Parser Plugin.register_parser("juniper_udp_native", self) config_param :output_format, :string, :default => 'structured' # This method is called after config_params have read configuration parameters def configure(conf) super ## Check if "output_format" has a valid value unless @output_format.to_s == "structured" || @output_format.to_s == "flat" || @output_format.to_s == "statsd" raise ConfigError, "output_format value '#{@output_format}' is not valid. Must be : structured, flat or statsd" end end def parse(text) host = Socket.gethostname ## Decode GBP packet jti_msg = TelemetryStream.decode(text) resource = "" ## Extract device name & Timestamp device_name = jti_msg.system_id gpb_time = epoc_to_sec(jti_msg.timestamp) measurement_prefix = "enterprise.juniperNetworks" ## Extract sensor begin jnpr_sensor = jti_msg.enterprise.juniperNetworks datas_sensors = JSON.parse(jnpr_sensor.to_json) $log.debug "Extract sensor data from #{device_name} with output #{output_format}" rescue => e $log.warn "Unable to extract sensor data sensor from jti_msg.enterprise.juniperNetworks, Error during processing: #{$!}" $log.debug "Unable to extract sensor data sensor from jti_msg.enterprise.juniperNetworks, Data Dump : " + jti_msg.inspect.to_s return end $log.debug "==============================================================" $log.debug "TEXT: #{text}" $log.debug "JTI_MSG: #{jti_msg}" $log.debug "JNPR_SENSOR: #{jnpr_sensor}" $log.debug "INSPECT : " + jnpr_sensor.inspect $log.debug datas_sensors $log.debug "==============================================================" ## Go over each Sensor final_data = Array.new datas_sensors.each do |sensor, s_data| if s_data.is_a? Hash final_data = parse_hash(s_data, jnpr_sensor)[0] end end for data in final_data data['device'] = device_name data['host'] = host data['sensor_name'] = datas_sensors.keys[0] end for data in final_data yield gpb_time, data end end end end end diff --git a/lib/inline_jflow.pb.rb b/lib/inline_jflow.pb.rb index 0696ea5..15b2e69 100644 --- a/lib/inline_jflow.pb.rb +++ b/lib/inline_jflow.pb.rb @@ -1,117 +1,121 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class InlineJflow < ::Protobuf::Message; end class InlineJflowNpuStats < ::Protobuf::Message; end ## # Message Fields # class InlineJflow optional :string, :ipv4_flows_export_format, 2 optional :string, :ipv6_flows_export_format, 3 optional :string, :vpls_flows_export_format, 4 optional :string, :mpls_flows_export_format, 5 optional :uint32, :ipv4_route_record_cnt, 6 optional :uint32, :ipv6_route_record_cnt, 7 optional :uint32, :mpls_route_record_cnt, 8 optional :uint32, :autonomous_system_record_cnt, 9 optional :uint64, :ipv4_max_flows_count, 10 optional :uint64, :ipv6_max_flows_count, 11 optional :uint64, :vpls_max_flows_count, 12 optional :uint64, :mpls_max_flows_count, 13 optional :uint32, :memory_alloc_fail_cnt, 14, :".telemetry_options" => { :is_counter => true } optional :uint32, :ipv4_configured_observation_domain_id, 15 optional :uint32, :ipv6_configured_observation_domain_id, 16 optional :uint32, :vpls_configured_observation_domain_id, 17 optional :uint32, :mpls_configured_observation_domain_id, 18 optional :uint32, :last_clear_timestamp, 19 optional :bool, :ipv6_extended_attribute, 20 optional :bool, :flexible_flow_sizing, 21 optional :bool, :use_extended_flow_memory, 22 repeated ::InlineJflowNpuStats, :npu_stats, 50 end class InlineJflowNpuStats required :uint32, :npu_identifier, 1 optional :uint64, :ipv4_flow_packets, 51, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flow_bytes, 52, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_total_flows, 53, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_active_flows, 54, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flows_exported, 55, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_packets_exported, 56, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flows_inactive_timed_out, 57, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flows_active_timed_out, 58, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flow_create_failure, 59, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_route_lookup_failure, 60, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_autonomous_system_lookup_failure, 61, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv4_flow_packet_export_failure, 62, :".telemetry_options" => { :is_counter => true } optional :float, :ipv4_flow_table_utilization, 63, :".telemetry_options" => { :is_gauge => true } optional :uint64, :ipv4_flow_insert_count, 64, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flow_packets, 101, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flow_bytes, 102, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_total_flows, 103, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_active_flows, 104, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flows_exported, 105, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_packets_exported, 106, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flows_inactive_timed_out, 107, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flows_active_timed_out, 108, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flow_create_failure, 109, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_route_lookup_failure, 110, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_autonomous_system_lookup_failure, 111, :".telemetry_options" => { :is_counter => true } optional :uint64, :ipv6_flow_packet_export_failure, 112, :".telemetry_options" => { :is_counter => true } optional :float, :ipv6_flow_table_utilization, 113, :".telemetry_options" => { :is_gauge => true } optional :uint64, :ipv6_flow_insert_count, 114, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flow_packets, 151, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flow_bytes, 152, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_total_flows, 153, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_active_flows, 154, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flows_exported, 155, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_packets_exported, 156, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flows_inactive_timed_out, 157, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flows_active_timed_out, 158, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flow_create_failure, 159, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_route_lookup_failure, 160, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_autonomous_system_lookup_failure, 161, :".telemetry_options" => { :is_counter => true } optional :uint64, :vpls_flow_packet_export_failure, 162, :".telemetry_options" => { :is_counter => true } optional :float, :vpls_flow_table_utilization, 163, :".telemetry_options" => { :is_gauge => true } optional :uint64, :vpls_flow_insert_count, 164, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flow_packets, 201, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flow_bytes, 202, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_total_flows, 203, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_active_flows, 204, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flows_exported, 205, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_packets_exported, 206, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flows_inactive_timed_out, 207, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flows_active_timed_out, 208, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flow_create_failure, 209, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_route_lookup_failure, 210, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_autonomous_system_lookup_failure, 211, :".telemetry_options" => { :is_counter => true } optional :uint64, :mpls_flow_packet_export_failure, 212, :".telemetry_options" => { :is_counter => true } optional :float, :mpls_flow_table_utilization, 213, :".telemetry_options" => { :is_gauge => true } optional :uint64, :mpls_flow_insert_count, 214, :".telemetry_options" => { :is_counter => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::InlineJflow, :".inline_jflow_stats_ext", 9, :extension => true end diff --git a/lib/juniper_telemetry_udp_lib.rb b/lib/juniper_telemetry_udp_lib.rb index c9277f8..279db64 100644 --- a/lib/juniper_telemetry_udp_lib.rb +++ b/lib/juniper_telemetry_udp_lib.rb @@ -1,106 +1,109 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# ############################## ## Supporting functions ## ############################## def parse_hash(data, jnpr_sensor, master_key='') leaf_data = Hash.new arr_data = Array.new arr_key = Array.new fin_data = Array.new data.each do |key, value| if master_key == '' new_master_key = key else new_master_key = master_key + '.' + key end if not [Hash, Array].include?(value.class) leaf_data[new_master_key] = value elsif value.is_a? Array arr_data << parse_array(value, jnpr_sensor, new_master_key) arr_key << new_master_key elsif value.is_a? Hash hash_data = parse_hash(value, jnpr_sensor, new_master_key) if hash_data.is_a? Hash arr_data << [hash_data] else arr_data << hash_data end arr_key << new_master_key end end # Put all the data from Array to hash. # If the key names with list name to avoid overwriting if not leaf_data.empty? arr_key.length.times do |i| for data_aa in arr_data[i] leaf_tmp = leaf_data.clone if not data_aa == nil # Data could be a hash or a array. If it is an array then iterate over it and # store individual elements if data_aa.is_a? Hash data_aa.each do |key_aa, value_aa| leaf_tmp[key_aa] = value_aa end fin_data += [leaf_tmp] else for data_ha in data_aa leaf_tmp = leaf_data.clone data_ha.each do |key_aa, value_aa| leaf_tmp[key_aa] = value_aa end fin_data += [leaf_tmp] end end end end end else fin_data = arr_data.clone end arr_data.clear #if (fin_data.to_a.empty?) && (not leaf_data.empty?) && (leaf_flag) if (fin_data.to_a.empty?) && (not leaf_data.empty?) fin_data += [leaf_data] end return fin_data end def parse_array(data, jnpr_sensor, master_key) arr_data = [] for value in data # if value.is_a? Array # arr_data << parse_array(value, jnpr_sensor) if value.is_a? Hash arr_data += parse_hash(value, jnpr_sensor, master_key) else $log.error "Leaf elements in array are not coded. Please open a issue." end end return arr_data end def epoc_to_sec(epoc) # Check if sec, usec or msec nbr_digit = epoc.to_s.size if nbr_digit == 10 return epoc.to_i elsif nbr_digit == 13 return (epoc.to_i/1000).to_i elsif nbr_digit == 16 return (epoc.to_i/1000000).to_i end return epoc end diff --git a/lib/logical_port.pb.rb b/lib/logical_port.pb.rb index 403d7f8..4e376fd 100644 --- a/lib/logical_port.pb.rb +++ b/lib/logical_port.pb.rb @@ -1,98 +1,102 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class LogicalPort < ::Protobuf::Message; end class LogicalInterfaceInfo < ::Protobuf::Message; end class IngressInterfaceStats < ::Protobuf::Message; end class EgressInterfaceStats < ::Protobuf::Message; end class OperationalState < ::Protobuf::Message; end class ForwardingClassAccounting < ::Protobuf::Message; end class LogicalInterfaceQueueStats < ::Protobuf::Message; end ## # Message Fields # class LogicalPort repeated ::LogicalInterfaceInfo, :interface_info, 1 end class LogicalInterfaceInfo required :string, :if_name, 1, :".telemetry_options" => { :is_key => true } required :uint64, :init_time, 2, :".telemetry_options" => { :is_timestamp => true } optional :uint32, :snmp_if_index, 3, :".telemetry_options" => { :is_key => true } optional :string, :parent_ae_name, 4, :".telemetry_options" => { :is_key => true } optional ::IngressInterfaceStats, :ingress_stats, 5 optional ::EgressInterfaceStats, :egress_stats, 6 optional ::OperationalState, :op_state, 7 optional :string, :administractive_status, 8 optional :string, :description, 9 optional :uint32, :last_change, 10 optional :uint32, :high_speed, 11 repeated ::LogicalInterfaceQueueStats, :ingress_queue_info, 12 repeated ::LogicalInterfaceQueueStats, :egress_queue_info, 13 end class IngressInterfaceStats required :uint64, :if_packets, 1, :".telemetry_options" => { :is_counter => true } required :uint64, :if_octets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_ucast_packets, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_mcast_packets, 4, :".telemetry_options" => { :is_counter => true } repeated ::ForwardingClassAccounting, :if_fc_stats, 5 end class EgressInterfaceStats required :uint64, :if_packets, 1, :".telemetry_options" => { :is_counter => true } required :uint64, :if_octets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_ucast_packets, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_mcast_packets, 4, :".telemetry_options" => { :is_counter => true } end class OperationalState optional :string, :operational_status, 1 end class ForwardingClassAccounting optional :string, :if_family, 1, :".telemetry_options" => { :is_key => true } optional :uint32, :fc_number, 2, :".telemetry_options" => { :is_key => true } optional :uint64, :if_packets, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_octets, 4, :".telemetry_options" => { :is_counter => true } end class LogicalInterfaceQueueStats optional :uint32, :queue_number, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :packets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :bytes, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :tail_drop_packets, 4, :".telemetry_options" => { :is_counter => true } optional :uint64, :rate_limit_drop_packets, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :rate_limit_drop_bytes, 6, :".telemetry_options" => { :is_counter => true } optional :uint64, :red_drop_packets, 7, :".telemetry_options" => { :is_counter => true } optional :uint64, :red_drop_bytes, 8, :".telemetry_options" => { :is_counter => true } optional :uint64, :average_buffer_occupancy, 9, :".telemetry_options" => { :is_gauge => true } optional :uint64, :current_buffer_occupancy, 10, :".telemetry_options" => { :is_gauge => true } optional :uint64, :peak_buffer_occupancy, 11, :".telemetry_options" => { :is_gauge => true } optional :uint64, :allocated_buffer_size, 12, :".telemetry_options" => { :is_gauge => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::LogicalPort, :".jnprLogicalInterfaceExt", 7, :extension => true end diff --git a/lib/lsp_mon.pb.rb b/lib/lsp_mon.pb.rb index 7dbe5f8..75897e9 100644 --- a/lib/lsp_mon.pb.rb +++ b/lib/lsp_mon.pb.rb @@ -1,115 +1,119 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Enum Classes # class Lsp_event < ::Protobuf::Enum define :INITIATED, 0 define :CONCLUDED_UP, 1 define :CONCLUDED_TORN_DOWN, 2 define :PROTECTION_AVAILABLE, 3 define :PROTECTION_UNAVAILABLE, 4 define :AUTOBW_SUCCESS, 5 define :AUTOBW_FAIL, 6 define :RESV_TEAR_RECEIVED, 7 define :DESELECT_ACTIVE_PATH, 8 define :CHANGE_ACTIVE_PATH, 9 define :DETOUR_UP, 10 define :DETOUR_DOWN, 11 define :ORIGINATE_MBB, 12 define :SELECT_ACTIVE_PATH, 13 define :CSPF_NO_ROUTE, 14 define :CSPF_SUCCESS, 15 define :RESTART_RECOVERY_FAIL, 16 define :PATHERR_RECEIVED, 17 define :PATH_MTU_CHANGE, 18 define :TUNNEL_LOCAL_REPAIRED, 19 end class Event_subcode < ::Protobuf::Enum define :ADMISSION_CONTROL_FAILURE, 1 define :SESSION_PREEMPTED, 2 define :BAD_LOOSE_ROUTE, 3 define :BAD_STRICT_ROUTE, 4 define :LABEL_ALLOCATION_FAILURE, 5 define :NON_RSVP_CAPABLE_ROUTER, 6 define :TTL_EXPIRED, 7 define :ROUTING_LOOP_DETECTED, 8 define :REQUESTED_BANDWIDTH_UNAVAILABLE, 9 end ## # Message Classes # class Key < ::Protobuf::Message; end class Lsp_monitor_data_event < ::Protobuf::Message; end class Ero_type_entry < ::Protobuf::Message; end class Ero_ipv4_type < ::Protobuf::Message; end class Rro_type_entry < ::Protobuf::Message; end class Rro_ipv4_type < ::Protobuf::Message; end class Lsp_monitor_data_property < ::Protobuf::Message; end class Lsp_mon < ::Protobuf::Message; end ## # File Options # #set_option :optimize_for, ::Google::Protobuf::FileOptions::OptimizeMode::LITE_RUNTIME ## # Message Fields # class Key required :string, :name, 1 required :int32, :instance_identifier, 2 required :uint64, :time_stampg, 3 end class Lsp_monitor_data_event required ::Lsp_event, :event_identifier, 1 optional ::Event_subcode, :subcode, 2 end class Ero_type_entry required :uint32, :ip, 1 optional :string, :flags, 2 end class Ero_ipv4_type repeated ::Ero_type_entry, :entry, 1 end class Rro_type_entry optional :uint32, :nodeid, 1 optional :uint32, :flags, 2 optional :uint32, :intf_addr, 3 optional :uint32, :label, 4 end class Rro_ipv4_type repeated ::Rro_type_entry, :rro_entry, 1 end class Lsp_monitor_data_property optional :uint64, :bandwidth, 1 optional :string, :path_name, 2 optional :int32, :metric, 3 optional :float, :max_avg_bw, 4 optional ::Ero_ipv4_type, :ero, 5 optional ::Rro_ipv4_type, :rro, 6 end class Lsp_mon required ::Key, :key_field, 1 optional ::Lsp_monitor_data_event, :event_field, 2 optional ::Lsp_monitor_data_property, :property_field, 3 end diff --git a/lib/lsp_stats.pb.rb b/lib/lsp_stats.pb.rb index a1ff9c3..1bf211e 100644 --- a/lib/lsp_stats.pb.rb +++ b/lib/lsp_stats.pb.rb @@ -1,46 +1,50 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class LspStats < ::Protobuf::Message; end class LspStatsRecord < ::Protobuf::Message; end ## # Message Fields # class LspStats repeated ::LspStatsRecord, :lsp_stats_records, 1 end class LspStatsRecord required :string, :name, 1, :".telemetry_options" => { :is_key => true } required :uint32, :instance_identifier, 2, :".telemetry_options" => { :is_key => true } required :string, :counter_name, 3, :".telemetry_options" => { :is_key => true } optional :uint64, :packets, 4, :".telemetry_options" => { :is_counter => true } optional :uint64, :bytes, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :packet_rate, 6 optional :uint64, :byte_rate, 7 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::LspStats, :".jnpr_lsp_statistics_ext", 5, :extension => true end diff --git a/lib/npu_memory_utilization.pb.rb b/lib/npu_memory_utilization.pb.rb index b3472ee..7b2df60 100644 --- a/lib/npu_memory_utilization.pb.rb +++ b/lib/npu_memory_utilization.pb.rb @@ -1,59 +1,63 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class NetworkProcessorMemoryUtilization < ::Protobuf::Message; end class NpuMemory < ::Protobuf::Message; end class NpuMemorySummary < ::Protobuf::Message; end class NpuMemoryPartition < ::Protobuf::Message; end ## # Message Fields # class NetworkProcessorMemoryUtilization repeated ::NpuMemory, :memory_stats, 1 end class NpuMemory required :string, :identifier, 1 repeated ::NpuMemorySummary, :summary, 2 repeated ::NpuMemoryPartition, :partition, 3 end class NpuMemorySummary optional :string, :resource_name, 1 optional :uint64, :size, 2 optional :uint64, :allocated, 3 optional :int32, :utilization, 4 end class NpuMemoryPartition optional :string, :name, 1 optional :string, :application_name, 2 optional :uint32, :bytes_allocated, 3 optional :uint32, :allocation_count, 4 optional :uint32, :free_count, 5 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::NetworkProcessorMemoryUtilization, :".npu_memory_ext", 11, :extension => true end diff --git a/lib/npu_utilization.pb.rb b/lib/npu_utilization.pb.rb index 8dcc27c..bbc5db8 100644 --- a/lib/npu_utilization.pb.rb +++ b/lib/npu_utilization.pb.rb @@ -1,63 +1,67 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class NetworkProcessorUtilization < ::Protobuf::Message; end class Utilization < ::Protobuf::Message; end class MemoryLoad < ::Protobuf::Message; end class PacketLoad < ::Protobuf::Message; end ## # Message Fields # class NetworkProcessorUtilization repeated ::Utilization, :npu_util_stats, 1 end class Utilization required :string, :identifier, 1 optional :uint32, :utilization, 2 repeated ::PacketLoad, :packets, 3 repeated ::MemoryLoad, :memory, 4 end class MemoryLoad optional :string, :name, 1 optional :uint32, :average_util, 2 optional :uint32, :highest_util, 3 optional :uint32, :lowest_util, 4 optional :uint32, :average_cache_hit_rate, 5 optional :uint32, :highest_cache_hit_rate, 6 optional :uint32, :lowest_cache_hit_rate, 7 end class PacketLoad required :string, :identifier, 1 optional :uint64, :rate, 2 optional :uint32, :average_instructions_per_packet, 3 optional :uint32, :average_wait_cycles_per_packet, 4 optional :uint32, :average_cycles_per_packet, 5 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::NetworkProcessorUtilization, :".jnpr_npu_utilization_ext", 12, :extension => true end diff --git a/lib/optics.pb.rb b/lib/optics.pb.rb index 8d5a7f6..647cd2a 100644 --- a/lib/optics.pb.rb +++ b/lib/optics.pb.rb @@ -1,93 +1,97 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Optics < ::Protobuf::Message; end class OpticsInfos < ::Protobuf::Message; end class OpticsDiagStats < ::Protobuf::Message; end class OpticsDiagLaneStats < ::Protobuf::Message; end ## # Message Fields # class Optics repeated ::OpticsInfos, :Optics_diag, 1 end class OpticsInfos required :string, :if_name, 1, :".telemetry_options" => { :is_key => true } optional :uint32, :snmp_if_index, 2 optional ::OpticsDiagStats, :optics_diag_stats, 3 end class OpticsDiagStats optional :uint32, :optics_type, 1 optional :double, :module_temp, 2, :".telemetry_options" => { :is_gauge => true } optional :double, :module_temp_high_alarm_threshold, 3, :".telemetry_options" => { :is_gauge => true } optional :double, :module_temp_low_alarm_threshold, 4, :".telemetry_options" => { :is_gauge => true } optional :double, :module_temp_high_warning_threshold, 5, :".telemetry_options" => { :is_gauge => true } optional :double, :module_temp_low_warning_threshold, 6, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_output_power_high_alarm_threshold_dbm, 7, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_output_power_low_alarm_threshold_dbm, 8, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_output_power_high_warning_threshold_dbm, 9, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_output_power_low_warning_threshold_dbm, 10, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_rx_power_high_alarm_threshold_dbm, 11, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_rx_power_low_alarm_threshold_dbm, 12, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_rx_power_high_warning_threshold_dbm, 13, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_rx_power_low_warning_threshold_dbm, 14, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_bias_current_high_alarm_threshold, 15, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_bias_current_low_alarm_threshold, 16, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_bias_current_high_warning_threshold, 17, :".telemetry_options" => { :is_gauge => true } optional :double, :laser_bias_current_low_warning_threshold, 18, :".telemetry_options" => { :is_gauge => true } optional :bool, :module_temp_high_alarm, 19 optional :bool, :module_temp_low_alarm, 20 optional :bool, :module_temp_high_warning, 21 optional :bool, :module_temp_low_warning, 22 repeated ::OpticsDiagLaneStats, :optics_lane_diag_stats, 23 end class OpticsDiagLaneStats optional :uint32, :lane_number, 1, :".telemetry_options" => { :is_key => true } optional :double, :lane_laser_temperature, 2, :".telemetry_options" => { :is_gauge => true } optional :double, :lane_laser_output_power_dbm, 3, :".telemetry_options" => { :is_gauge => true } optional :double, :lane_laser_receiver_power_dbm, 4, :".telemetry_options" => { :is_gauge => true } optional :double, :lane_laser_bias_current, 5 optional :bool, :lane_laser_output_power_high_alarm, 6 optional :bool, :lane_laser_output_power_low_alarm, 7 optional :bool, :lane_laser_output_power_high_warning, 8 optional :bool, :lane_laser_output_power_low_warning, 9 optional :bool, :lane_laser_receiver_power_high_alarm, 10 optional :bool, :lane_laser_receiver_power_low_alarm, 11 optional :bool, :lane_laser_receiver_power_high_warning, 12 optional :bool, :lane_laser_receiver_power_low_warning, 13 optional :bool, :lane_laser_bias_current_high_alarm, 14 optional :bool, :lane_laser_bias_current_low_alarm, 15 optional :bool, :lane_laser_bias_current_high_warning, 16 optional :bool, :lane_laser_bias_current_low_warning, 17 optional :bool, :lane_tx_loss_of_signal_alarm, 18 optional :bool, :lane_rx_loss_of_signal_alarm, 19 optional :bool, :lane_tx_laser_disabled_alarm, 20 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Optics, :".jnpr_optics_ext", 10, :extension => true end diff --git a/lib/packet_stats.pb.rb b/lib/packet_stats.pb.rb index 810fae3..3511acc 100644 --- a/lib/packet_stats.pb.rb +++ b/lib/packet_stats.pb.rb @@ -1,56 +1,60 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class PacketStatistics < ::Protobuf::Message; end class PacketStatsPacketForwardingEngine < ::Protobuf::Message; end class PacketStatsClass < ::Protobuf::Message; end class PacketStatsCounter < ::Protobuf::Message; end ## # Message Fields # class PacketStatistics repeated ::PacketStatsClass, :packet_stats, 1 repeated ::PacketStatsPacketForwardingEngine, :packet_stats_pfe, 2 end class PacketStatsPacketForwardingEngine required :string, :pfe_identifier, 1 repeated ::PacketStatsClass, :packet_stats, 2 end class PacketStatsClass required :string, :name, 1 required ::PacketStatsCounter, :counter, 2 end class PacketStatsCounter required :uint64, :packet_count, 1 optional :uint64, :byte_count, 2 optional :uint64, :packet_rate, 3 optional :uint64, :bit_rate, 4 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::PacketStatistics, :".jnpr_packet_statistics_ext", 8, :extension => true end diff --git a/lib/port.pb.rb b/lib/port.pb.rb index 62593e7..4459ae9 100644 --- a/lib/port.pb.rb +++ b/lib/port.pb.rb @@ -1,105 +1,109 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Port < ::Protobuf::Message; end class InterfaceInfos < ::Protobuf::Message; end class QueueStats < ::Protobuf::Message; end class InterfaceStats < ::Protobuf::Message; end class IngressInterfaceErrors < ::Protobuf::Message; end class EgressInterfaceErrors < ::Protobuf::Message; end ## # Message Fields # class Port repeated ::InterfaceInfos, :interface_stats, 1 end class InterfaceInfos required :string, :if_name, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :init_time, 2 optional :uint32, :snmp_if_index, 3 optional :string, :parent_ae_name, 4 repeated ::QueueStats, :egress_queue_info, 5 repeated ::QueueStats, :ingress_queue_info, 6 optional ::InterfaceStats, :ingress_stats, 7 optional ::InterfaceStats, :egress_stats, 8 optional ::IngressInterfaceErrors, :ingress_errors, 9 optional :string, :if_administration_status, 10 optional :string, :if_operational_status, 11 optional :string, :if_description, 12 optional :uint64, :if_transitions, 13, :".telemetry_options" => { :is_counter => true } optional :uint32, :ifLastChange, 14 optional :uint32, :ifHighSpeed, 15 optional ::EgressInterfaceErrors, :egress_errors, 16 end class QueueStats optional :uint32, :queue_number, 1, :".telemetry_options" => { :is_key => true } optional :uint64, :packets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :bytes, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :tail_drop_packets, 4, :".telemetry_options" => { :is_counter => true } optional :uint64, :rl_drop_packets, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :rl_drop_bytes, 6, :".telemetry_options" => { :is_counter => true } optional :uint64, :red_drop_packets, 7, :".telemetry_options" => { :is_counter => true } optional :uint64, :red_drop_bytes, 8, :".telemetry_options" => { :is_counter => true } optional :uint64, :avg_buffer_occupancy, 9, :".telemetry_options" => { :is_gauge => true } optional :uint64, :cur_buffer_occupancy, 10, :".telemetry_options" => { :is_gauge => true } optional :uint64, :peak_buffer_occupancy, 11, :".telemetry_options" => { :is_gauge => true } optional :uint64, :allocated_buffer_size, 12, :".telemetry_options" => { :is_gauge => true } end class InterfaceStats optional :uint64, :if_pkts, 1, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_octets, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_1sec_pkts, 3, :".telemetry_options" => { :is_gauge => true } optional :uint64, :if_1sec_octets, 4, :".telemetry_options" => { :is_gauge => true } optional :uint64, :if_uc_pkts, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_mc_pkts, 6, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_bc_pkts, 7, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_error, 8, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_pause_pkts, 9, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_unknown_proto_pkts, 10, :".telemetry_options" => { :is_counter => true } end class IngressInterfaceErrors optional :uint64, :if_errors, 1, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_qdrops, 2, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_frame_errors, 3, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_discards, 4, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_runts, 5, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_l3_incompletes, 6, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_l2chan_errors, 7, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_l2_mismatch_timeouts, 8, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_fifo_errors, 9, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_in_resource_errors, 10, :".telemetry_options" => { :is_counter => true } end class EgressInterfaceErrors optional :uint64, :if_errors, 1, :".telemetry_options" => { :is_counter => true } optional :uint64, :if_discards, 2, :".telemetry_options" => { :is_counter => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Port, :".jnpr_interface_ext", 3, :extension => true end diff --git a/lib/port_exp.pb.rb b/lib/port_exp.pb.rb index a8bc02b..d7d40ca 100644 --- a/lib/port_exp.pb.rb +++ b/lib/port_exp.pb.rb @@ -1,41 +1,45 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class Port_exp < ::Protobuf::Message; end class InterfaceExpInfos < ::Protobuf::Message; end ## # Message Fields # class Port_exp repeated ::InterfaceExpInfos, :interfaceExp_stats, 1 end class InterfaceExpInfos required :string, :if_name, 1, :".telemetry_options" => { :is_key => true } optional :string, :if_operational_status, 2 end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::Port_exp, :".jnpr_interface_exp_ext", 18, :extension => true end diff --git a/lib/qmon.pb.rb b/lib/qmon.pb.rb index b2c33b4..c6a9c42 100644 --- a/lib/qmon.pb.rb +++ b/lib/qmon.pb.rb @@ -1,68 +1,72 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # class QueueMonitor < ::Protobuf::Message; end class QueueMonitorElement < ::Protobuf::Message; end class QueueMonitorDirection < ::Protobuf::Message; end class QueueMonitorStats < ::Protobuf::Message; end ## # Message Fields # class QueueMonitor repeated ::QueueMonitorElement, :queue_monitor_element_info, 1 end class QueueMonitorElement required :string, :if_name, 1, :".telemetry_options" => { :is_key => true } optional :string, :parent_ae_name, 2 optional ::QueueMonitorDirection, :queue_monitor_stats_ingress, 3 optional ::QueueMonitorDirection, :queue_monitor_stats_egress, 4 end class QueueMonitorDirection repeated ::QueueMonitorStats, :queue_monitor_stats_info, 1 end class QueueMonitorStats required :uint32, :queue_number, 1, :".telemetry_options" => { :is_key => true } required :uint32, :queue_id, 2, :".telemetry_options" => { :is_key => true } required :uint32, :peak_buffer_occupancy_bytes, 3, :".telemetry_options" => { :is_gauge => true } optional :uint32, :peak_buffer_occupancy_percent, 4, :".telemetry_options" => { :is_gauge => true } required :uint64, :packets, 5, :".telemetry_options" => { :is_counter => true } required :uint64, :octets, 6, :".telemetry_options" => { :is_counter => true } required :uint64, :tail_drop_packets, 7, :".telemetry_options" => { :is_counter => true } required :uint64, :tail_drop_octets, 8, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_packets_color_0, 9, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_octets_color_0, 10, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_packets_color_1, 11, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_octets_color_1, 12, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_packets_color_2, 13, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_octets_color_2, 14, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_packets_color_3, 15, :".telemetry_options" => { :is_counter => true } required :uint64, :red_drop_octets_color_3, 16, :".telemetry_options" => { :is_counter => true } end ## # Extended Message Fields # class ::JuniperNetworksSensors < ::Protobuf::Message optional ::QueueMonitor, :".jnpr_qmon_ext", 15, :extension => true end diff --git a/lib/telemetry_top.pb.rb b/lib/telemetry_top.pb.rb index 02ad310..2a5b8fd 100644 --- a/lib/telemetry_top.pb.rb +++ b/lib/telemetry_top.pb.rb @@ -1,59 +1,63 @@ +# +# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. +# + # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'google/protobuf/descriptor.pb' ## # Message Classes # class TelemetryFieldOptions < ::Protobuf::Message; end class TelemetryStream < ::Protobuf::Message; end class IETFSensors < ::Protobuf::Message; end class EnterpriseSensors < ::Protobuf::Message; end class JuniperNetworksSensors < ::Protobuf::Message; end ## # Message Fields # class TelemetryFieldOptions optional :bool, :is_key, 1 optional :bool, :is_timestamp, 2 optional :bool, :is_counter, 3 optional :bool, :is_gauge, 4 end class TelemetryStream required :string, :system_id, 1, :".telemetry_options" => { :is_key => true } optional :uint32, :component_id, 2, :".telemetry_options" => { :is_key => true } optional :uint32, :sub_component_id, 3, :".telemetry_options" => { :is_key => true } optional :string, :sensor_name, 4, :".telemetry_options" => { :is_key => true } optional :uint32, :sequence_number, 5 optional :uint64, :timestamp, 6, :".telemetry_options" => { :is_timestamp => true } optional :uint32, :version_major, 7 optional :uint32, :version_minor, 8 optional ::IETFSensors, :ietf, 100 optional ::EnterpriseSensors, :enterprise, 101 end ## # Extended Message Fields # class ::Google::Protobuf::FieldOptions < ::Protobuf::Message optional ::TelemetryFieldOptions, :".telemetry_options", 1024, :extension => true end class ::EnterpriseSensors < ::Protobuf::Message optional ::JuniperNetworksSensors, :".juniperNetworks", 2636, :extension => true end