Coyote vs Loadbalancer

The Blog for the Rest of Us

Juniper Telemetry Interfaceをfluentdで受ける

作業メモ

環境

  • Juniper vMX on AWS EC2(BYOL/Trial)
    • JUNOS 19.4R1.9
  • fluentd
    • AWS EC2 AMI 4.14.231-173.361.amzn2.x86_64
    • td-agent 1.10.2

したいこと

Junosから送られてくるJuniper Telemetry Interface(over UDP)をfluentdで受けたい。とりあえずはテキストでローカルに吐いてくれれば良い

作業

前提条件

  • fluentdはパッケージでインストール済み

Junosの設定

  • AWS Marketplaceで取得したJunos vMXにはrootパスワードが設定されておらず、commitが出来ないのでよしなに設定

  • 普段、Junosを触らないが、ドキュメント通りに設定すれば出来た

    • Configuring a Junos Telemetry Interface Sensor (CLI Procedure) | Junos OS | Juniper Networks
      • Export Profile, Streaming Server Profile, Sensor Profileの設定が必要
    • Export Profile
      • Junos自身がどういうIP/ポート...でテレメトリを出すか?を指定
      • set local-addressにはJunosのマネジメントIPを指定した
      • set local-portは適当に12345
      • set transportは今回、UDPにした
      • DSCP, forwarding class, packet loss priorityはoptionalで今回は作り込む気はないので、スキップ
    • Streaming Server Profile
      • テレメトリを受けるサーバの設定
      • set remote-addressにはJunosのマネジメントにつながっているAWSVPCのセグメント上に立てたfluentdを動かすEC2のIPアドレスを指定
      • set remote-portは適当に22000を指定
    • Sensor Profile
  • 最終的には以下の感じのconfigになった

services {
    analytics {
        streaming-server ec2 {
            remote-address 10.0.1.63;
            remote-port 22000;
        }
        export-profile fluentd {
            local-address 10.0.1.164;
            local-port 12345;
            reporting-rate 5;
            format gpb;
            transport udp;
        }
        sensor interface-1 {
            server-name ec2;
            export-name fluentd;
            resource /junos/system/linecard/cpu/memory/;
        }
    }
}

Pluginのインストール

git clone https://github.com/Juniper/fluent-plugin-udp-native-sensors   # 普通にclone
git fetch origin pull/3/head:with_keys_1.0  # fluentd最新版に対応したPRを取得
git checkout with_keys_1.0 
sudo td-agent-gem build fluent-plugin-udp-native-sensors.gemspec  # fluentd内蔵のgemでビルド
sudo td-agent-gem install fluent-plugin-udp-native-sensors-0.0.1.gem  # fluentd内蔵のgemでインストール

Pluginの設定

  • GithubのREADME通りだが、/etc/td-agent/td-agent.confに以下を追記
    • もしJunosの設定でStreaming Server Profileにあるremote-portを22000以外にしていたら、その変更したポートを指定する
<source>
    @type udp
    tag juniperNetworks
    format juniper_udp_native
    port 22000
    bind 0.0.0.0
</source>

<match juniperNetworks>
   @type file
   path /home/ec2-user/junos/
</match>
  • td-agentを再起動

参考文献