watcher

package
v0.0.0-...-b6ef80e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2015 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearPingIfNeeded

func ClearPingIfNeeded(ip string)

ClearPingIfNeeded analyze if we need to do clean of the ip related objects

func RegisterPingWatch

func RegisterPingWatch(ip string, timeout time.Duration) (*tools.BroadcastReceiver, error)

RegisterPingWatch add to the watch list

func SendPing

func SendPing(ip string) int

SendPing send a ping packet

func StartLoopPing

func StartLoopPing()

StartLoopPing start the go routing sending recursively ping for element in database

func StartPingWatcher

func StartPingWatcher()

StartPingWatcher start the goroutine for watch receiving of ping response

func UpdatePingChannels

func UpdatePingChannels()

UpdatePingChannels clean a set the watching of channels

Types

type CPingMap

type CPingMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CPingMap with mutex for concurrency

type Ping

type Ping struct {
	Ch      tools.Broadcaster
	Start   time.Time //TODO remove this and base calcul on Send[] average
	Send    map[int]PingSend
	Timeout time.Duration // a infinite send will have 0 here
}

Ping contain information about a runnnig ping

type PingResponse

type PingResponse struct {
	//TODO check PID for long running or multiple ping
	IP     string
	Result bool
	Time   time.Duration
	Error  string
}

PingResponse represent ip response and stats

func PingTest

func PingTest(ip string, timeout time.Duration) PingResponse

PingTest execute a ping and return un litenerfor response

type PingSend

type PingSend struct {
	// contains filtered or unexported fields
}

PingSend format of a Ping send

type SNMPResponse

type SNMPResponse struct {
	IP     string
	Result bool
	Time   time.Duration
	Desc   string
	Error  string
}

func SNMPTest

func SNMPTest(ip string, community string, timeout time.Duration) SNMPResponse

TODO monitor snmp trap

type Watcher

type Watcher struct {
	DB           *db.Db
	PingListener *icmp.PacketConn
	PingToListen CPingMap
	PingSeq      uint
	PingChannels chan PingResponse
}

Watcher contain watcher informations

func Get

func Get() *Watcher

Get get the Watcher

func Init

func Init(d *db.Db) *Watcher

Init init the Watcher

Jump to

Keyboard shortcuts

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