2021年1月6日 星期三

手動安裝netdata到Ubuntu 20.04

 Ubuntu 20.04的apt,netdata最新版本只有到1.19。想要裝目前最新版(1.28.0),就必須要手動安裝。顯示出來目前apt系統上的netdata版本

apt info netdata

安裝netdata所需的套件:

sudo apt-get install zlib1g-dev uuid-dev \
    libuv1-dev liblz4-dev libjudy-dev libssl-dev libmnl-dev \
    gcc make git autoconf autoconf-archive \
    autogen automake pkg-config curl

從Git上面下載最新版的NetData

git clone https://github.com/netdata/netdata.git
cd netdata

手動安裝最新版的NetData,關閉上傳資料,做LTO最佳化

sudo ./netdata-installer.sh --disable-telemetry --enable-lto

安裝過程會顯示安裝的檔案放置位置

^
  |.-.   .-.   .-.   .-.   .  netdata
  |   '-'   '-'   '-'   '-'   real-time performance monitoring, done right!
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->


  You are about to build and install netdata to your system.

  The build process will use /tmp for
  any temporary files. You can override this by setting $TMPDIR to a
  writable directory where you can execute files.

  It will be installed at these locations:

   - the daemon     at /usr/sbin/netdata
   - config files   in /etc/netdata
   - web files      in /usr/share/netdata
   - plugins        in /usr/libexec/netdata
   - cache files    in /var/cache/netdata
   - db files       in /var/lib/netdata
   - log files      in /var/log/netdata
   - pid file       at /var/run/netdata.pid
   - logrotate file at /etc/logrotate.d/netdata

  This installer allows you to change the installation path.
  Press Control-C and run the same command with --help for help.

Press ENTER to build and install netdata to your system >

安裝過程會教一些調教

--- Check KSM (kernel memory deduper) ---

Memory de-duplication instructions

You have kernel memory de-duper (called Kernel Same-page Merging,
or KSM) available, but it is not currently enabled.

To enable it run:

   echo 1 >/sys/kernel/mm/ksm/run
   echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

If you enable it, you will save 40-60% of netdata memory.

--- Check version.txt ---
--- Check apps.plugin ---
--- Copy uninstaller ---
--- Basic netdata instructions ---

netdata by default listens on all IPs on port 19999,
so you can access it with:

 http://this.machine.ip:19999/

To stop netdata run:

 systemctl stop netdata

To start netdata run:

 systemctl start netdata

Uninstall script copied to: /usr/libexec/netdata/netdata-uninstaller.sh

--- Installing (but not enabling) the netdata updater tool ---
Failed to disable unit: Unit file netdata-updater.timer does not exist.
Update script is located at /usr/libexec/netdata/netdata-updater.sh

--- Check if we must enable/disable the netdata updater tool ---
You chose *NOT* to enable auto-update, removing any links to the updater from cron (it may have happened if you are reinstalling)

--- Wrap up environment set up ---
Preparing .environment file
[/home/ong/netdata]# chmod 0644 /etc/netdata/.environment
OK

Setting netdata.tarball.checksum to 'new_installation'

The following non-fatal errors were encountered during the installation process:

* Could not find cmake, which is required to build libwebsockets. The install process will continue, but you may not be able to connect this node to Netdata Cloud.
* Could not find cmake, which is required to build JSON-C. The install process will continue, but Netdata Cloud support will be disabled.
* Failed to build libbpf. You may not be able to use eBPF plugin.

--- We are done! ---

 ^
 |.-.   .-.   .-.   .-.   .-.   .  netdata                          .-.   .-
 |   '-'   '-'   '-'   '-'   '-'   is installed and running now!  -'   '-'
 +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->

 enjoy real-time performance and health monitoring...

這邊要注意/etc/netdata/netdata.conf有幾個部分要修改

  • default port = 19999 服務開在這個port
  • bind to = 192.168.1.246  服務開在這個IP
  • allow connections from = localhost 192.168.1.*
    那些IP可以看到

啟動netdata的方法

sudo systemctl start netdata
sudo systemctl stop netdata
sudo systemctl enable netdata
sudo systemctl start netdata


參考資料

_EOF_

沒有留言:

張貼留言