datastore

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package datastore : データ保存

Package datastore : データ保存

Index

Constants

View Source
const (
	DrawItemTypeRect = iota
	DrawItemTypeEllipse
	DrawItemTypeText
	DrawItemTypeImage
	DrawItemTypePollingText
	DrawItemTypePollingGauge
	DrawItemTypePollingNewGauge
	DrawItemTypePollingBar
	DrawItemTypePollingLine
)
View Source
const (
	LogModeNone = iota
	LogModeAlways
	LogModeOnChange
	LogModeAI
)

Variables

View Source
var (

	// Conf Data on Memory
	MapConf      MapConfEnt
	BackImage    BackImageEnt
	NotifyConf   NotifyConfEnt
	DiscoverConf DiscoverConfEnt
	AIConf       AIConfEnt
	LocConf      LocConfEnt
	AutoCharCode bool
	// Restart snmptrapd
	RestartSnmpTrapd bool

	//
	MIBDB *gomibdb.MIBDB

	Dark bool
	// for TwLogEye gRPC
	CACert     string
	ClientCert string
	ClientKey  string
	// from Command Line
	PingMode    string
	SyslogPort  int
	TrapPort    int
	NetFlowPort int
	SFlowPort   int
	TCPPort     int
	SSHdPort    int
	// OpenTelemetry
	OTelHTTPPort int
	OTelgRPCPort int
	OTelCert     string
	OTelKey      string
	OTelCA       string
	// MCP Server
	MCPCert string
	MCPKey  string
	// MQTT Server
	MqttTCPPort int
	MqttWSPort  int
	MqttCert    string
	MqttKey     string
	MqttFrom    string
	MqttUsers   string
)
View Source
var (
	ErrNoPayload     = fmt.Errorf("no payload")
	ErrInvalidNode   = fmt.Errorf("invalid node")
	ErrInvalidParams = fmt.Errorf("invald params")
	ErrDBNotOpen     = fmt.Errorf("db not open")
	ErrInvalidID     = fmt.Errorf("invalid id")
)

Define errors

View Source
var MIBInfoMap = make(map[string]*MIBInfo)
View Source
var MIBModules = []*MIBModuleEnt{}
View Source
var MIBTree = []*MIBTreeEnt{}
View Source
var MIBTypeMap = make(map[string]MIBTypeEnt)
View Source
var (
	NotifyOAuth2RedirectPort int
)
View Source
var PollingTemplateList []*PollingTemplateEnt

Functions

func AddDrawItem

func AddDrawItem(di *DrawItemEnt) error

func AddEventLog

func AddEventLog(e *EventLogEnt)

func AddLine

func AddLine(l *LineEnt) error

func AddNetwork added in v1.9.0

func AddNetwork(n *NetworkEnt) error

func AddNode

func AddNode(n *NodeEnt) error

func AddOTelMetric added in v1.22.0

func AddOTelMetric(m *OTelMetricEnt)

func AddOrUpdateIcon

func AddOrUpdateIcon(i *IconEnt) error

func AddPolling

func AddPolling(p *PollingEnt) error

AddPolling : ポーリングを追加する

func AddPollingLog

func AddPollingLog(p *PollingEnt) error

func AddPollingWithDupCheck added in v1.15.0

func AddPollingWithDupCheck(p *PollingEnt) error

AddPollingWithDupCheck : 重複しないようにポーリングを追加する

func BackupDB

func BackupDB(file string) error

func CheckCharCode added in v1.9.0

func CheckCharCode(s string) string

func ClearCAData added in v1.18.0

func ClearCAData()

func ClearPollingLogs added in v1.5.0

func ClearPollingLogs(ids []string) error

ClearPollingLogs : ポーリングログの削除をまとめて行う

func CloseDB

func CloseDB()

CloseDB : DBをクローズする

func CompactDB added in v1.20.0

func CompactDB(srcPath, dstPath string) error

func DeleteAIResult

func DeleteAIResult(id string) error

func DeleteAllLogs

func DeleteAllLogs(b string) error

func DeleteAllMqttStat added in v1.28.0

func DeleteAllMqttStat() error

func DeleteAllOTelData added in v1.22.0

func DeleteAllOTelData() error

func DeleteArpEnt added in v0.9.1

func DeleteArpEnt(ips []string) error

DeleteArpEnt deletes ARP table entries associated with the specified IP addresses.

func DeleteCertMonitor added in v1.24.0

func DeleteCertMonitor(id string)

func DeleteDrawItem

func DeleteDrawItem(id string) error

func DeleteIcon

func DeleteIcon(icon string) error

func DeleteLine

func DeleteLine(lineID string) error

func DeleteMqttStats added in v1.28.0

