0
点赞
收藏
分享

微信扫一扫

基于 netdata 监控单机 Linux 服务器

基于 netdata 监控单机 Linux 服务器

1. 安装netdata

[root@zhb65 /]# yum install netdata
Loaded plugins: fastestmirror, langpacks
ADDOPS-base                                                                                                                                                                                                                                            | 2.9 kB  00:00:00     
base                                                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
centosplus                                                                                                                                                                                                                                             | 2.9 kB  00:00:00     
epel                                                                                                                                                                                                                                                   | 2.9 kB  00:00:00     
extras                                                                                                                                                                                                                                                 | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                                                | 2.9 kB  00:00:00     
(1/6): ADDOPS-base/7/x86_64/primary_db                                                                                                                                                                                                                 | 1.0 MB  00:00:00     
(2/6): extras/7/x86_64/primary_db                                                                                                                                                                                                                      | 254 kB  00:00:00     
(3/6): base/7/x86_64/primary_db                                                                                                                                                                                                                        | 6.1 MB  00:00:00     
(4/6): epel/x86_64/primary_db                                                                                                                                                                                                                          | 7.7 MB  00:00:00     
(5/6): centosplus/7/x86_64/primary_db                                                                                                                                                                                                                  | 8.3 MB  00:00:00     
(6/6): updates/7/x86_64/primary_db                                                                                                                                                                                                                     |  26 MB  00:00:00     
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package netdata.x86_64 0:1.44.3-1.el7 will be installed
--> Processing Dependency: netdata-data = 1.44.3-1.el7 for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: netdata-conf = 1.44.3-1.el7 for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: protobuf-c for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: protobuf for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: nodejs for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: nc for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: libuv.so.1()(64bit) for package: netdata-1.44.3-1.el7.x86_64
--> Processing Dependency: liblz4.so.1()(64bit) for package: netdata-1.44.3-1.el7.x86_64
--> Running transaction check
---> Package libuv.x86_64 1:1.44.2-1.el7 will be installed
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package lz4.x86_64 0:1.8.3-1.el7 will be installed
---> Package netdata-conf.noarch 0:1.44.3-1.el7 will be installed
---> Package netdata-data.noarch 0:1.44.3-1.el7 will be installed
---> Package nmap-ncat.x86_64 2:6.40-19.el7 will be installed
---> Package nodejs.x86_64 1:16.20.2-1.el7 will be installed
--> Processing Dependency: nodejs-libs(x86-64) = 1:16.20.2-1.el7 for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: openssl11 >= 1:1.1.1 for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libnode.so.93()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libbrotlienc.so.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libbrotlidec.so.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
---> Package protobuf.x86_64 0:2.5.0-8.el7 will be installed
---> Package protobuf-c.x86_64 0:1.0.2-3.el7 will be installed
--> Running transaction check
---> Package libbrotli.x86_64 0:1.0.9-10.el7 will be installed
---> Package nodejs-libs.x86_64 1:16.20.2-1.el7 will be installed
---> Package openssl11.x86_64 1:1.1.1k-7.el7 will be installed
---> Package openssl11-libs.x86_64 1:1.1.1k-7.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                               Arch                                                          Version                                                                Repository                                                   Size
==============================================================================================================================================================================================================================================================================
Installing:
 netdata                                                               x86_64                                                        1.44.3-1.el7                                                           epel                                                        3.9 M
Installing for dependencies:
 libbrotli                                                             x86_64                                                        1.0.9-10.el7                                                           epel                                                        308 k
 libuv                                                                 x86_64                                                        1:1.44.2-1.el7                                                         epel                                                        145 k
 libyaml                                                               x86_64                                                        0.1.4-11.el7_0                                                         base                                                         55 k
 lz4                                                                   x86_64                                                        1.8.3-1.el7                                                            base                                                         85 k
 netdata-conf                                                          noarch                                                        1.44.3-1.el7                                                           epel                                                        163 k
 netdata-data                                                          noarch                                                        1.44.3-1.el7                                                           epel                                                         11 M
 nmap-ncat                                                             x86_64                                                        2:6.40-19.el7                                                          base                                                        206 k
 nodejs                                                                x86_64                                                        1:16.20.2-1.el7                                                        epel                                                         96 k
 nodejs-libs                                                           x86_64                                                        1:16.20.2-1.el7                                                        epel                                                         13 M
 openssl11                                                             x86_64                                                        1:1.1.1k-7.el7                                                         epel                                                        694 k
 openssl11-libs                                                        x86_64                                                        1:1.1.1k-7.el7                                                         epel                                                        1.5 M
 protobuf                                                              x86_64                                                        2.5.0-8.el7                                                            base                                                        338 k
 protobuf-c                                                            x86_64                                                        1.0.2-3.el7                                                            base                                                         28 k

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  1 Package (+13 Dependent packages)

