prometheus

package
v1.20.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInstance

func SetInstance(i Ops)

SetInstance replaces the instance with the provided one. Should be used only for testing purposes.

Types

type AlertManagerOps

type AlertManagerOps interface {
	// ListAlertManagers lists all alertmanager instances in a given namespace
	ListAlertManagers(namespace string) (*monitoringv1.AlertmanagerList, error)
	// GetAlertManager gets the alert manager that matches the given name
	GetAlertManager(name, namespace string) (*monitoringv1.Alertmanager, error)
	// CreateAlertManager creates the given alert manager
	CreateAlertManager(*monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error)
	// UpdateAlertManager updates the given alert manager
	UpdateAlertManager(*monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error)
	// DeleteAlertManager deletes the given alert manager
	DeleteAlertManager(name, namespace string) error
}

AlertManagerOps is an interface to perform AlertManager operations

type Client

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

Client is a wrapper for the prometheus operator client.

func New

New builds a new client.

func NewForConfig

func NewForConfig(c *rest.Config) (*Client, error)

NewForConfig builds a new client for the given config.

func (*Client) CreateAlertManager

func (c *Client) CreateAlertManager(alertmanager *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error)

CreateAlertManager creates the given alert manager

func (*Client) CreatePrometheus

func (c *Client) CreatePrometheus(prometheus *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error)

CreatePrometheus creates the given prometheus

func (*Client) CreatePrometheusRule

func (c *Client) CreatePrometheusRule(rule *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error)

CreatePrometheusRule creates the given prometheus rule

func (*Client) CreateServiceMonitor

func (c *Client) CreateServiceMonitor(serviceMonitor *monitoringv1.ServiceMonitor) (*monitoringv1.ServiceMonitor, error)

CreateServiceMonitor creates the given service monitor

func (*Client) DeleteAlertManager

func (c *Client) DeleteAlertManager(name, namespace string) error

DeleteAlertManager deletes the given alert manager

func (*Client) DeletePrometheus

func (c *Client) DeletePrometheus(name, namespace string) error

DeletePrometheus deletes the given prometheus

func (*Client) DeletePrometheusRule

func (c *Client) DeletePrometheusRule(name, namespace string) error

DeletePrometheusRule deletes the given prometheus rule

func (*Client) DeleteServiceMonitor

func (c *Client) DeleteServiceMonitor(name, namespace string) error

DeleteServiceMonitor deletes the given service monitor

func (*Client) GetAlertManager

func (c *Client) GetAlertManager(name string, namespace string) (*monitoringv1.Alertmanager, error)

GetAlertManager gets the alert manager that matches the given name

func (*Client) GetPrometheus

func (c *Client) GetPrometheus(name string, namespace string) (*monitoringv1.Prometheus, error)

GetPrometheus gets the prometheus instance that matches the given name

func (*Client) GetPrometheusRule

func (c *Client) GetPrometheusRule(name string, namespace string) (*monitoringv1.PrometheusRule, error)

GetPrometheusRule gets the prometheus rule that matches the given name

func (*Client) GetServiceMonitor

func (c *Client) GetServiceMonitor(name string, namespace string) (*monitoringv1.ServiceMonitor, error)

GetServiceMonitor gets the service monitor instance that matches the given name

func (*Client) ListAlertManagers

func (c *Client) ListAlertManagers(namespace string) (*monitoringv1.AlertmanagerList, error)

ListAlertManagers lists all alertmanager instances in a given namespace

func (*Client) ListPrometheusRules

func (c *Client) ListPrometheusRules(namespace string) (*monitoringv1.PrometheusRuleList, error)

ListPrometheusRules creates the given prometheus rule

func (*Client) ListPrometheuses

func (c *Client) ListPrometheuses(namespace string) (*monitoringv1.PrometheusList, error)

ListPrometheuses lists all prometheus instances in a given namespace

func (*Client) ListServiceMonitors

func (c *Client) ListServiceMonitors(namespace string) (*monitoringv1.ServiceMonitorList, error)

