Grafana+InfluxDB+Collectd搭建企业级监控方案一

Grafana+collectd+InfluxDB,采用客户端->服务端存储->WEB界面显示的工作模式,使用UTP传输数据,并且支持自定义图表,有良好的扩展性,重要的是Grafana页面展示比较美观,更关键的是InfluxDB提供了Python的API,InfluxDB提供了Python的APIInfluxDB提供了Python的API,重要事情说三遍。

页面展示可浏览官方演示平台:http://play.grafana.org/

首先说说这个组合的工作模式和分工:

采集数据(collectd)-> 存储数据(InfluxDB) -> 显示数据(Grafana)。
InfluxDB 是 Go 语言开发的一个开源分布式时序数据库,非常适合存储指标、事件、分析等数据,看版本号(v0.8.8)就知道这个项目还很年轻;
collectd 就不用介绍了吧,C 语言写的一个系统性能采集工具;
Grafana 是纯 Javascript 开发的前端工具,用于访问 InfluxDB,自定义报表、显示图表等


collectd负责把数据从客户端采集到服务端的InfluxDB这个数据库中,Grafana负责把数据从InfluxDB库中取出来在页面展示


测试环境介绍:
server端:172.18.1.113 
安装程序:InfluxDB Grafana

Client端:172.18.2.125
安装程序:Collectd


server端

一、influxdb安装

(1)配置YUM源
cat <<EOF |tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

(2)安装和启动
#yum install -y influxdb 
#service influxdb start

(3)相关信息
web后台http://172.18.1.113:8083/
API接口 172.18.1.113:8086
配置文件路径:/etc/influxdb/influxdb.conf


二、grafana安装

1.RPM包安装
(1)安装
#wget https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm
#rpm -Uvh grafana-2.6.0-1.x86_64.rpm

(2)修改配置
日志路径:
/var/log/grafana/grafana.log

配置文件路径:
/etc/grafana/grafana.ini

#vim /etc/grafana/grafana.ini

//由于默认端口3000和我测试环境的一个程序冲突,所以修改默认服务端口为
http_port = 3001

#/etc/init.d/grafana-server restart

启动服务后访问 http://172.18.1.113:3001


Client端

collectd安装,大部分Linux版本自带的YUM源都有此软件
#yum insatll -y collectd

但有些机器会报下面的错,没办法,只能手动下载安装

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package collectd available.
Error: Nothing to do

安装步骤

yum -y  install perl-ExtUtils-Embed perl-ExtUtils-MakeMaker  liboping* 
wget https://collectd.org/files/collectd-5.5.0.tar.gz
tar -xvf collectd-5.5.0.tar.gz 
cd collectd
./configure --enable-cpu  --enable-df --enable-disk --enable-interface --enable-load --enable-memory --enable-ping --enable-swap --enable-users --enable-uptime
make && make install
做软连接,方便操作:

cp contrib/redhat/init.d-collectd  /etc/rc.d/init.d/collectd
chmod +x /etc/rc.d/init.d/collectd
ln -s /opt/collectd/sbin/collectdmon  /usr/sbin/
ln -s /opt/collectd/sbin/collectd  /usr/sbin/
把配置文件复制到/etc/下面:

cp /opt/collectd/etc/collectd.conf  /etc/
过程中如果报如下错误:

configure: error: no acceptable C compiler found in $PATH

解决办法,安装c编译环境:

yum install gcc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0X码上链

你的鼓将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值