Total download size: 31 M
Installed size: 112 M
Is this ok [y/d/N]: y
Downloading packages:
(1/14): libuv-1.44.2-1.el7.x86_64.rpm                                                                                                                                                                                                                  | 145 kB  00:00:00     
(2/14): lz4-1.8.3-1.el7.x86_64.rpm                                                                                                                                                                                                                     |  85 kB  00:00:00     
(3/14): libyaml-0.1.4-11.el7_0.x86_64.rpm                                                                                                                                                                                                              |  55 kB  00:00:00     
(4/14): libbrotli-1.0.9-10.el7.x86_64.rpm                                                                                                                                                                                                              | 308 kB  00:00:00     
(5/14): netdata-conf-1.44.3-1.el7.noarch.rpm                                                                                                                                                                                                           | 163 kB  00:00:00     
(6/14): netdata-1.44.3-1.el7.x86_64.rpm                                                                                                                                                                                                                | 3.9 MB  00:00:00     
(7/14): nodejs-16.20.2-1.el7.x86_64.rpm                                                                                                                                                                                                                |  96 kB  00:00:00     
(8/14): nmap-ncat-6.40-19.el7.x86_64.rpm                                                                                                                                                                                                               | 206 kB  00:00:00     
(9/14): netdata-data-1.44.3-1.el7.noarch.rpm                                                                                                                                                                                                           |  11 MB  00:00:00     
(10/14): nodejs-libs-16.20.2-1.el7.x86_64.rpm                                                                                                                                                                                                          |  13 MB  00:00:00     
(11/14): openssl11-libs-1.1.1k-7.el7.x86_64.rpm                                                                                                                                                                                                        | 1.5 MB  00:00:00     
(12/14): openssl11-1.1.1k-7.el7.x86_64.rpm                                                                                                                                                                                                             | 694 kB  00:00:00     
(13/14): protobuf-c-1.0.2-3.el7.x86_64.rpm                                                                                                                                                                                                             |  28 kB  00:00:00     
(14/14): protobuf-2.5.0-8.el7.x86_64.rpm                                                                                                                                                                                                               | 338 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                          39 MB/s |  31 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:openssl11-libs-1.1.1k-7.el7.x86_64                                                                                                                                                                                                                      1/14 
  Installing : 1:libuv-1.44.2-1.el7.x86_64                                                                                                                                                                                                                               2/14 
  Installing : libbrotli-1.0.9-10.el7.x86_64                                                                                                                                                                                                                             3/14 
  Installing : 1:nodejs-libs-16.20.2-1.el7.x86_64                                                                                                                                                                                                                        4/14 
  Installing : 1:openssl11-1.1.1k-7.el7.x86_64                                                                                                                                                                                                                           5/14 
  Installing : 1:nodejs-16.20.2-1.el7.x86_64                                                                                                                                                                                                                             6/14 
  Installing : netdata-data-1.44.3-1.el7.noarch                                                                                                                                                                                                                          7/14 
  Installing : 2:nmap-ncat-6.40-19.el7.x86_64                                                                                                                                                                                                                            8/14 
  Installing : protobuf-2.5.0-8.el7.x86_64                                                                                                                                                                                                                               9/14 
  Installing : netdata-conf-1.44.3-1.el7.noarch                                                                                                                                                                                                                         10/14 
  Installing : libyaml-0.1.4-11.el7_0.x86_64                                                                                                                                                                                                                            11/14 
  Installing : lz4-1.8.3-1.el7.x86_64                                                                                                                                                                                                                                   12/14 
  Installing : protobuf-c-1.0.2-3.el7.x86_64                                                                                                                                                                                                                            13/14 
  Installing : netdata-1.44.3-1.el7.x86_64                                                                                                                                                                                                                              14/14 
