1 整体架构

riemann整体架构

2 event

所有的event都是一个map, 它们拥有一些共同的key

host A hostname, e.g. "api1", "foo.com" 代表主机
service e.g. "API port 8000 reqs/sec" 这个事件的服务名称
state Any string less than 255 bytes, e.g. "ok", "warning", "critical" 状态
time The time of the event, in unix epoch seconds 事件发生的时间
description Freeform text 事件的描述
tags Freeform list of strings, e.g. ["rate", "fooproduct", "transient"] 标签
metric A number associated with this event, e.g. the number of reqs/sec. 此事件的量化指标数值
ttl A floating-point time, in seconds, that this event is considered valid for. Expired states may be removed from the index. 过期时间

每个event的唯一标识是host + service

metric代表事件的量化指标数值,具体的含义由我们自己定义。比如:

;;如果这个事件是每秒钟请求数的事件,那么它可能是这个样子
{
host : "xxx"
service: "request per sec"
metric: "100" ;;表示每秒钟有100个请求
}


;;如果这个事件是某个cpu的load情况
{
host: "xxx"
service: "cpu load"
metric: "0.1" ;;表示cpu的load值
}

3 index

所有的event进入rieman后会被存入index中,逻辑上它是一个列表,每一行是一个event(主键是 host+service ),当相同的event到来时,最新的event会替代已有的,也就是说只会保存最新的event信息。 可以通过查询index来获取所有的监控信息。

4 streams

所有的event进入rieman后会被放入streams中,其会从streams的开始一直传递到最后。因此可以对数据进行过滤,集合,转发等等的操作。

5 一些常见的客户端工具(用于发送event)

5.1 rieman-mysql-replication

5.1.1 环境

centos7.2 2017-02-23 11:13:30

5.1.2 安装过程

#准备工作

#需要其中的aclocal
yum install automake
#需要其中的libtoolize
yum install libtool-2.4.2-21.el7_2.x86_64

#如果不安装,会出现fatal error: mysql/mysql.h: No such file or directory
yum install soci-mysql-devel.x86_64
#下载源码
git clone https://github.com/exoscale/riemann-mysql.git

...待补充