ArcShell

Alerting

An alert in ArcShell is a “recurring notification”. ArcShell provides basic alert types. It is easy to create new types when needed. The ArcShell service daemon must be running to enable recurring notifications. Alerts are automatically tracked and they are highly configurable. Alert configuration is accomplished by modifying the attributes related to alert types and establishing contact groups.

List The Available Alert Types

# List the available alert types.
$ alert_list_alert_types
critical
high
low
medium

# List the configuration file used to define the alert type.
$ alert_list_alert_types -l
/media/sf_temp/arcshell/config/alert_types/critical
/media/sf_temp/arcshell/config/alert_types/high
/media/sf_temp/arcshell/config/alert_types/low
/media/sf_temp/arcshell/config/alert_types/medium

# List all configuration files in all ArcShell homes. ArcShell loads the first file found.
# ArcShell checks the user home, global home, and then the delivered home.
$ alert_list_alert_types -a
${arcHome}: '/media/sf_temp/arcshell/config/alert_types'
/media/sf_temp/arcshell/config/alert_types/critical
/media/sf_temp/arcshell/config/alert_types/high
/media/sf_temp/arcshell/config/alert_types/low
/media/sf_temp/arcshell/config/alert_types/medium
${arcGlobalHome}: '/media/sf_temp/arcshell/arc/config/alert_types'
${arcUserHome}: '/home/ethan/arcshell/config/alert_types'

Creating Custom Alert Types

Create new alert types by copying a delivered configuration file to a new file in your global home. The name of the new file is the name of the new alert type. Edit the file once it is created.

# Note we copy a delivered file to create a global version of the new file.
$ cp ${arcHome}/config/alert_types/high ${arcGlobalHome}/config/alert_types/nuke
# In this example the new alert type is called "nuke".
$ vi ${arcHome}/arc/config/alert_types/nuke

Attributes Associated With Each Alert Type

Let’s look at the attributes that can be set for each alert type.

$ cat "${arcHome}/config/alert_types/critical"
# The initial keyword to associate with the alert. 
# It must be one of the configured keywords.
alert_keyword="critical"

# How many times should the initial alert type notify with the above keyword?
alert_count=999

# What is the notification interval in minutes?
alert_interval=15

# Once the above completes we can change the keyword.
# It can be less critical or more.
alert_reminder_keyword=

# Reminder count before automatically closing the alert.
alert_reminder_count=

# Reminder interval in minutes.
alert_reminder_interval=

Alert Behavior

When a new alert is generated, ArcShell sends an alert message by making a call to the messaging module’s “send_message” interface. The message is associated with the “alert_keyword” defined for the alert type. If the ArcShell service daemon is running, ArcShell will continue to send the same message up until “alert_count” at an interval defined by “alert_interval”. At this point ArcShell will continue to send messages if the “alert_reminder*” settings are defined for the given alert type.

How To Open An Alert

Delivered alert types can be opened making a specific function call for each alert type.

# Open a critical alert. 
$ alert_open_critical "Connection Failure"

# List the open alerts.
$ alert_list_open_alerts

# Close the alert. Note the title of the alert was used to formulate the alert ID.
# There are no spaces in the ID.
$ alert_close "Connection_Failure"

How To Open An Alert Using A Custom Alert Type

Custom alert types can be opened using “alert_open” with the “-type” option. If “-type” is not used the type defaults to “warning” which is one of the delivered alert types.

# Open a critical alert. 
$ alert_open -type "nuke" "Massive Connection Failure"

# List the open alerts.
$ alert_list_open_alerts

# Close the alert.
$ alert_close "Massive_Connection_Failure"

Make sure you take the time to read through the details below before implementing alerts in your code.

Reference

alert_list_alert_types

Return the list of available alert types.

> alert_list_alert_types [-l|-a]
# -l: Long listing. List relevant configuration files.
# -a: List all. List all of the configuration files.

alert_types_show

Returns each alert type and its configuration settings. Lists all configuration files.

> alert_types_show

alert_open_critical

Open a critical alert if not open.

> alert_open_critical [-stdin] [-group "X,..."] ["alert_id"] "alert_title"
# -stdin: Reads data from standard input. Alert is only opened when there is data.
# -group: List of one or more contact groups to route the alert to.
# alert_id: Option ID for this alert. If not provided a modified form of the title is used.
# alert_title: Title of the alert. Appears in subject line of any messages.

alert_open_high

Open a high alert if not open.

> alert_open_high [-stdin] [-group "X,..."] ["alert_id"] "alert_title"
# -stdin: Reads data from standard input. Alert is only opened when there is data.
# -group: List of one or more contact groups to route the alert to.
# alert_id: Option ID for this alert. If not provided a modified form of the title is used.
# alert_title: Title of the alert. Appears in subject line of any messages.

alert_open_medium

Open a medium alert if not open.

> alert_open_medium [-stdin] [-group "X,..."] ["alert_id"] "alert_title"
# -stdin: Reads data from standard input. Alert is only opened when there is data.
# -group: List of one or more contact groups to route the alert to.
# alert_id: Option ID for this alert. If not provided a modified form of the title is used.
# alert_title: Title of the alert. Appears in subject line of any messages.

alert_open_low

Open a low alert if not open.

> alert_open_low [-stdin] [-group "X,..."] ["alert_id"] "alert_title"
# -stdin: Reads data from standard input. Alert is only opened when there is data.
# -group: List of one or more contact groups to route the alert to.
# alert_id: Option ID for this alert. If not provided a modified form of the title is used.
# alert_title: Title of the alert. Appears in subject line of any messages.

alert_open

Open an alert if not open.

> alert_open_critical [-stdin] [-keyword "X"] [-group "X,..."] [-type "X"] ["alert_id"] "alert_title"
# -stdin: Reads data from standard input. Alert is only opened when there is data.
# -group: List of one or more contact groups to route the alert to.
# -type: A valid alert type. Defaults to 'warning'.
# alert_id: Option ID for this alert. If not provided a modified form of the title is used.
# alert_title: Title of the alert. Appears in subject line of any messages.

alert_check_alerts

Runs through all open alerts and sends them if they are due. Called from a schedule task.

> alert_check_alerts

alert_is_open

Return true an alert is already opened.

> alert_is_open "alert_id"

alert_close

Close an alert.

> alert_close "alert_id"
# alert_id: Alert

alert_list_open_alerts

Return the list of open alert ID’s.

> alert_list_open_alerts

alert_list_alerts

Returns complete record for each open alert.

> alert_list_alerts

alert_close_all

Close all open alerts.

> alert_close_all