database

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAgent

func AddAgent(database *sql.DB, agentId string, path string) error

AddAgent adds the agent to the given DB

func AgentIDExists

func AgentIDExists(database *sql.DB, agentId string) bool

AgenIDExists checks if agent is added to the db

func CreateDB

func CreateDB(dbName string) (*sql.DB, error)

CreateDB create and return SQLite DB

func GetAgents

func GetAgents(database *sql.DB) []string

func GetCustomMetricNames

func GetCustomMetricNames(database *sql.DB) []string

func GetDBPathForAgent

func GetDBPathForAgent(database *sql.DB, agentId string) string

GetDBPathForAgent returns the db path of the given agent

func GetLogFromDB

func GetLogFromDB(database *sql.DB, logType string, from int64, to int64, time int64) []string

GetLogFromDB returns log records of the given log type in the given time/range

func GetLogFromDBCount

func GetLogFromDBCount(database *sql.DB, logType string, count int64) []string

GetLogFromDBCount returns log records of the given log type

func OpenDB

func OpenDB(db *sql.DB, path string) (*sql.DB, error)

OpenDB opens a SQLite DB file

func RemoveAgent

func RemoveAgent(database *sql.DB, agentId string) error

RemoveAgent removes agent info

func SaveLogToDB

func SaveLogToDB(database *sql.DB, unixTime string, jsonStr string, logType string) error

SaveLogToDB saves given monitor log to the sqlite DB

Types

type MySql added in v0.0.22

type MySql struct {
	DB        *sql.DB
	SqlErr    error
	Connected bool
	User      string
	Host      string
	Database  string
}

func (*MySql) AddAgent added in v0.0.22

func (mysql *MySql) AddAgent(agentId string, timezone string) error

func (*MySql) AddAlert added in v1.1.1

func (mysql *MySql) AddAlert(alertStatus *alertstatus.AlertStatus) error

func (*MySql) AgentIDExists added in v0.0.22

func (mysql *MySql) AgentIDExists(agentId string) bool

func (*MySql) ClearAllAlertsWithNullEnd added in v1.1.1

func (mysql *MySql) ClearAllAlertsWithNullEnd() error

func (*MySql) Close added in v0.0.22

func (mysql *MySql) Close()

func (*MySql) Connect added in v0.0.22

func (mysql *MySql) Connect(user string, password string, host string, database string, isMultiStatement bool)

func (*MySql) GetAgents added in v0.0.22

func (mysql *MySql) GetAgents() []string

func (*MySql) GetAlertByStartEvent added in v1.1.1

func (mysql *MySql) GetAlertByStartEvent(logId string) []string

func (*MySql) GetCustomMetricNames added in v0.0.22

func (mysql *MySql) GetCustomMetricNames(serverName string) []string

func (*MySql) GetLogFromDB added in v0.0.22

func (mysql *MySql) GetLogFromDB(serverName string, logType string, from int64, to int64, time int64) []string

func (*MySql) GetLogFromDBCount added in v0.0.22

func (mysql *MySql) GetLogFromDBCount(serverId string, logType string, count int64) []string

func (*MySql) GetLogFromDBWithId added in v1.1.1

func (mysql *MySql) GetLogFromDBWithId(serverName string, logType string, logName string, from int64, to int64) [][]string

func (*MySql) GetPreviousOpenAlert added in v1.1.1

func (mysql *MySql) GetPreviousOpenAlert(alertStatus *alertstatus.AlertStatus) []string

func (*MySql) Init added in v0.0.22

func (mysql *MySql) Init() error

func (*MySql) Ping added in v1.1.1

func (mysql *MySql) Ping(serverName string, unixTime string) error

func (*MySql) PurgeMonitorDataOlderThan added in v1.1.1

func (mysql *MySql) PurgeMonitorDataOlderThan(unixTime string) (int64, error)

func (*MySql) RemoveAgent added in v0.0.22

func (mysql *MySql) RemoveAgent(agentId string) error

func (*MySql) SaveLogToDB added in v0.0.22

func (mysql *MySql) SaveLogToDB(serverName string, unixTime string, jsonStr string, logType string, logName string) error

func (*MySql) Select added in v0.0.22

func (mysql *MySql) Select(query string, args ...interface{}) (Table, error)

func (*MySql) ServerPingTime added in v1.1.1

func (mysql *MySql) ServerPingTime(serverName string) (string, error)

func (*MySql) SetAlertEndLog added in v1.1.1

func (mysql *MySql) SetAlertEndLog(alertStatus *alertstatus.AlertStatus, startEventId string) error

func (*MySql) UpdateAlert added in v1.1.1

func (mysql *MySql) UpdateAlert(alertStatus *alertstatus.AlertStatus, startEventId string) error

type Table added in v0.0.22

type Table struct {
	Name    string
	Headers []string
	Data    [][]string
}

Jump to

Keyboard shortcuts

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