3 Star 9 Fork 8

junbin.yang / mgo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Unlicense

mgo

项目介绍

linux系统监控数据采集服务

软件架构

Server端提供2个业务端口,一个负责二进制数据接收,一个用于提供WebApi。

Client端采集系统数据,发送至Server端数据接收端口。

注意:整个系统无数据库或Redis等数据存储机制,Server端接收数据后存储在内存中,进程关闭则释放所有数据,暂不做持久化处理。

使用说明

  1. 启动服务端:./mgo_ser
  2. 启动客户端:./mgo_cli
  3. 浏览器访问:http://ip:9090/
  4. 若手动设置启动参数,可在参数最后加start使进程在后台运行,也可使用stop/restart

服务配置

  1. Server端配置

     -SerPort=61000    //指定Server端数据接收端口
    
     -ApiPort=9090     //指定Server端WebApi端口
    
     -MaxData=144      //设置Server端保存的数据长度
    
     -Debug=0          //设置日志是否显示详细数据,0或1

    以上为Server端默认值,即./mgo_ser 等价于 ./mgo_ser -SerPort=61000 -ApiPort=9090 -MaxData=144 -Debug=0

     -SetDB=root:123456:127.0.0.1:3306:mgo    //v0.2新增可选参数(账号:密码:地址:端口:库名),如启动时有此参数,数据将存入数据库
  2. Client端配置

     -SerPort=61000        //指定Server端数据接收端口
    
     -SerAddr=localhost    //指定Server端IP地址
    
     -MonDir=/             //设置需要采集监控的磁盘分区,有多个可用半角逗号隔开,如-MonDir=/home,/var/log
    
     -Speed=600            //设置Client端采集频率,单位秒,默认300秒,最小10秒
    
     -LanName=Default      //设置数据的网络归属名称
    
     -Debug=0              //设置日志是否显示详细数据,0或1

    即./mgo_cli 等价于 ./mgo_cli -SerPort=61000 -SerAddr=localhost -MonDir=/ -Debug=0 -Speed=600 -LanName=Default

WebApi说明

  1. 路由

     ~/host        //主机信息
    
     ~/mem         //内存信息
    
     ~/load        //CpuLoad信息
    
     ~/diskInfo    //所有磁盘信息
    
     ~/diskUsed    //MonDir所设置的分区使用情况
    
     ~/process     //系统进程数
    
     ~/flow        //网卡流量数据
    
     ~/network     //网卡信息
    
     ~/cpuInfo     //CPU信息
    
     ~/cpuUsed     //CPU使用情况
  2. 参数

     lan=Default    //网络归属名称,可用来区分不同主机或者不同网络(一般用来区分不同网络,不同主机通过返回数据中的ip区分)
    
     pageSize=24    //单页json数据长度
    
     page=1         //显示第几页

    以上均为默认值,但至少需要传递一个参数,如 http://ip:9090/process?lan=HENAN ,查看LanName=HENAN的所有服务器进程数量。

    如:

  3. 返回值

     TotalPages    //数据总页数
    
     redatas       //数据集,为LanName下的所有主机信息数组

    数据集数组格式:

     dataTime    //数据采集时间
    
     Lan         //LanName
    
     Ip          //主机IP
    
     Data        //具体数据内容

更新方向(已完成)

  1. Server端数据持久化处理(支持数据写入数据库),v0.2已支持

更新方向(开发中)

  1. Server端的UI模块(后续加入,考虑程序耦合性,目前已提供WebApi,用户想在UI上玩出什么花样都可以自己实现)

参与贡献

  1. Fork 本项目
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

码云特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. 码云官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解码云上的优秀开源项目
  4. GVP 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
  5. 码云官方提供的使用手册 https://gitee.com/help
  6. 码云封面人物是一档用来展示码云会员风采的栏目 https://gitee.com/gitee-stars/
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to [http://unlicense.org]

简介

linux系统监控数据采集服务 展开 收起
Go
Unlicense
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/junbinyang/mongo.git
git@gitee.com:junbinyang/mongo.git
junbinyang
mongo
mgo
master

搜索帮助