diff --git a/lib/cmerror.pb.rb b/lib/cmerror.pb.rb new file mode 100644 index 0000000..ab14e32 --- /dev/null +++ b/lib/cmerror.pb.rb @@ -0,0 +1,54 @@ +# 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 new file mode 100644 index 0000000..5391c58 --- /dev/null +++ b/lib/cmerror_data.pb.rb @@ -0,0 +1,52 @@ +# 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/fabric.pb.rb b/lib/fabric.pb.rb new file mode 100644 index 0000000..bbf4293 --- /dev/null +++ b/lib/fabric.pb.rb @@ -0,0 +1,85 @@ +# 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 87c9f5e..e696d79 100644 --- a/lib/firewall.pb.rb +++ b/lib/firewall.pb.rb @@ -1,83 +1,83 @@ # 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 - optional :uint64, :timestamp, 2 + 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 - optional :uint64, :allocated, 2 + 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 - optional :uint64, :packets, 2 - optional :uint64, :bytes, 3 + 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 - optional :uint64, :out_of_spec_packets, 2 - optional :uint64, :out_of_spec_bytes, 3 + 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 - optional :uint64, :offered_bytes, 2 - optional :uint64, :transmitted_packets, 3 - optional :uint64, :transmitted_bytes, 4 + 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 - optional :uint64, :premium_packets, 2 - optional :uint64, :premium_bytes, 3 - optional :uint64, :aggregate_packets, 4 - optional :uint64, :aggregate_bytes, 5 + 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 681f740..8617493 100644 --- a/lib/fluent/plugin/parser_juniper_udp_native.rb +++ b/lib/fluent/plugin/parser_juniper_udp_native.rb @@ -1,172 +1,101 @@ require 'juniper_telemetry_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_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 - arr_data << parse_hash(value, jnpr_sensor, new_master_key) - arr_key << new_master_key - end - end - #puts arr_data - # 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_aa.each do |key_aa, value_aa| - leaf_tmp[key_aa] = value_aa - end - end - fin_data += [leaf_tmp] - end - end - else - #puts arr_data.to_json - fin_data = arr_data.clone - #puts fin_data.to_json - 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 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 jnpr_sensor.jnpr_interface_ext.interface_stats.inspect - #for var in jnpr.sensor.inspect - # $log.debug " ---: " + var - #end - $log.debug "==============================================================" ## Go over each Sensor - #datas_sensors = {"firts"=> [{'a'=> 1, 'b': 2}, {:c=>3, d:4}]} - #datas_sensors = {"jnpr_interface_ext1"=>{"interface_stats1"=>[{:a=>1, :b=>2}, {:c=>3, :d=>4}]}} final_data = Array.new datas_sensors.each do |sensor, s_data| - #$log.debug "#{datas_sensors}" - #final_data = Array.new 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 - #puts "++++++++++++++" - #puts final_data - #puts final_data.to_json - #puts "++++++++++++++" - 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 new file mode 100644 index 0000000..0696ea5 --- /dev/null +++ b/lib/inline_jflow.pb.rb @@ -0,0 +1,117 @@ +# 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_lib.rb b/lib/juniper_telemetry_lib.rb index 8ca00f9..c9277f8 100644 --- a/lib/juniper_telemetry_lib.rb +++ b/lib/juniper_telemetry_lib.rb @@ -1,21 +1,106 @@ ############################## ## 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 a1a9934..403d7f8 100644 --- a/lib/logical_port.pb.rb +++ b/lib/logical_port.pb.rb @@ -1,74 +1,98 @@ # 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 - required :uint64, :init_time, 2 - optional :uint32, :snmp_if_index, 3 - optional :string, :parent_ae_name, 4 + 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 - required :uint64, :if_octets, 2 - optional :uint64, :if_ucast_packets, 3 - required :uint64, :if_mcast_packets, 4 + 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 - required :uint64, :if_octets, 2 + 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 - optional :uint32, :fc_number, 2 - optional :uint64, :if_packets, 3 - optional :uint64, :if_octets, 4 + 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 5d4a0e9..d20461f 100644 --- a/lib/lsp_mon.pb.rb +++ b/lib/lsp_mon.pb.rb @@ -1,109 +1,115 @@ # 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 74e93ca..a1ff9c3 100644 --- a/lib/lsp_stats.pb.rb +++ b/lib/lsp_stats.pb.rb @@ -1,46 +1,46 @@ # 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 - required :uint32, :instance_identifier, 2 - required :string, :counter_name, 3 - optional :uint64, :packets, 4 - optional :uint64, :bytes, 5 + 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 new file mode 100644 index 0000000..b3472ee --- /dev/null +++ b/lib/npu_memory_utilization.pb.rb @@ -0,0 +1,59 @@ +# 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 new file mode 100644 index 0000000..8dcc27c --- /dev/null +++ b/lib/npu_utilization.pb.rb @@ -0,0 +1,63 @@ +# 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 new file mode 100644 index 0000000..8d5a7f6 --- /dev/null +++ b/lib/optics.pb.rb @@ -0,0 +1,93 @@ +# 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 new file mode 100644 index 0000000..810fae3 --- /dev/null +++ b/lib/packet_stats.pb.rb @@ -0,0 +1,56 @@ +# 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 0934371..62593e7 100644 --- a/lib/port.pb.rb +++ b/lib/port.pb.rb @@ -1,89 +1,105 @@ # encoding: utf-8 ## # This file is auto-generated. DO NOT EDIT! # require 'protobuf' ## # Imports # require 'telemetry_top.pb' ## # Message Classes # -class GPort < ::Protobuf::Message; end +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 QueueStats < ::Protobuf::Message; end +class EgressInterfaceErrors < ::Protobuf::Message; end ## # Message Fields # -class GPort +class Port repeated ::InterfaceInfos, :interface_stats, 1 end class InterfaceInfos - required :string, :if_name, 1 - required :uint64, :init_time, 2 + 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 - required :uint64, :if_pkts, 1 - required :uint64, :if_octets, 2 - required :uint64, :if_1sec_pkts, 3 - required :uint64, :if_1sec_octets, 4 - required :uint64, :if_uc_pkts, 5 - required :uint64, :if_mc_pkts, 6 - required :uint64, :if_bc_pkts, 7 + 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_in_errors, 1 - optional :uint64, :if_in_qdrops, 2 - optional :uint64, :if_in_frame_errors, 3 - optional :uint64, :if_in_discards, 4 - optional :uint64, :if_in_runts, 5 - optional :uint64, :if_in_l3_incompletes, 6 - optional :uint64, :if_in_l2chan_errors, 7 - optional :uint64, :if_in_l2_mismatch_timeouts, 8 - optional :uint64, :if_in_fifo_errors, 9 - optional :uint64, :if_in_resource_errors, 10 + 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 QueueStats - optional :uint32, :queue_number, 1 - optional :uint64, :packets, 2 - optional :uint64, :bytes, 3 - optional :uint64, :tail_drop_packets, 4 - optional :uint64, :rl_drop_packets, 5 - optional :uint64, :rl_drop_bytes, 6 - optional :uint64, :red_drop_packets, 7 - optional :uint64, :red_drop_bytes, 8 - optional :uint64, :avg_buffer_occupancy, 9 - optional :uint64, :cur_buffer_occupancy, 10 - optional :uint64, :peak_buffer_occupancy, 11 - optional :uint64, :allocated_buffer_size, 12 +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 ::GPort, :".jnpr_interface_ext", 3, :extension => true + optional ::Port, :".jnpr_interface_ext", 3, :extension => true end diff --git a/lib/port_exp.pb.rb b/lib/port_exp.pb.rb new file mode 100644 index 0000000..a8bc02b --- /dev/null +++ b/lib/port_exp.pb.rb @@ -0,0 +1,41 @@ +# 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 new file mode 100644 index 0000000..b2c33b4 --- /dev/null +++ b/lib/qmon.pb.rb @@ -0,0 +1,68 @@ +# 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 ad70a73..02ad310 100644 --- a/lib/telemetry_top.pb.rb +++ b/lib/telemetry_top.pb.rb @@ -1,59 +1,59 @@ # 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 - optional :uint32, :component_id, 2 - optional :uint32, :sub_component_id, 3 - optional :string, :sensor_name, 4 + 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 + 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