---
title: "使用simple_flow实现实时系统的监控"
author: "finallygo"
date: "2014-11-06T14:10:00Z"
tags: []
categories: ["开源软件"]
slug: "simple-flow"
draft: false
lastmod: "2015-01-23T18:23:13Z"
id: 2153014
url: "https://finallygo.iteye.com/blog/2153014"
---

1. 监控系统简介
   
   通过拉取在线服务日志(比如apache的access log),将日志信息(pv数据)保存到redis,并通过曲线图展示
2. 使用组件
   
   (1) simple\_flow -- 流式计算
   
   (2) simple\_server -- 用于前端展示
   
   (3) redis -- pv数据存储
   
   (4) jschats -- 前端曲线展示
3. 流程图
   
   ![](http://dl2.iteye.com/upload/attachment/0103/3591/14ed06e8-1126-356f-86b6-3bf15a937225.jpg)
4. 准备过程
   
   (1) 启动 redis (在本地6379端口)
   
   (2) 会滚动的日志文件
5. 实现流程
   
   (1) 下载 simple\_flow : [https://github.com/hongliuliao/simple\_flow](https://github.com/hongliuliao/simple_flow) (请使用tag为agent\_server\_mode的版本)
   
   (2) 执行 make && make statistic\_flow\_server && make statistic\_http\_server
   
   (3) 启动 statistic\_flow\_server :   ./bin/statistic\_flow\_server 
   
   (4) 启动 fileagent : ./bin/fileagent localhost 3492 \[日志文件]
   
   (5) 启动 statistic\_http\_server: ./bin/statistic\_http\_server
   
   (6) 通过浏览器访问: [http://192.168.238.140:3493/show.html](http://192.168.238.140:3493/show.html) (ip请切换成对应的),效果如下图:
   
   ![](http://dl2.iteye.com/upload/attachment/0103/3593/f86a02fa-dda5-33c8-b6c3-422d76639989.jpg)
6. 具体代码可以在test目录下找到