Install Grafana
Linux安装方式:
# Download and unpack Grafana from binary tar (adjust version as appropriate).
curl -L -O https://grafanarel.s3.amazonaws.com/builds/grafana-2.5.0.linux-x64.tar.gz
tar zxf grafana-2.5.0.linux-x64.tar.gz
# Start Grafana.
cd grafana-2.5.0/
./bin/grafana-server web
我本机是MAC,安装方式:
brew update
brew install grafana
brew services start grafana
Usage
访问http://localhost:3000/login默认用户名密码是admin:admin。
登录成功以后如下图:
创建数据源
To create a Prometheus data source:
- Click on the Grafana logo to open the sidebar menu.
- Click on "Data Sources" in the sidebar.
- Click on "Add New".
- Select "Prometheus" as the type.
- Set the appropriate Prometheus server URL (for example,
http://localhost:9090/
) - Adjust other data source settings as desired (for example, turning the proxy access off).
-
Click "Add" to save the new data source.
效果图如下:
创建Prometheus图表
比较好的方式是引入网上别人已经做好的,然后改动。
访问https://grafana.com/dashboards?dataSource=prometheus,设置“Data Source”为“Prometheus”,如下图:
点击进入第一个,复制ID
然后在自己部署的grafana点击加号,然后点击“import”
然后输入ID
设置源,点击Import
可以看到引入成功了