func DeleteMqttStats(ids []string)

func DeleteNetwork added in v1.9.0

func DeleteNetwork(id string) error

func DeleteNode

func DeleteNode(nodeID string) error

func DeleteNodeStateChanged

func DeleteNodeStateChanged(id string)

func DeleteNotifyOAuth2Token added in v1.26.0

func DeleteNotifyOAuth2Token() error

func DeleteOTelMetric added in v1.22.0

func DeleteOTelMetric(m *OTelMetricEnt)

func DeleteOldMqttStats added in v1.35.0

func DeleteOldMqttStats(days int)

func DeletePollings

func DeletePollings(ids []string) error

func FindVendor

func FindVendor(mac string) string

FindVendor : Find Vendor Name from MAC Address

func ForEachArp

func ForEachArp(f func(*ArpEnt) bool)

func ForEachCert added in v1.18.0

func ForEachCert(cb func(c *CertEnt) bool)

func ForEachCertMonitors added in v1.24.0

func ForEachCertMonitors(f func(*CertMonitorEnt) bool)

func ForEachEventLog

func ForEachEventLog(st, et int64, f func(*EventLogEnt) bool) error

func ForEachItems

func ForEachItems(f func(*DrawItemEnt) bool)

func ForEachLastArpLogs

func ForEachLastArpLogs(f func(*ArpLogEnt) bool) error

ForEachLastArpLogs は最新のARP Logを返します。

func ForEachLastEventLog

func ForEachLastEventLog(f func(*EventLogEnt) bool) error

func ForEachLastPollingLog

func ForEachLastPollingLog(pollingID string, f func(*PollingLogEnt) bool) error

func ForEachLastSyslog

func ForEachLastSyslog(f func(*SyslogEnt) bool) error

ForEachLastSyslog get syslogs

func ForEachLastTraps

func ForEachLastTraps(f func(*TrapEnt) bool) error

ForEachLastTraps get TRAP

func ForEachLines

func ForEachLines(f func(*LineEnt) bool)

ForEachLines : Line毎の処理

func ForEachLogs added in v1.4.0

func ForEachLogs(st, et int64, lt string, f func(*LogEnt) bool) error

ForEachLogs returns logs that match the specified conditions.

func ForEachMqttStat added in v1.28.0

func ForEachMqttStat(f func(s *MqttStatEnt) bool)

func ForEachNetFlow added in v1.5.0

func ForEachNetFlow(st, et int64, f func(*NetFlowEnt) bool) error

ForEachNetFlow get NetFlow log

func ForEachNetworks added in v1.9.0

func ForEachNetworks(f func(*NetworkEnt) bool)

ForEachNetworks : Network毎の処理

func ForEachNodes

func ForEachNodes(f func(*NodeEnt) bool)

func ForEachOTelMetric added in v1.22.0

func ForEachOTelMetric(f func(m *OTelMetricEnt) bool)

func ForEachOTelTrace added in v1.22.0

func ForEachOTelTrace(tbk string, f func(t *OTelTraceEnt) bool)

func ForEachPollings

func ForEachPollings(f func(*PollingEnt) bool)

ForEachPollings : ポーリング毎の処理

func ForEachSFlow added in v1.8.0

func ForEachSFlow(st, et int64, f func(*SFlowEnt) bool) error

ForEachSFlow get sFlow log

func ForEachSFlowCounter added in v1.8.0

func ForEachSFlowCounter(st, et int64, f func(*SFlowCounterEnt) bool) error

ForEachSFlowCounter gets sFlow counter logs.

func ForEachStateChangedNodes

func ForEachStateChangedNodes(f func(string) bool)

func ForEachSyslog added in v1.3.0

func ForEachSyslog(st, et int64, f func(*SyslogEnt) bool) error

ForEachSyslog get syslogs

func ForEachTraps added in v1.3.0

func ForEachTraps(st, et int64, f func(*TrapEnt) bool) error

ForEachTraps get TRAP

func GenSSHPrivateKey added in v1.4.0

func GenSSHPrivateKey() []byte

func GetDBSize

func GetDBSize() int64

func GetDataStorePath

func GetDataStorePath() string

GetDataStorePath returns the path to the data store.

func GetLLM added in v1.32.0

func GetLLM(ctx context.Context) (llms.Model, error)

func GetLoc

func GetLoc(sip string) string

func GetMIBValueString added in v1.9.0

func GetMIBValueString(name string, variable *gosnmp.SnmpPDU, raw bool) string

func GetNodeMemo added in v1.19.0

func GetNodeMemo(nodeID string) string

GetNodeMemo retrieves a memo related to the specified node.

