receivers

package
v0.0.0-...-e8cbd8a Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Receives = prometheus.NewSummary(
		prometheus.SummaryOpts{
			Name: "receive_operation_duration_microseconds",
			Help: "Total duration and counts of receiver methods",
		})
	ReceiveErrors = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "receive_operation_errors",
			Help: "Errors encountered while receiving",
		})
)

Functions

This section is empty.

Types

type JsonReceiver

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

JsonReceiver implements the Receiver interface by providing an HTTP POST handler that receives content formatted for Json's API.

func NewJsonReceiver

func NewJsonReceiver(alertReceived chan<- models.Alert) *JsonReceiver

NewJsonReceiver initializes an empty `JsonReceiver` and returns a pointer to it.

It expects a response channel to be passed in for parsed `Alert` data structures to be placed onto.

func (*JsonReceiver) Handler

func (h *JsonReceiver) Handler(w http.ResponseWriter, r *http.Request)

type Receiver

type Receiver interface {
	Handler(http.ResponseWriter, *http.Request)
}

Receiver is an interface whose implementers must provide a generic `Receive()` function that sets up a networked listening interface to receive alerts from Nagios.

Jump to

Keyboard shortcuts

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