Documentation
¶
Overview ¶
Package client : Web APIを利用したクライントライブラリです。
Index ¶
- type AiListEntWebAPI
- type ArpFilter
- type ArpWebAPI
- type DeviceEnt
- type EventLogEnt
- type EventLogFilter
- type EventLogsWebAPI
- type FlowEnt
- type IPReportEnt
- type LogEnt
- type LogFilterEnt
- type MonitorDataEnt
- type NetflowFilter
- type NetflowWebAPI
- type NetflowWebAPILogEnt
- type NodeEnt
- type PollingEnt
- type PollingLogEnt
- type PollingsWebAPI
- type SFlowCounterEnt
- type SFlowCounterFilter
- type SFlowCounterWebAPI
- type SFlowCounterWebAPILogEnt
- type SFlowFilter
- type SFlowWebAPI
- type SFlowWebAPILogEnt
- type SensorEnt
- type SensorMonitorEnt
- type SensorStatsEnt
- type ServerEnt
- type SnmpTrapFilter
- type SnmpTrapWebAPI
- type SyslogFilter
- type SyslogWebAPI
- type SyslogWebAPILogEnt
- type TWSNMPApi
- func (a *TWSNMPApi) Delete(path string) error
- func (a *TWSNMPApi) DeleteLog(id string) error
- func (a *TWSNMPApi) DeleteNodes(ids []string) error
- func (a *TWSNMPApi) DeletePollings(ids []string) error
- func (a *TWSNMPApi) DeleteReport(t, id string) error
- func (a *TWSNMPApi) Get(path string) ([]byte, error)
- func (a *TWSNMPApi) GetAIList() ([]*AiListEntWebAPI, error)
- func (a *TWSNMPApi) GetArpLogs(filter *ArpFilter) ([]*ArpWebAPI, error)
- func (a *TWSNMPApi) GetDevices() ([]*DeviceEnt, error)
- func (a *TWSNMPApi) GetEventLogs(filter *EventLogFilter) (*EventLogsWebAPI, error)
- func (a *TWSNMPApi) GetFlows() ([]*FlowEnt, error)
- func (a *TWSNMPApi) GetIPFIX(filter *NetflowFilter) (*NetflowWebAPI, error)
- func (a *TWSNMPApi) GetIPs() ([]*IPReportEnt, error)
- func (a *TWSNMPApi) GetMonitor() ([]*MonitorDataEnt, error)
- func (a *TWSNMPApi) GetNetFlow(filter *NetflowFilter) (*NetflowWebAPI, error)
- func (a *TWSNMPApi) GetNodes() ([]*NodeEnt, error)
- func (a *TWSNMPApi) GetPollingLogs(id string, filter *TimeFilter) ([]*PollingLogEnt, error)
- func (a *TWSNMPApi) GetPollings() (*PollingsWebAPI, error)
- func (a *TWSNMPApi) GetSFlow(filter *SFlowFilter) (*SFlowWebAPI, error)
- func (a *TWSNMPApi) GetSFlowCounter(filter *SFlowCounterFilter) (*SFlowCounterWebAPI, error)
- func (a *TWSNMPApi) GetSensors() ([]*SensorEnt, error)
- func (a *TWSNMPApi) GetServers() ([]*ServerEnt, error)
- func (a *TWSNMPApi) GetSnmpTraps(filter *SnmpTrapFilter) ([]*SnmpTrapWebAPI, error)
- func (a *TWSNMPApi) GetSyslogs(filter *SyslogFilter) (*SyslogWebAPI, error)
- func (a *TWSNMPApi) GetUsers() ([]*UserEnt, error)
- func (a *TWSNMPApi) Login(user, password string) error
- func (a *TWSNMPApi) Post(path string, data []byte) ([]byte, error)
- func (a *TWSNMPApi) ResetReport(t string) error
- func (a *TWSNMPApi) UpdateNode(node *NodeEnt) error
- func (a *TWSNMPApi) UpdatePolling(polling *PollingEnt) error
- type TimeFilter
- type UserClientEnt
- type UserEnt
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AiListEntWebAPI ¶
type AiListEntWebAPI struct {
ID string // 内部ID
NodeID string // ノードの内部ID
NodeName string // ノード名
PollingName string // ポーリング名
Score float64 // スコア
Count int // 件数
LastTime int64 // 最終分析日時
}
AiListEntWebAPI は、AI分析リストのデータ構造です。
type ArpFilter ¶
type ArpFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
IP string // IPアドレス
MAC string // MACアドレス
}
ArpFilter は、ARPログの検索条件を指定します。
type ArpWebAPI ¶
type ArpWebAPI struct {
Time int64 // 検知日時
State string // 状態
IP string // IPアドレス
MAC string // MACアドレス
Vendor string // ベンダー
OldMAC string // 前のMACアドレス
OldVendor string // 前のベンダー
}
ArpWebAPI は、ARPログです。
type EventLogEnt ¶ added in v1.44.0
type EventLogFilter ¶
type EventLogFilter struct {
Level string // ログのレベル
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
Type string // ログのタイプ
NodeID string // ログの対象ノードのID
Event string // イベントに含まれる文字列(正規表現)
}
EventLogFilter is the search criteria for event logs.
type EventLogsWebAPI ¶
type EventLogsWebAPI struct {
EventLogs []*EventLogEnt // イベントログの検索結果
NodeList []selectEntWebAPI // ノード名選択肢
}
EventLogsWebAPI is the search result for event logs.
type FlowEnt ¶ added in v1.44.0
type FlowEnt struct {
ID string // ID Client:Server
Client string
Server string
Services map[string]int64
Count int64
Bytes int64
ClientName string
ClientNodeID string
ClientLoc string
ServerName string
ServerNodeID string
ServerLoc string
Score float64
ValidScore bool
Penalty int64
FirstTime int64
LastTime int64
UpdateTime int64
}
type IPReportEnt ¶ added in v1.44.0
type LogFilterEnt ¶ added in v1.44.0
type MonitorDataEnt ¶ added in v1.44.0
type NetflowFilter ¶
type NetflowFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04 StartDate string
SrcDst bool // 双方向検索
IP string // 双方向検索の場合のIPアドレス
Port string // 双方向検索の場合のポート番号
SrcIP string // 送信元IP
SrcPort string // 送信元ポート
DstIP string // 宛先IP
DstPort string // 宛先ポート
Protocol string // プロトコル
TCPFlag string // TCPフラグ
NextTime int64 // 継続検索の場合の時刻(nano Sec)
Filter int // 累計の検索数
}
NetflowFilter は、NetFlow/IPFIXの検索条件です。
type NetflowWebAPI ¶
type NetflowWebAPI struct {
Logs []*NetflowWebAPILogEnt // ログの検索結果
NextTime int64 // 継続検索の次回の時刻(nano Sec)
Process int // 総ログ件数
Filter int // フィルターした件数
Limit int // 上限
}
NetflowWebAPI は、NetFlow/IPFIXログの検索結果です。
type NetflowWebAPILogEnt ¶
type NetflowWebAPILogEnt struct {
Time int64 // ログの受信日時
Src string // 送信元ホスト名
SrcIP string // 送信元IP
SrcMAC string // 送信元MACアドレス
SrcPort int // 送信元ポート番号
DstIP string // 宛先IP
DstMAC string // 宛先MACアドレス
DstPort int // 宛先ポート番号
Dst string // 宛先ホスト名
Protocol string // プロコトル
TCPFlags string // TCPフラグ
Packets int64 // パケット数
Bytes int64 // バイト数
Duration float64 // 通信期間
}
NetflowWebAPILogEnt は、NetFlow/IPFIXログのデータ構造です。
type NodeEnt ¶ added in v1.44.0
type NodeEnt struct {
ID string
Name string
Descr string
Icon string
Image string
State string
X int
Y int
IP string
IPv6 string
MAC string
SnmpMode string
Community string
User string
Password string
GNMIUser string
GNMIPassword string
GNMIEncoding string
GNMIPort string
PublicKey string
URL string
AddrMode string
AutoAck bool
}
type PollingEnt ¶ added in v1.44.0
type PollingEnt struct {
ID string
Name string
NodeID string
Type string
Mode string
Params string
Filter string
Extractor string
Script string
Level string
PollInt int
Timeout int
Retry int
LogMode int
NextTime int64
LastTime int64
Result map[string]interface{}
State string
FailAction string
RepairAction string
AIMode string
VecotrCols string
}
type PollingLogEnt ¶ added in v1.44.0
type PollingsWebAPI ¶
type PollingsWebAPI struct {
Pollings []*PollingEnt
NodeList []selectEntWebAPI
}
PollingsWebAPI は、ポーリングの応答データの構造です。
type SFlowCounterEnt ¶ added in v1.44.0
type SFlowCounterFilter ¶
type SFlowCounterFilter struct {
Remote string // 送信元
Type string // 種別
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
NextTime int64 // 継続検索の開始時刻(nano Sec)
Filter int // 累計検索件数
}
SFlowCounterFilter は、SFlow Counterログの検索条件です。
type SFlowCounterWebAPI ¶
type SFlowCounterWebAPI struct {
Logs []*SFlowCounterWebAPILogEnt // 検索結果のログ
NextTime int64 // 継続検索の次回時刻
Process int // 総ログ数
Filter int // フィルターした件数
Limit int // 上限
}
SFlowCounterWebAPI は、SFlow Counterログの検索結果です。
type SFlowCounterWebAPILogEnt ¶
type SFlowCounterWebAPILogEnt struct {
Time int64 // 受信時刻
SFlowCounterEnt // カウンターサンプルのデータ
}
SFlowCounterWebAPILogEnt は、SFlowCounterログです。
type SFlowFilter ¶
type SFlowFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04 StartDate string
SrcDst bool // 双方向検索
IP string // 双方向検索のIP
Port string // 双方向検索のポート
SrcIP string // 送信元IP
SrcPort string // 送信元ポート番号
DstIP string // 宛先IP
DstPort string // 宛先ポート
Protocol string // プロトコル
TCPFlag string // TCPフラグ
Reason string // 切断理由
NextTime int64 // 継続検索の開始時刻(nano Sec)
Filter int // 累計検索件数
}
SFlowFilter はSFlowログ検索条件です。
type SFlowWebAPI ¶
type SFlowWebAPI struct {
Logs []*SFlowWebAPILogEnt // 検索結果のログ
NextTime int64 // 継続検索の次回時刻(nano Sec)
Process int // 総ログ数
Filter int // フィルターした件数
Limit int // 上限
}
SFlowWebAPI は、SFlowログの検索結果です。
type SFlowWebAPILogEnt ¶
type SFlowWebAPILogEnt struct {
Time int64 // ログ受信日時
Src string // 送信元ホスト
SrcIP string // 送信元IP
SrcMAC string // 送信元MACアドレス
SrcPort int // 送信元ポート番号
DstIP string // 宛先IP
DstMAC string // 宛先MACアドレス
DstPort int // 宛先ポート番号
Dst string // 宛先ホスト名
Protocol string // プロトコル
TCPFlags string // TCPフラグ
Bytes int64 // バイト数
Reason int // 切断理由
}
SFlowWebAPILogEnt は、SFlowログです。
type SensorMonitorEnt ¶ added in v1.44.0
type SensorStatsEnt ¶ added in v1.44.0
type SnmpTrapFilter ¶
type SnmpTrapFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
FromAddress string // TRAPの送信元アドレス
TrapType string // TRAPの種別
Variables string // TRAPに付帯したMIB
}
SnmpTrapFilter は、SNMP TRAPログの検索条件です。
type SnmpTrapWebAPI ¶
type SnmpTrapWebAPI struct {
Time int64 // TRAPの受信日時
FromAddress string // TRAPの送信元アドレス
TrapType string // TRAPの種別
Variables string // TRAPに付帯したMIB
}
SnmpTrapWebAPI は、SNMP TRAPログです。
type SyslogFilter ¶
type SyslogFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
Level string // レベル
Type string // ログのタイプ
Host string // ログの送信元ホスト
Tag string // ログのタグ
Message string // ログのメッセージ
Extractor string // 抽出パターン
NextTime int64 // 継続ログの開始時刻(nano Sec)
Filter int // ログの累積件数
}
SyslogFilter is the search criteria for syslog.
type SyslogWebAPI ¶
type SyslogWebAPI struct {
Logs []*SyslogWebAPILogEnt // sysylogの検索結果
ExtractHeader []string // 抽出データのヘッダ
ExtractDatas [][]string // 抽出データ
NextTime int64 // 継続検索の開始時刻(nano Sec)
Process int // ログの総数
Filter int // フィルター後の件数
Limit int // 検索上限
}
SyslogWebAPI は、syslogの検索結果です。
type SyslogWebAPILogEnt ¶
type SyslogWebAPILogEnt struct {
Time int64 // タイムスタンプ(nano Sec)
Level string // レベル
Host string // 送信元ホスト
Type string // ログの種別
Tag string // タグ
Message string // メッセージ
Severity int // Severity
Facility int // Facility
}
SyslogWebAPILogEnt is the data structure for syslog.
type TWSNMPApi ¶
type TWSNMPApi struct {
URL string // TWSNMP FCのURL
Token string // JWTアクセストークン
InsecureSkipVerify bool // HTTPSで通信する時にサーバー証明書の検証を行わない
Timeout int // タイムアウト
}
TWSNMPApi is a data structure for communicating with TWSNMP FC.
func (*TWSNMPApi) DeleteNodes ¶
DeleteNodes は、ノードを削除します。
Example ¶
c := NewClient("http://127.0.0.1:8080")
err := c.Login("twsnmp", "twsnmp")
if err != nil {
log.Fatal(err)
}
err = c.DeleteNodes([]string{"node id"})
if err != nil {
log.Fatal(err)
}
func (*TWSNMPApi) DeletePollings ¶
DeletePollings は、ポーリングを削除します。
func (*TWSNMPApi) DeleteReport ¶
DeleteReport は,指定された種別とIDのレポートを削除します。
func (*TWSNMPApi) GetAIList ¶
func (a *TWSNMPApi) GetAIList() ([]*AiListEntWebAPI, error)
GetAIList はTWSNMP FCからAI分析リストを取得します。
func (*TWSNMPApi) GetArpLogs ¶
GetArpLogs はTWSNMP FCからARPログを取得します。
func (*TWSNMPApi) GetDevices ¶
GetDevices はTWSNMP FCからLANデバイスレポートを取得します。
func (*TWSNMPApi) GetEventLogs ¶
func (a *TWSNMPApi) GetEventLogs(filter *EventLogFilter) (*EventLogsWebAPI, error)
GetEventLogs gets event logs from TWSNMP FC.
func (*TWSNMPApi) GetIPFIX ¶
func (a *TWSNMPApi) GetIPFIX(filter *NetflowFilter) (*NetflowWebAPI, error)
GetIPFIX はTWSNMP FCからIPFIXログを取得します。
func (*TWSNMPApi) GetIPs ¶
func (a *TWSNMPApi) GetIPs() ([]*IPReportEnt, error)
GetIPs はTWSNMP FCからIPレポートを取得します。
func (*TWSNMPApi) GetMonitor ¶
func (a *TWSNMPApi) GetMonitor() ([]*MonitorDataEnt, error)
GetMonitor はTWSNMP FCからモニターレポートを取得します。
func (*TWSNMPApi) GetNetFlow ¶
func (a *TWSNMPApi) GetNetFlow(filter *NetflowFilter) (*NetflowWebAPI, error)
GetNetFlow はTWSNMP FCからNetFlowログを取得します。
func (*TWSNMPApi) GetNodes ¶
GetNodes はTWSNMP FCからノードリストを取得します。
Example ¶
c := NewClient("http://127.0.0.1:8080")
err := c.Login("twsnmp", "twsnmp")
if err != nil {
log.Fatal(err)
}
nodes, err := c.GetNodes()
if err != nil {
log.Fatal(err)
}
for _, n := range nodes {
fmt.Printf("%+v\n", n)
}
func (*TWSNMPApi) GetPollingLogs ¶
func (a *TWSNMPApi) GetPollingLogs(id string, filter *TimeFilter) ([]*PollingLogEnt, error)
GetPollingLogs はTWSNMP FCからポーリングログを取得します。
Example ¶
c := NewClient("http://127.0.0.1:8080")
err := c.Login("twsnmp", "twsnmp")
if err != nil {
log.Fatal(err)
}
r, err := c.GetPollings()
if err != nil {
log.Fatal(err)
}
for _, p := range r.Pollings {
if p.LogMode > 0 {
logs, err := c.GetPollingLogs(p.ID, &TimeFilter{})
if err != nil {
log.Fatal(err)
}
for _, l := range logs {
fmt.Printf("%+v\n", l)
}
}
}
func (*TWSNMPApi) GetPollings ¶
func (a *TWSNMPApi) GetPollings() (*PollingsWebAPI, error)
GetPollings はTWSNMP FCからポーリングリストを取得します。
func (*TWSNMPApi) GetSFlow ¶
func (a *TWSNMPApi) GetSFlow(filter *SFlowFilter) (*SFlowWebAPI, error)
GetSFlow はTWSNMP FCからSFlowログを取得します。
func (*TWSNMPApi) GetSFlowCounter ¶
func (a *TWSNMPApi) GetSFlowCounter(filter *SFlowCounterFilter) (*SFlowCounterWebAPI, error)
GetSFlowCounter はTWSNMP FCからSFlow Counterログを取得します。
func (*TWSNMPApi) GetSensors ¶
GetSensors はTWSNMP FCからセンサーレポートを取得します。
func (*TWSNMPApi) GetServers ¶
GetServers はTWSNMP FCからサーバーレポートを取得します。
func (*TWSNMPApi) GetSnmpTraps ¶
func (a *TWSNMPApi) GetSnmpTraps(filter *SnmpTrapFilter) ([]*SnmpTrapWebAPI, error)
GetSnmpTraps はTWSNMP FCからSNMP Trapログを取得します。
func (*TWSNMPApi) GetSyslogs ¶
func (a *TWSNMPApi) GetSyslogs(filter *SyslogFilter) (*SyslogWebAPI, error)
GetSyslogs はTWSNMP FCからsyslogを取得します。
func (*TWSNMPApi) Login ¶
Login logs in to TWSNMP FC.
Example ¶
c := NewClient("http://127.0.0.1:8080")
err := c.Login("twsnmp", "twsnmp")
if err != nil {
log.Fatal(err)
}
func (*TWSNMPApi) ResetReport ¶
ResetReport は,指定された種別とIDのレポートのスコアを再計算します。
func (*TWSNMPApi) UpdateNode ¶
UpdateNode は、ノードを追加または削除します。
Example ¶
c := NewClient("http://127.0.0.1:8080")
err := c.Login("twsnmp", "twsnmp")
if err != nil {
log.Fatal(err)
}
err = c.UpdateNode(&NodeEnt{
Name: "test",
X: 100,
Y: 100,
})
if err != nil {
log.Fatal(err)
}
func (*TWSNMPApi) UpdatePolling ¶
func (a *TWSNMPApi) UpdatePolling(polling *PollingEnt) error
UpdatePolling は、ポーリングの追加または更新します。
type TimeFilter ¶
type TimeFilter struct {
StartDate string // 検索の開始日 例:2006-01-02
StartTime string // 検索の開始時刻 例: 15:04
EndDate string // 検索の終了日 例:2006-01-02
EndTime string // 検索の終了時刻 例: 15:04
}
TimeFilter は、ポーリングログの時間範囲の条件を指定します。