func GetNotifyOAuth2Token added in v1.26.0

func GetNotifyOAuth2Token() *oauth2.Token

func GetOTelTraceBucketList added in v1.22.0

func GetOTelTraceBucketList() []string

func GetPrivateKey

func GetPrivateKey(pm bool) []byte

func GetSSHPublicKey added in v1.4.0

func GetSSHPublicKey() (string, error)

func GetServiceName

func GetServiceName(prot, port int) (string, bool)

func GetSshdPublicKeys added in v1.4.0

func GetSshdPublicKeys() string

func HasLine added in v1.9.0

func HasLine(l1 *LineEnt, isNet bool) bool

HasLine : 同じラインを探す

func HasValidNotifyOAuth2Token added in v1.26.0

func HasValidNotifyOAuth2Token(n NotifyConfEnt) bool

func Init

func Init(ctx context.Context, path string, wg *sync.WaitGroup) error

func InitCAConf added in v1.18.0

func InitCAConf(req CreateCAReq) error

func IsGlobalUnicast

func IsGlobalUnicast(ips string) bool

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

func LoadMailTemplate

func LoadMailTemplate(t string) string

func LoadMqttStat added in v1.28.0

func LoadMqttStat()

func LoadOTelMetric added in v1.23.0

func LoadOTelMetric()

LoadOTelMetric loads metrics from the DB.

func PrintDateAndTime added in v1.2.0

func PrintDateAndTime(i interface{}) string

PrintDateAndTime formats a value according to the SNMP DateAndTime display hint.

func PrintHintedMIBIntVal added in v1.1.0

func PrintHintedMIBIntVal(val int32, hint string, us bool) string

func PrintIPAddress added in v1.2.0

func PrintIPAddress(i interface{}) string

func PrintMIBStringVal added in v1.2.0

func PrintMIBStringVal(i interface{}) string

func ResetArpTable

func ResetArpTable() error

ResetArpTable clears the ARP table and ARP log.

func RevokeCert added in v1.18.0

func RevokeCert(cert *CertEnt) error

func RevokeCertByID added in v1.18.0

func RevokeCertByID(id string) error

func SaveAIConf

func SaveAIConf() error

func SaveAIResult

func SaveAIResult(res *AIResult) error

func SaveBackImage

func SaveBackImage() error

func SaveCertMonitor added in v1.24.0

func SaveCertMonitor(c *CertMonitorEnt) error

func SaveDiscoverConf

func SaveDiscoverConf() error

func SaveLocConf added in v1.1.0

func SaveLocConf() error

func SaveLogBuffer

func SaveLogBuffer(logBuffer []*LogEnt)

func SaveMapConf

func SaveMapConf() error

func SaveMapData

func SaveMapData()

SaveMapData saves the map data to the DB every 24 hours.

func SaveMqttStats added in v1.30.0

func SaveMqttStats()

func SaveNodeMemo added in v1.19.0

func SaveNodeMemo(nodeID, memo string) error

SaveNodeMemo saves a memo related to the specified node.

func SaveNotifyConf

func SaveNotifyConf() error

func SaveNotifyOAuth2Token added in v1.26.0

func SaveNotifyOAuth2Token(token *oauth2.Token) error

func SaveOTelMetric added in v1.23.0

func SaveOTelMetric()

SaveOTelMetric saves metrics to the DB.

func SavePKIConf added in v1.18.0

func SavePKIConf() error

func SaveSshdPublicKeys added in v1.4.0

func SaveSshdPublicKeys(pk string) error

func SetDark

func SetDark(dark bool) error

func SetNodeStateChanged

func SetNodeStateChanged(id string)

SetNodeStateChanged :

func UpdateArpEnt

func UpdateArpEnt(ip, mac string)

func UpdateCert added in v1.18.0

func UpdateCert(cert *CertEnt) error

func UpdateLine

func UpdateLine(l *LineEnt) error

func UpdateMqttStat added in v1.28.0

func UpdateMqttStat(clientID, remote, topic string, b int)

func UpdateNetwork added in v1.9.0

func UpdateNetwork(n *NetworkEnt) error

func UpdateOTelTrace added in v1.22.0

func UpdateOTelTrace(list []*OTelTraceEnt) error

func UpdatePolling

func UpdatePolling(p *PollingEnt, save bool) error

Types

type AIConfEnt

type AIConfEnt struct {
	HighThreshold float64 `json:"HighThreshold"`
	LowThreshold  float64 `json:"LowThreshold"`
	WarnThreshold float64 `json:"WarnThreshold"`
}

type AIResult

type AIResult struct {
	PollingID string      `json:"PollingID"`
	LastTime  int64       `json:"LastTime"`
	ScoreData [][]float64 `json:"ScoreData"`
}

