Netdata:全方位监控服务器状态

环境

  • Debian9
  • LNMP

简介

Netdata is real-time health monitoring and performance troubleshooting for systems and applications. It helps you instantly diagnose slowdowns and anomalies in your infrastructure with thousands of metrics, interactive visualizations, and insightful health alarms. Plus, long-term storage comes ready out-of-the-box, so can collect, monitor, and maintain your metrics in one insightful place.

安装

NetData官网按需要生成安装命令,可以选择对应的系统架构、自动更新、稳定版/开发版、是否发送匿名数据。

按默认选项的话,命令为:

bash <(curl -Ss https://my-netdata.io/kickstart.sh)

如果不出意外,脚本执行完成后,NetData就应该已经安装好了。可以在浏览器中访问对应ip地址下的19999端口,检查NetData是否已成功安装。

设置域名访问

这里我们使用Nginx进行代理。

编辑对应虚拟主机配置,如/usr/local/nginx/conf/vhost/域名.conf,添加一个location设置。

        location ~ /netdata/(?<ndpath>.*) {
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_http_version 1.1;
            proxy_pass_request_headers on;
            proxy_set_header Connection "keep-alive";
            proxy_store off;
            proxy_pass http://127.0.0.1:19999/$ndpath$is_args$args;
            gzip on;
            gzip_proxied any;
            gzip_types *;
        }

重启Nginx,然后应该就可以通过域名/netdata访问Netdata面板了。

关闭ip:port访问

编辑/etc/netdata/netdata.conf,将下述内容取消注释。

[web]
...
    bind to = 127.0.0.1 ::1
...

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据