ListServiceMonitors lists all servicemonitors in a given namespace

func (*Client) SetConfig

func (c *Client) SetConfig(cfg *rest.Config)

SetConfig sets the config and resets the client

func (*Client) UpdateAlertManager

func (c *Client) UpdateAlertManager(alertmanager *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error)

UpdateAlertManager updates the given alert manager

func (*Client) UpdatePrometheus

func (c *Client) UpdatePrometheus(prometheus *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error)

UpdatePrometheus updates the given prometheus

func (*Client) UpdatePrometheusRule

func (c *Client) UpdatePrometheusRule(rule *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error)

UpdatePrometheusRule updates the given prometheus rule

func (*Client) UpdateServiceMonitor

func (c *Client) UpdateServiceMonitor(serviceMonitor *monitoringv1.ServiceMonitor) (*monitoringv1.ServiceMonitor, error)

UpdateServiceMonitor updates the given service monitor

type Ops

type Ops interface {
	ServiceMonitorOps
	PodOps
	RuleOps
	AlertManagerOps

	// SetConfig sets the config and resets the client
	SetConfig(config *rest.Config)
}

Ops is an interface to perform Prometheus object operations.

func Instance

func Instance() Ops

Instance returns a singleton instance of the client.

func NewInstanceFromConfigFile

func NewInstanceFromConfigFile(config string) (Ops, error)

NewInstanceFromConfigFile returns new instance of client by using given config file

type PodOps

type PodOps interface {
	// ListPrometheuses lists all prometheus instances in a given namespace
	ListPrometheuses(namespace string) (*monitoringv1.PrometheusList, error)
	// GetPrometheus gets the prometheus instance that matches the given name
	GetPrometheus(name, namespace string) (*monitoringv1.Prometheus, error)
	// CreatePrometheus creates the given prometheus
	CreatePrometheus(*monitoringv1.Prometheus) (*monitoringv1.Prometheus, error)
	// UpdatePrometheus updates the given prometheus
	UpdatePrometheus(*monitoringv1.Prometheus) (*monitoringv1.Prometheus, error)
	// DeletePrometheus deletes the given prometheus
	DeletePrometheus(name, namespace string) error
}

PodOps is an interface to perform Prometheus operations

type RuleOps

type RuleOps interface {
	// ListPrometheusRules creates the given prometheus rule
	ListPrometheusRules(namespace string) (*monitoringv1.PrometheusRuleList, error)
	// GetPrometheusRule gets the prometheus rule that matches the given name
	GetPrometheusRule(name, namespace string) (*monitoringv1.PrometheusRule, error)
	// CreatePrometheusRule creates the given prometheus rule
	CreatePrometheusRule(*monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error)
	// UpdatePrometheusRule updates the given prometheus rule
	UpdatePrometheusRule(*monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error)
	// DeletePrometheusRule deletes the given prometheus rule
	DeletePrometheusRule(name, namespace string) error
}

RuleOps is an interface to perform PrometheusRule operations

type ServiceMonitorOps

type ServiceMonitorOps interface {
	// ListServiceMonitors lists all servicemonitors in a given namespace
	ListServiceMonitors(namespace string) (*monitoringv1.ServiceMonitorList, error)
	// GetServiceMonitor gets the service monitor instance that matches the given name
	GetServiceMonitor(name, namespace string) (*monitoringv1.ServiceMonitor, error)
	// CreateServiceMonitor creates the given service monitor
	CreateServiceMonitor(*monitoringv1.ServiceMonitor) (*monitoringv1.ServiceMonitor, error)
	// UpdateServiceMonitor updates the given service monitor
	UpdateServiceMonitor(*monitoringv1.ServiceMonitor) (*monitoringv1.ServiceMonitor, error)
	// DeleteServiceMonitor deletes the given service monitor
	DeleteServiceMonitor(name, namespace string) error
}

ServiceMonitorOps is an interface to perform ServiceMonitor operations

Jump to

Keyboard shortcuts

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