func GetAIReesult

func GetAIReesult(id string) (*AIResult, error)

type ArpEnt

type ArpEnt struct {
	IP        string `json:"IP"`
	MAC       string `json:"MAC"`
	NodeID    string `json:"NodeID"`
	Vendor    string `json:"Vendor"`
	FirstTime int64  `json:"FirstTime"`
	LastTime  int64  `json:"LastTime"`
}

func GetArpEnt added in v1.15.0

func GetArpEnt(ip string) *ArpEnt

type ArpLogEnt

type ArpLogEnt struct {
	Time   int64  `json:"Time"`
	State  string `json:"State"`
	IP     string `json:"IP"`
	NewMAC string `json:"NewMAC"`
	OldMAC string `json:"OldMAC"`
}

type BackImageEnt

type BackImageEnt struct {
	X      int    `json:"X"`
	Y      int    `json:"Y"`
	Width  int    `json:"Width"`
	Height int    `json:"Height"`
	Path   string `json:"Path"`
}

type CertEnt added in v1.18.0

type CertEnt struct {
	ID          string            `json:"ID"`
	Subject     string            `json:"Subject"`
	NodeID      string            `json:"NodeID"`
	Created     int64             `json:"Created"`
	Revoked     int64             `json:"Revoked"`
	Expire      int64             `json:"Expire"`
	Type        string            `json:"Type"`
	Certificate string            `json:"Certificate"`
	Info        map[string]string `json:"Info"`
}

func FindCert added in v1.18.0

func FindCert(id string) *CertEnt

type CertMonitorEnt added in v1.24.0

type CertMonitorEnt struct {
	ID           string `json:"ID"`
	State        string `json:"State"`
	Target       string `json:"Target"`
	Port         uint16 `json:"Port"`
	Subject      string `json:"Subject"`
	Issuer       string `json:"Issuer"`
	SerialNumber string `json:"SerialNumber"`
	Verify       bool   `json:"Verify"`
	NotAfter     int64  `json:"NotAfter"`
	NotBefore    int64  `json:"NotBefore"`
	Error        string `json:"Error"`
	FirstTime    int64  `json:"FirstTime"`
	LastTime     int64  `json:"LastTime"`
}

func GetCertMonitor added in v1.24.0

func GetCertMonitor(id string) *CertMonitorEnt

type CreateCAReq added in v1.18.0

type CreateCAReq struct {
	RootCAKeyType string `json:"RootCAKeyType"`
	Name          string `json:"Name"`
	SANs          string `json:"SANs"`
	AcmePort      int    `json:"AcmePort"`
	HTTPBaseURL   string `json:"HttpBaseURL"`
	AcmeBaseURL   string `json:"AcmeBaseURL"`
	HTTPPort      int    `json:"HttpPort"`
	RootCATerm    int    `json:"RootCATerm"`
	CrlInterval   int    `json:"CrlInterval"`
	CertTerm      int    `json:"CertTerm"`
}

CreateCAReq represents a request from the frontend.

type DiscoverConfEnt

type DiscoverConfEnt struct {
	StartIP    string `json:"StartIP"`
	EndIP      string `json:"EndIP"`
	Timeout    int    `json:"Timeout"`
	Retry      int    `json:"Retry"`
	X          int    `json:"X"`
	Y          int    `json:"Y"`
	AddPolling bool   `json:"AddPolling"`
	PortScan   bool   `json:"PortScan"`
	ReCheck    bool   `json:"ReCheck"`
	AddNetwork bool   `json:"AddNetwork"`
}

type DrawItemEnt

type DrawItemEnt struct {
	ID        string       `json:"ID"`
	Type      DrawItemType `json:"Type"`
	X         int          `json:"X"`
	Y         int          `json:"Y"`
	W         int          `json:"W"`
	H         int          `json:"H"`
	Color     string       `json:"Color"`
	Path      string       `json:"Path"`
	Text      string       `json:"Text"`
	Size      int          `json:"Size"`
	PollingID string       `json:"PollingID"`
	VarName   string       `json:"VarName"`
	Format    string       `json:"Format"`
	Value     float64      `json:"Value"`
	Scale     float64      `json:"Scale"`
	Cond      int          `json:"Cond"`
	Values    []float64    `json:"Values"`
}

func GetDrawItem

func GetDrawItem(id string) *DrawItemEnt

type DrawItemType

type DrawItemType int

type EventLogEnt

type EventLogEnt struct {
	Time      int64  `json:"Time"`
	Type      string `json:"Type"`
	Level     string `json:"Level"`
	NodeName  string `json:"NodeName"`
	NodeID    string `json:"NodeID"`
	Event     string `json:"Event"`
	LastLevel string `json:"LastLevel"`
}

