g

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION  = "1.0.2"
	CMDB_APP = "VipFalcon"
	CMDB_KEY = "329a55d8ddff6359c63eccb52c611140"
)

Variables

View Source
var (
	ConfigFile string
)
View Source
var RedisConnPool *redis.Pool
View Source
var RedisConnPoolCDMBCache *redis.Pool

Functions

func GetFidAndAVCFromDB

func GetFidAndAVCFromDB(id int, stype string) (int64, string, error)

func GetHostGroup

func GetHostGroup(hostname string) (string, error)

func GetHostIP

func GetHostIP(hostname string) (string, error)

modified by vincent.zhang for pigeon

func GetMetricType

func GetMetricType(hostname, counter string) (string, error)

func InitLog

func InitLog(level string) (err error)

func InitRedisConnPool

func InitRedisConnPool()
func Link(event *cmodel.Event) string

func ParseConfig

func ParseConfig(cfg string)

func PingRedis

func PingRedis(c redis.Conn, t time.Time) error

func UpdateFidToDB

func UpdateFidToDB(id int, fid int64, stype string) error

Types

type ApiConfig

type ApiConfig struct {
	Sms          string `json:"sms"`
	Mail         string `json:"mail"`
	Dashboard    string `json:"dashboard"`
	CMDB         string `json:"cmdb"`
	PlusApi      string `json:"plus_api"`
	PlusApiToken string `json:"plus_api_token"`
	IM           string `json:"im"`
}

type CMDHostInfoResponse

type CMDHostInfoResponse struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Hosts   []*HostObject `json:"object"`
	Success bool          `json:"success"`
}

type CombinerConfig

type CombinerConfig struct {
	Levels   []int `json:"levels"`
	Intervel int   `json:"interval"`
}

add by vincent.zhang for pigeon

type FalconPortalConfig

type FalconPortalConfig struct {
	Addr string `json:"addr"`
	Idle int    `json:"idle"`
	Max  int    `json:"max"`
}

type GlobalConfig

type GlobalConfig struct {
	LogLevel     string              `json:"log_level"`
	FalconPortal *FalconPortalConfig `json:"falcon_portal"`
	Http         *HttpConfig         `json:"http"`
	Redis        *RedisConfig        `json:"redis"`
	SendOK       bool                `json:"send_ok"`       //add by vincent.zhang for ok event
	ChangeIgnore bool                `json:"change_ignore"` //add by vincent.zhang for ignore status, 已被ignore的告警再来problem event是否改变为unresolved,并发送
	SendMoreMax  bool                `json:"send_more_max"` //add by vincent.zhang for ignore status, 已达到最大告警次数的告警再来problem event是否发送
	Pigeon       *PigeonConfig       `json:"pigeon"`        //add by vincent.zhang for pigeon
	Api          *ApiConfig          `json:"api"`
	Worker       *WorkerConfig       `json:"worker"`
	Housekeeper  *HousekeeperConfig  `json:"Housekeeper"`
}

func Config

func Config() *GlobalConfig

type HostObject

type HostObject struct {
	Hostname  string `json:"server_name"`
	IP        string `json:"ip"`
	Domain    string `json:"domain_name"`
	Buss_name string `json:"buss_name`
}

func GetHostInfoFromCMDB

func GetHostInfoFromCMDB(hostname string) (*HostObject, error)

type HousekeeperConfig

type HousekeeperConfig struct {
	EventRetentionDays int `json:"event_retention_days"`
	EventDeleteBatch   int `json:"event_delete_batch"`
}

type HttpConfig

type HttpConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

type PigeonConfig

type PigeonConfig struct {
	AlarmAddr    string          `json:"alarm_addr"`
	OKAddr       string          `json:"ok_addr"`
	FidAddr      string          `json:"fid_addr"`
	HighCombiner *CombinerConfig `json:"high_combiner"`
	LowCombiner  *CombinerConfig `json:"low_combiner"`
}

type RedisConfig

type RedisConfig struct {
	Addr            string   `json:"addr"`
	AddrCMDBCache   string   `json:"addrCMDBCache"`
	MaxIdle         int      `json:"maxIdle"`
	HighQueues      []string `json:"highQueues"`
	LowQueues       []string `json:"lowQueues"`
	UserIMQueue     string   `json:"userIMQueue"`
	UserSmsQueue    string   `json:"userSmsQueue"`
	UserMailQueue   string   `json:"userMailQueue"`
	PigeonHighQueue string   `json:"pigeonHighQueue"` //add by vincent.zhang for combining high level alarms
	PigeonLowQueue  string   `json:"pigeonLowQueue"`  //add by vincent.zhang for combining high low alarms
}

type WorkerConfig

type WorkerConfig struct {
	IM     int `json:"im"`
	Sms    int `json:"sms"`
	Mail   int `json:"mail"`
	Pigeon int `json:"pigeon"` //add pigeon by vincent.zhang
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL