Documentation ¶
Index ¶
Constants ¶
const ( QueryNewBlock string = `tm.event='NewBlock'` QueryVote string = `tm.event='Vote'` )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlertConfig ¶
type AlertConfig struct { // How many minutes to wait before alerting that no new blocks have been seen Stalled int `yaml:"stalled_minutes"` // Whether to alert when no new blocks are seen StalledAlerts bool `yaml:"stalled_enabled"` // How many missed blocks are acceptable before alerting ConsecutiveMissed int `yaml:"consecutive_missed"` // Tag for pagerduty to set the alert priority ConsecutivePriority string `yaml:"consecutive_priority"` // Whether to alert on consecutive missed blocks ConsecutiveAlerts bool `yaml:"consecutive_enabled"` // Window is how many blocks missed as a percentage of the slashing window to trigger an alert Window int `yaml:"percentage_missed"` // PercentagePriority is a tag for pagerduty to route on priority PercentagePriority string `yaml:"percentage_priority"` // PercentageAlerts is whether to alert on percentage based misses PercentageAlerts bool `yaml:"percentage_enabled"` // AlertIfInactive decides if tenderduty send an alert if the validator is not in the active set? AlertIfInactive bool `yaml:"alert_if_inactive"` // AlertIfNoServers: should an alert be sent if no servers are reachable? AlertIfNoServers bool `yaml:"alert_if_no_servers"` // PagerdutyAlerts: Should pagerduty alerts be sent for this chain? Both 'config.pagerduty.enabled: yes' and this must be set. //deprecated: use Pagerduty.Enabled instead PagerdutyAlerts bool `yaml:"pagerduty_alerts"` // DiscordAlerts: Should discord alerts be sent for this chain? Both 'config.discord.enabled: yes' and this must be set. //deprecated: use Discord.Enabled instead DiscordAlerts bool `yaml:"discord_alerts"` // TelegramAlerts: Should telegram alerts be sent for this chain? Both 'config.telegram.enabled: yes' and this must be set. //deprecated: use Telegram.Enabled instead TelegramAlerts bool `yaml:"telegram_alerts"` // chain specific overrides for alert destinations. // Pagerduty configuration values Pagerduty PDConfig `yaml:"pagerduty"` // Discord webhook information Discord DiscordConfig `yaml:"discord"` // Telegram webhook information Telegram TeleConfig `yaml:"telegram"` }
AlertConfig defines the type of alerts to send for a ChainConfig
type ChainConfig ¶
type ChainConfig struct { // ChainId is used to ensure any endpoints contacted claim to be on the correct chain. This is a weak verification, // no light client validation is performed, so caution is advised when using public endpoints. ChainId string `yaml:"chain_id"` // ValAddress is the validator operator address to be monitored. Tenderduty v1 required the consensus address, // this is no longer needed. The operator address is much easier to find in explorers etc. ValAddress string `yaml:"valoper_address"` // ValconsOverride allows skipping the lookup of the consensus public key and setting it directly. ValconsOverride string `yaml:"valcons_override"` // ExtraInfo will be appended to the alert data. This is useful for pagerduty because multiple tenderduty instances // can be pointed at pagerduty and duplicate alerts will be filtered by using a key. The first alert will win, this // can be useful for knowing what tenderduty instance sent the alert. ExtraInfo string `yaml:"extra_info"` // FIXME not used yet! // Alerts defines the types of alerts to send for this chain. Alerts AlertConfig `yaml:"alerts"` // PublicFallback determines if tenderduty should attempt to use public RPC endpoints in the situation that not // explicitly defined RPC servers are available. Not recommended. PublicFallback bool `yaml:"public_fallback"` // Nodes defines what RPC servers to connect to. Nodes []*NodeConfig `yaml:"nodes"` // contains filtered or unexported fields }
ChainConfig represents a validator to be monitored on a chain, it is somewhat of a misnomer since multiple validators can be monitored on a single chain.
func (*ChainConfig) GetValInfo ¶
func (cc *ChainConfig) GetValInfo(first bool) (err error)
GetValInfo the first bool is used to determine if extra information about the validator should be printed.
func (*ChainConfig) WsRun ¶
func (cc *ChainConfig) WsRun()
WsRun is our main entrypoint for the websocket listener. In the Run loop it will block, and if it exits force a renegotiation for a new client.
type Config ¶
type Config struct { // EnableDash enables the web dashboard EnableDash bool `yaml:"enable_dashboard"` // Listen is the URL for the dashboard to listen on, must be a valid/parsable URL Listen string `yaml:"listen_port"` // HideLogs controls whether logs are sent to the dashboard. It will also suppress many alarm details. // This is useful if the dashboard will be public. HideLogs bool `yaml:"hide_logs"` // NodeDownMin controls how long we wait before sending an alert that a node is not responding or has // fallen behind. NodeDownMin int `yaml:"node_down_alert_minutes"` // Prom controls if the prometheus exporter is enabled. Prom bool `yaml:"prometheus_enabled"` // PrometheusListenPort is the port number used by the prometheus web server PrometheusListenPort int `yaml:"prometheus_listen_port"` // Pagerduty configuration values Pagerduty PDConfig `yaml:"pagerduty"` // Discord webhook information Discord DiscordConfig `yaml:"discord"` // Telegram api information Telegram TeleConfig `yaml:"telegram"` // Chains has settings for each validator to monitor. The map's name does not need to match the chain-id. Chains map[string]*ChainConfig `yaml:"chains"` // contains filtered or unexported fields }
Config holds both the settings for tenderduty to monitor and state information while running.
type DiscordConfig ¶
type DiscordConfig struct { Enabled bool `yaml:"enabled"` Webhook string `yaml:"webhook"` Mentions []string `yaml:"mentions"` }
DiscordConfig holds the information needed to publish to a Discord webhook for sending alerts
type DiscordEmbed ¶
type DiscordMessage ¶
type DiscordMessage struct { Username string `json:"username,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` Content string `json:"content"` Embeds []DiscordEmbed `json:"embeds,omitempty"` }
type NodeConfig ¶
type NodeConfig struct { Url string `yaml:"url"` AlertIfDown bool `yaml:"alert_if_down"` // contains filtered or unexported fields }
NodeConfig holds the basic information for a node to connect to.
type PDConfig ¶
type PDConfig struct { Enabled bool `yaml:"enabled"` ApiKey string `yaml:"api_key"` DefaultSeverity string `yaml:"default_severity"` }
PDConfig is the information required to send alerts to PagerDuty
type StatusType ¶
type StatusType int
StatusType represents the various possible end states. Prevote and Precommit are special cases, where the node monitoring for misses did see them, but the proposer did not include in the block.
const ( Statusmissed StatusType = iota StatusPrevote StatusPrecommit StatusSigned StatusProposed )
type StatusUpdate ¶
type StatusUpdate struct { Height int64 Status StatusType Final bool }
StatusUpdate is passed over a channel from the websocket client indicating the current state, it is immediate in the case of prevotes etc, and the highest value seen is used in the final determination (which is how we tag prevote/precommit + missed blocks.
type TeleConfig ¶
type TeleConfig struct { Enabled bool `yaml:"enabled"` ApiKey string `yaml:"api_key"` Channel string `yaml:"channel"` Mentions []string `yaml:"mentions"` }
TeleConfig holds the information needed to publish to a Telegram webhook for sending alerts
type TmConn ¶
TmConn is the websocket client. This is probably not necessary since I expected more complexity.
type ValInfo ¶
type ValInfo struct { Moniker string `json:"moniker"` Bonded bool `json:"bonded"` Jailed bool `json:"jailed"` Tombstoned bool `json:"tombstoned"` Missed int64 `json:"missed"` Window int64 `json:"window"` Conspub []byte `json:"conspub"` Valcons string `json:"valcons"` }
ValInfo holds most of the stats/info used for secondary alarms. It is refreshed roughly every minute.
type WsReply ¶
type WsReply struct { Id int64 `json:"id"` Result struct { Query string `json:"query"` Data struct { Type string `json:"type"` Value json.RawMessage `json:"value"` } `json:"data"` } `json:"result"` }
WsReply is a trimmed down version of the JSON sent from a tendermint websocket subscription.