《实时监控grafana+graphite+collectd安装方法》由会员分享,可在线阅读,更多相关《实时监控grafana+graphite+collectd安装方法(5页珍藏版)》请在金锄头文库上搜索。
1、实时监控grafana安装1.架构如图rnnysqlJGRAPHITEgraphite氏妄疫云坚祺察MRIJE刮只珅诳CpU甚进套洛M送判迎jgLCOLLECTDnetworkdiskcpunetworkcollectdcollect dproxy_collectd2.准备工作yum install mysql mysql-server httpd perl-devel epel-release service mysqld start3.客户端安装collectd说明:由于YUM安装的COLLECTD的版本较低。必须源码安装COLLECTD源码安装的COLLECTD支持WRITE-GRAPH
2、ITE插件。 在所有的监控主机安装COLLECTDwget http:/collectd.Org/files/collectd-5.5.0.tar.bz2 tar xvf collectd-5.5.0.tar.bz2 cd collectd-5.5.0 ./configure -enable-all-plugins make all &make install#修改 COLLECTD 配置文件/etc/collectd.conf Hostname当前监控主机名称LoadPlugin network Interface eth0 #修改代理COLLECTD的配置文件Hostname当前监控主机名
3、称LoadPlugin networkLoadPlugin write_graphite 加载监控插件,networks write_graphite这两个是必须 的。#做为代理的 COLLECTD 服务器地址Interface eth0#把接受到的监控数据写入graphiteHost 127.0.0.1 #graphite 地址Port 2003Protocol tcpLogSendErrors truePrefix collectd #命名前缀 Postfix collectdStoreRates trueAlwaysAppendDS falseEscapeCharacter _ Grap
4、hite ComposerTree SearchAuto-Camp let er拍_ :So. sho. inci rhe 24 hourt 白 Graphite+j J carbonl 1 亡I 如IcDllectcj |+)_j collectd1_13collectd 、+j L collectcllocalhostcollectd)O User Graphs命名规则根据 collectd. confprefix4-host+pastfix添加自启动脚本cp /contrib/redhat/init.d-collectd /etc/init.d/collectd chkconfig co
5、llectd on service collectd start4.数据库初始#连接数据库 mysql -uroot -p#执行如下SQLcreate database graphite;GRANT ALL PRIVILEGES ON graphite.* TO graphitelocalhost IDENTIFIED BY 密码;FLUSH PRIVILEGES;5. 安装 graphiteyum install python-carbon python-whisper MySql-python graphite-web #启动 carbon service carbon-cache sta
6、rt#修改 graphite-web 酉己置/etc/graphite-web/local_settings.pyDATABASES =default: NAME: graphite,#数据库名称,在MYSQL里创建的名称ENGINE: django.db.backends.mysql, #默认使用 MYSQL USER: graphite,#连接数据库的用户名PASSWORD: duanbai,#连接数据库的密码HOST: localhost,#数据库主机地址PORT: 3306#数据库主机端口 #修改配置后要进行同步数据库结构 /usr/lib/python2.6/site-package
7、s/graphite/manage.py syncdb6. apache 配置/etc/httpd/conf/httpd.confServerName graphite-webDocumentRoot /usr/share/graphite/webappErrorLog /var/log/httpd/graphite-web-error.logCustomLog /var/log/httpd/graphite-web-access.log commonAlias /media/ /usr/lib/python2.6/site-packages/django/contrib/admin/medi
8、a/WSGIScriptAlias / /usr/share/graphite/graphite-web.wsgiWSGIImportScript /usr/share/graphite/graphite-web.wsgi process-group=%GLOBAL application-group=%GLOBALSetHandler None SetHandler None jQcii-0泊i政土祢rt7. 安装 grafanawget https:/grafanarel.s3.amazonaws.eom/builds/grafana-2.6.0-1.x86_64.rpm rpm -ivh grafana-2.6.0-1.x86_64.rpmgrafana 酉己置说明/ete/grafana/grafana.eonfsecuritygrafana的管理用户名 grafana的管理用户密码admin_user = adminadmin_password = adminGrafana初始设置添加数据源如图Add new巷 Data sources OverviewDashboards喜 Data SourcesAdd data sourceMmlnGralana adminSign out