[关闭]
@skyway 2016-07-25T13:02:45.000000Z 字数 1812 阅读 854

open-falcon-hbs

go falcon


主要功能

模块结构

此处输入图片的描述

内存数据Map结构

  1. type Template struct {
  2. Id int `json:"id"`
  3. Name string `json:"name"`
  4. ParentId int `json:"parentId"`
  5. ActionId int `json:"actionId"`
  6. Creator string `json:"creator"`
  7. }
  1. type Strategy struct {
  2. Id int `json:"id"`
  3. Metric string `json:"metric"`
  4. Tags map[string]string `json:"tags"`
  5. Func string `json:"func"` // e.g. max(#3) all(#3)
  6. Operator string `json:"operator"` // e.g. < !=
  7. RightValue float64 `json:"rightValue"` // critical value
  8. MaxStep int `json:"maxStep"`
  9. Priority int `json:"priority"`
  10. Note string `json:"note"`
  11. Tpl *Template `json:"tpl"`
  12. }
  1. type Expression struct {
  2. Id int `json:"id"`
  3. Metric string `json:"metric"`
  4. Tags map[string]string `json:"tags"`
  5. Func string `json:"func"` // e.g. max(#3) all(#3)
  6. Operator string `json:"operator"` // e.g. < !=
  7. RightValue float64 `json:"rightValue"` // critical value
  8. MaxStep int `json:"maxStep"`
  9. Priority int `json:"priority"`
  10. Note string `json:"note"`
  11. ActionId int `json:"actionId"`
  12. }
  1. type Host struct {
  2. Id int
  3. Name string
  4. }

DB和Cache

  1. rows, err = DB.Query(sql)
  2. if err != nil {
  3. log.Println("ERROR:", err)
  4. return err
  5. }
  6. defer DB.Close()
  7. for rows.Next(){
  8. err = rows.Scan(&id, &hostname)
  9. if err != nil {
  10. log.Println("ERROR:", err)
  11. continue
  12. }
  13. }

RPC实现方式

RPC服务可通过HTTP,TCP和JSON的方式建立Sever和Client;Hbs的RPC服务端通过JSON方式实现,可注册多个client,实现相关接口,供agent和judge调用。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注