Giter Site home page Giter Site logo

fluent-plugin-juniper-telemetry's Introduction

Beta Community

fluentd-plugin-juniper-telemetry

Fluentd plugin for Juniper telemetry

Installation

From gems repository

gem install fluent-plugin-juniper-telemetry

From source

git clone https://github.com/JNPRAutomate/fluent-plugin-juniper-telemetry.git
cd fluent-plugin-juniper-telemetry
rake install

Usage

This plugin include 2 parsers, one for each type of Juniper Devices data streaming type.

Juniper Telemetry Interface (jvision)

Supported devices : MX/PTX (up to 16.1) format juniper_jti

Supported Sensors

  • Physical Interface > /junos/system/linecard/interface/
  • Logical Interface > /junos/system/linecard/interface/logical/usage
  • Firewall Filter > /junos/system/linecard/firewall/

Experimental Sensors

  • LSP Statistics > /junos/services/label-switched-path/usage/

analyticsd

Supported devices : EX4300 & QFX5100 (add version info) format juniper_analyticsd

Supported devices are listed as of December 2016, please refer to Juniper website for accurate support list


Options

output_format: The format of the data send to the output plugin : structured*, statsd, flat

structured

All information are in key/value pair, the list of keys depend of the type of data send.

{
    "device":"WFD-QFX5100-48T-1",
    "type":"traffic-stats.txmcpkt",  
    "interface":"xe-0_0_3",  
    "value":838
}

Format "structured" is compatible with output_plugin for influxdb

flat

{
    "device.wfd-qfx5100-48t-2.interface.xe-0_0_1.queue.latency" : 3231155
}

Format "flat" is compatible with output_plugin for graphite

Statsd

{
    "statsd_type" : "gauge",
    "statsd_key" : "interface.et-0_0_52.type.txucpkt",
    "statsd_gauge" : 37673515243
}

Format "statsd" is compatible with output_plugin for statsd

Configuration Example

<source>
    @type udp
    tag jnpr.jti
    format juniper_jti
    port 40000
    bind 0.0.0.0
</source>
<source>
    @type udp
    tag jnpr.analyticsd
    format juniper_analyticsd
    port 40020
    bind 0.0.0.0
</source>

Full configuration example is available here

Docker container for test & development

The project include a docker container for test and development. The container is preconfigured with fluentd for all plugins.
Configuration file is available here

By default, everything is going to stdout in /var/log/fluentd.log

You first need to build the container

docker build -t fluent-plugin-juniper-telemetry .

And then you can launch it

docker run --rm -t -i fluent-plugin-juniper-telemetry /sbin/my_init -- bash -l

There are 2 scripts provided : docker.build.sh and docker.debug.sh, to simplify these steps.

Build ruby library based on proto files

The container has all tools needed to generate ruby library from proto files.
It's possible to regenerate all ruby files by executing the command below.

It will mount the project under the directory /gpb inside the container and compile all files Newly created .rb will be stored under lib/

docker run --rm -t -v $(pwd):/gpb -i fluent-plugin-juniper-telemetry /bin/sh /home/fluent/compile_protofile.sh

Packet samples for development and troubleshooting

The directory packet_examples include some capture files from different devices. These can easily be replay and send to another container for development and testing purpose using a third party container with tcpreplay

In order to be able to send these files to any container, we need to change the destition IP and MAc addresses. In a docker environment, it's possible to use the broadcast address of the internal network 172.17/16 and a generic mac address.
See instruction below on how to update these information

Replay a capture (while being in the packet_examples directory)

docker run --rm -t -v $(pwd):/data -i dgarros/tcpreplay /usr/bin/tcpreplay --intf1=eth0 --pps=100 jvision_phy_int.pcap

Rewrite destination Mac and IP addresses

docker run --rm -t -v $(pwd):/data -i dgarros/tcpreplay /usr/bin/tcprewrite --infile=jvision_phy_int.pcap --outfile=jvision_phy_int_fixed.pcap --dstipmap=10.92.71.225:172.17.255.255 --enet-dmac=01:00:05:11:00:06 --fixcsum

