【ntop活用TIPS】ntopngの性能向上施策

本ブログ記事は、ntopngの負荷が恒常的に高い環境で性能を向上させる施策をご案内します。
分析対象トラフィックの増加により、時間の経過とともに重くなったntopngの動作を改善したい方は、是非ご一読ください。

注意点としましては、ソフトウェアによるチューニングは限界があり、やはり現状利用しているCPU,Memory,DISKのスペックをあげて頂くというのが最善の方法である旨、ご承知おきください。

文:ジュピターテクノロジー よしひろ

アーキテクチャの変更

こちらの記事内図9-1で、①ネットワーク機器のミラーポートと直接接続を利用している方は、②ネットワーク機器のミラーポートとnprobeをインストールしたPCのNICを接続への変更をすることによって、nprobeが負荷を軽減してくれます。具体的な設定変更は、/etc/ntopng/ntopng.confと/etc/nprobe/nprobe.conf設定の変更です。

①のアークテクチャ利用の方は、/etc/ntopng/ntopng.conf内の-iオプションが、物理NICの指定になっております。

例: /etc/ntopng/ntopng.conf
-i=enp2s0

こちらをnprobe経由にするために、以下の太字のように編集します。

例: /etc/ntopng/ntopng.conf
-F=clickhouse;127.0.0.1;ntopng;default;default
-G=/var/run/ntopng.pid
#-i=enp2s0
-i=tcp://127.0.0.1:5556c
-m=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8
-p=/etc/ntopng/ndpi.protos
-x=200000
-X=400000
-n=1
-w=3000
-W=443

次に、nprobeが物理NICのパケットを収集し、ntopngに分析した情報を送付する設定にします。以下の太字のように記載してください。

例: /etc/nprobe/nprobe.conf
-i=enp2s0
--zmq=tcp://127.0.0.1:5556
--zmq-probe-mode
-n=none
-T=@NTOPNG@
-G=/var/run/nprobe-enp2s0.pid

2つの設定ファイルの編集が終わりましたら、サービスを再起動してステータス確認をし、正常起動しているかご確認ください。

$sudo systemctl restart nprobe
$sudo systemctl restart ntopng
$sudo systemctl status nprobe
$sudo systemctl status ntopng

Clickhouseの最適化

メモリが潤沢にないシステムでは、以下のチューニングが推奨されます。以下公式サイトからの抜粋です。

  • config.xml内のマークキャッシュサイズを小さくします。最低500 MBに設定できますが、ゼロに設定することはできません。
  • クエリ処理スレッドの数を1に減らします
  • max_block_size8192に低くします。1024のように小さくても、実用的な場合があります。
  • max_download_threads1に低くします。
  • input_format_parallel_parsingoutput_format_parallel_formatting0に設定します。

具体的には、以下2つのファイルの修正を行います。

/etc/clickhouse-server/config.xmlと同ディレクトリのusers.xml

# diff -c config.xml_org config.xml
*** config.xml_org      2025-07-07 17:33:40.432152103 +0900
--- config.xml  2025-07-07 17:34:01.354508401 +0900
***************
*** 468,473 ****
--- 468,474 ----

      <!-- For marks of secondary indices. -->
      <!-- <index_mark_cache_size>5368709120</index_mark_cache_size> -->
+     <index_mark_cache_size>524288000</index_mark_cache_size>

      <!-- If you enable the `min_bytes_to_use_mmap_io` setting,
           the data in MergeTree tables can be read with mmap to avoid copying from kernel to userspace.
# diff -c users.xml_org  users.xml
*** users.xml_org       2025-07-07 17:33:51.502340622 +0900
--- users.xml   2025-07-07 17:34:09.557648096 +0900
***************
*** 4,12 ****
      <!-- Profiles of settings. -->
      <profiles>
          <!-- Default settings. -->
!         <default>
!             <!-- <async_insert>1</async_insert> -->
!         </default>

          <!-- Profile that allows only read queries. -->
          <readonly>
--- 4,11 ----
      <!-- Profiles of settings. -->
      <profiles>
          <!-- Default settings. -->
!       <default>
!       </default>

          <!-- Profile that allows only read queries. -->
          <readonly>
***************
*** 96,102 ****
              <grants>
                  <query>GRANT ALL ON *.*</query>
              </grants>
!             -->
          </default>
      </users>

--- 95,108 ----
              <grants>
                  <query>GRANT ALL ON *.*</query>
              </grants>
!           -->
!           <settings>
!                   <max_threads>1</max_threads>
!                   <max_block_size>8192</max_block_size>
!                     <max_download_threads>1</max_download_threads>
!                     <input_format_parallel_parsing>0</input_format_parallel_parsing>
!                     <output_format_parallel_formatting>0</output_format_parallel_formatting>
!             </settings>
          </default>
      </users>

アラートの無効化

clickhouseは、2つのデータを保持します。①rawフローデータ(履歴画面で使用)、②アラート。clickhouseの負荷を下げるためには、この②アラートを無効化するといったやり方があります。ntopng画面左メニューの「Policies」→「動作チェック」をクリックします。画面左しの「すべて無効」ボタンをクリックすれば、アラートが無効化(画面上部の有効のカウントが0になります)されます。

アラートの無効化

実際のxmlファイルや設定ファイルは弊社お客様であれば、ご提供いたしますのでお気軽にご連絡ください。

ntopngのお問い合わせ

ntop社製品にご興味のある方は、以下リンクよりいつでも弊社までお問い合わせください。

こんな記事も読まれています

最新記事

おすすめ記事

  1. QRコード詐欺メールが3年で10倍に急増!Libraesvaの革新機能で被害を防ぐ

  2. 簡単!確実!『PRTG Network Monitor』のバックアップ&復元方法

  3. WinSyslog使い方ガイド#1送信元デバイスや月ごとにフォルダを自動分割する

製品カテゴリー

その他の情報

TOP