config

package
v0.0.0-...-b03fc3e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(cfg *DBConfig) error

Init initialices the DB

func SetDirs

func SetDirs(data string, log string, conf string)

SetDirs set default dirs to set db and logs

func SetLogger

func SetLogger(l *logrus.Logger)

SetLogger set the output log

Types

type AlertEndpointRel

type AlertEndpointRel struct {
	AlertID    string `xorm:"alert_id"`
	EndpointID string `xorm:"endpoint_id"`
}

AlertEndpointRel relation between Alerts and Endpoint's type

func (AlertEndpointRel) TableName

func (AlertEndpointRel) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type AlertEvent

type AlertEvent struct {
	ID                   int64         `xorm:"'id' pk autoincr"`
	CorrelationID        string        `xorm:"correlationid"`
	AlertID              string        `xorm:"alertid"`
	ProductID            string        `xorm:"productid"`
	ProductTagValue      string        `xorm:"producttagvalue"`
	Field                string        `xorm:"field"`
	Message              string        `xorm:"message"`
	Details              string        `xorm:"details text"`
	ResistorDashboardURL string        `xorm:"resistor-dashboardurl text"`
	FirstEventTime       time.Time     `xorm:"firsteventtime"`
	EventTime            time.Time     `xorm:"eventtime"`
	Duration             time.Duration `xorm:"duration"`
	Level                string        `xorm:"level"`
	PreviousLevel        string        `xorm:"previousLevel"`
	Tags                 []string      `xorm:"tags"`
	Value                float64       `xorm:"value"`
	MonExc               string        `xorm:"mon_exc"`
}

AlertEvent is a structure that contains relevant data about an alert event. The structure is intended to be JSON encoded, providing a consistent data format.

func (AlertEvent) TableName

func (AlertEvent) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type AlertEventHist

type AlertEventHist struct {
	ID                   int64         `xorm:"'id' pk"`
	CorrelationID        string        `xorm:"correlationid"`
	AlertID              string        `xorm:"alertid"`
	ProductID            string        `xorm:"productid"`
	ProductTagValue      string        `xorm:"producttagvalue"`
	Field                string        `xorm:"field"`
	Message              string        `xorm:"message"`
	Details              string        `xorm:"details text"`
	ResistorDashboardURL string        `xorm:"resistor-dashboardurl text"`
	FirstEventTime       time.Time     `xorm:"firsteventtime"`
	EventTime            time.Time     `xorm:"eventtime"`
	Duration             time.Duration `xorm:"duration"`
	Level                string        `xorm:"level"`
	PreviousLevel        string        `xorm:"previousLevel"`
	Tags                 []string      `xorm:"tags"`
	Value                float64       `xorm:"value"`
	MonExc               string        `xorm:"mon_exc"`
}

AlertEventHist is a structure that contains relevant data about an alert event. The structure is intended to be JSON encoded, providing a consistent data format.

func (AlertEventHist) TableName

func (AlertEventHist) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type AlertEventsSummary

type AlertEventsSummary struct {
	Level string `json:"level"`
	Num   int    `json:"num"`
}

AlertEventsSummary is a structure that contains summary data about alert events.

type AlertIDCfg

type AlertIDCfg struct {
	//Alert ID data
	ID          string `xorm:"'id' unique" binding:"Required"` //Autogenerated with next 4 ids (IDBaseLine-IdProduct-IdGroup-IdNumAlert)
	Active      bool   `xorm:"active"`
	BaselineID  string `xorm:"baselineid" binding:"Required"`
	ProductID   string `xorm:"productid" binding:"Required"` //FK - > Product_devices
	AlertGroup  string `xorm:"alertgroup" binding:"Required"`
	NumAlertID  int    `xorm:"numalertid" binding:"Required"`
	Description string `xorm:"description text"`
	//Alert Origin data
	InfluxDB           string `xorm:"influxdb" binding:"Required"`
	InfluxRP           string `xorm:"influxrp" binding:"Required"`
	InfluxMeasurement  string `xorm:"influxmeasurement" binding:"Required"`
	TagDescription     string `xorm:"tagdescription"`
	InfluxFilter       string `xorm:"influxfilter"`
	TriggerType        string `xorm:"triggertype" binding:"Required;In(DEADMAN,THRESHOLD,TREND)"` //deadman|
	IntervalCheck      string `xorm:"intervalcheck" binding:"Required"`
	AlertFrequency     string `xorm:"alertfrequency"`
	AlertNotify        int    `xorm:"alertnotify"`
	OperationID        string `xorm:"operationid"`
	Field              string `xorm:"field" binding:"Required"`
	IsCustomExpression bool   `xorm:"iscustomexpression"`
	FieldDesc          string `xorm:"fielddesc"`
	ExtraData          int64  `xorm:"extradata"`
	StatFunc           string `xorm:"statfunc"`
	CritDirection      string `xorm:"critdirection"`
	Shift              string `xorm:"shift"`
	TrendType          string `xorm:"trendtype"` //Absolute/Relative
	TrendSign          string `xorm:"trendsign"` //Positive/Negative
	FieldType          string `xorm:"fieldtype"` //Counter/Gauge
	Rate               bool   `xorm:"rate"`
	FieldResolution    string `xorm:"fieldresolution"`
	//thresholds
	//CRITICAL
	ThCritDef         float64 `xorm:"th_crit_def"`
	ThCritEx1         float64 `xorm:"th_crit_ex1"`
	ThCritEx2         float64 `xorm:"th_crit_ex2"`
	ThCritRangeTimeID string  `xorm:"th_crit_rangetime_id"`

	//WARN
	ThWarnDef         float64 `xorm:"th_warn_def"`
	ThWarnEx1         float64 `xorm:"th_warn_ex1"`
	ThWarnEx2         float64 `xorm:"th_warn_ex2"`
	ThWarnRangeTimeID string  `xorm:"th_warn_rangetime_id"`

	//INFO
	ThInfoDef         float64 `xorm:"th_info_def"`
	ThInfoEx1         float64 `xorm:"th_info_ex1"`
	ThInfoEx2         float64 `xorm:"th_info_ex2"`
	ThInfoRangeTimeID string  `xorm:"th_info_rangetime_id"`

	//Grafana dashboard
	GrafanaServer      string `xorm:"grafana_server"`
	GrafanaDashLabel   string `xorm:"grafana_dash_label"`
	GrafanaDashPanelID string `xorm:"grafana_panel_id"`
	ProductTag         string `xorm:"producttag"`
	DeviceIDLabel      string `xorm:"deviceid_label"`
	ExtraTag           string `xorm:"extra_tag"`
	ExtraLabel         string `xorm:"extra_label"`
	AlertExtraText     string `xorm:"alert_extra_text"`
	IDTag              string `xorm:"idtag"`
	//Where to deploy this rule
	KapacitorID string `xorm:"kapacitorid" binding:"Required"`

	Endpoint                []string  `xorm:"-"` //relation with endpointcfgs
	Modified                time.Time `xorm:"modified"`
	ServersWOLastDeployment []string  `xorm:"servers_wo_last_deployment"`
	LastDeploymentTime      time.Time `xorm:"last_deployment_time"`
	Imported                time.Time `xorm:"imported"`
}

