1、安装grafana
官网地址:Download Grafana | Grafana Labs
centos为例:
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.3.6-1.x86_64.rpm
sudo yum install grafana-enterprise-8.3.6-1.x86_64.rpm
grafana默认登录密码是admin:admin
grafana监控web界面默认监听3000端口,访问http://ip:3000可查看监控
2、promethus安装
官网地址:Download | Prometheus
下载对应操作系统的安装包(centos为例)
wget https://github.com/prometheus/prometheus/releases/download/v2.33.3/prometheus-2.33.3.linux-amd64.tar.gz
解压
tar zxvf prometheus-2.33.3.linux-amd64.tar.gz
修改配置文件prometheus.yml
cd prometheus-2.33.3.linux-amd64
vim prometheus.yml 根据需要修改scrape_configs
启动promethus(默认监听9090端口,若修改端口号可以增加选项--web.listen-address=:9091)
./prometheus
启动成功后可以访问http://ip:9090访问
3、使用
在grafana管理界面添加promethus数据源
通过configuration->Data sources添加数据源,数据源选择Promethus