Open-falcon-hbs Learning

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Open-falcon-hbs

tags (space delimited): Go Falcon

Key Features

    • Handling agent heartbeat requests, populating the host table

    • IP whitelist issued by all agents

    • Issued to implement the plug-in information

    • Issued monitoring port, process

    • Cache monitoring Policy

Module structure

Memory Data Map Structure

    • Hostmap:
      (hostname, hostId int)

    • Hostgroupsmap:
      (hostId, groupsId []int)

    • Groupplugins:
      (groupId, pluginsPath []string)

    • Grouptemplates:
      (groupId, templatesID []int)

    • Templatecache:
      (templateId, Template)

type Template struct {    Id       int    `json:"id"`    Name     string `json:"name"`    ParentId int    `json:"parentId"`    ActionId int    `json:"actionId"`    Creator  string `json:"creator"`}
    • Strategies:
      (strategryID, Strategry)

type Strategy struct {    Id         int               `json:"id"`    Metric     string            `json:"metric"`    Tags       map[string]string `json:"tags"`    Func       string            `json:"func"`       // e.g. max(#3) all(#3)    Operator   string            `json:"operator"`   // e.g. < !=    RightValue float64           `json:"rightValue"` // critical value    MaxStep    int               `json:"maxStep"`    Priority   int               `json:"priority"`    Note       string            `json:"note"`    Tpl        *Template         `json:"tpl"`}
    • Hosttemplates:
      (hostID, templatesID []int)

    • Expressioncache:
      (expressionId, [] Expression)

type Expression struct {    Id         int               `json:"id"`    Metric     string            `json:"metric"`    Tags       map[string]string `json:"tags"`    Func       string            `json:"func"`       // e.g. max(#3) all(#3)    Operator   string            `json:"operator"`   // e.g. < !=    RightValue float64           `json:"rightValue"` // critical value    MaxStep    int               `json:"maxStep"`    Priority   int               `json:"priority"`    Note       string            `json:"note"`    ActionId   int               `json:"actionId"`}
    • Monitoredhosts:
      (hostID, Host)

type Host struct {    Id   int    Name string}

DB and Cache

    • Database operations

rows, err = DB.Query(sql)if err != nil {    log.Println("ERROR:", err)    return err}…defer DB.Close()for rows.Next(){    …    err = rows.Scan(&id, &hostname)    if err != nil {        log.Println("ERROR:", err)        continue    }    …}
    • Caching policies
      The initial runtime reads data from PORTALDB in memory, and then executes the PORTALDB query every minute (consistent with the initial run operation) to update the data into memory.

    • Plug-in Policies

    1. Plugins update request contains hostname and checksum (checksum initially empty), HBS reads the plug-in path information from the PORTALDB after receiving the request, and after sorting the path takes MD5 to form checksum, Checksum compared to the agent request, the same return null does not make the plugins update, otherwise return the plug-in information, Agent received after the update plug-in and regular execution of plug-ins.

How RPC is implemented

RPC services can be established through HTTP,TCP and JSON Sever and CLIENT;HBS RPC service side through the implementation of JSON, can register multiple clients, implement the relevant interface for agent and Judge Call.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.