Build gem

make gems-build
make gems-push

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

fluent-plugin-juniper-telemetry's People

Contributors

dgarros avatar mpergament avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-plugin-juniper-telemetry's Issues

uninitialized constant Fluent::TextParser::Parser (NameError)

[ec2-user@ip-10-0-241-238 fluent]$ 2018-07-13 13:54:54 +0000 [info]: fluent/log.rb:322:info: parsing config file is succeeded path="/etc/fluent/fluent.conf"
2018-07-13 13:54:54 +0000 [trace]: fluent/log.rb:281:trace: registered output plugin 'stdout'
2018-07-13 13:54:54 +0000 [trace]: fluent/log.rb:281:trace: registered buffer plugin 'memory'
2018-07-13 13:54:54 +0000 [trace]: fluent/log.rb:281:trace: registered formatter plugin 'stdout'
2018-07-13 13:54:54 +0000 [trace]: fluent/log.rb:281:trace: registered formatter plugin 'json'
2018-07-13 13:54:54 +0000 [trace]: fluent/log.rb:281:trace: registered input plugin 'udp'
/home/ec2-user/.gem/ruby/2.4/gems/fluent-plugin-juniper-telemetry-0.3.0/lib/fluent/plugin/parser_juniper_jti.rb:12:in <class:TextParser>': uninitialized constant Fluent::TextParser::Parser (NameError) from /home/ec2-user/.gem/ruby/2.4/gems/fluent-plugin-juniper-telemetry-0.3.0/lib/fluent/plugin/parser_juniper_jti.rb:11:in module:Fluent'
from /home/ec2-user/.gem/ruby/2.4/gems/fluent-plugin-juniper-telemetry-0.3.0/lib/fluent/plugin/parser_juniper_jti.rb:10:in <top (required)>' from /usr/share/ruby/vendor_ruby/2.4/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/core_ext/kernel_require.rb:55:in require' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/registry.rb:102:in block in search'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/registry.rb:99:in each' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/registry.rb:99:in search'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/registry.rb:44:in lookup' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin.rb:146:in new_impl'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin.rb:123:in new_parser' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin_helper/parser.rb:89:in block in configure'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin_helper/parser.rb:85:in each' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin_helper/parser.rb:85:in configure'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin_helper/server.rb:308:in configure' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin/in_udp.rb:50:in configure'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/plugin.rb:164:in configure' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/root_agent.rb:282:in add_source'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/root_agent.rb:122:in block in configure' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/root_agent.rb:118:in each'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/root_agent.rb:118:in configure' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/engine.rb:131:in configure'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/engine.rb:96:in run_configure' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/supervisor.rb:795:in run_configure'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/supervisor.rb:579:in dry_run' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/supervisor.rb:597:in supervise'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/supervisor.rb:502:in run_supervisor' from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/lib/fluent/command/fluentd.rb:310:in <top (required)>'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/share/ruby/vendor_ruby/2.4/rubygems/core_ext/kernel_require.rb:55:in require'
from /home/ec2-user/.gem/ruby/2.4/gems/fluentd-1.2.3/bin/fluentd:8:in <top (required)>' from /home/ec2-user/bin/fluentd:23:in load'
from /home/ec2-user/bin/fluentd:23:in `

'

Lacking support for newer sensors

This plugin is getting old and lacks support for the newer JTI sensors from 2017 and onward (/junos/system/linecard/optics/ for instance). Any chance this plugin would get an update to accommodate these new sensors?

Are people using something else than Fluentd these days?I would be thankful to know.

Not able to store all data into InfluxDB

Hi,

I'm able to see all the data on STD-OUT but not all of it is being stored inside my InfluxDB. For example, I'm only seeing the following fields being stored in my InfluxDB:

show field keys from "jnpr.jvision"
name: jnpr.jvision
fieldKey         fieldType
--------         ---------
device           string
egress_queue     integer
interface        string
interface_parent string
type             string
value            integer
value_float      float
value_string     string

When data is scrolling to STD-OUT I see JSON formatted text which has the data that I need, but for some reason, it does not get stored in my InfluxDB.

This is what my fluent.conf looks like:

$ cat /etc/fluent/fluent.conf
<source>
  @type forward
  @id forward_input
</source>

#############
## INPUT ##
#############

<source>
   @type udp
   tag jnpr.jvision
   #tag debug
   format juniper_jti
   #format juniper_analyticsd
   output_format structured
   port 50051
   bind 0.0.0.0
</source>

##############
## OUTPUT ##
##############

<match jnpr.**>
   @type copy

   <store>
      @type influxdb
      host localhost
      port 8086
      dbname testfluent
      #measurement interfaces
      #user juniper
      #password juniper
      #value_keys ["value"]
      #value_keys ["jti_msg_json"]
      value_keys ["jnpr_interface_ext"]
      buffer_type memory
      # buffer_chunk_limit 524288 # 512 * 1024
      # buffer_queue_limit 1024
      flush_interval 2
      auto_tags enable
      # retry_limit 17
      # retry_wait 1.0
      # num_threads 1
   </store>
</match>

## match tag=debug.** and dump to console
<match jnpr.**>
  @type stdout
  @id stdout_output
</match>

The data that I'm trying to push info my InfluxDB prints out like this to STD-OUT:

2019-09-12 14:48:51 +0000 [debug]: #0 fluent/log.rb:302:debug: Received JTI sensor data from device 'router1:10.10.10.10' at time '1568299731'
2019-09-12 14:48:51 +0000 [debug]: #0 fluent/log.rb:302:debug: Value of 'jti_msg_json': '{"system_id"=>"router1:10.10.10.10", "component_id"=>0, "sensor_name"=>"ifd:/junos/system/linecard/interface/:/junos/system/linecard/interface/:PFE", "sequence_number"=>51855, "timestamp"=>1568299731366, "version_major"=>1, "version_minor"=>1, "enterprise"=>{"juniperNetworks"=>{"jnpr_interface_ext"=>{"interface_stats"=>[{"if_name"=>"et-0/0/0", "init_time"=>1565024147, "snmp_if_index"=>651, "parent_ae_name"=>"ae13", "egress_queue_info"=>[{"queue_number"=>0, "packets"=>749989902, "bytes"=>708195314929, "tail_drop_packets"=>0, "rl_drop_packets"=>0, "rl_drop_bytes"=>0, "red_drop_packets"=>0, "red_drop_bytes"=>0, "avg_buffer_occupancy"=>15986, "cur_buffer_occupancy"=>0, "peak_buffer_occupancy"=>15986, "allocated_buffer_size"=>4294967295}, {"queue_number"=>1, "packets"=>39370, "bytes"=>4554094, "tail_drop_packets"=>0, "rl_drop_packets"=>0, "rl_drop_bytes"=>0, "red_drop_packets"=>0, "red_drop_bytes"=>0, "avg_buffer_occupancy"=>0, "cur_buffer_occupancy"=>0, "peak_buffer_occupancy"=>0, "allocated_buffer_size"=>4294967295}, {"queue_number"=>2, "packets"=>3430, "bytes"=>4374851, "tail_drop_packets"=>0, "rl_drop_packets"=>0, "rl_drop_bytes"=>0, "red_drop_packets"=>0, "red_drop_bytes"=>0, "avg_buffer_occupancy"=>0, "cur_buffer_occupancy"=>0, "peak_buffer_occupancy"=>0, "allocated_buffer_size"=>4294967295}, {"queue_number"=>3, "packets"=>0, "bytes"=>0, "tail_drop_packets"=>0, "rl_drop_packets"=>0, "rl_drop_bytes"=>0, "red_drop_packets"=>0, "red_drop_bytes"=>0, "avg_buffer_occupancy"=>0, "cur_buffer_occupancy"=>0, "peak_buffer_occupancy"=>0, "allocated_buffer_size"=>4294967295}, {"queue_number"=>4, "packets"=>0, "bytes"=>0, "tail_drop_packets"=>0, "rl_drop_packets"=>0, "rl_drop_bytes"=>0, "red_drop_packets"=>0, "red_drop_bytes"=>0, "avg_buffer_occupancy"=>0, "cur_buffer_occupancy"=>0, "peak_buffer_occupancy"=>0, "allocated_buffer_size"=>4294967295}, {"queue_number"=>5, "packets"=>73655, "bytes"=>13382896, 

So I want to be able to store all this data inside my InfluxDB.
Any help would be greatly appreciated, thank you.

Using flugin with td-agent fluentd

`'####

