alert - bruno-beloff/scs_analysis GitHub Wiki

docs > software repositories > scs_analysis > commands > alerts


DESCRIPTION

The alert utility is used to create, update, delete or find alert specifications.

Alerts take the form of emails. These are sent when a parameter falls below or above specified bounds, or when the value is null (a null value is being reported, or no reports are available). The alert specification sets these bounds, together with the aggregation period. One of two types of period may be specified:

  • Recurring - a period of a given number of minutes, hours or days. Recurring periods are sampled back-to back.
  • Diurnal - a daily period with given start time and end times. Diurnal periods are sampled immediately after the end time.

In --find mode, results can be filtered by description, topic, field or email address. Finder matches are exact.

When doing an update, the cc list (-g flag) may be preceded with:

  • a - add the following email address(es)
  • r - remove the following email address(es)

If neither indicator is used, then the specified email address(es) replace the current ones.

A history of out-of-bounds events for each alert specification can be found using the alert_status utility.

The --credentials flag is only required where the user wishes to store multiple identities. Setting the credentials is done interactively using the command line interface.

SYNOPSIS

alert.py { -z | [-c CREDENTIALS] { -F | -R ID | -C | -U ID | -D ID } [-d DESCRIPTION] [-p TOPIC] [-f FIELD] [-l LOWER] [-u UPPER] [-n { 0 | 1 }] [{ -r INTERVAL UNITS TIMEZONE | -t START END TIMEZONE }] [-a { 0 | 1 }] [-j { 0 | 1 }] [-s { 0 | 1 }] [-i INDENT] [-v] [-e EMAIL_ADDR] [-g [{ a | r }] EMAIL_ADDR_1 .. EMAIL_ADDR_N]}

Options
--version show program's version number and exit
-h, --help show this help message and exit
-c CREDENTIALS_NAME, --credentials=CREDENTIALS_NAME the stored credentials to be presented
-z, --zones list the available timezone names to stderr
-F, --find find alerts for given description, topic, field or email
-R RETRIEVE_ID, --retrieve=RETRIEVE_ID retrieve alert with given ID
-C, --create create alert
-U UPDATE_ID, --update=UPDATE_ID update alert with given ID
-D DELETE_ID, --delete=DELETE_ID delete alert with given ID
-d DESCRIPTION, --description=DESCRIPTION description
-p TOPIC, --topic-path=TOPIC topic path
-f FIELD, --field=FIELD field
-l LOWER_THRESHOLD, --lower-threshold=LOWER_THRESHOLD lower threshold
-u UPPER_THRESHOLD, --upper-threshold=UPPER_THRESHOLD upper threshold
-n ALERT_ON_NONE, --alert-on-none=ALERT_ON_NONE alert on none (default false)
-r RECURRING_PERIOD, --recurring-period=RECURRING_PERIOD aggregation interval, units { D | H | M } and timezone
-t DIURNAL_PERIOD, --diurnal-period=DIURNAL_PERIOD aggregation start, end and timezone
-t TIMED_PERIOD, --timed-period=TIMED_PERIOD aggregation start and end
-a CONTIGUOUS_ALERTS, --contiguous-alerts=CONTIGUOUS_ALERTS raise alerts on contiguous exceedence (default true)
-j JSON_MESSAGE, --json-message=JSON_MESSAGE message body is JSON (default false)
-s SUSPENDED, --suspended=SUSPENDED suspended (default false)
-e EMAIL, --email=EMAIL email To address (any on find)
-g, --cc-list email CC list
-i INDENT, --indent=INDENT pretty-print the output with INDENT
-v, --verbose report narrative to stderr

EXAMPLES

alert.py -vi4 -c super -Fe [email protected]
alert.py -vi4 -c super -C -d be2-3-nightime-test -p south-coast-science-dev/development/loc/1/climate -f val.tmp -u 10 -n 1 -t 16:00 8:00 Europe/London -e [email protected] -g [email protected]

DOCUMENT EXAMPLE - RECURRING

    {
        "id": 85,
        "description": "",
        "topic": "south-coast-science-demo/brighton-urban/loc/1/particulates",
        "field": "exg.val.pm2p5",
        "lower-threshold": null,
        "upper-threshold": 20.0,
        "alert-on-none": false,
        "aggregation-period": {
            "type": "recurring",
            "interval": 1,
            "units": "M",
            "timezone": "Europe/London"
        },
        "contiguous-alerts": false,
        "json-message": false,
        "creator-email-address": "[email protected]",
        "to": "[email protected]",
        "cc-list": [],
        "suspended": false
    }

DOCUMENT EXAMPLE - DIURNAL

    {
        "id": 107,
        "description": "be2-3-nightime-test",
        "topic": "south-coast-science-dev/development/loc/1/climate",
        "field": "val.tmp",
        "lower-threshold": null,
        "upper-threshold": 10.0,
        "alert-on-none": false,
        "aggregation-period": {
            "type": "diurnal",
            "start": "20:00:00",
            "end": "09:50:00",
            "timezone": "Europe/London"
        },
        "contiguous-alerts": true,
        "json-message": false,
        "creator-email-address": "[email protected]",
        "to": "[email protected]",
        "cc-list": [
            "[email protected]"
        ],
        "suspended": false
    }

SEE ALSO

scs_analysis/alert_status
scs_analysis/cognito_user_credentials

BUGS

The --test-interval flag is not currently in use, and is ignored.

⚠️ **GitHub.com Fallback** ⚠️