CentOS 6.7にPacketbeatをインストールした際のメモ
Packetbeatの1.0.0-rc1がリリースされたので、手持ちのCentOS 6.7のマシンにインストールしてみた。
May 27, 2015 –
Elastic, the company behind the popular open source projects Elasticsearch, Logstash, and Kibana with more than 20 million downloads, today announced it has acquired Packetbeat, a real-time network packet analytics solution built natively on Elastic’s technology stack, as well as unveiled a new open source framework called Beats for anyone to build data shippers on top of Elasticsearch.
https://www.elastic.co/about/press/elastic-acquires-packetbeat
Packetbeatはオープンソースの全文検索エンジンElasticsearchのと連携するネットワークパケット解析ソリューションで、今年の5月にElastic社が買収している。
After spending a decade working in networking packet analytics, Packetbeat founders Monica Sarbu and Tudor Golubenco experienced first-hand the complexity of analyzing and troubleshooting wire data. Realizing that existing solutions were mostly proprietary and not able to extract real-time application-level data from network packets, Monica and Tudor sought out to create a new solution based on Elasticsearch and Kibana. With a vision to help fellow IT and network operators tap into complex, distributed systems, Packetbeat was created as the first open source solution for network packet analytics to extract real-time insights from wire data.
https://www.elastic.co/about/press/elastic-acquires-packetbeat
引用文にあるように、キャプチャしたパケットをリアルタイムに解析してグラフィカルに表示するというソリューションは、プロプライエタリのものなら10年以上前からいくつも存在しているが、定評あるオープンソースの全文検索エンジンと組み合わせて、すぐに使えるレベルというものはなかった。触り始めた段階の印象としては、Elasticsearchで大量のサーバーログの解析をするのと同じように、サーバーのパケットを解析するためのツール、といった感じで、「パケット」を中心に据えたものとは一線を画している(と思う)。
インストールは公式サイトにある手順で全く問題なかった。今回はいろいろNICも増設してあるものの最新でも何でもないXeon E5506を載せたCentOS 6.7 x64のPCにインストールしてみた。ElasticsearchもKobanaも何もないところからのインストールだ。
まず、Elasticsearchをインストールして起動。
sudo yum install java-1.7.0-openjdk curl -L -O https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.0.0/elasticsearch-2.0.0.rpm sudo rpm -i elasticsearch-2.0.0.rpm sudo service elasticsearch start
次に、Kibanaをインストール。
curl -L -O https://download.elastic.co/kibana/kibana/kibana-4.2.0-linux-x64.tar.gz tar xzvf kibana-4.2.0-linux-x64.tar.gz cd kibana-4.2.0-linux-x64/ ./bin/kibana
デフォルトポートは5601なので、ブラウザからhttp://[IPアドレス]:5601でKibanaが開く。
Packetbeat用のダッシュボードもインストールしておく。
curl -L -O http://download.elastic.co/beats/dashboards/beats-dashboards-1.0.0-rc1.tar.gz tar xzvf beats-dashboards-1.0.0-rc1.tar.gz cd beats-dashboards-1.0.0-rc1/ ./load.sh
No default index patternというエラーが出るので、Indicesのタブで[Packetbeat-]YYYY.MM.DDを選び、さらに★のマークをクリックしてデフォルトインデックスとして設定する。今度はDashboardタブのフォルダアイコンをクリックして、HTTPをクリックするとダッシュボードが開く。
最後にPacketbeatをインストールする。
sudo yum install libpcap curl -L -O https://download.elastic.co/beats/packetbeat/packetbeat-1.0.0-rc1-x86_64.rpm sudo rpm -vi packetbeat-1.0.0-rc1-x86_64.rpm
手元の環境ではlibpcapはインストールずみだった。
設定は/etc/packetbeat/packetbeat.ymlにあるが、とりあえずそのままで。この場合、全NICがキャプチャ対象となるが、非プレミスキャスモードとなる。
インデックステンプレートをロードして起動。
curl -XPUT 'http://localhost:9200/_template/packetbeat' -d@/etc/packetbeat/packetbeat.template.json sudo /etc/init.d/packetbeat start
これで下記のようにHTTPトラフィックを発生させると、Kibanaに表示される。
curl http://www.elastic.co/ > /dev/null
実に簡単に動作した。素晴らしい!とりあえず今日はここまで。