helpers

package
v0.0.0-...-0b629a7 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClientsMetrics

func BuildClientsMetrics(clients *[]interface{}) *structs.StatusMetrics

BuildClientsMetrics builds the metrics for the events

func BuildEventsMetrics

func BuildEventsMetrics(events *[]interface{}) *structs.StatusMetrics

BuildEventsMetrics builds the metrics for the events

func GetBoolFromInterface

func GetBoolFromInterface(i interface{}) (bool, error)

GetBoolFromInterface ...

func GetEvent

func GetEvent(check, client, dc string, events *[]interface{}) (map[string]interface{}, error)

GetEvent returns an event associated to a specific check

func GetIP

func GetIP(r *http.Request) string

GetIP returns the real user IP address

func GetInterfacesFromBytes

func GetInterfacesFromBytes(bytes []byte) ([]interface{}, error)

GetInterfacesFromBytes returns a slice of interfaces from a slice of byte

func GetMapFromBytes

func GetMapFromBytes(bytes []byte) (map[string]interface{}, error)

GetMapFromBytes returns a map from a slice of byte

func GetMapFromInterface

func GetMapFromInterface(i interface{}) map[string]interface{}

GetMapFromInterface returns a map from an interface

func InterfaceToSlice

func InterfaceToSlice(slice interface{}) ([]interface{}, error)

InterfaceToSlice takes a slice of type interface{} and returns a slice of interface

func InterfaceToString

func InterfaceToString(i []interface{}) []string

InterfaceToString takes a slice of interface{} a slice of string

func IsCheckSilenced

func IsCheckSilenced(check, client map[string]interface{}, dc string, silenced []interface{}) (bool, []string)

IsCheckSilenced determines whether a check for a particular client is silenced. Returns true if the check is silenced and a slice of silence entries IDs

func IsClientSilenced

func IsClientSilenced(client, dc string, silenced []interface{}) bool

IsClientSilenced determines whether a client is silenced. Returns true if the client is silenced.

func IsStringInArray

func IsStringInArray(item string, array []string) bool

IsStringInArray searches 'array' for 'item' string Returns true 'item' is a value of 'array'

func RandomString

func RandomString(length int) string

RandomString generates a random string of the provided length

func StringInSlice

func StringInSlice(a string, list []string) bool

return true if String in Slice, false otherwise

Types

This section is empty.

Jump to

Keyboard shortcuts

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