Output descriptions:

Treasure Data (http://www.treasure-data.com/) provides cloud based data

analytics platform, which easily stores and processes data from td-agent.

FREE plan is also provided.

@see http://docs.fluentd.org/articles/http-to-td

This section matches events whose tag is td.DATABASE.TABLE

match tag=debug.** and dump to console

#<match debug.**>

@type stdout

@id output_stdout

#

<match jnpr.**>
@type stdout
@id stdout_output

Source descriptions:

built-in TCP input

@see http://docs.fluentd.org/articles/in_forward

@type forward @id input_forward

#################

Input

#################

########## Jvision ################

@type udp tag juniperNetworks format none # format juniper_udp_native port 5001 bind 0.0.0.0 message_length_limit 5000 @type udp tag jnpr.test format none format juniper_jti port 5000 bind 0.0.0.0 # body_size_limit 4MB

built-in UNIX socket input

#

type unix

#

HTTP input

POST http://localhost:8888/?json=

POST http://localhost:8888/td.myapp.login?json={"user"%3A"me"}

@see http://docs.fluentd.org/articles/in_http

@type http @id input_http port 8888

live debugging agent

@type debug_agent @id input_debug_agent bind 127.0.0.1 port 24230

Examples:

File input

read apache logs continuously and tags td.apache.access

#

@type tail

@id input_tail

@type apache2

path /var/log/httpd-access.log

tag td.apache.access

#

File output

match tag=local.** and write to file

#<match local.**>

@type file

@id output_file

path /var/log/td-agent/access

#

Forwarding

match tag=system.** and forward to another td-agent server

#<match system.**>

@type forward

@id output_system_forward

host 192.168.0.11

# secondary host is optional

host 192.168.0.12

#

Multiple output

match tag=td.. and output to Treasure Data AND file

#<match td..>

@type copy

@id output_copy

@type tdlog

apikey API_KEY

auto_create_table

@type file

path /var/log/td-agent/buffer/td

@type file

path /var/log/td-agent/td-%Y-%m-%d/%H.log

#`

i write file config : /etc/td-agent/td-agent.conf
input is udp but i run service has error :
td-agent.service: Control process exited, code=exited status=1
Jul 23 18:25:32 telemetry-lab systemd[1]: Failed to start td-agent: Fluentd based data collector for Treasure Data.
Jul 23 18:25:32 telemetry-lab systemd[1]: td-agent.service: Unit entered failed state.
Jul 23 18:25:32 telemetry-lab systemd[1]: td-agent.service: Failed with result 'exit-code'.
Jul 23 18:25:32 telemetry-lab systemd[1]: td-agent.service: Service hold-off time over, scheduling restart.
Jul 23 18:25:32 telemetry-lab systemd[1]: Stopped td-agent: Fluentd based data collector for Treasure Data.
Jul 23 18:25:32 telemetry-lab systemd[1]: td-agent.service: Start request repeated too quickly.
Jul 23 18:25:32 telemetry-lab systemd[1]: Failed to start td-agent: Fluentd based data collector for Treasure Data.

How i can fix it ?

ae0 interface error

Hi

I notice that plugin parser_juniper_jti.rb is not working earn you have ae0 interface. I have add this simple workaround and now it is collecting and paring data.

In line 93
if data == 'ae0'
$log.warn "err-ae0 '#{data}'"
else
data.each do |type,value|

Is this something you can fix to collect data from ae0 interfaces ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.