type IconEnt

type IconEnt struct {
	Name string `json:"Name"`
	Icon string `json:"Icon"`
	Code int64  `json:"Code"`
}

func GetIcons

func GetIcons() []*IconEnt

type LineEnt

type LineEnt struct {
	ID         string `json:"ID"`
	NodeID1    string `json:"NodeID1"`
	PollingID1 string `json:"PollingID1"`
	State1     string `json:"State1"`
	NodeID2    string `json:"NodeID2"`
	PollingID2 string `json:"PollingID2"`
	State2     string `json:"State2"`
	PollingID  string `json:"PollingID"`
	Width      int    `json:"Width"`
	State      string `json:"State"`
	Info       string `json:"Info"`
	Port       string `json:"Port"`
}

func GetLine

func GetLine(lineID string) *LineEnt

type LocConfEnt added in v1.1.0

type LocConfEnt struct {
	Style    string  `json:"Style"`
	Center   string  `json:"Center"`
	Zoom     float64 `json:"Zoom"`
	IconSize int     `json:"IconSize"`
}

LocConfEnt : 地図設定

type LogEnt

type LogEnt struct {
	Time int64 // UnixNano()
	Type string
	Log  string
}

type LogFilterEnt

type LogFilterEnt struct {
	StartTime string
	EndTime   string
	Filter    string
	LogType   string
}

type MIBInfo

type MIBInfo struct {
	OID         string
	Status      string
	Type        string
	Enum        string
	Defval      string
	Units       string
	Index       string
	Description string
	EnumMap     map[int]string
	Hint        string
}

func FindMIBInfo

func FindMIBInfo(name string) *MIBInfo

type MIBModuleEnt

type MIBModuleEnt struct {
	Type  string `json:"Type"`
	File  string `json:"File"`
	Name  string `json:"Name"`
	Error string `json:"Error"`
}

MIBModuleEnt represents an entry in the list of loaded MIB modules.

type MIBTreeEnt

type MIBTreeEnt struct {
	OID      string `json:"oid"`
	Name     string `json:"name"`
	MIBInfo  *MIBInfo
	Children []*MIBTreeEnt `json:"children"`
}

type MIBTypeEnt added in v1.1.0

type MIBTypeEnt struct {
	Enum    string
	EnumMap map[int]string
	Hint    string
}

type MapConfEnt

type MapConfEnt struct {
	MapName        string `json:"MapName"`
	PollInt        int    `json:"PollInt"`
	Timeout        int    `json:"Timeout"`
	Retry          int    `json:"Retry"`
	LogDays        int    `json:"LogDays"`
	SnmpMode       string `json:"SnmpMode"`
	Community      string `json:"Community"`
	SnmpUser       string `json:"SnmpUser"`
	SnmpPassword   string `json:"SnmpPassword"`
	EnableSyslogd  bool   `json:"EnableSyslogd"`
	EnableTrapd    bool   `json:"EnableTrapd"`
	EnableArpWatch bool   `json:"EnableArpWatch"`
	EnableNetflowd bool   `json:"EnableNetflowd"`
	EnableSshd     bool   `json:"EnableSshd"`
	EnableSFlowd   bool   `json:"EnableSFlowd"`
	EnableTcpd     bool   `json:"EnableTcpd"`
	EnableOTel     bool   `json:"EnableOTel"`
	EnableMqtt     bool   `json:"EnableMqtt"`
	MqttToSyslog   bool   `json:"Mqtt2Syslog"`
	MCPTransport   string `json:"MCPTransport"`
	MCPEndpoint    string `json:"MCPEndpoint"`
	MCPToken       string `json:"MCPToken"`
	MCPFrom        string `json:"MCPFrom"`
	IconSize       int    `json:"IconSize"`
	MapSize        int    `json:"MapSize"`
	ArpWatchRange  string `json:"ArpWatchRange"`
	ArpTimeout     int    `json:"ArpTimeout"`
	OTelRetention  int    `json:"OTelRetention"`
	OTelFrom       string `json:"OTelFrom"`
	LLMProvider    string `json:"LLMProvider"`
	LLMBaseURL     string `json:"LLMBaseURL"`
	LLMAPIKey      string `json:"LLMAPIKey"`
	LLMModel       string `json:"LLMModel"`
}

MapConfEnt : マップ設定

type MqttStatEnt added in v1.28.0

type MqttStatEnt struct {
	ID       string `json:"ID"`
	State    string `json:"State"`
	ClientID string `json:"ClientID"`
	Topic    string `json:"Topic"`
	Remote   string `json:"Remote"`
	Count    int    `json:"Count"`
	Bytes    int64  `json:"Bytes"`
	First    int64  `json:"First"`
	Last     int64  `json:"Last"`
}

