config

package
v0.0.0-...-d1fbd11 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertsThreshold

type AlertsThreshold struct {
	VotingPowerThreshold           int64 `mapstructure:"voting_power_threshold"`
	NumPeersThreshold              int64 `mapstructure:"num_peers_threshold"`
	BlockDiffThreshold             int64 `mapstructure:"block_diff_threshold"`
	MissedBlocksThreshold          int64 `mapstructure:"missed_blocks_threshold"`
	EpochDiffThreshold             int64 `mapstructure:"epoch_diff_threshold"`
	EmergencyMissedBlocksThreshold int64 `mapstructure:"emergency_missed_blocks_threshold"`
}

AlertsThreshold is a struct which holds defined alerting thresholds to send alerts

type Config

type Config struct {
	Scraper          Scraper          `mapstructure:"scraper"`
	Telegram         Telegram         `mapstructure:"telegram"`
	SendGrid         SendGrid         `mapstructure:"sendgrid"`
	InfluxDB         InfluxDB         `mapstructure:"influxdb"`
	DailyAlerts      DailyAlerts      `mapstructure:"daily_alerts"`
	EnableAlerts     EnableAlerts     `mapstructure:"enable_alerts"`
	ValidatorDetails ValidatorDetails `mapstructure:"validator_details"`
	AlertsThreshold  AlertsThreshold  `mapstructure:"alerts_threshold"`
}

Config will be configured by user for monitoring and also to get alerts based on it

func ReadFromFile

func ReadFromFile() (*Config, error)

ReadFromFile to read config details using viper

func (*Config) Validate

func (c *Config) Validate(e ...string) error

Validate config struct

type DailyAlerts

type DailyAlerts struct {
	AlertTime1 string `mapstructure:"alert_time1"`
	AlertTime2 string `mapstructure:"alert_time2"`
}

DailyAlerts to send validator status alerts twice a day

type EnableAlerts

type EnableAlerts struct {
	EnableTelegramAlerts string `mapstructure:"enable_telegram_alerts"`
	EnableEmailAlerts    string `mapstructure:"enable_email_alerts"`
}

EnableAlerts struct which holds option to enable/disable alerts

type InfluxDB

type InfluxDB struct {
	Port     string `mapstructure:"port"`
	Database string `mapstructure:"database"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

InfluxDB is a struct which asks for influx database details

type Scraper

type Scraper struct {
	Rate          string `mapstructure:"rate"`
	Port          string `mapstructure:"port"`
	ValidatorRate string `mapstructure:"validator_rate"`
}

Scraper time interval to call targets based on defined scrape

type SendGrid

type SendGrid struct {
	Token          string `mapstructure:"sendgrid_token"`
	EmailAddress   string `mapstructure:"email_address"`
	PagerdutyEmail string `mapstructure:"pagerduty_email"`
}

SendGrid is a struct which holds sendgrid token and also your email and pagerduty email

type Telegram

type Telegram struct {
	BotToken string `mapstructure:"tg_bot_token"`
	ChatID   int64  `mapstructure:"tg_chat_id"`
}

Telegram is a struct which holds telegram bot token and chatID

type ValidatorDetails

type ValidatorDetails struct {
	ValidatorAddress    string `mapstructure:"validator_addr"`
	ValidatorHexAddress string `mapstructure:"validator_hex_addr"`
	ValidatorName       string `mapstructure:"validator_name"`
	NetworkURL          string `mapstructure:"network_url"`
	NetworkNodeName     string `mapstructure:"network_node_name"`
	SocketPath          string `mapstructure:"socket_path"`
}

ValidatorDetails struct which holds details of validator

Jump to

Keyboard shortcuts

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