grafana+graphit安装笔记
OS:MAC 10.11
查看测试线运行demo请访问http://10.103.13.101:3000/dashboard/db/graphite-carbon-metrics?editorTab=Options
1 grafana
1)安装文档:
http://docs.grafana.org/installation/mac/
https://segmentfault.com/a/1190000000693520
2)运行service:brew service start grafana-server
3)查看配置: vim /usr/local/etc/grafana/grafana.ini
a. http_port:3000
b. localhost
c. admin-amin(密码可以在页面的profile里修改)
d. database
4)http or https
5)运行:在浏览器中输入localhost:3000,此时可以看到监控页面,用admin账户登入即可
6)比较智能,有多重角色控制,这块儿待开发
2 graphite
1)安装
sudo pip install whisper carbon graphite-web
默认安装目录: /opt/graphite
2)配置
https://segmentfault.com/a/1190000000693520
http://graphite.wikidot.com/installation
*http://blog.liulantao.com/blog/2014/2014-01-26-graphite-setup-notes.html
https://github.com/graphite-project/graphite-web
http://graphite.readthedocs.io/en/latest/
*http://blog.163.com/guaiguai_family/blog/static/20078414520140710515276/*
3)修改local_setting.py
务必重新设计SECRET_KEY,根据需要调整TIME_ZONE和其他参数,解注debug=true
根据提示创建需要的.log文件
跑数据,创建一个mysql库这个库只用作存储用户表和数据表结构,不用正式数据
python manage.py syncdb
4)run一下这个app吧!
python carbon-cache start
cd /opt/graphite
bin/run-graphite-devel-server.py /opt/graphite
在浏览器中访问http://0.0.0.0:8080/ 嗯,此时看到一个看起来比较正常的管理页面
没有图,图片碎成了一个小点,心伤。 好吧,页面提示没有cairocffi模块,没有就安装呗,查了一下这个模块是Python绑定的一个2D标量图形库的面相对象api的集合,为多种图片类型提供了后台支持。嗯,不求甚解,了解一下就OK了。
pip install cairocffi
报错c/_cffi_backend.c:15:10: fatal error: 'ffi.h' file not found
brew install pig-config libffi
再次充满了希望!
cannot import name constants
又失败了。。。
sudo pip install constants
dlopen() failed to load a library: cairo / cairo-2
这个问题比较诡异,这个github页有几个人很专注的讨论了这个问题https://github.com/SimonSapin/cairocffi/issues/29
安装方法sudo brew install cairo
酱,再次运行看起来就正常了
最后在页面测试的时候,还可能报一些文件不存在或者权限deny的错误,直接touch或者sudo就可以了
3 grafana+graphite
1)将二者结合到一起
https://segmentfault.com/a/1190000000693520
找到config.js,修改datasources
/usr/local/Cellar/grafana/3.1.1/share/grafana/public/app/core/config.js
2)将二者结合到一起-2
grafana的主菜单中有一个“Data Sources”菜单,点击进入,可以看到一个Data Sources列表,右上方有绿色的添加按钮“Add data source”,顾名思义可以添加数据源。
3)页面配置就慢慢探索吧,点点就会了,也可以参考grafana的官方文档
4 nginx
1)本机已经装了nginx,这块儿不表
2)配置nginx.conf
3)单独写了一个local.grafana.nginx 然后在nginx.conf里将这个配置include进来
本机上配置的是8088端口,访问127.0.0.1:8088 可以看到配置成功,不过话说感觉这里配置个nginx也没有什么鸟用吧!
4)接下来,应该专心考虑数据集成和拟合了
5 数据集成拟合
1)后台数据处理这块进度略慢,一方面其他事情中断、另一方面更主要的是不熟悉。
2)上午熟悉了nc命令,测试了一下,正式log的导出应该不成问题了,在目的服务器上开一个nc监听端口nc -l 1234 > reseiveData.txt&,在源服务器上发送数据nc server_name server_port
3)metric
4)http://graphite.readthedocs.io/en/latest/
做到之前的那一步就可以直接操作grafana配置了,真是强大啊,不用自己写代码,直接配置就能展示漂亮的页面和强大的聚合功能。接下来就是写写脚本啦~
写了一个小demo:
sync_data.sh
#!/bin/bash
PORT=2003
SERVER=10.103.13.101
now_1mago=`date -d "1 minutes ago" +%y%m%d%H%M%S`
now=`date +%y%m%d%H%M%S`
now_1magotm=`date -d "1 minute ago" +%s`
# 项目名称
project=$1
sleep 30
logfile="/opt/logs/tornado/test1/*.log"
tmplogfile="/opt/log_collect/$num.log"
profile="/opt/log_collect/profile"
for i in `cat $profile`
do
cat $logfile|grep '[0-9]\{6\}'|grep "$i"|tr -d ":"|awk '{a='"$now_1mago"';b='"$now"';c=$2 $3}(c>=a&&c<b){print $0}'|awk 'BEGIN{sum_error=0}{sum_error+=1} END {print "test.'"$project"'.'"$i"'",sum_error,"'$now_1magotm'"}' | nc ${SERVER} ${PORT} &
done
http://graphite-api.readthedocs.io/en/latest/api.html#format
graphite给出的测试用例对于写脚本还是挺有用的,无非就是把数据整合成graphite能接受的格式,然后从2003端口发出去。
接上文,已经放弃mac中的脚本写作了,直接在linux上部署,grafana和graphite已经能访问了,转到测试服务器,centos5.5,接下来的工作要在centos5.5上开展,linux上的安装和配置稍有不同,但是大体步骤都是一样的,参考同一份文档即可!
粗糙整理,未完待续
grafana+graphit安装笔记的更多相关文章
- MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记
MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记 说明 以root账户登录Linux操作系统,注意:本文中的所有命令行前面的 #> 表示命令行提示符 ...
- 基于Ubuntu14.04系统的nvidia tesla K40驱动和cuda 7.5安装笔记
基于Ubuntu14.04系统的nvidia tesla K40驱动和cuda 7.5安装笔记 飞翔的蜘蛛人 注1:本人新手,文章中不准确的地方,欢迎批评指正 注2:知识储备应达到Linux入门级水平 ...
- sublime 安装笔记
sublime 安装笔记 下载地址 安装package control 根据版本复制相应的代码到console,运行 按要求重启几次后再按crtl+shift+p打开命令窗口 输入pcip即可开始安装 ...
- docker在ubuntu14.04下的安装笔记
本文主要是参考官网教程进行ubuntu14.04的安装. 下面是我的安装笔记. 笔记原件完整下载: 链接: https://pan.baidu.com/s/1dEPQ8mP 密码: gq2p
- ArchLinux 安装笔记:续 --zz
续前话 在虚拟机里调试了几天,终于鼓起勇气往实体机安装了,到桌面环境为止的安装过程可以看我的前一篇文章<ArchLinux 安装笔记>.桌面环境我使用的是 GNOME,虽然用了很长一段时间 ...
- Hadoop1.x与2.x安装笔记
Hadoop1.x与2.x安装笔记 Email: chujiaqiang229@163.com 2015-05-09 Hadoop 1.x 安装 Hadoop1.x 集群规划 No 名称 内容 备注 ...
- PHP7安装笔记
PHP7安装笔记 时间 -- :: 喵了个咪 原文 http://www.hdj.me/php7-install-note 主题 PHP # 安装mcrypt yum install -y php-m ...
- python 库安装笔记
python 库安装笔记 zoerywzhou@163.com http://www.cnblogs.com/swje/ 作者:Zhouwan 2017-2-22 友情提示 安装python库的过程中 ...
- 开始使用gentoo linux——gentoo安装笔记(下)
gentoo安装笔记(下) 上一章,已经对操作系统安装做了充分准备,并且已经从livecd(u盘系统)切换进入了gentoo安装环境中. 不过现在才是真正的开始!打起精神!这可不是在装ubuntu! ...
随机推荐
- 金山软件wps2012-2013通杀0day
#!/usr/bin/python # Exploit Title: Kingsoft Office Writer v2012 8.1.0.3385 .wps Buffer Overflow Expl ...
- easyui-validatebox 验证
required: "必选字段", remote: "请修正该字段", email: "请输入正确格式的电子邮件" ...
- 配置DelegatingFilterProxy使用Spring管理filter chain
项目环境:JDK7 + Maven3.04 0. 项目使用springmvc作为controller层 1. 引入spring-security <dependency> <grou ...
- MicroERP如何配置网络应用
概述: MicroERP支持多种数据库运行,其中单机版数据库格式为Access,网络版数据库可以SQLServer.Oracle.MySQL等.以下分别以Access和SQLServer ...
- Maven 从svn下载后,pom.xml报错解决方案
Multiple annotations found at this line: - Execution default-testResources of goal org.apache.maven. ...
- Adding a WebPart to a SharePoint 2013 Master Page 分类: Sharepoint 2015-07-08 01:03 7人阅读 评论(0) 收藏
On SharePoint 2013 you can not add the Web Parts to the master page the same way of 2010. Please use ...
- ios 真机调试 could not find Developer Disk Image
同事不小心把iphone测试机升级到了最新系统, 真机调试以前的项目时候不能运行, 提示could not find Developer Disk Image. 原因:缺少最新系统9.3的镜像 解决办 ...
- redis随笔集-使用
redis是一个开源的.使用C语言编写的.支持网络交互的.可基于内存也可持久化的Key-Value数据库 一数据集合: 1.list -- 链表 key-value形式,通过list ID 可以实 ...
- 使用CSS3动画属性实现360°无限循环旋转【代码片段】
使用CSS3的animation动画属性实现360°无限循环旋转. 代码片段: <div id="test"> <img src="/CSS3/img/ ...
- freeCAD下载与安装
官方安装: freeCAD稳定版 freeCAD官方提供了几个稳定版本供开发者使用: Windows (XP, Vista and 7, 32 and 64bits), Mac OS X (Lion ...