type NetFlowEnt added in v1.5.0

type NetFlowEnt struct {
	Time     int64   `json:"Time"`
	SrcAddr  string  `json:"SrcAddr"`
	SrcPort  int     `json:"SrcPort"`
	SrcLoc   string  `json:"SrcLoc"`
	SrcMAC   string  `json:"SrcMAC"`
	DstAddr  string  `json:"DstAddr"`
	DstPort  int     `json:"DstPort"`
	DstLoc   string  `json:"DstLoc"`
	DstMAC   string  `json:"DstMAC"`
	Bytes    int     `json:"Bytes"`
	Packets  int     `json:"Packets"`
	TCPFlags string  `json:"TCPFlags"`
	Protocol string  `json:"Protocol"`
	ToS      int     `json:"ToS"`
	Start    int64   `json:"Start"`
	End      int64   `json:"End"`
	Dur      float64 `json:"Dur"`
}

type NetworkEnt added in v1.9.0

type NetworkEnt struct {
	ID        string    `json:"ID"`
	Name      string    `json:"Name"`
	Descr     string    `json:"Descr"`
	IP        string    `json:"IP"`
	SnmpMode  string    `json:"SnmpMode"`
	Community string    `json:"Community"`
	User      string    `json:"User"`
	Password  string    `json:"Password"`
	SnmpPort  int       `json:"SnmpPort"`
	URL       string    `json:"URL"`
	ArpWatch  bool      `json:"ArpWatch"`
	Unmanaged bool      `json:"Unmanaged"`
	HPorts    int       `json:"HPorts"`
	X         int       `json:"X"`
	Y         int       `json:"Y"`
	W         int       `json:"W"`
	H         int       `json:"H"`
	SystemID  string    `json:"SystemID"`
	Error     string    `json:"Error"`
	LLDP      bool      `json:"LLDP"`
	Ports     []PortEnt `json:"Ports"`
}

func FindNetwork added in v1.9.0

func FindNetwork(id, ip string) *NetworkEnt

FindNetwork : システムIDと管理IPでNetwrorkを検索する

func FindNetworkByIP added in v1.15.0

func FindNetworkByIP(ip string) *NetworkEnt

FindNetworkByIP : 管理IPでNetwrorkを検索する

func GetNetwork added in v1.9.0

func GetNetwork(id string) *NetworkEnt

type NodeEnt

type NodeEnt struct {
	ID           string `json:"ID"`
	Name         string `json:"Name"`
	Descr        string `json:"Descr"`
	Icon         string `json:"Icon"`
	Image        string `json:"Image"`
	State        string `json:"State"`
	X            int    `json:"X"`
	Y            int    `json:"Y"`
	IP           string `json:"IP"`
	MAC          string `json:"MAC"`
	Vendor       string `json:"Vendor"`
	SnmpMode     string `json:"SnmpMode"`
	Community    string `json:"Community"`
	User         string `json:"User"`
	SSHUser      string `json:"SSHUser"`
	Password     string `json:"Password"`
	GNMIPort     string `json:"GNMIPort"`
	GNMIEncoding string `json:"GNMIEncoding"`
	GNMIUser     string `json:"GNMIUser"`
	GNMIPassword string `json:"GNMIPassword"`
	PublicKey    string `json:"PublicKey"`
	URL          string `json:"URL"`
	AddrMode     string `json:"AddrMode"`
	AutoAck      bool   `json:"AutoAck"`
	Loc          string `json:"Loc"`
	SnmpPort     int    `json:"SnmpPort"`
}

func FindNodeFromIP

func FindNodeFromIP(ip string) *NodeEnt

func FindNodeFromMAC

func FindNodeFromMAC(mac string) *NodeEnt

func FindNodeFromName

func FindNodeFromName(name string) *NodeEnt

func GetNode

func GetNode(nodeID string) *NodeEnt

type NotifyConfEnt

type NotifyConfEnt struct {
	Provider           string `json:"Provider"`
	MailServer         string `json:"MailServer"`
	InsecureSkipVerify bool   `json:"InsecureSkipVerify"`
	User               string `json:"User"`
	Password           string `json:"Password"`
	MailTo             string `json:"MailTo"`
	MailFrom           string `json:"MailFrom"`
	Subject            string `json:"Subject"`
	Interval           int    `json:"Interval"`
	Level              string `json:"Level"`
	Report             bool   `json:"Report"`
	LLMSummary         bool   `json:"LLMSummary"`
	NotifyRepair       bool   `json:"NotifyRepair"`
	ExecCmd            string `json:"ExecCmd"`
	BeepHigh           string `json:"BeepHigh"`
	BeepLow            string `json:"BeepLow"`
	WebHookNotify      string `json:"WebHookNotify"`
	WebHookReport      string `json:"WebHookReport"`
	ClientID           string `json:"ClientID"`
	ClientSecret       string `json:"ClientSecret"`
	MSTenant           string `json:"MSTenant"`
}

