oxidized

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceStatusSuccess      = "success"
	DeviceStatusNever        = "never"
	DeviceStatusNoConnection = "no_connection"
)
View Source
const (
	// MetricSuccess represents a successful status.
	MetricSuccess = 2
	// MetricNever represents a "never" status.
	MetricNever = 1
	// MetricError represents an error status.
	MetricError = 0
)

Variables

This section is empty.

Functions

func ConvertOixidzedTimeToUnix

func ConvertOixidzedTimeToUnix(t string) (int64, error)

ConvertOixidzedTimeTo8601 converts from 2019-11-19 14:00:00 CET to UnixTimeStamp

Types

type ConfigStat

type ConfigStat struct {
	// Size of the config in bytes
	Size int
	// Number of lines in the config
	Lines int
}

type Device

type Device struct {
	// FullName is the full name of the device, e.g. "netzwerk/leaf-netzwerk-01"
	FullName string `json:"full_name"`
	// Name is the name of the device, e.g. "leaf-netzwerk-01"
	Name string `json:"name"`
	// Group is the group of the device, e.g. "netzwerk"
	Group string `json:"group"`
	// Ip is the FQDN or IP of the device
	Ip string `json:"ip"`
	// Model is the model of the device, e.g. "cisco_ios"
	Model string `json:"model"`
	// Status is either "success", "never" or "no_connection"
	Status string `json:"status"`

	// Last is the last backup of the device
	Last struct {
		// Start is the start time of the last backup
		Start string `json:"start"`
		// End is the end time of the last backup
		End string `json:"end"`
		// Status is the status of the last backup
		Status string `json:"status"`
		// Time is the time of the last backup in seconds
		Time float32 `json:"time"`
	}
}

type DeviceStat

type DeviceStat struct {
	Name string `json:"name"`
}

type OxidizedClient

type OxidizedClient struct {
	Url      string
	Username string
	Password string
}

func NewOxidizedClient

func NewOxidizedClient(url, username, password string) *OxidizedClient

func (*OxidizedClient) GetConfigStats

func (c *OxidizedClient) GetConfigStats(group string, name string, onlyDefaulGroup bool) (*ConfigStat, error)

func (*OxidizedClient) GetDevices

func (c *OxidizedClient) GetDevices() ([]Device, error)

GetDevices returns a list of devices from the oxidized API.

func (*OxidizedClient) GetStatus

func (c *OxidizedClient) GetStatus() ([]DeviceStat, error)

GetDeviceStats returns the stats from the oxidized API.

func (*OxidizedClient) OnlyDefaultGroup added in v1.0.2

func (o *OxidizedClient) OnlyDefaultGroup(devices []Device) bool

OnlyDefaultGroup returns true if the oxidized instance has only devices of the default group

type OxidizedCollector

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

OxidizedCollector is a prometheus collector for oxidized It implements the prometheus.Collector interface See https://godoc.org/github.com/prometheus/client_golang/prometheus#Collector

func NewOxidizedCollector

func NewOxidizedCollector(oxiClient *OxidizedClient) *OxidizedCollector

NewOxidizedCollector creates a new collector and creates the descriptors for the metrics

func (*OxidizedCollector) Collect

func (c *OxidizedCollector) Collect(ch chan<- prometheus.Metric)

Collect is called by the Prometheus registry when collecting metrics

func (*OxidizedCollector) Describe

func (c *OxidizedCollector) Describe(ch chan<- *prometheus.Desc)

Describe sends the super-set of all possible descriptors of metrics

Jump to

Keyboard shortcuts

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