Netdata config should be edited with /usr/libexec/netdata/edit-config
Netdata go plugin can be easily installed with /usr/sbin/netdata-install-go-plugins.sh script
  Verifying  : netdata-1.44.3-1.el7.x86_64                                                                                                                                                                                                                               1/14 
  Verifying  : protobuf-c-1.0.2-3.el7.x86_64                                                                                                                                                                                                                             2/14 
  Verifying  : lz4-1.8.3-1.el7.x86_64                                                                                                                                                                                                                                    3/14 
  Verifying  : 1:libuv-1.44.2-1.el7.x86_64                                                                                                                                                                                                                               4/14 
  Verifying  : libyaml-0.1.4-11.el7_0.x86_64                                                                                                                                                                                                                             5/14 
  Verifying  : netdata-conf-1.44.3-1.el7.noarch                                                                                                                                                                                                                          6/14 
  Verifying  : protobuf-2.5.0-8.el7.x86_64                                                                                                                                                                                                                               7/14 
  Verifying  : 2:nmap-ncat-6.40-19.el7.x86_64                                                                                                                                                                                                                            8/14 
  Verifying  : 1:nodejs-16.20.2-1.el7.x86_64                                                                                                                                                                                                                             9/14 
  Verifying  : 1:openssl11-libs-1.1.1k-7.el7.x86_64                                                                                                                                                                                                                     10/14 
  Verifying  : 1:nodejs-libs-16.20.2-1.el7.x86_64                                                                                                                                                                                                                       11/14 
  Verifying  : 1:openssl11-1.1.1k-7.el7.x86_64                                                                                                                                                                                                                          12/14 
  Verifying  : netdata-data-1.44.3-1.el7.noarch                                                                                                                                                                                                                         13/14 
  Verifying  : libbrotli-1.0.9-10.el7.x86_64                                                                                                                                                                                                                            14/14 

Installed:
  netdata.x86_64 0:1.44.3-1.el7                                                                                                                                                                                                                                               

Dependency Installed:
  libbrotli.x86_64 0:1.0.9-10.el7    libuv.x86_64 1:1.44.2-1.el7     libyaml.x86_64 0:0.1.4-11.el7_0      lz4.x86_64 0:1.8.3-1.el7      netdata-conf.noarch 0:1.44.3-1.el7 netdata-data.noarch 0:1.44.3-1.el7 nmap-ncat.x86_64 2:6.40-19.el7 nodejs.x86_64 1:16.20.2-1.el7
  nodejs-libs.x86_64 1:16.20.2-1.el7 openssl11.x86_64 1:1.1.1k-7.el7 openssl11-libs.x86_64 1:1.1.1k-7.el7 protobuf.x86_64 0:2.5.0-8.el7 protobuf-c.x86_64 0:1.0.2-3.el7   

Complete!

2. 修改配置文件

[root@zhb65 /]# sudo vim /etc/netdata/netdata.conf

# netdata configuration
#
# You can get the latest version of this file, using:
#
#  netdatacli dumpconfig > /etc/netdata/netdata.conf
#
# You can also download it using:
#
#  wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
# or
#  curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
#
# You can uncomment and change any of the options below.
# The value shown in the commented settings, is the default value.
#

[global]
    run as user = netdata

    # default storage size - increase for longer data retention
    page cache size = 32
    dbengine multihost disk space = 256

    # some defaults to run netdata with least priority
    process scheduling policy = idle
    OOM score = 1000

    stock config directory = /usr/lib/netdata/conf.d

[web]
    web files owner = root
    web files group = netdata

    # by default do not expose the netdata port
    bind to = localhost

[health]
    stock health configuration directory = /usr/lib/netdata/conf.d/health.d

把localhost 改成 0.0.0.0

3. 启动并查看对应服务状态

[root@zhb65 /]#  sudo systemctl start netdata
[root@zhb65 /~]#  ss -antp | grep 19999
LISTEN     0      128          *:19999                    *:*

4. 访问页面

http://主机地址:19999/

举报

相关推荐

0 条评论