type OTelMetricDataPointEnt added in v1.22.0

type OTelMetricDataPointEnt struct {
	Start      int64    `json:"Start"`
	Time       int64    `json:"Time"`
	Attributes []string `json:"Attributes"`
	// Histogram
	Count          uint64    `json:"Count"`
	BucketCounts   []uint64  `json:"BucketCounts"`
	ExplicitBounds []float64 `json:"ExplicitBounds"`
	Sum            float64   `json:"Sum"`
	Min            float64   `json:"Min"`
	Max            float64   `json:"Max"`
	// Gauge
	Gauge float64 `json:"Gauge"`
	// ExponentialHistogram
	Positive      []uint64 `json:"Positive"`
	Negative      []uint64 `json:"Negative"`
	Scale         int64    `json:"Scale"`
	ZeroCount     int64    `json:"ZeroCount"`
	ZeroThreshold float64  `json:"ZeroThreshold"`
	// Index
	Index int `json:"Index"`
}

type OTelMetricEnt added in v1.22.0

type OTelMetricEnt struct {
	Host        string                    `json:"Host"`
	Service     string                    `json:"Service"`
	Scope       string                    `json:"Scope"`
	Name        string                    `json:"Name"`
	Type        string                    `json:"Type"`
	Description string                    `json:"Description"`
	Unit        string                    `json:"Unit"`
	DataPoints  []*OTelMetricDataPointEnt `json:"DataPoints"`
	Count       int                       `json:"Count"`
	First       int64                     `json:"First"`
	Last        int64                     `json:"Last"`
}

func FindOTelMetric added in v1.22.0

func FindOTelMetric(host, service, scope, name string) *OTelMetricEnt

type OTelTraceEnt added in v1.22.0

type OTelTraceEnt struct {
	Bucket  string             `json:"Bucket"`
	TraceID string             `json:"TraceID"`
	Start   int64              `json:"Start"`
	End     int64              `json:"End"`
	Dur     float64            `json:"Dur"`
	Spans   []OTelTraceSpanEnt `json:"Spans"`
	Last    int64              `json:"Last"`
}

func GetOTelTrace added in v1.22.0

func GetOTelTrace(bucket, tid string) *OTelTraceEnt

type OTelTraceSpanEnt added in v1.22.0

type OTelTraceSpanEnt struct {
	SpanID       string   `json:"SpanID"`
	ParentSpanID string   `json:"ParentSpanID"`
	Host         string   `json:"Host"`
	Service      string   `json:"Service"`
	Scope        string   `json:"Scope"`
	Name         string   `json:"Name"`
	Start        int64    `json:"Start"`
	End          int64    `json:"End"`
	Dur          float64  `json:"Dur"`
	Attributes   []string `json:"Attributes"`
}

type PKIConfEnt added in v1.18.0

type PKIConfEnt struct {
	Name           string `json:"Name"`
	SANs           string `json:"AcmeSANs"`
	RootCAKeyType  string `json:"RootCAKeyType"`
	RootCAKey      string `json:"RootCAKey"`
	RootCACert     string `json:"RootCACert"`
	RootCATerm     int    `json:"RootCATerm"`
	CertTerm       int    `json:"CertTerm"`
	Serial         int64  `json:"Serial"`
	AcmeServerKey  string `json:"AcmeServerKey"`
	AcmeServerCert string `json:"AcmeServerCert"`
	AcmeBaseURL    string `json:"AcmeBaseURL"`
	AcmePort       int    `json:"AcmePort"`
	HTTPBaseURL    string `json:"HttpBaseURL"`
	HTTPPort       int    `json:"HttpPort"`
	ScepCAKey      string `json:"ScepCAKey"`
	ScepCACert     string `json:"ScepCACert"`
	CrlNumber      int64  `json:"CrlNumber"`
	CrlInterval    int    `json:"CrlInterval"`
	EnableAcme     bool   `json:"EnableAcme"`
	EnableHTTP     bool   `json:"EnableHttp"`
}

PKIConfEnt is the configuration data for a CA stored in the DB.

var PKIConf PKIConfEnt

type PKIControlEnt added in v1.18.0

