Documentation ¶
Overview ¶
Package prometheus provides functions that are useful to control and manage the built-in prometheus instance.
Index ¶
- Constants
- type Prometheus
- func (obj *Prometheus) AddManagedResource(resUUID string, rtype string) error
- func (obj *Prometheus) Init() error
- func (obj *Prometheus) InitKindMetrics(kinds []string) error
- func (obj *Prometheus) RemoveManagedResource(resUUID string, rtype string) error
- func (obj *Prometheus) Start() error
- func (obj *Prometheus) Stop() error
- func (obj *Prometheus) UpdateCheckApplyTotal(kind string, apply, eventful, errorful bool) error
- func (obj *Prometheus) UpdatePgraphStartTime() error
- func (obj *Prometheus) UpdateState(resUUID string, rtype string, newState ResState) error
- type ResState
Constants ¶
const DefaultPrometheusListen = "127.0.0.1:9233"
DefaultPrometheusListen is registered in https://github.com/prometheus/prometheus/wiki/Default-port-allocations
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prometheus ¶
type Prometheus struct { Listen string // the listen specification for the net/http server // contains filtered or unexported fields }
Prometheus is the struct that contains information about the prometheus instance. Run Init() on it.
func (*Prometheus) AddManagedResource ¶
func (obj *Prometheus) AddManagedResource(resUUID string, rtype string) error
AddManagedResource increments the Managed Resource counter and updates the resource status.
func (*Prometheus) Init ¶
func (obj *Prometheus) Init() error
Init some parameters - currently the Listen address.
func (*Prometheus) InitKindMetrics ¶
func (obj *Prometheus) InitKindMetrics(kinds []string) error
InitKindMetrics initialized prometheus counters. For each kind of resource checkApply counters are initialized with all the possible value.
func (*Prometheus) RemoveManagedResource ¶
func (obj *Prometheus) RemoveManagedResource(resUUID string, rtype string) error
RemoveManagedResource decrements the Managed Resource counter and updates the resource status.
func (*Prometheus) Start ¶
func (obj *Prometheus) Start() error
Start runs a http server in a go routine, that responds to /metrics as prometheus would expect.
func (*Prometheus) UpdateCheckApplyTotal ¶
func (obj *Prometheus) UpdateCheckApplyTotal(kind string, apply, eventful, errorful bool) error
UpdateCheckApplyTotal refreshes the failing gauge by parsing the internal state map.
func (*Prometheus) UpdatePgraphStartTime ¶
func (obj *Prometheus) UpdatePgraphStartTime() error
UpdatePgraphStartTime updates the mgmt_graph_start_time_seconds metric to the current timestamp.
func (*Prometheus) UpdateState ¶
func (obj *Prometheus) UpdateState(resUUID string, rtype string, newState ResState) error
UpdateState updates the state of the resources in our internal state map then triggers a refresh of the failing gauge.