Grafana 是 Graphite仪表盘和图形编辑器。Grafana 是开源的、功能齐全的度量仪表盘和图形编辑器,支持 Graphite,InfluxDB 和 OpenTSDB。
Grafana 主要特性:
1. Add Grafana’s repository to sources.list:
添加安装Grafana所需的源
1 | echo 'deb https://packagecloud.io/grafana/stable/debian/ wheezy main' | sudo tee -a /etc/apt/sources.list |
2. Add the Package Cloud key to install signed packages:
1 | curl https://packagecloud.io/gpg.key | sudo apt-key add - |
3. Update apt and install Grafana:
更新源,通过apt-get安装Grafana
1 | sudo apt-get update && sudo apt-get install grafana |
4. Configure Grafana to use the PostgreSQL database created earlier:
配置Grafana使用之前创建的PostgreSQL数据库
File excerpt: /etc/grafana/grafana.ini
1 | [database] |
5. Also in /etc/grafana/grafana.ini
, configure the domain
and root_url
, and set a strong admin password and secret key:
配置WEB端口及帐号密码:
File excerpt: **/etc/grafana/grafana.ini
1 | [server] |
6. Enable proxy modules for Apache reverse proxying to work:
1 | sudo a2enmod proxy proxy_http xml2enc |
7. Create an Apache site configuration file to proxy requests to Grafana. Remember to change example.com
to your own domain:
通过Apache 使用80端口对Grafana进行访问
File excerpt: /etc/apache2/sites-available/apache2-grafana.conf
1 | <VirtualHost *:80> |
8. Enable Grafana’s site configuration with:
启用Grafana的Apache配置:
1 | sudo a2ensite apache2-grafana |
9. Configure Grafana to run after boot and then start service:
设置Grafana开机启动:
1 | sudo update-rc.d grafana-server defaults 95 10 |
Restart Apache to load the new modules and configuration changes:
重启Apache,以应用最新配置:
1 | sudo service apache2 restart |
At this point, you should be able to open your Linode’s domain or IP address in a browser to see Grafana’s login page.
至些,可以从浏览中通过访问主机80端口来访问Grafana界面。
Add a Graphite Data Source to Grafana
为Grafa添加数据源,即连接Graphite
1. Log in into Grafana using the admin
credentials you specified in grafana.ini
above.
使用前面设置的帐号密码来登录Grafana,默认帐号密码是:admin/admin
2. Click on Data Sources
and select Add new
. Fill in all the fields as shown in the screenshot below:
Click Save to create the new Data Source.
3. Now, before creating a graph, add more test data for the test.count metric by again running:
在添加新的监控图表之前,生成一份新测试数据:
1 | for i in 4 6 8 16 2; do echo "test.count $i `date +%s`" | nc -q0 127.0.0.1 2003; sleep 6; done |
4. Create a new dashboard by clicking the Home button and then + New:
添加一个Dashboard:
5. Add a Graph panel to the newly created dashboard:
在新创建的dashboard中添加新图:
6. Edit the Graph panel properties by clicking the tab with the words no title (click here). Then click Edit:
向图中添加数据
7. Make sure the graphite data source you’ve created is chosen in the dropdown box at the bottom right (marked as 1 in the screenshot below). In the dropdown at the top right corner (marked as 2), choose Last 15 minutes.
Click select metric. Choose test and then count (marked as 3) to add the test metric you previously created. At this point, the sample data should appear on the graph.
Finally, click the Save button (marked as 4) to save the dashboard you just created.
选择需要监控的数据源。
一图胜千言。
Grafana图片界面展示:http://play.grafana-zabbix.org/dashboard/db/grafana-zabbix-demo
The pure English Version: https://www.linode.com/docs/uptime/monitoring/deploy-graphite-with-grafana-on-ubuntu-14-04
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
下面是一引起扩展资料,有兴趣的可以做为扩展阅读。