type PKIControlEnt struct {
	AcmeBaseURL string `json:"AcmeBaseURL"`
	EnableAcme  bool   `json:"EnableAcme"`
	EnableHTTP  bool   `json:"EnableHttp"`
	AcmeStatus  string `json:"AcmeStatus"`
	HTTPStatus  string `json:"HttpStatus"`
	CrlInterval int    `json:"CrlInterval"`
	CertTerm    int    `json:"CertTerm"`
}

type PollingEnt

type PollingEnt struct {
	ID           string                 `json:"ID"`
	Name         string                 `json:"Name"`
	NodeID       string                 `json:"NodeID"`
	Type         string                 `json:"Type"`
	Mode         string                 `json:"Mode"`
	Params       string                 `json:"Params"`
	Filter       string                 `json:"Filter"`
	Extractor    string                 `json:"Extractor"`
	Script       string                 `json:"Script"`
	Level        string                 `json:"Level"`
	PollInt      int                    `json:"PollInt"`
	Timeout      int                    `json:"Timeout"`
	Retry        int                    `json:"Retry"`
	LogMode      int                    `json:"LogMode"`
	NextTime     int64                  `json:"NextTime"`
	LastTime     int64                  `json:"LastTime"`
	Result       map[string]interface{} `json:"Result"`
	State        string                 `json:"State"`
	FailAction   string                 `json:"FailAction"`
	RepairAction string                 `json:"RepairAction"`
	AIMode       string                 `json:"AIMode"`
	VectorCols   string                 `json:"VectorCols"`
	MqttURL      string                 `json:"MqttURL"`
	MqttTopic    string                 `json:"MqttTopic"`
	MqttCols     string                 `json:"MqttCols"`
}

func GetPolling

func GetPolling(id string) *PollingEnt

GetPolling : ポーリングを取得する

type PollingLogEnt

type PollingLogEnt struct {
	Time      int64                  `json:"Time"`
	PollingID string                 `json:"PollingID"`
	State     string                 `json:"State"`
	Result    map[string]interface{} `json:"Result"`
}

func GetAllPollingLog

func GetAllPollingLog(pollingID string) []*PollingLogEnt

GetAllPollingLog :全てのポーリングログを取得する

type PollingTemplateEnt

type PollingTemplateEnt struct {
	ID        int    `json:"ID"`
	Name      string `json:"Name"`
	Level     string `json:"Level"`
	Type      string `json:"Type"`
	Mode      string `json:"Mode"`
	Params    string `json:"Params"`
	Filter    string `json:"Filter"`
	Extractor string `json:"Extractor"`
	Script    string `json:"Script"`
	Descr     string `json:"Descr"`
	AutoParam string `json:"AutoParam"`
}

func GetPollingTemplate

func GetPollingTemplate(id int) *PollingTemplateEnt

type PortEnt added in v1.9.0

type PortEnt struct {
	ID      string `json:"ID"`
	Name    string `json:"Name"`
	Polling string `json:"Polling"`
	Index   string `json:"Index"`
	X       int    `json:"X"`
	Y       int    `json:"Y"`
	State   string `json:"State"`
}

type SFlowCounterEnt added in v1.8.0

type SFlowCounterEnt struct {
	Time   int64  `json:"Time"`
	Remote string `json:"Remote"`
	Type   string `json:"Type"`
	Data   string `json:"Data"`
}

type SFlowEnt added in v1.8.0

type SFlowEnt struct {
	Time     int64  `json:"Time"`
	SrcAddr  string `json:"SrcAddr"`
	SrcPort  int    `json:"SrcPort"`
	SrcLoc   string `json:"SrcLoc"`
	SrcMAC   string `json:"SrcMAC"`
	DstAddr  string `json:"DstAddr"`
	DstPort  int    `json:"DstPort"`
	DstLoc   string `json:"DstLoc"`
	DstMAC   string `json:"DstMAC"`
	Bytes    int    `json:"Bytes"`
	TCPFlags string `json:"TCPFlags"`
	Protocol string `json:"Protocol"`
	Reason   int    `json:"Reason"`
}

type SyslogEnt

type SyslogEnt struct {
	Time     int64  `json:"Time"`
	Level    string `json:"Level"`
	Host     string `json:"Host"`
	Type     string `json:"Type"`
	Tag      string `json:"Tag"`
	Message  string `json:"Message"`
	Severity int    `json:"Severity"`
	Facility int    `json:"Facility"`
}

SyslogEnt represents a syslog entry.

type TrapEnt

type TrapEnt struct {
	Time        int64  `json:"Time"`
	FromAddress string `json:"FromAddress"`
	TrapType    string `json:"TrapType"`
	Variables   string `json:"Variables"`
}

Jump to

Keyboard shortcuts

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