monitor

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builders

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

type Controller

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

func NewController

func NewController(
	configs map[string]config.Config,
	cliGW *cligw.Gateway,
) *Controller

NewController creates a new instance of the Controller. It takes a map of configuration and a CLI gateway as input and returns a pointer to the Controller. The map of configuration is used to initialize the Controller's configs field. The CLI gateway is used to initialize the Controller's gateways field. The static and dynamic maps in the Builders field are initialized with empty maps. The newly created Controller instance is returned.

func (*Controller) Dynamic

func (c *Controller) Dynamic() error

Dynamic is a method of the Controller struct, responsible for initializing and rendering dashboards based on the configuration data.

func (*Controller) InitDashboard

func (c *Controller) InitDashboard() error

InitDashboard initializes the enabled dashboard based on the display configuration. It retrieves the corresponding hosts for the dashboard and initializes the dashboard builder. If an error occurs during table initialization, it returns an error.

func (*Controller) InitTables

func (c *Controller) InitTables() error

InitTables initializes the enabled tables based on the display configuration. It retrieves the corresponding hosts for each table and initializes the table builder. If an error occurs during table initialization, it returns an error.

func (*Controller) Monitor

func (c *Controller) Monitor() error

Monitor prompts the user to select the type of monitor to render, and then renders the monitor. For static monitors, the user is prompted to select the tables to render. Only tables that are enabled in the configuration file are displayed in the list of choices. If no tables are enabled, an error is displayed and the function returns without rendering any tables.

func (*Controller) ParseConfigData

func (c *Controller) ParseConfigData(monitorType enums.MonitorType) error

ParseConfigData retrieves data from hosts and sets their health based on the selected tables. The function first retrieves data from the RPC table, sorts the hosts, and sets their health. It then retrieves data from the selected tables in parallel using goroutines. For each selected table, the function retrieves data from the hosts and sets their health. Any errors that occur during this process are sent to a channel. If an error is received from the channel, it is returned immediately. If no errors are received, the function returns nil.

func (*Controller) ParseConfigRPC

func (c *Controller) ParseConfigRPC() error

ParseConfigRPC fetches hosts data for the RPC table, sorts the hosts in alphabetical order, and sets their health status.

func (*Controller) RenderDashboards

func (c *Controller) RenderDashboards() error

RenderDashboards displays the selected dashboard on the terminal. First, the function retrieves the name of the currently selected dashboard. Then, it retrieves the corresponding dynamic dashboard builder from the controller's `builders` map. If the builder is found, the function calls its `Render` method to render the dashboard. If the builder is not found, the function returns an error. Finally, the function returns nil to indicate success.

func (*Controller) RenderTables

func (c *Controller) RenderTables() error

RenderTables renders the selected tables. The function checks whether data has been provided for each table and enables or disables the table based on the availability of data. For each selected table, the function retrieves the corresponding table builder from the static table builders map and calls its Render method. The function returns nil if all selected tables have been rendered successfully.

func (*Controller) Static

func (c *Controller) Static() error

Static is a method of the Controller struct, responsible for initializing and rendering tables based on the configuration data.

type Gateways

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

type Hosts

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

type Releases added in v1.2.1

type Releases []Releases

Jump to

Keyboard shortcuts

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