背景:
netdata能提供对os和各种数据库(包括pg)的监控
相关网址为:
如下是安装后的web展示结果:
https://my-netdata.io/
是可以通过互联网访问的网址,该网址安装有netdata和mysql,只要能联网,就能查看。
如下操作的前提:
1.确保受监控主机能连接互联网。
2.如下命令均在受监控主机上运行
3.受监控主机上安装有一个HGDB Cluster,版本是4.3.2
4.监控结果的web展示:http://受监控主机的ip地址:19999
如下是安装netdata的命令:
os上执行: bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --dont-start-it systemctl enable netdata systemctl start netdata 此时netdata监控已经可以查看效果了。只是里边没有对postgre数据库的监控。
在hgdb中执行:create user netdata password 'aaaaaa' superuser; cat /etc/netdata/python.d/postgres.conf socket: name : 'local' user :'netdata' password : 'aaaaaa' database : 'highgo' tcp: ---->>>我用的是这一个。本文件中的四个,netdata会依次尝试连接 name : 'local' database : 'highgo' user : 'netdata' password : 'aaaaaa' host : '192.168.80.172' port : 5432 tcpipv4: name : 'local' database : 'postgres' user : 'postgres' host : '127.0.0.1' port : 5432 tcpipv6: name : 'local' database : 'postgres' user : 'postgres' host : '::1' port : 5432
systemctl restart netdata
此时netdata监控界面中就有对postgre数据库的监控项目了。
注意如上调试命令中,有关postgres的输出,若是提示连接不上数据库,在netdata的web监控页面的右侧是看不到"Postgres local"监控项目的