Documentation ¶
Index ¶
- func Init(cfg *DBConfig) error
- func SetDirs(data string, log string, conf string)
- func SetLogger(l *logrus.Logger)
- type Config
- type DBConfig
- type DatabaseCfg
- func (dbc *DatabaseCfg) AddDeviceCfg(dev DeviceCfg) (int64, error)
- func (dbc *DatabaseCfg) AddHMCCfg(dev HMCCfg) (int64, error)
- func (dbc *DatabaseCfg) AddInfluxCfg(dev InfluxCfg) (int64, error)
- func (dbc *DatabaseCfg) AddNmonFileInfo(dev NmonFileInfo) (int64, error)
- func (dbc *DatabaseCfg) AddOrUpdateDeviceCfg(dev *DeviceCfg) (int64, error)
- func (dbc *DatabaseCfg) AddOrUpdateNmonFileInfo(dev *NmonFileInfo) (int64, error)
- func (dbc *DatabaseCfg) DelDeviceCfg(id string) (int64, error)
- func (dbc *DatabaseCfg) DelHMCCfg(id string) (int64, error)
- func (dbc *DatabaseCfg) DelInfluxCfg(id string) (int64, error)
- func (dbc *DatabaseCfg) DelNmonFileInfo(id string) (int64, error)
- func (dbc *DatabaseCfg) GetDeviceCfgAffectOnDel(id string) ([]*DbObjAction, error)
- func (dbc *DatabaseCfg) GetDeviceCfgArray(filter string) ([]*DeviceCfg, error)
- func (dbc *DatabaseCfg) GetDeviceCfgByID(id string) (DeviceCfg, error)
- func (dbc *DatabaseCfg) GetDeviceCfgMap(filter string) (map[string]*DeviceCfg, error)
- func (dbc *DatabaseCfg) GetHMCCfgAffectOnDel(id string) ([]*DbObjAction, error)
- func (dbc *DatabaseCfg) GetHMCCfgArray(filter string) ([]*HMCCfg, error)
- func (dbc *DatabaseCfg) GetHMCCfgByID(id string) (HMCCfg, error)
- func (dbc *DatabaseCfg) GetHMCCfgMap(filter string) (map[string]*HMCCfg, error)
- func (dbc *DatabaseCfg) GetInfluxCfgAffectOnDel(id string) ([]*DbObjAction, error)
- func (dbc *DatabaseCfg) GetInfluxCfgArray(filter string) ([]*InfluxCfg, error)
- func (dbc *DatabaseCfg) GetInfluxCfgByID(id string) (InfluxCfg, error)
- func (dbc *DatabaseCfg) GetInfluxCfgMap(filter string) (map[string]*InfluxCfg, error)
- func (dbc *DatabaseCfg) GetNmonFileInfoAffectOnDel(id string) ([]*DbObjAction, error)
- func (dbc *DatabaseCfg) GetNmonFileInfoArray(filter string) ([]*NmonFileInfo, error)
- func (dbc *DatabaseCfg) GetNmonFileInfoByID(id string) (NmonFileInfo, error)
- func (dbc *DatabaseCfg) GetNmonFileInfoByIDFile(id string, filename string) (NmonFileInfo, error)
- func (dbc *DatabaseCfg) GetNmonFileInfoMap(filter string) (map[string]*NmonFileInfo, error)
- func (dbc *DatabaseCfg) InitDB()
- func (dbc *DatabaseCfg) LoadDbConfig(cfg *DBConfig)
- func (dbc *DatabaseCfg) UpdateDeviceCfg(id string, dev DeviceCfg) (int64, error)
- func (dbc *DatabaseCfg) UpdateDeviceCfgBase(id string, dev DeviceCfg) (int64, error)
- func (dbc *DatabaseCfg) UpdateHMCCfg(id string, dev HMCCfg) (int64, error)
- func (dbc *DatabaseCfg) UpdateInfluxCfg(id string, dev InfluxCfg) (int64, error)
- func (dbc *DatabaseCfg) UpdateNmonFileInfo(id string, dev NmonFileInfo) (int64, error)
- type DbObjAction
- type DeviceCfg
- type GeneralConfig
- type HMCCfg
- type HTTPConfig
- type InfluxCfg
- type NmonConfig
- type NmonFileInfo
- type SelfMonConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { General GeneralConfig Database DatabaseCfg Selfmon SelfMonConfig HTTP HTTPConfig Nmon NmonConfig }
Config All resitor configuration
type DBConfig ¶
type DBConfig struct { Influxdb map[string]*InfluxCfg HMC map[string]*HMCCfg Devices map[string]*DeviceCfg NmonFileInfo map[string]*NmonFileInfo }
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) AddDeviceCfg ¶
func (dbc *DatabaseCfg) AddDeviceCfg(dev DeviceCfg) (int64, error)
AddDeviceCfg for adding new devices
func (*DatabaseCfg) AddHMCCfg ¶
func (dbc *DatabaseCfg) AddHMCCfg(dev HMCCfg) (int64, error)
AddHMCCfg for adding new devices
func (*DatabaseCfg) AddInfluxCfg ¶
func (dbc *DatabaseCfg) AddInfluxCfg(dev InfluxCfg) (int64, error)
AddInfluxCfg for adding new devices
func (*DatabaseCfg) AddNmonFileInfo ¶
func (dbc *DatabaseCfg) AddNmonFileInfo(dev NmonFileInfo) (int64, error)
AddNmonFileInfo for adding new devices
func (*DatabaseCfg) AddOrUpdateDeviceCfg ¶
func (dbc *DatabaseCfg) AddOrUpdateDeviceCfg(dev *DeviceCfg) (int64, error)
AddOrUpdateDeviceCfg this method insert data if not previouosly exist the tuple ifxServer.Name or update it if already exist
func (*DatabaseCfg) AddOrUpdateNmonFileInfo ¶
func (dbc *DatabaseCfg) AddOrUpdateNmonFileInfo(dev *NmonFileInfo) (int64, error)
AddOrUpdateNmonFileInfo this method insert data if not previouosly exist the tuple ifxServer.Name or update it if already exist
func (*DatabaseCfg) DelDeviceCfg ¶
func (dbc *DatabaseCfg) DelDeviceCfg(id string) (int64, error)
DelDeviceCfg for deleting Devices databases from ID
func (*DatabaseCfg) DelHMCCfg ¶
func (dbc *DatabaseCfg) DelHMCCfg(id string) (int64, error)
DelHMCCfg for deleting HMC databases from ID
func (*DatabaseCfg) DelInfluxCfg ¶
func (dbc *DatabaseCfg) DelInfluxCfg(id string) (int64, error)
DelInfluxCfg for deleting influx databases from ID
func (*DatabaseCfg) DelNmonFileInfo ¶
func (dbc *DatabaseCfg) DelNmonFileInfo(id string) (int64, error)
DelNmonFileInfo for deleting influx databases from ID
func (*DatabaseCfg) GetDeviceCfgAffectOnDel ¶
func (dbc *DatabaseCfg) GetDeviceCfgAffectOnDel(id string) ([]*DbObjAction, error)
GetDeviceCfgAffectOnDel for deleting devices from ID
func (*DatabaseCfg) GetDeviceCfgArray ¶
func (dbc *DatabaseCfg) GetDeviceCfgArray(filter string) ([]*DeviceCfg, error)
GetDeviceCfgArray generate an array of devices with all its information
func (*DatabaseCfg) GetDeviceCfgByID ¶
func (dbc *DatabaseCfg) GetDeviceCfgByID(id string) (DeviceCfg, error)
GetDeviceCfgByID get device data by id
func (*DatabaseCfg) GetDeviceCfgMap ¶
func (dbc *DatabaseCfg) GetDeviceCfgMap(filter string) (map[string]*DeviceCfg, error)
GetDeviceCfgMap return data in map format
func (*DatabaseCfg) GetHMCCfgAffectOnDel ¶
func (dbc *DatabaseCfg) GetHMCCfgAffectOnDel(id string) ([]*DbObjAction, error)
GetHMCCfgAffectOnDel for deleting devices from ID
func (*DatabaseCfg) GetHMCCfgArray ¶
func (dbc *DatabaseCfg) GetHMCCfgArray(filter string) ([]*HMCCfg, error)
GetHMCCfgArray generate an array of devices with all its information
func (*DatabaseCfg) GetHMCCfgByID ¶
func (dbc *DatabaseCfg) GetHMCCfgByID(id string) (HMCCfg, error)
GetHMCCfgByID get device data by id
func (*DatabaseCfg) GetHMCCfgMap ¶
func (dbc *DatabaseCfg) GetHMCCfgMap(filter string) (map[string]*HMCCfg, error)
GetHMCCfgMap return data in map format
func (*DatabaseCfg) GetInfluxCfgAffectOnDel ¶
func (dbc *DatabaseCfg) GetInfluxCfgAffectOnDel(id string) ([]*DbObjAction, error)
GetInfluxCfgAffectOnDel for deleting devices from ID
func (*DatabaseCfg) GetInfluxCfgArray ¶
func (dbc *DatabaseCfg) GetInfluxCfgArray(filter string) ([]*InfluxCfg, error)
GetInfluxCfgArray generate an array of devices with all its information
func (*DatabaseCfg) GetInfluxCfgByID ¶
func (dbc *DatabaseCfg) GetInfluxCfgByID(id string) (InfluxCfg, error)
GetInfluxCfgByID get device data by id
func (*DatabaseCfg) GetInfluxCfgMap ¶
func (dbc *DatabaseCfg) GetInfluxCfgMap(filter string) (map[string]*InfluxCfg, error)
GetInfluxCfgMap return data in map format
func (*DatabaseCfg) GetNmonFileInfoAffectOnDel ¶
func (dbc *DatabaseCfg) GetNmonFileInfoAffectOnDel(id string) ([]*DbObjAction, error)
GetNmonFileInfoAffectOnDel for deleting devices from ID
func (*DatabaseCfg) GetNmonFileInfoArray ¶
func (dbc *DatabaseCfg) GetNmonFileInfoArray(filter string) ([]*NmonFileInfo, error)
GetNmonFileInfoArray generate an array of devices with all its information
func (*DatabaseCfg) GetNmonFileInfoByID ¶
func (dbc *DatabaseCfg) GetNmonFileInfoByID(id string) (NmonFileInfo, error)
GetNmonFileInfoByID get device data by id
func (*DatabaseCfg) GetNmonFileInfoByIDFile ¶
func (dbc *DatabaseCfg) GetNmonFileInfoByIDFile(id string, filename string) (NmonFileInfo, error)
GetNmonFileInfoByIDFile get device data by id
func (*DatabaseCfg) GetNmonFileInfoMap ¶
func (dbc *DatabaseCfg) GetNmonFileInfoMap(filter string) (map[string]*NmonFileInfo, error)
GetNmonFileInfoMap return data in map format
func (*DatabaseCfg) LoadDbConfig ¶
func (dbc *DatabaseCfg) LoadDbConfig(cfg *DBConfig)
LoadDbConfig get data from database
func (*DatabaseCfg) UpdateDeviceCfg ¶
func (dbc *DatabaseCfg) UpdateDeviceCfg(id string, dev DeviceCfg) (int64, error)
UpdateDeviceCfg for adding new Devices
func (*DatabaseCfg) UpdateDeviceCfgBase ¶
func (dbc *DatabaseCfg) UpdateDeviceCfgBase(id string, dev DeviceCfg) (int64, error)
UpdateDeviceCfgBase for adding new Devices from Scanned products , don't change current configurations
func (*DatabaseCfg) UpdateHMCCfg ¶
func (dbc *DatabaseCfg) UpdateHMCCfg(id string, dev HMCCfg) (int64, error)
UpdateHMCCfg for adding new HMC
func (*DatabaseCfg) UpdateInfluxCfg ¶
func (dbc *DatabaseCfg) UpdateInfluxCfg(id string, dev InfluxCfg) (int64, error)
UpdateInfluxCfg for adding new influxdb
func (*DatabaseCfg) UpdateNmonFileInfo ¶
func (dbc *DatabaseCfg) UpdateNmonFileInfo(id string, dev NmonFileInfo) (int64, error)
UpdateNmonFileInfo for adding new influxdb
type DbObjAction ¶
DbObjAction measurement groups to assign to devices
type DeviceCfg ¶
type DeviceCfg struct { //LogicalPartition ID string `xorm:"'id' unique" binding:"Required"` //lpar.PartitionUUID Name string `xorm:"name" binding:"Required"` //lpar.PartitionName SerialNumber string `xorm:"serial_number"` //lpar.LogicalSerialNumber OSVersion string `xorm:"os_version"` //lpar.OperatingSystemVersion Type string `xorm:"type"` //lpar.PartitionType (LPAR/VIOServer PartitionState string `xorm:"-"` //lpar.PartitionState Location string `xorm:"location"` EnableHMCStats bool `xorm:"'enable_hmc_stats' default 1"` EnableNmonStats bool `xorm:"'enable_nmon_stats' default 1"` NmonFreq int `xorm:"'nmon_freq' default 60" binding:"Default(60);IntegerNotZero"` NmonOutDB string `xorm:"'nmon_outdb' default 'default'" binding:"Default(default)"` NmonIP string `xorm:"nmon_ip"` NmonSSHUser string `xorm:"nmon_ssh_user"` NmonSSHKey string `xorm:"nmon_ssh_key"` NmonLogLevel string `xorm:"'nmon_loglevel' default 'info'" binding:"Default(info)"` NmonFilePath string `` /* 137-byte string literal not displayed */ NmonProtDebug bool `xorm:"'nmon_prot_debug' default 0"` NmonFilters []string `xorm:"'nmon_filters' default '[\"^TOP\"]'"` ExtraTags []string `xorm:"extra-tags"` //common tags for nmon and also for hmc stats Description string `xorm:"description"` }
DeviceCfg contains all hmc related device definitions
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 HMCCfg ¶
type HMCCfg struct { ID string `xorm:"'id' unique" binding:"Required"` //https://+Host+:12443 Host string `xorm:"host" binding:"Required"` Port int `xorm:"port" binding:"Required"` User string `xorm:"user" binding:"Required"` Password string `xorm:"password" binding:"Required"` Active bool `xorm:"'active' default 1"` ManagedSystemsOnly bool `xorm:"'managed_systems_only' default 0"` Freq int `xorm:"'freq' default 60" binding:"Default(60);IntegerNotZero"` UpdateScanFreq int `xorm:"'update_scan_freq' default 60" binding:"Default(60);UIntegerAndLessOne"` OutDB string `xorm:"outdb"` LogLevel string `xorm:"loglevel" binding:"Default(info)"` HMCAPIDebug bool `xorm:"hmc_api_debug"` LogFile string `xorm:"logfile"` //influx tags DeviceTagName string `xorm:"devicetagname" binding:"Default(hostname)"` DeviceTagValue string `xorm:"devicetagvalue" binding:"Default(id)"` ExtraTags []string `xorm:"extra-tags"` Description string `xorm:"description"` }
HMCCfg contains all hmcrelated device definitions
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 InfluxCfg ¶
type InfluxCfg struct { ID string `xorm:"'id' unique" binding:"Required"` Host string `xorm:"host" binding:"Required"` Port int `xorm:"port" binding:"Required;IntegerNotZero"` DB string `xorm:"db" binding:"Required"` User string `xorm:"user" binding:"Required"` Password string `xorm:"password" binding:"Required"` Retention string `xorm:"'retention' default 'autogen'" binding:"Required"` Precision string `xorm:"'precision' default 's'" binding:"Default(s);OmitEmpty;In(h,m,s,ms,u,ns)"` //posible values [h,m,s,ms,u,ns] default seconds for the nature of data Timeout int `xorm:"'timeout' default 30" binding:"Default(30);IntegerNotZero"` UserAgent string `xorm:"useragent" binding:"Default(pseriescollector)"` EnableSSL bool `xorm:"enable_ssl"` SSLCA string `xorm:"ssl_ca"` SSLCert string `xorm:"ssl_cert"` SSLKey string `xorm:"ssl_key"` InsecureSkipVerify bool `xorm:"insecure_skip_verify"` Description string `xorm:"description"` }
InfluxCfg is the main configuration for any InfluxDB TSDB
type NmonConfig ¶
type NmonConfig struct {
DefTimeZone string `mapstructure:"default_timezone"`
}
NmonConfig basic conf for nmon files
type NmonFileInfo ¶
type NmonFileInfo struct { ID string `xorm:"'id' unique" binding:"Required"` DeviceName string `xorm:"device_name" binding:"Required"` FileName string `xorm:"file_name" binding:"Required"` LastPosition int64 `xorm:"last_position"` LastTime string `xorm:"last_time"` }
NmonFileInfo store status of the last read position for each Device/Nmon File