AlertIDCfg Alert Definition Config type

func (AlertIDCfg) TableName

func (AlertIDCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type AlertIDCfgJSON

type AlertIDCfgJSON struct {
	//Alert ID data
	ID           string `json:"alertid"` //Autogenerated with next 4 ids (IDBaseLine-IdProduct-IdGroup-IdNumAlert)
	BaselineID   string `json:"baselineid"`
	ProductID    string `json:"productid"` //FK - > Product_devices
	ProductGroup string `json:"productgroup,omitempty"`
	AlertGroup   string `json:"alertgroup"`
	//Alert Origin data
	InfluxDBName      string `json:"influxdbname"`
	InfluxRP          string `json:"influxrp"`
	InfluxMeasurement string `json:"influxmeasurement"`
	InfluxFilter      string `json:"influxfilter,omitempty"`
	TriggerType       string `json:"triggertype"` //deadman|
	IntervalCheck     string `json:"intervalcheck"`
	AlertFrequency    string `json:"alertfrequency,omitempty"`
	OperationID       string `json:"operationid,omitempty"`
	Field             string `json:"field"`
	StatFunc          string `json:"statfunc,omitempty"`
	CritDirection     string `json:"critdirection,omitempty"`
	Shift             string `json:"shift,omitempty"`
	TrendType         string `json:"trendtype,omitempty"` //Absolute/Relative
	TrendSign         string `json:"trendsign,omitempty"` //Positive/Negative
	FieldType         string `json:"fieldtype,omitempty"` //Counter/Gauge
	FieldResolution   string `json:"fieldresolution,omitempty"`
	//thresholds
	//APPLIED
	ThCrit float64 `json:"th_crit"`
	ThWarn float64 `json:"th_warn"`
	ThInfo float64 `json:"th_info"`

	AlertExtraText string `json:"alert_extra_text,omitempty"`
	IDTag          string `json:"idtag,omitempty"`
	//Where to deploy this rule
	KapacitorID string `json:"kapacitorid"`
}

AlertIDCfgJSON structure with data info in json

type AlertingCfg

type AlertingCfg struct {
	CleanPeriod           string `toml:"cleanperiod"`
	MaxRows               int64  `toml:"maxrows"`
	ResistorURL           string `toml:"resistorurl"`
	CorrelationIDTemplate string `toml:"correlationidtemplate"`
}

AlertingCfg alerting config options

type Config

type Config struct {
	General   GeneralConfig
	Database  DatabaseCfg
	Selfmon   SelfMonConfig
	HTTP      HTTPConfig
	Influxdb  InfluxCfg
	Endpoints EndpointsCfg
	Alerting  AlertingCfg
}

Config All resistor configuration

type DBConfig

type DBConfig struct {
	DeviceStat        map[int64]*DeviceStatCfg
	Operation         map[string]*OperationCfg
	RangeTime         map[string]*RangeTimeCfg
	Product           map[string]*ProductCfg
	Kapacitor         map[string]*KapacitorCfg
	AlertID           map[string]*AlertIDCfg
	AlertEventHistMap map[int64]*AlertEventHist
	AlertEventMap     map[int64]*AlertEvent
	Template          map[string]*TemplateCfg
	Endpoint          map[string]*EndpointCfg
}

DBConfig read from DB

type DatabaseCfg

type DatabaseCfg struct {
	Type       string `toml:"type"`
	Host       string `toml:"host"`
	Name       string `toml:"name"`
	User       string `toml:"user"`
	Password   string `toml:"password"`
	SQLLogFile string `toml:"sqllogfile"`
	Debug      string `toml:"debug"`
	// contains filtered or unexported fields
}

DatabaseCfg de configuration for the database

func (*DatabaseCfg) AddAlertEvent

func (dbc *DatabaseCfg) AddAlertEvent(dev *AlertEvent) (int64, error)

AddAlertEvent for adding new alert events

func (*DatabaseCfg) AddAlertEventHist

func (dbc *DatabaseCfg) AddAlertEventHist(dev *AlertEventHist) (int64, error)

AddAlertEventHist for adding new Alert Event History

func (*DatabaseCfg) AddAlertIDCfg

func (dbc *DatabaseCfg) AddAlertIDCfg(dev *AlertIDCfg) (int64, error)

AddAlertIDCfg for adding new devices

func (*DatabaseCfg) AddDeviceStatCfg

func (dbc *DatabaseCfg) AddDeviceStatCfg(dev *DeviceStatCfg) (int64, error)

AddDeviceStatCfg for adding new devices

func (*DatabaseCfg) AddEndpointCfg

func (dbc *DatabaseCfg) AddEndpointCfg(dev *EndpointCfg) (int64, error)

AddEndpointCfg for adding new devices

func (*DatabaseCfg) AddIfxDBCfg

func (dbc *DatabaseCfg) AddIfxDBCfg(dev *IfxDBCfg) (int64, error)

AddIfxDBCfg for adding new devices

func (*DatabaseCfg) AddIfxMeasurementCfg

func (dbc *DatabaseCfg) AddIfxMeasurementCfg(dev *IfxMeasurementCfg) (int64, error)

AddIfxMeasurementCfg for adding new devices

func (*DatabaseCfg) AddIfxServerCfg

func (dbc *DatabaseCfg) AddIfxServerCfg(dev *IfxServerCfg) (int64, error)

AddIfxServerCfg for adding new devices

func (*DatabaseCfg) AddKapacitorCfg

func (dbc *DatabaseCfg) AddKapacitorCfg(dev *KapacitorCfg) (int64, error)

AddKapacitorCfg for adding new devices

func (*DatabaseCfg) AddOperationCfg

func (dbc *DatabaseCfg) AddOperationCfg(dev *OperationCfg) (int64, error)

AddOperationCfg for adding new operations

func (*DatabaseCfg) AddOrUpdateIfxDBCfg

func (dbc *DatabaseCfg) AddOrUpdateIfxDBCfg(dev *IfxDBCfg) (int64, error)

AddOrUpdateIfxDBCfg this method insert data if not previouosly exist the tuple ifxServer.Name or update it if already exist

func (*DatabaseCfg) AddOrUpdateIfxMeasurementCfg

func (dbc *DatabaseCfg) AddOrUpdateIfxMeasurementCfg(dev *IfxMeasurementCfg) (int64, error)

AddOrUpdateIfxMeasurementCfg this method inserts data if not previously exists or updates it if already exists

func (*DatabaseCfg) AddProductCfg

func (dbc *DatabaseCfg) AddProductCfg(dev *ProductCfg) (int64, error)

AddProductCfg for adding new devices

func (*DatabaseCfg) AddProductGroupCfg

func (dbc *DatabaseCfg) AddProductGroupCfg(dev *ProductGroupCfg) (int64, error)

AddProductGroupCfg for adding new devices

func (*DatabaseCfg) AddRangeTimeCfg

func (dbc *DatabaseCfg) AddRangeTimeCfg(dev *RangeTimeCfg) (int64, error)

AddRangeTimeCfg for adding new devices

func (*DatabaseCfg) AddTemplateCfg

func (dbc *DatabaseCfg) AddTemplateCfg(dev *TemplateCfg) (int64, error)

AddTemplateCfg for adding new templates

func (*DatabaseCfg) DelAlertEvent

func (dbc *DatabaseCfg) DelAlertEvent(idlist string) (int64, error)

DelAlertEvent for deleting alert events from list of IDs

func (*DatabaseCfg) DelAlertEventHist

func (dbc *DatabaseCfg) DelAlertEventHist(idlist string) (int64, error)

DelAlertEventHist for deleting alert events from list of IDs

func (*DatabaseCfg) DelAlertIDCfg

func (dbc *DatabaseCfg) DelAlertIDCfg(id string) (int64, error)

DelAlertIDCfg for deleting alerts from ID

func (*DatabaseCfg) DelDeviceStatCfg

func (dbc *DatabaseCfg) DelDeviceStatCfg(id int64) (int64, error)

DelDeviceStatCfg for deleting influx databases from ID

func (*DatabaseCfg) DelEndpointCfg

func (dbc *DatabaseCfg) DelEndpointCfg(id string) (int64, error)

DelEndpointCfg for deleting influx databases from ID

func (*DatabaseCfg) DelIfxDBCfg

func (dbc *DatabaseCfg) DelIfxDBCfg(id string) (int64, error)

DelIfxDBCfg for deleting influx databases from ID

func (*DatabaseCfg) DelIfxMeasurementCfg

func (dbc *DatabaseCfg) DelIfxMeasurementCfg(id string) (int64, error)

DelIfxMeasurementCfg for deleting influx databases from ID

func (*DatabaseCfg) DelIfxServerCfg

func (dbc *DatabaseCfg) DelIfxServerCfg(id string) (int64, error)

DelIfxServerCfg for deleting influx databases from ID

func (*DatabaseCfg) DelKapacitorCfg

func (dbc *DatabaseCfg) DelKapacitorCfg(id string) (int64, error)

DelKapacitorCfg for deleting influx databases from ID

func (*DatabaseCfg) DelOperationCfg

func (dbc *DatabaseCfg) DelOperationCfg(id string) (int64, error)

DelOperationCfg for deleting operations from ID

func (*DatabaseCfg) DelProductCfg

func (dbc *DatabaseCfg) DelProductCfg(id string) (int64, error)

DelProductCfg for deleting influx databases from ID

func (*DatabaseCfg) DelProductGroupCfg

func (dbc *DatabaseCfg) DelProductGroupCfg(id string) (int64, error)

DelProductGroupCfg for deleting influx databases from ID

func (*DatabaseCfg) DelRangeTimeCfg

func (dbc *DatabaseCfg) DelRangeTimeCfg(id string) (int64, error)

DelRangeTimeCfg for deleting influx databases from ID

func (*DatabaseCfg) DelTemplateCfg

func (dbc *DatabaseCfg) DelTemplateCfg(id string) (int64, error)

DelTemplateCfg for deleting influx databases from ID

func (*DatabaseCfg) GetAlertEventAffectOnDel

func (dbc *DatabaseCfg) GetAlertEventAffectOnDel(id string) ([]*DbObjAction, error)

GetAlertEventAffectOnDel NO config tables affected when deleting alert events

func (*DatabaseCfg) GetAlertEventArray

func (dbc *DatabaseCfg) GetAlertEventArray(filter string) ([]*AlertEvent, error)

GetAlertEventArray generate an array of alert events with all its information

func (*DatabaseCfg) GetAlertEventArrayWithParams

func (dbc *DatabaseCfg) GetAlertEventArrayWithParams(filter string, maxrows int64, page int64, itemsPerPage int64, maxSize int64, sortColumn string, sortDir string) ([]*AlertEvent, error)

GetAlertEventArrayWithParams generate an array of alert events with all their information

func (*DatabaseCfg) GetAlertEventByID

func (dbc *DatabaseCfg) GetAlertEventByID(id int64) (AlertEvent, error)

GetAlertEventByID get device data by id

func (*DatabaseCfg) GetAlertEventHistAffectOnDel

func (dbc *DatabaseCfg) GetAlertEventHistAffectOnDel(id string) ([]*DbObjAction, error)

GetAlertEventHistAffectOnDel NO config tables affected when deleting alert events

func (*DatabaseCfg) GetAlertEventHistArray

func (dbc *DatabaseCfg) GetAlertEventHistArray(filter string) ([]*AlertEventHist, error)

GetAlertEventHistArray generate an array of Alert Events History with all their information

func (*DatabaseCfg) GetAlertEventHistArrayWithParams

func (dbc *DatabaseCfg) GetAlertEventHistArrayWithParams(filter string, maxrows int64, page int64, itemsPerPage int64, maxSize int64, sortColumn string, sortDir string) ([]*AlertEventHist, error)

GetAlertEventHistArrayWithParams generate an array of Alert Events History with all their information

func (*DatabaseCfg) GetAlertEventHistByID

func (dbc *DatabaseCfg) GetAlertEventHistByID(id int64) (AlertEventHist, error)

GetAlertEventHistByID get device data by id

func (*DatabaseCfg) GetAlertEventHistMap

func (dbc *DatabaseCfg) GetAlertEventHistMap(filter string) (map[int64]*AlertEventHist, error)

GetAlertEventHistMap return data in map format

func (*DatabaseCfg) GetAlertEventMap

func (dbc *DatabaseCfg) GetAlertEventMap(filter string) (map[int64]*AlertEvent, error)

GetAlertEventMap return data in map format

func (*DatabaseCfg) GetAlertEventsByLevelArray

func (dbc *DatabaseCfg) GetAlertEventsByLevelArray(filter string) ([]*AlertEventsSummary, error)

GetAlertEventsByLevelArray generates an array of alert events summary

func (*DatabaseCfg) GetAlertEventsHistByLevelArray

func (dbc *DatabaseCfg) GetAlertEventsHistByLevelArray(filter string) ([]*AlertEventsSummary, error)

GetAlertEventsHistByLevelArray generates an array of alert events summary

func (*DatabaseCfg) GetAlertIDCfgAffectOnDel

func (dbc *DatabaseCfg) GetAlertIDCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetAlertIDCfgAffectOnDel NO config tables affected when deleting AlertIDCfg

func (*DatabaseCfg) GetAlertIDCfgArray

func (dbc *DatabaseCfg) GetAlertIDCfgArray(filter string) ([]*AlertIDCfg, error)

GetAlertIDCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetAlertIDCfgByID

func (dbc *DatabaseCfg) GetAlertIDCfgByID(id string) (AlertIDCfg, error)

GetAlertIDCfgByID get device data by id

func (*DatabaseCfg) GetAlertIDCfgMap

func (dbc *DatabaseCfg) GetAlertIDCfgMap(filter string) (map[string]*AlertIDCfg, error)

GetAlertIDCfgMap return data in map format

func (*DatabaseCfg) GetDeviceStatCfgAffectOnDel

func (dbc *DatabaseCfg) GetDeviceStatCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetDeviceStatCfgAffectOnDel for deleting devicestats from ID

func (*DatabaseCfg) GetDeviceStatCfgArray

func (dbc *DatabaseCfg) GetDeviceStatCfgArray(filter string) ([]*DeviceStatCfg, error)

GetDeviceStatCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetDeviceStatCfgByID

func (dbc *DatabaseCfg) GetDeviceStatCfgByID(id int64) (DeviceStatCfg, error)

GetDeviceStatCfgByID get device data by id

func (*DatabaseCfg) GetDeviceStatCfgMap

func (dbc *DatabaseCfg) GetDeviceStatCfgMap(filter string) (map[int64]*DeviceStatCfg, error)

GetDeviceStatCfgMap return data in map format

func (*DatabaseCfg) GetEndpointCfgAffectOnDel

func (dbc *DatabaseCfg) GetEndpointCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetEndpointCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetEndpointCfgArray

func (dbc *DatabaseCfg) GetEndpointCfgArray(filter string) ([]*EndpointCfg, error)

GetEndpointCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetEndpointCfgByID

func (dbc *DatabaseCfg) GetEndpointCfgByID(id string) (EndpointCfg, error)

GetEndpointCfgByID get device data by id

func (*DatabaseCfg) GetEndpointCfgMap

func (dbc *DatabaseCfg) GetEndpointCfgMap(filter string) (map[string]*EndpointCfg, error)

GetEndpointCfgMap return data in map format

func (*DatabaseCfg) GetIfxDBCfgAffectOnDel

func (dbc *DatabaseCfg) GetIfxDBCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetIfxDBCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetIfxDBCfgArray

func (dbc *DatabaseCfg) GetIfxDBCfgArray(filter string) ([]*IfxDBCfg, error)

GetIfxDBCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetIfxDBCfgArrayByMeasName

func (dbc *DatabaseCfg) GetIfxDBCfgArrayByMeasName(filter string) ([]*IfxDBCfg, error)

GetIfxDBCfgArrayByMeasName Gets an array of Influx databases with their measurements

func (*DatabaseCfg) GetIfxDBCfgByID

func (dbc *DatabaseCfg) GetIfxDBCfgByID(id string) (IfxDBCfg, error)

GetIfxDBCfgByID get device data by id

func (*DatabaseCfg) GetIfxDBCfgMap

func (dbc *DatabaseCfg) GetIfxDBCfgMap(filter string) (map[string]*IfxDBCfg, error)

GetIfxDBCfgMap return data in map format

func (*DatabaseCfg) GetIfxMeasurementCfgAffectOnDel

func (dbc *DatabaseCfg) GetIfxMeasurementCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetIfxMeasurementCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetIfxMeasurementCfgArray

func (dbc *DatabaseCfg) GetIfxMeasurementCfgArray(filter string) ([]*IfxMeasurementCfg, error)

GetIfxMeasurementCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetIfxMeasurementCfgByID

func (dbc *DatabaseCfg) GetIfxMeasurementCfgByID(id string) (IfxMeasurementCfg, error)

GetIfxMeasurementCfgByID get device data by id

func (*DatabaseCfg) GetIfxMeasurementCfgBySQLQuery

func (dbc *DatabaseCfg) GetIfxMeasurementCfgBySQLQuery(sqlquery string) (IfxMeasurementCfg, error)

GetIfxMeasurementCfgBySQLQuery Gets an IfxMeasurementCfg with all its information

func (*DatabaseCfg) GetIfxMeasurementCfgDistinctNamesArray

func (dbc *DatabaseCfg) GetIfxMeasurementCfgDistinctNamesArray(filter string) ([]*IfxMeasurementCfg, error)

GetIfxMeasurementCfgDistinctNamesArray generate an array of IfxMeasurementCfg with distinct names

func (*DatabaseCfg) GetIfxMeasurementCfgMap

func (dbc *DatabaseCfg) GetIfxMeasurementCfgMap(filter string) (map[string]*IfxMeasurementCfg, error)

GetIfxMeasurementCfgMap return data in map format

func (*DatabaseCfg) GetIfxMeasurementTagsArray

func (dbc *DatabaseCfg) GetIfxMeasurementTagsArray(filter string) ([]string, error)

GetIfxMeasurementTagsArray Gets the array of tags for the measurements passed in filter The filter contains a list of measurement names then with these measurement names a list of tags is obtained

func (*DatabaseCfg) GetIfxServerCfgAffectOnDel

func (dbc *DatabaseCfg) GetIfxServerCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetIfxServerCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetIfxServerCfgArray

func (dbc *DatabaseCfg) GetIfxServerCfgArray(filter string) ([]*IfxServerCfg, error)

GetIfxServerCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetIfxServerCfgByID

func (dbc *DatabaseCfg) GetIfxServerCfgByID(id string) (IfxServerCfg, error)

GetIfxServerCfgByID get device data by id

func (*DatabaseCfg) GetIfxServerCfgMap

func (dbc *DatabaseCfg) GetIfxServerCfgMap(filter string) (map[string]*IfxServerCfg, error)

GetIfxServerCfgMap return data in map format

func (*DatabaseCfg) GetKapacitorCfgAffectOnDel

func (dbc *DatabaseCfg) GetKapacitorCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetKapacitorCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetKapacitorCfgArray

func (dbc *DatabaseCfg) GetKapacitorCfgArray(filter string) ([]*KapacitorCfg, error)

GetKapacitorCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetKapacitorCfgByID

func (dbc *DatabaseCfg) GetKapacitorCfgByID(id string) (KapacitorCfg, error)

GetKapacitorCfgByID get device data by id

func (*DatabaseCfg) GetKapacitorCfgMap

func (dbc *DatabaseCfg) GetKapacitorCfgMap(filter string) (map[string]*KapacitorCfg, error)

GetKapacitorCfgMap return data in map format

func (*DatabaseCfg) GetOperationCfgAffectOnDel

func (dbc *DatabaseCfg) GetOperationCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetOperationCfgAffectOnDel for deleting operations from ID

func (*DatabaseCfg) GetOperationCfgArray

func (dbc *DatabaseCfg) GetOperationCfgArray(filter string) ([]*OperationCfg, error)

GetOperationCfgArray generate an array of operations with all its information

func (*DatabaseCfg) GetOperationCfgByID

func (dbc *DatabaseCfg) GetOperationCfgByID(id string) (OperationCfg, error)

GetOperationCfgByID get operation data by id

func (*DatabaseCfg) GetOperationCfgMap

func (dbc *DatabaseCfg) GetOperationCfgMap(filter string) (map[string]*OperationCfg, error)

GetOperationCfgMap return data in map format

func (*DatabaseCfg) GetProductCfgAffectOnDel

func (dbc *DatabaseCfg) GetProductCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetProductCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetProductCfgArray

func (dbc *DatabaseCfg) GetProductCfgArray(filter string) ([]*ProductCfg, error)

GetProductCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetProductCfgByID

func (dbc *DatabaseCfg) GetProductCfgByID(id string) (ProductCfg, error)

GetProductCfgByID get device data by id

func (*DatabaseCfg) GetProductCfgMap

func (dbc *DatabaseCfg) GetProductCfgMap(filter string) (map[string]*ProductCfg, error)

GetProductCfgMap return data in map format

func (*DatabaseCfg) GetProductGroupCfgAffectOnDel

func (dbc *DatabaseCfg) GetProductGroupCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetProductGroupCfgAffectOnDel for deleting devices from ID

func (*DatabaseCfg) GetProductGroupCfgArray

func (dbc *DatabaseCfg) GetProductGroupCfgArray(filter string) ([]*ProductGroupCfg, error)

GetProductGroupCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetProductGroupCfgByID

func (dbc *DatabaseCfg) GetProductGroupCfgByID(id string) (ProductGroupCfg, error)

GetProductGroupCfgByID get device data by id

func (*DatabaseCfg) GetProductGroupCfgMap

func (dbc *DatabaseCfg) GetProductGroupCfgMap(filter string) (map[string]*ProductGroupCfg, error)

GetProductGroupCfgMap return data in map format

func (*DatabaseCfg) GetRangeTimeCfgAffectOnDel

func (dbc *DatabaseCfg) GetRangeTimeCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetRangeTimeCfgAffectOnDel Check if there are any AlertIDCfg affected when deleting RangeTimeCfg with this ID

func (*DatabaseCfg) GetRangeTimeCfgArray

func (dbc *DatabaseCfg) GetRangeTimeCfgArray(filter string) ([]*RangeTimeCfg, error)

GetRangeTimeCfgArray generate an array of devices with all its information

func (*DatabaseCfg) GetRangeTimeCfgByID

func (dbc *DatabaseCfg) GetRangeTimeCfgByID(id string) (RangeTimeCfg, error)

GetRangeTimeCfgByID get device data by id

func (*DatabaseCfg) GetRangeTimeCfgMap

func (dbc *DatabaseCfg) GetRangeTimeCfgMap(filter string) (map[string]*RangeTimeCfg, error)

GetRangeTimeCfgMap return data in map format

func (*DatabaseCfg) GetTemplateCfgAffectOnDel

func (dbc *DatabaseCfg) GetTemplateCfgAffectOnDel(id string) ([]*DbObjAction, error)

GetTemplateCfgAffectOnDel for deleting templates from ID

func (*DatabaseCfg) GetTemplateCfgArray

func (dbc *DatabaseCfg) GetTemplateCfgArray(filter string) ([]*TemplateCfg, error)

GetTemplateCfgArray generate an array of templates with all its information

func (*DatabaseCfg) GetTemplateCfgByID

func (dbc *DatabaseCfg) GetTemplateCfgByID(id string) (TemplateCfg, error)

GetTemplateCfgByID get template data by id

func (*DatabaseCfg) GetTemplateCfgMap

func (dbc *DatabaseCfg) GetTemplateCfgMap(filter string) (map[string]*TemplateCfg, error)

GetTemplateCfgMap return data in map format

func (*DatabaseCfg) InitDB

func (dbc *DatabaseCfg) InitDB()

InitDB initialize de BD configuration

func (*DatabaseCfg) LoadDbConfig

func (dbc *DatabaseCfg) LoadDbConfig(cfg *DBConfig)

LoadDbConfig get data from database

func (*DatabaseCfg) UpdateAlertIDCfg

func (dbc *DatabaseCfg) UpdateAlertIDCfg(id string, dev *AlertIDCfg) (int64, error)

UpdateAlertIDCfg for updating AlertIDCfg

func (*DatabaseCfg) UpdateDeviceStatCfg

func (dbc *DatabaseCfg) UpdateDeviceStatCfg(id int64, dev *DeviceStatCfg) (int64, error)

UpdateDeviceStatCfg for adding new influxdb

func (*DatabaseCfg) UpdateEndpointCfg

func (dbc *DatabaseCfg) UpdateEndpointCfg(id string, dev *EndpointCfg) (int64, error)

UpdateEndpointCfg for adding new influxdb

func (*DatabaseCfg) UpdateIfxDBCfg

func (dbc *DatabaseCfg) UpdateIfxDBCfg(nid string, new *IfxDBCfg) (int64, error)

UpdateIfxDBCfg for adding new influxdb

func (*DatabaseCfg) UpdateIfxMeasurementCfg

func (dbc *DatabaseCfg) UpdateIfxMeasurementCfg(id string, dev *IfxMeasurementCfg) (int64, error)

UpdateIfxMeasurementCfg for adding new IfxMeasurementCfg

func (*DatabaseCfg) UpdateIfxServerCfg

func (dbc *DatabaseCfg) UpdateIfxServerCfg(id string, dev *IfxServerCfg) (int64, error)

UpdateIfxServerCfg for adding new influxdb

func (*DatabaseCfg) UpdateKapacitorCfg

func (dbc *DatabaseCfg) UpdateKapacitorCfg(id string, dev *KapacitorCfg) (int64, error)

UpdateKapacitorCfg for adding new influxdb

func (*DatabaseCfg) UpdateOperationCfg

func (dbc *DatabaseCfg) UpdateOperationCfg(id string, dev *OperationCfg) (int64, error)

UpdateOperationCfg for updating operation

func (*DatabaseCfg) UpdateProductCfg

func (dbc *DatabaseCfg) UpdateProductCfg(id string, dev *ProductCfg) (int64, error)

UpdateProductCfg for adding new influxdb

func (*DatabaseCfg) UpdateProductGroupCfg

func (dbc *DatabaseCfg) UpdateProductGroupCfg(id string, dev *ProductGroupCfg) (int64, error)

UpdateProductGroupCfg for adding new influxdb

func (*DatabaseCfg) UpdateRangeTimeCfg

func (dbc *DatabaseCfg) UpdateRangeTimeCfg(id string, dev *RangeTimeCfg) (int64, error)

UpdateRangeTimeCfg for adding new influxdb

func (*DatabaseCfg) UpdateTemplateCfg

func (dbc *DatabaseCfg) UpdateTemplateCfg(id string, dev *TemplateCfg) (int64, error)

UpdateTemplateCfg for adding new influxdb

type DbObjAction

type DbObjAction struct {
	Type     string
	TypeDesc string
	ObID     string
	Action   string
}

DbObjAction measurement groups to assign to devices

type DeviceStatCfg

type DeviceStatCfg struct {
	ID             int64     `xorm:"'id' pk autoincr"`
	OrderID        int64     `xorm:"orderid"`
	DeviceID       string    `xorm:"deviceid" binding:"Required"`
	AlertID        string    `xorm:"alertid" binding:"Required"`
	ProductID      string    `xorm:"productid" binding:"Required"`
	ExceptionID    int64     `xorm:"exceptionid"`
	Active         bool      `xorm:"active"`
	BaseLine       string    `xorm:"baseline"`
	FilterTagKey   string    `xorm:"filterTagKey"`
	FilterTagValue string    `xorm:"filterTagValue"`
	Description    string    `xorm:"description text"`
	Imported       time.Time `xorm:"imported"`
}

DeviceStatCfg current stats by device

func (DeviceStatCfg) TableName

func (DeviceStatCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type EndpointCfg

type EndpointCfg struct {
	ID                 string    `xorm:"'id' unique" binding:"Required"`
	Type               string    `xorm:"type"`
	Description        string    `xorm:"description text"`
	Imported           time.Time `xorm:"imported"`
	URL                string    `xorm:"url"`
	Headers            []string  `xorm:"headers"`
	BasicAuthUsername  string    `xorm:"basicauthusername"`
	BasicAuthPassword  string    `xorm:"basicauthpassword"`
	LogFile            string    `xorm:"logfile"`
	LogLevel           string    `xorm:"loglevel"`
	Enabled            bool      `xorm:"enabled"`
	Channel            string    `xorm:"channel"`
	SlackUsername      string    `xorm:"slackusername"`
	IconEmoji          string    `xorm:"iconemoji"`
	SslCa              string    `xorm:"sslca"`
	SslCert            string    `xorm:"sslcert"`
	SslKey             string    `xorm:"sslkey"`
	InsecureSkipVerify bool      `xorm:"insecureskipverify"`
	Host               string    `xorm:"host"`
	Port               int       `xorm:"port"`
	Username           string    `xorm:"username"`
	Password           string    `xorm:"password"`
	From               string    `xorm:"from"`
	To                 []string  `xorm:"to"`
}

EndpointCfg Alert Destination HTTP based backends config

func (EndpointCfg) TableName

func (EndpointCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type EndpointsCfg

type EndpointsCfg struct {
	ProxyURL string `toml:"proxyurl"`
}

EndpointsCfg endpoints config options

type GeneralConfig

type GeneralConfig struct {
	InstanceID string `toml:"instanceID"`
	LogDir     string `toml:"logdir"`
	HomeDir    string `toml:"homedir"`
	DataDir    string `toml:"datadir"`
	LogLevel   string `toml:"loglevel"`
}

GeneralConfig has miscellaneous configuration options

type HTTPConfig

type HTTPConfig struct {
	Port          int    `toml:"port"`
	AdminUser     string `toml:"adminuser"`
	AdminPassword string `toml:"adminpassword"`
	CookieID      string `toml:"cookieid"`
}

HTTPConfig has webserver config options

type IfxDBCfg

type IfxDBCfg struct {
	ID           string           `xorm:"'id' pk"`
	Name         string           `xorm:"'name'  not null unique(ifxdb)" binding:"Required"`
	IfxServer    string           `xorm:"'ifxserver'  not null unique(ifxdb)" binding:"Required"`
	Retention    []string         `xorm:"retention" binding:"Required"`
	Description  string           `xorm:"description text"`
	Measurements []*ItemComponent `xorm:"-"`
	Imported     time.Time        `xorm:"imported"`
}

IfxDBCfg Influx Database definition

func (IfxDBCfg) TableName

func (IfxDBCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type IfxDBMeasRel

type IfxDBMeasRel struct {
	IfxDBID     string `xorm:"ifxdbid" `
	IfxMeasID   string `xorm:"ifxmeasid"`
	IfxMeasName string `xorm:"ifxmeasname"`
}

IfxDBMeasRel Relationship between Ifx DB's and Its measurements

func (IfxDBMeasRel) TableName

func (IfxDBMeasRel) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type IfxMeasurementCfg

type IfxMeasurementCfg struct {
	ID          string    `xorm:"'id' pk" binding:"Required"`
	Name        string    `xorm:"'name' not  null"`
	Tags        []string  `xorm:"tags text" binding:"Required"`
	Fields      []string  `xorm:"fields mediumtext" binding:"Required"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

IfxMeasurementCfg Measurement Definition

func (IfxMeasurementCfg) TableName

func (IfxMeasurementCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type IfxServerCfg

type IfxServerCfg struct {
	ID          string    `xorm:"'id' unique" binding:"Required"`
	URL         string    `xorm:"URL" binding:"Required"`
	AdminUser   string    `xorm:"adminuser"`
	AdminPasswd string    `xorm:"adminpasswod"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

IfxServerCfg Influx server config

func (IfxServerCfg) TableName

func (IfxServerCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type InfluxCfg

type InfluxCfg struct {
	ID        string `toml:"id"`
	Host      string `toml:"host"`
	Port      int    `toml:"port"`
	DB        string `toml:"db"`
	User      string `toml:"user"`
	Password  string `toml:"password"`
	Retention string `toml:"retention"`
	Precision string `toml:"precision"` //posible values [h,m,s,ms,u,ns] default seconds for the nature of data
	Timeout   int    `toml:"timeout"`
	UserAgent string `toml:"useragent"`
}

InfluxCfg the output influx database where to store self performace metrics

type ItemComponent

type ItemComponent struct {
	ID   string
	Name string
}

ItemComponent for ID's/Names

type KapacitorCfg

type KapacitorCfg struct {
	ID          string    `xorm:"'id' unique" binding:"Required"`
	URL         string    `xorm:"URL" binding:"Required"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

KapacitorCfg Kapacitor URL's config type

func (KapacitorCfg) TableName

func (KapacitorCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type OperationCfg

type OperationCfg struct {
	ID          string    `xorm:"'id' unique" binding:"Required"`
	URL         string    `xorm:"URL" binding:"Required"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

OperationCfg Operation instructions

func (OperationCfg) TableName

func (OperationCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type ProductCfg

type ProductCfg struct {
	ID               string    `xorm:"'id' unique" binding:"Required"`
	ProductTag       string    `xorm:"producttag" binding:"Required"`
	CommonTags       []string  `xorm:"commontags"`
	ExtraTags        []string  `xorm:"extratags"`
	BaseLines        []string  `xorm:"baselines"`
	Measurements     []string  `xorm:"measurements"`
	AlertGroups      []string  `xorm:"alertgroups"`
	FieldResolutions []string  `xorm:"fieldresolutions"`
	Description      string    `xorm:"description text"`
	Imported         time.Time `xorm:"imported"`
}

ProductCfg Product Catalog Config type

func (ProductCfg) TableName

func (ProductCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type ProductGroupCfg

type ProductGroupCfg struct {
	ID          string    `xorm:"'id' unique" binding:"Required"`
	Products    []string  `xorm:"products"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

ProductGroupCfg Product Group Catalog Config type

func (ProductGroupCfg) TableName

func (ProductGroupCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type RangeTimeCfg

type RangeTimeCfg struct {
	ID          string    `xorm:"'id' unique" binding:"Required"`
	MaxHour     int       `xorm:"'max_hour' default 23"`
	MinHour     int       `xorm:"'min_hour' default 0"`
	WeekDays    string    `xorm:"'weekdays' default '0123456'"`
	Description string    `xorm:"description text"`
	Imported    time.Time `xorm:"imported"`
}

RangeTimeCfg Range or periods Times definition config type

func (RangeTimeCfg) TableName

func (RangeTimeCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

type SelfMonConfig

type SelfMonConfig struct {
	Enabled           bool     `toml:"enabled"`
	Freq              int      `toml:"freq"`
	Prefix            string   `toml:"prefix"`
	InheritDeviceTags bool     `toml:"inheritdevicetags"`
	ExtraTags         []string `toml:"extra-tags"`
}

SelfMonConfig configuration for self monitoring

type TemplateCfg

type TemplateCfg struct {
	ID                      string    `xorm:"'id' unique" binding:"Required"`
	TriggerType             string    `xorm:"triggertype" binding:"Required;In(DEADMAN,THRESHOLD,TREND)"` //deadman
	StatFunc                string    `xorm:"statfunc"`
	CritDirection           string    `xorm:"critdirection"`
	TrendType               string    `xorm:"trendtype"` //Absolute/Relative
	TrendSign               string    `xorm:"trendsign"` //Positive/Negative
	FieldType               string    `xorm:"fieldtype"` //Counter/Gauge
	TplData                 string    `xorm:"tpldata mediumtext"`
	Description             string    `xorm:"description text"`
	Modified                time.Time `xorm:"modified"`
	Imported                time.Time `xorm:"imported"`
	ServersWOLastDeployment []string  `xorm:"servers_wo_last_deployment"`
}

TemplateCfg Templating data structure

func (TemplateCfg) TableName

func (TemplateCfg) TableName() string

TableName go-xorm way to set the Table name to something different to "alert_h_t_t_p_out_rel"

Jump to

Keyboard shortcuts

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