skycoin / services

Incubator repo for various services
16 stars 25 forks source link

Service to send alerts when unconfirmed txns do not empty #96

Open gz-c opened 6 years ago

gz-c commented 6 years ago

Using this endpoint: https://explorer.skycoin.net/api/pendingTxs

If an unconfirmed txn is in the array for more than 1 minute, send an alert

This service can be run in a cron job

The API response is documented here: https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#get-unconfirmed-transactions The txid field can be used to identify the transaction.

nutmix commented 6 years ago

Suggest the following config parameters:

  1. smtp server:port
  2. smtp username
  3. smtp password
  4. smtp from address
  5. unconfirmed duration (default 60) in seconds.

Params ideally can be set via command line, config file or env.

Suggest system logs to stdout AND sends an email when it gets an error including:

  1. Error calling the API or parsing the results.
  2. Unconfirmed trans > 1 min (i.e. when it sends alert sms)
  3. SMTP errors (no email can be sent in this case, just write to log)
  4. any exceptions etc.

Write a quick readme.md with how to use/configure

Does the email/log need to contain the json returned by the API in case of delayed transaction?

gz-c commented 6 years ago

Email should include it, but if for some reason its excessively large it can be truncated to some max size.

The log can say how many unconfirmed txns, the timestamp of the oldest and timestamp of the newest, using a human readable timestamp. Email should include this information too

nutmix commented 6 years ago

Alexey has written the code, he is just tweaking it and he will check it in to master branch (no develop branch)