Documentation ¶
Overview ¶
Package datastore : データ保存
Package datastore : データ保存
Index ¶
- Constants
- Variables
- func AddDrawItem(di *DrawItemEnt) error
- func AddEventLog(e *EventLogEnt)
- func AddLine(l *LineEnt) error
- func AddNode(n *NodeEnt) error
- func AddOrUpdateIcon(i *IconEnt) error
- func AddPolling(p *PollingEnt) error
- func AddPollingLog(p *PollingEnt) error
- func BackupDB(file string) error
- func ClearPollingLogs(ids []string) error
- func CloseDB()
- func DeleteAIResult(id string) error
- func DeleteAllLogs(b string) error
- func DeleteArpEnt(ips []string) error
- func DeleteDrawItem(id string) error
- func DeleteIcon(icon string) error
- func DeleteLine(lineID string) error
- func DeleteNode(nodeID string) error
- func DeleteNodeStateChanged(id string)
- func DeletePollings(ids []string) error
- func DelteImage(path string) error
- func FindVendor(mac string) string
- func ForEachArp(f func(*ArpEnt) bool) error
- func ForEachEventLog(st, et int64, f func(*EventLogEnt) bool) error
- func ForEachItems(f func(*DrawItemEnt) bool)
- func ForEachLastArpLogs(f func(*ArpLogEnt) bool) error
- func ForEachLastEventLog(f func(*EventLogEnt) bool) error
- func ForEachLastPollingLog(pollingID string, f func(*PollingLogEnt) bool) error
- func ForEachLastSyslog(f func(*SyslogEnt) bool) error
- func ForEachLastTraps(f func(*TrapEnt) bool) error
- func ForEachLines(f func(*LineEnt) bool)
- func ForEachLogs(st, et int64, lt string, f func(*LogEnt) bool) error
- func ForEachNetFlow(st, et int64, f func(*NetFlowEnt) bool) error
- func ForEachNodes(f func(*NodeEnt) bool)
- func ForEachPollings(f func(*PollingEnt) bool)
- func ForEachStateChangedNodes(f func(string) bool)
- func ForEachSyslog(st, et int64, f func(*SyslogEnt) bool) error
- func ForEachTraps(st, et int64, f func(*TrapEnt) bool) error
- func GenSSHPrivateKey() []byte
- func GetDBSize() int64
- func GetDataStorePath() string
- func GetImage(path string) ([]byte, error)
- func GetImageList() []string
- func GetLoc(sip string) string
- func GetPrivateKey(pm bool) []byte
- func GetSSHPublicKey() (string, error)
- func GetServiceName(prot, port int) (string, bool)
- func GetSshdPublicKeys() string
- func Init(ctx context.Context, path string, wg *sync.WaitGroup) error
- func IsGlobalUnicast(ips string) bool
- func IsPrivateIP(ip net.IP) bool
- func LoadMailTemplate(t string) string
- func PrintDateAndTime(i interface{}) string
- func PrintHintedMIBIntVal(val int32, hint string, us bool) string
- func PrintIPAddress(i interface{}) string
- func PrintMIBStringVal(i interface{}) string
- func ResetArpTable() error
- func SaveAIConf() error
- func SaveAIResult(res *AIResult) error
- func SaveBackImage() error
- func SaveDiscoverConf() error
- func SaveImage(path string, img []byte) error
- func SaveLocConf() error
- func SaveLogBuffer(logBuffer []*LogEnt)
- func SaveMapConf() error
- func SaveMapData()
- func SaveNotifyConf() error
- func SaveSshdPublicKeys(pk string) error
- func SetDark(dark bool) error
- func SetNodeStateChanged(id string)
- func UpdateArpEnt(ip, mac string) error
- func UpdateLine(l *LineEnt) error
- func UpdatePolling(p *PollingEnt, save bool) error
- type AIConfEnt
- type AIResult
- type ArpEnt
- type ArpLogEnt
- type BackImageEnt
- type DiscoverConfEnt
- type DrawItemEnt
- type DrawItemType
- type EventLogEnt
- type IconEnt
- type LineEnt
- type LocConfEnt
- type LogEnt
- type LogFilterEnt
- type MIBInfo
- type MIBModuleEnt
- type MIBTreeEnt
- type MIBTypeEnt
- type MapConfEnt
- type NetFlowEnt
- type NodeEnt
- type NotifyConfEnt
- type PollingEnt
- type PollingLogEnt
- type PollingTemplateEnt
- type SyslogEnt
- type TrapEnt
Constants ¶
View Source
const ( LogModeNone = iota LogModeAlways LogModeOnChange LogModeAI )
View Source
const ( DrawItemTypeRect = iota DrawItemTypeEllipse DrawItemTypeText DrawItemTypeImage DrawItemTypePollingText DrawItemTypePollingGauge DrawItemTypePollingNewGauge DrawItemTypePollingBar DrawItemTypePollingLine )
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 )
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 PollingTemplateList []*PollingTemplateEnt
Functions ¶
func AddDrawItem ¶
func AddDrawItem(di *DrawItemEnt) error
func AddEventLog ¶
func AddEventLog(e *EventLogEnt)
func AddOrUpdateIcon ¶
func AddPollingLog ¶
func AddPollingLog(p *PollingEnt) error
func ClearPollingLogs ¶ added in v1.5.0
ClearPollingLogs : ポーリングログの削除をまとめて行う
func DeleteAIResult ¶
func DeleteAllLogs ¶
func DeleteArpEnt ¶ added in v0.9.1
DeleteArpEntは、指定のIPアドレスに関連したARPテーブルとARPログを削除する
func DeleteDrawItem ¶
func DeleteIcon ¶
func DeleteLine ¶
func DeleteNode ¶
func DeleteNodeStateChanged ¶
func DeleteNodeStateChanged(id string)
func DeletePollings ¶
func DelteImage ¶
func ForEachArp ¶
func ForEachEventLog ¶
func ForEachEventLog(st, et int64, f func(*EventLogEnt) bool) error
func ForEachItems ¶
func ForEachItems(f func(*DrawItemEnt) bool)
func ForEachLastArpLogs ¶
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 ¶
ForEachLastSyslog get syslogs
func ForEachLastTraps ¶
ForEachLastTraps get TRAP
func ForEachLogs ¶ added in v1.4.0
ForEachLogsは指定した条件のログを返します。
func ForEachNetFlow ¶ added in v1.5.0
func ForEachNetFlow(st, et int64, f func(*NetFlowEnt) bool) error
ForEachNetFlow get NetFlow log
func ForEachNodes ¶
func ForEachSyslog ¶ added in v1.3.0
ForEachSyslog get syslogs
func ForEachTraps ¶ added in v1.3.0
ForEachTraps get TRAP
func GenSSHPrivateKey ¶ added in v1.4.0
func GenSSHPrivateKey() []byte
func GetImageList ¶
func GetImageList() []string
func GetPrivateKey ¶
func GetSSHPublicKey ¶ added in v1.4.0
func GetServiceName ¶
func GetSshdPublicKeys ¶ added in v1.4.0
func GetSshdPublicKeys() string
func IsGlobalUnicast ¶
func IsPrivateIP ¶
func LoadMailTemplate ¶
func PrintDateAndTime ¶ added in v1.2.0
func PrintDateAndTime(i interface{}) string
DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
func PrintHintedMIBIntVal ¶ added in v1.1.0
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 SaveAIConf ¶
func SaveAIConf() error
func SaveAIResult ¶
func SaveBackImage ¶
func SaveBackImage() 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 SaveNotifyConf ¶
func SaveNotifyConf() error
func SaveSshdPublicKeys ¶ added in v1.4.0
func UpdateArpEnt ¶
func UpdateLine ¶
func UpdatePolling ¶
func UpdatePolling(p *PollingEnt, save bool) error
Types ¶
type AIResult ¶
type AIResult struct { PollingID string `json:"PollingID"` LastTime int64 `json:"LastTime"` ScoreData [][]float64 `json:"ScoreData"` }
func GetAIReesult ¶
type BackImageEnt ¶
type DiscoverConfEnt ¶
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 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"` }
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 LogFilterEnt ¶
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 ¶
type MIBModuleEnt ¶
type MIBModuleEnt struct { Type string `json:"Type"` File string `json:"File"` Name string `json:"Name"` Error string `json:"Error"` }
読み込んだMIBのリスト
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 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"` IconSize int `json:"IconSize"` }
MapConfEnt : マップ設定
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"` DstAddr string `json:"DstAddr"` DstPort int `json:"DstPort"` DstLoc string `json:"DstLoc"` Bytes int `json:"Bytes"` Packets int `json:"Packets"` TCPFlags string `json:"TCPFlags"` Protocol string `json:"Protocol"` ToS int `json:"ToS"` Dur float64 `json:"Dur"` }
type NodeEnt ¶
type NodeEnt struct { ID string `json:"ID"` Name string `json:"Name"` Descr string `json:"Descr"` Icon string `json:"Icon"` 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"` PublicKey string `json:"PublicKey"` URL string `json:"URL"` AddrMode string `json:"AddrMode"` AutoAck bool `json:"AutoAck"` Loc string `json:"Loc"` }
func FindNodeFromIP ¶
func FindNodeFromMAC ¶
func FindNodeFromName ¶
type NotifyConfEnt ¶
type NotifyConfEnt struct { 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"` NotifyRepair bool `json:"NotifyRepair"` ExecCmd string `json:"ExecCmd"` BeepHigh string `json:"BeepHigh"` BeepLow string `json:"BeepLow"` LineNotifyRepair bool `json:"LineNotifyRepair"` LineLevel string `json:"LineLevel"` LineToken string `json:"LineToken"` }
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"` }
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
Click to show internal directories.
Click to hide internal directories.