neptune-explorer/templates/email/neptune_rpc_alert.txt
danda 71cf752b41 feat: add neptune-core rpc connection watchdog
closes #1

Implements a background watchdog task that:
1. calls neptune-core /network rpc every N seconds (default: 10)
2. emits log message on any state change
3. sends detailed email alert to admin on any state change

Changes:
* AppState now has internal Arc<RwLock<AppStateInner>> to permit
  watchdog task to mutate the rpc_client field.
* adjust application to AppState changes (use locks)
* not_found functions no longer accept state arg
* move state initialization into AppState::init()
* add optional alert parameters: admin-email, smtp-*
* add neptune_rpc module with watchdog task
* add alert_email module
* simplify main()
* log warnings if alert parameters not set
* add chrono dep
* add lettre dep
2024-05-25 19:16:36 -07:00

54 lines
1.5 KiB
Plaintext

%% if self.now_connected {
**** ALERT: Neptune RPC Connection Restored ****
%% } else {
**** ALERT: Neptune RPC Connection Lost ****
%% }
site: {{self.config.site_name}} at {{self.config.site_domain}}:{{self.config.listen_port}}
-- Details --
Event: Neptune RPC Connection Status Change.
Event Time: {{self.now.to_rfc3339()}}
Event Description:
%% if self.now_connected {
The neptune-explorer application has re-established connection with the
neptune-core rpc server. Service is restored.
%% } else {
The neptune-explorer application is unable to connect to the neptune-core rpc
server. Website users are experiencing a site-outage.
%% }
New Status:
Neptune RPC Connected: {{self.now_connected}}
Now: {{self.now.to_rfc3339()}}
Previous Status:
Neptune RPC Connected: {{self.was_connected}}
Since: {{self.since.to_rfc3339()}}
Duration: {{self.duration}}
Block Explorer Uptime:
Started: {{self.app_started.to_rfc3339()}}
Duration: {{self.app_duration}} seconds
Neptune-core RPC:
Host: {{self.config.site_domain}} (localhost)
Port: {{self.config.neptune_rpc_port}}
Recommended action:
%% if self.now_connected {
Test the block explorer to ensure it is operating correctly.
No further corrective action should be necessary.
%% } else {
Review if neptune-core is running and accessible. Restart if necessary.
When neptune-core becomes available the block-explorer should automatically
re-establish the connection within {{self.config.neptune_rpc_watchdog_secs}} seconds.
%% }