netalertx

package
v0.97.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package netalertx implements the NetAlertX network device monitoring provider.

Index

Constants

View Source
const (
	ID          = "netalertx"
	EndpointKey = "endpoint"
	TokenKey    = "token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Name           string `json:"devName"`
	MAC            string `json:"devMAC"`
	MacAlt         string `json:"devMac"`
	IP             string `json:"devIP"`
	LastIP         string `json:"devLastIP"`
	Type           string `json:"devType"`
	Vendor         string `json:"devVendor"`
	Owner          string `json:"devOwner"`
	Status         string `json:"devStatus"`
	Favorite       int    `json:"devFavorite"`
	LastConnection string `json:"devLastConnection"`
}

Device is a NetAlertX network device record.

type DevicesResponse

type DevicesResponse struct {
	Success bool     `json:"success"`
	Devices []Device `json:"devices"`
	Message string   `json:"message,omitzero"`
}

DevicesResponse is returned by GET /devices.

type NetAlertX

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

NetAlertX is an HTTP client for the NetAlertX REST API.

func GetClient

func GetClient() *NetAlertX

GetClient builds a NetAlertX client from vendors.netalertx config. Returns nil when endpoint is not configured.

func NewNetAlertX

func NewNetAlertX(endpoint, token string) *NetAlertX

NewNetAlertX creates a NetAlertX client with Bearer token auth. Returns nil when endpoint is empty.

func (*NetAlertX) GetTopology

func (n *NetAlertX) GetTopology(ctx context.Context) (*Topology, error)

GetTopology returns network topology nodes and links.

func (*NetAlertX) GetTotals

func (n *NetAlertX) GetTotals(ctx context.Context) (*Totals, error)

GetTotals returns device category counts.

func (*NetAlertX) Health

func (n *NetAlertX) Health(ctx context.Context) error

Health reports whether the devices totals endpoint is reachable.

func (*NetAlertX) ListDevices

func (n *NetAlertX) ListDevices(ctx context.Context) ([]Device, error)

ListDevices returns all devices.

func (*NetAlertX) SearchDevices

func (n *NetAlertX) SearchDevices(ctx context.Context, query string) ([]Device, error)

SearchDevices searches devices by MAC, name, or IP.

type SearchResponse

type SearchResponse struct {
	Success bool     `json:"success"`
	Devices []Device `json:"devices"`
}

SearchResponse is returned by POST /devices/search.

type Topology

type Topology struct {
	Nodes []TopologyNode `json:"nodes"`
	Links []TopologyLink `json:"links"`
}

Topology is the network topology graph.

type TopologyLink struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Port   string `json:"port"`
}

TopologyLink is an edge in the network topology.

type TopologyNode

type TopologyNode struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Vendor string `json:"vendor"`
}

TopologyNode is a node in the network topology.

type Totals

type Totals struct {
	All       int `json:"all"`
	Connected int `json:"connected"`
	Favorites int `json:"favorites"`
	New       int `json:"new"`
	Down      int `json:"down"`
	Archived  int `json:"archived"`
}

Totals holds device counts: [all, connected, favorites, new, down, archived].

Jump to

Keyboard shortcuts

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