live_monitor

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 21 Imported by: 0

README

Live Monitor

  1. Local Config

  2. Remote Config

/api/live-monitor/i-am-alive
/api/live-monitor/remove-item
/api/live-monitor/not-alive
/api/live-monitor/create-group
/api/live-monitor/configure-notification
  1. Server

Use go-ftl.com for domain for this.

Monitoring Stats [ class, n_obs, [ obs, obs... ] ]

[ class == "request", "sqlquery", "filesys", "os" ]

// Polled v.s. pushed

Documentation

Index

Constants

This section is empty.

Variables

View Source
var XDbOn = make(map[string]bool)
View Source
var XDbOnLock = sync.RWMutex{}

Functions

func BindFormOrJSON

func BindFormOrJSON(c *gin.Context, bindTo interface{}) (err error)

-------------------------------------------------------------------------------------------------------------------------

func BindFormOrJSONOptional

func BindFormOrJSONOptional(c *gin.Context, bindTo interface{}) (err error)

func CallDatabaseJSONFunction

func CallDatabaseJSONFunction(fCall string, encPat string, data ...interface{}) (rv string, err error)

func ConnectToDb

func ConnectToDb()

func DisConnectToDb

func DisConnectToDb()

DisConnectToDb() closes connection to databse.

func EmptyDflt

func EmptyDflt(s, d string) string

EmptyDflt if s is empty, then return d. Creates a default value for parametrs

func GenUUID

func GenUUID() string

GenUUID generates a UUID and returns it.

func GetMapKeys

func GetMapKeys[K comparable, V any](m map[K]V) []K

GetMapKeys Get all the keys from any typed map. (generic)

func HandlerReportIAmAlive

func HandlerReportIAmAlive(c *gin.Context)

func HandlerReportStatus

func HandlerReportStatus(c *gin.Context)

func ListNotAlive

func ListNotAlive()

------------------------------------------------------------------------------------------------------------------------- create or replace function q_qr_not_alive ()

func LogJsonReturned

func LogJsonReturned(x interface{}) interface{}

-------------------------------------------------------------------------------------------------------------------------

func MonitorRemoteSetups

func MonitorRemoteSetups(router *gin.Engine)

------------------------------------------------------------------------------------------------------------------------- xyzzy - TODO - add in API for GIN to call ReportIAmAlive...

func MonitorSetup

func MonitorSetup(xctx context.Context, xconn *pgxpool.Pool, gcfg *data.GlobalConfigData, log *os.File, xem email.EmailSender)

-------------------------------------------------------------------------------------------------------------------------

func MonitorSetupRemote

func MonitorSetupRemote(xserver_url string, gcfg *data.GlobalConfigData, log *os.File, xem email.EmailSender)

-------------------------------------------------------------------------------------------------------------------------

func ReadJson

func ReadJson(fn string, x interface{}) (err error)

ReadJson read in a JSON file into a go data structure.

func RemoveMonitorItem

func RemoveMonitorItem(name string)

------------------------------------------------------------------------------------------------------------------------- create or replace function q_qr_live_monitor_remove ( p_name text )

func ReportIAmAlive

func ReportIAmAlive(name, status string) (err error)

------------------------------------------------------------------------------------------------------------------------- create or replace function q_qr_i_am_alive ( p_name varchar, p_status varchar )

func RmExt

func RmExt(filename string) string

RmExt removes the extenstion from a file name if it exits. if filename is "bc.js", then "bc" will be retuend.

func SVar

func SVar(v interface{}) string

SVar return the JSON encoded version of the data.

func SVarI

func SVarI(v interface{}) string

SVarI return the JSON encoded version of the data with tab indentation.

func SetJsonHdr

func SetJsonHdr(c *gin.Context)

SetJsonHdr will set a content-type header to "application/json; charset=utf-8"

func SortSlice

func SortSlice[T constraints.Ordered](s []T)

SortSlice will Sort a slice of any type. (generic)

func SortedMapKeys

func SortedMapKeys[K constraints.Ordered, V any](m map[K]V) []K

SortMapKeys will sort the keys on a map and return a slice of sorted keys (generic)

func StatusSuccess

func StatusSuccess(s string, c *gin.Context) string

StatusSuccess prepends to a JSON return value with a status:success. This will also set the "Content-Type" to "application/json; charset=utf-8".

Types

type ApiIAmAliveData

type ApiIAmAliveData struct {
	Name   string `json:"name"   form:"name"    binding:"required"`
	Status string `json:"status" form:"status"`
}

-------------------------------------------------------------------------------------------------------------------------

type ReportStatusData

type ReportStatusData struct {
	Name string `json:"name"   form:"name"`
}

-------------------------------------------------------------------------------------------------------------------------

type ReportStatusSuccess

type ReportStatusSuccess struct {
	Status         string `json:"status"`
	Data           string `json:"data"`
	LogUUID        string `json:"LogUUID"`
	StdErrorReturn string
}

type ReportSuccess

type ReportSuccess struct {
	Status string `json:"status"`
}

type SQLIntType

type SQLIntType struct {
	X *int
}

type SQLStringType

type SQLStringType struct {
	X string
}

------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------

Jump to

Keyboard shortcuts

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