realevent
Configures the following settings for system alerts (events):
-
Configuration parameters. These are general notification settings.
-
Notification methods. This section describes how to configure the different notification methods - email, text messaging and web page.
-
Events. This section describes how to create and configure alert events.
-
Filters. This section describes how to specify days and times of day when alert messages should be sent to particular recipients.
Note
-
You must initialise the alert system with realevent -z before you can configure system alerts for the first time.
-
If you are using Database Isolation, you must use realroot to select the required instance of Reality before running realevent.
Syntax
realevent options
Options
The following list summarises the available command line options. The remaining sections describe how to use these options.
-a Amend.
-b boundEvent-specific bound setting.
-c configurationOption
Displays configuration help.
-D daysSpecifies the days on which an alert should be sent (filter configuration).
-d Disable.
-E eventsSpecifies the events to which a filter applies.
-e Enable.
-f filterSpecifies a filter.
-h Help.
-i eventIDSpecifies an event.
-l List configuration (lower case L.).
-m messageDefines a message.
-n notificationMethod
Specifies a notification method.
-p paramSpecifies a configuration parameter.
-r recipientSpecifies the recipient of an alert.
-s Send message (raise an alert).
-T timesSpecifies the period during which an alert should be sent (filter configuration).
-t messageSpecifies the text of a message.
-v valueSpecifies the value of a parameter.
-w Initialise the specified notification method. Use with the -n option.
-x Debug.
-z Zap. Resets or deletes (as appropriate) the specified parameter.
Restrictions
-
On UNIX hosts, system alerts must be configured by the realman user.
-
On Windows hosts, system alerts must be configured by a user with administrator privileges.
Configuration parameters
This section describes how to configure general notification settings.
Syntax
realevent -ap param -v value
Sets the specified parameter to value.
realevent -zp param
Clears the specified parameter.
Syntax elements
paramSpecifies the configuration parameter to be set or cleared. Must be one of the following:
myemail
The email address to be supplied in both the 'From' and 'Reply To' fields of any emails transmitted (it is not possible to specify different addresses for these fields). This must be specified before you configure the SMS or SMTP notification method.
smtpserver
The fully qualified domain name of the email server to which any emails will be sent. This must be specified before you configure the SMS or SMTP notification method.
smstemplate
The full path of the SMS template that is to be used to construct an email envelope. This must be specified before you configure the SMS notification method.
smsextra
An optional extra parameter that can be referenced from the SMS template.
myhost
The domain name of the host which is establishing the connection to the email server. Some email servers will reject the connection unless this is specified.
htmltemplate
The path to an HTML message template.
valueThe value to which to set the specified parameter.
Examples
realevent -ap myemail -v plato@deepspace.phi -l
Sets the value of the myemail parameter to the email address "plato@deepspace.phi". The -l (lower case L) option specifies that on completion the new configuration should be displayed.
realevent -zp myemail
Resets the myemail configuration parameter to a null string.
Notification method configuration
This section describes how to configure the different notification methods - email, text messaging and web page.
Syntax
realevent -a{e}{w}n notificationMethod {-r recipient}
Configures and/or enables the specified notification method. When enabling (e option), a recipient must have already been set up, or must be specified with the -r option. If the w option is included, the notification method is initialised if appropriate (in practice, this only applies to the html notification method, for which it clears the web page).
realevent -ae{w}n notificationMethod
Enables the specified notification method.
realevent -ad{w}n notificationMethod
Disables the specified notification method.
realevent -zn notificationMethod
Clears and disables the specified notification method.
Syntax elements
notificationMethod
The notification method to be configured. One of:
smtp
Notifies by email. The myemail and smtpserver configuration parameters must be set before configuring the smtp notification method.
sms
Notifies by text message to a mobile phone. The myemail, smtpserver and smstemplate configuration parameters must be set before configuring the sms notification method.
Note
Alerts sent by text message are sent to an SMTP-to-SMS gateway, which extracts the text message and forwards it to the recipient. To use text messaging, therefore, you will require a subscription to a suitable gateway.
html
Notifies by appending to the end of a web page. Note that if the w option is specified, the web page is cleared.
htmle
Similar to html but adds a 'Number: ' field containing a unique ascending identifier based on the date/time. The type is 'html'.
item
Notifies by creating a file for each notification in the directory with a prefix specified by the recipient. If no prefix is specified it defaults to 'files/event.'.
The filename is suffixed with a unique ascending identifier based on the date/time. This same identifier is included in the item as an additional a 'Number: ' field.
recipientSpecifies the email address, mobile phone number or web page address (as appropriate) of the recipient. Multiple recipients must be separated by semicolons and the list of recipients enclosed in quotes.
For SMS notification, recipient generally has the form mobilePhoneNumber@SMSGatewayServer (for example, 01234012345@fastsms.com
), where mobilePhoneNumber is the number of a mobile phone and SMSGatewayServer is the network name or IP address of the SMS gateway server that will forward the message to this number. Note, however, that some SMS gateway servers may require a different format - refer to your SMS gateway server documentation.
For web page notification, recipient must be the full path of a web page to which alert messages will be appended. The default is $REALROOT/files/event.rpt - this is a text file that is referenced by the web page $REALROOT/files/event.htm. If only a file name is specified, this is assumed to be relative to $REALROOT/files.
Examples
realevent -aen sms -r 01234012345@fastsms.com
Enables the sms notification method and sets it to the phone number 01234012345, with the text message being forwarded by the SMS server fastsms.com.
realevent -adn smtp
Disables the smtp notification method, but leaves its configuration unchanged.
realevent -aen smtp
Enables the smtp notification method, using the current configuration.
realevent -zn sms
Disables the sms notification method and resets it to its default state (no recipient).
Event configuration
This section describes how to create and configure alert events. Events are of two types: predefined service and system events, and user-defined events (some user-defined events may be created by NEC Software Solutions applications). User-defined events can be generated using either realevent or the ALERT TCL command.
Syntax
realevent -a{e}i eventID {-b boundValue} {-t message}
Configures and/or enables (-e option) the specified event. When enabling, the event must have already been configured, or the -b and/or -t options must be specified.
realevent -aei eventID
Enables the specified event.
realevent -adi eventID
Disables the specified event.
realevent -zi eventID
For Reality service and system events, resets and disables the specified event. For NEC application events and user-defined events (see below), deletes the specified event.
Syntax elements
eventIDThe ID of the required event. There are four types of event, with IDs in the following ranges:
1001-1999 Reality service events.
2001-2999 Reality system software events.
3001-3999 NEC application events.
4001-4999 Available for user-defined events.
Reality service and system alerts are generated automatically by the system. NEC application and user-defined events are generated with either realevent -s or the ALERT TCL command.
boundValue
A setting specific to a particular Reality Service or System Event. Bound values can be used to limit the number and type of events that will be reported; for example, you can choose to receive notification of all daemon log events, or just those that are most serious.
Note that you cannot define bound values for user-defined and NEC application events.
messageThe message to be sent to the recipient. For pre-defined events this overrides the default message.
Examples
realevent -aei 1002 -b 4 -t "My daemon messages"
Enables event 1002 and configures it to report daemon log events down to level 4. Recipients will be sent the message "My daemon messages", instead of the default message.
realevent -adi 4001
Disables event 4001, but leaves its configuration unchanged.
realevent -aei 4001
Enables event 4001, using the current configuration.
realevent -zi 1002
Disables event 1002 and resets it to its default state. Note that if the event were user-defined or an NEC application event, it would be deleted.
Filter configuration
This section describes how to specify days and times of day when alert messages should be sent to particular recipients:
-
If no filters have been created for a recipient, that recipient receives all messages.
-
If a recipient has any filters defined, messages are only sent if there is a filter that allows them.
Syntax
realevent -af filterNumber {-E events} {-r recipient} {-D days} {-T times}
Creates or amends a filter. When creating a new filter, you must specify a recipient.
realevent -zf filterNumber
Deletes the specified filter.
Syntax elements
filterNumber
The number of the filter to be created, amended or deleted.
eventsSpecifies the IDs of the events allowed by this filter. This can be a single event ID, a range of IDs in the form
recipientSpecifies the recipients (email addresses, mobile phone numbers and/or web page addresses) to which this filter will allow messages to be sent. Multiple recipients must be separated by semicolons.
Note
When creating a filter, you must specify at least one recipient. When amending a filter, the recipients can be omitted.
daysSpecifies the days on which this filter will allow alert messages to be sent. This can be a single day, a range of days (in the form
timesSpecifies the period during which this filter will allow alert messages to be sent. This can be a range of times (in the form
A range can span two days (for example, 18:00-09:00). However, the times set will apply only on the days set with the -D option (for example, -D wed -T 21:00-07:00
means from midnight to 7 am and from 9 pm to midnight on Wednesday, not from 9 pm on Wednesday to 7 am on Thursday).
Note
The * character in Unix systems must be in double quotes to be accepted. For example, it should be "*" instead of *.
Examples
realevent -af 1 -r me@home.com
Amends filter number 1 to allow messages to be sent only to the recipient me@home.com. If filter number 1 does not exist, it is created with all events enabled for all days and times.
realevent -af 1 -D wed-mon
Amends filter number 1 to allow messages to be sent on the days Wednesday to Monday only.
realevent -af 1 -E 1001-1999
Amends filter number 1 to allow only messages resulting from events 1001 to 1999 to be sent.
realevent -af 1 -T 17:30-2:00
Amends filter number 1 to allow messages to be sent between the hours of 5.30 pm and 2 am only.
realevent -af 1 -r him@home.com -E "*" -D "*" -T 18:00-23:59 -l
Amends filter number 1 to allow all events to send messages to the recipient him@home.com, between 6 pm and midnight on any day. The -l option specifies that, on completion, the changed configuration should be displayed.
realevent -zf 1
Deletes filter number 1.
Other options
-c[n ‖ f ‖ b ‖ p]Displays help for the specified configuration option, as follows:
b Event bounds.
f Filters.
n Notification methods.
p Configuration parameters.
-h Displays the main help page.
-l Used on its own, lists the complete current configuration. Can be combined with other options to list a revised configuration.
-s -i eventID {-m message}
Send the specified event, if enabled, to the enabled recipients. message is text sent in addition to that defined for the event. For example:
realevent -s -i 1001 -m "Sending test event 1001"
Raises alert event 1001, with the additional text "Sending test event 1001". This message is sent to all enabled recipients.
You can also raise alerts with the ALERT TCL command.
-x This switch can be combined with any other options to produce a debug trace.
-z Used on its own, the -z option reinitialises the entire alert system. All configuration parameters, notification methods and built-in events are reset to their default states, and all user-defined events and filters are deleted.
Note
You must initialise the alert system with realevent -z before you can configure system alerts for the first time.
Error messages
Unable to access the config file [path]
This usually indicates that you are not the realman user on UNIX, or an user with administrator privileges on Windows, and therefore realevent is unable to create the config file.
The SMS template
The SMS template is used to create an email that is sent to the SMS gateway server. This extracts the message and forwards it to the specified mobile phone number. The contents of the SMS template will depend on the requirements of your SMS gateway server - refer to your SMS gateway server documentation for details.
The template can contain the following codes:
%myemail% Represents the value of the myemail configuration parameter; that is, the return email address.
%smsextra% Represents the value of the smsextra configuration parameter.
When an alert is raised, these are replaced with the appropriate configuration parameter values.
SMS gateway providers
The following companies can provide SMS gateway services:
-
FASTSMS (fastsms.co.uk).
-
Agile Telecom (www.freesms.net).
-
Yahoo (www.yahoo.com).
Service and system events
Event ID |
Description |
Default message |
Info field |
Bound Values |
---|---|---|---|---|
1001 |
Invalid event ID (outside the range 1001 to 4999). |
Bad event code |
- |
None. |
1002 |
Raised whenever a message is added to the daemon log. The bound value allows you to filter the messages according to their significance - only messages up to the level you set (that is, the more significant messages) will generate an alert. |
Daemon event logged |
Details of the event that generated the daemon log message. |
0 - none (default) |
1003 |
Raised when the usage of a licensed service approaches or exceeds the licensed data limit. See Web Service Licences for example. |
Licensed LRUs exceeded |
The name of the database, the percentage of the licensed data limit (see Bound Values) and the total data throughput for the previous shift. |
2 - 100% |
Example
The following example demonstrates the procedure for configuring the alert system on a Windows host to use email notification:
realevent -ap myemail -v reality@deepspace.phi realevent -ap smtpserver -v mail.deepspace.phi realevent -aen smtp -r "fred.bloggs@deepspace.phi;bert.smith@deepspace.phi" realevent -aen html -r c:\realman\html\alerts.htm realevent -aei 1002 -b 4 realevent -aei 4001 -t "Application alert" realevent -af 1 -E "*" -r fred.bloggs@deepspace.phi -D mon -T 18:00-23:59 realevent -af 2 -E "*" -r fred.bloggs@deepspace.phi -D tue-thu -T 18:00-09:00 realevent -af 3 -E "*" -r fred.bloggs@deepspace.phi -D fri -T 00:00-09:00 realevent -af 4 -E "*" -r bert.smith@deepspace.phi -D fri -T 18:00-23:59 realevent -af 5 -E "*" -r bert.smith@deepspace.phi -D sat-sun -T "*" realevent -af 6 -E "*" -r bert.smith@deepspace.phi -D mon -T 00:00-09:00 realevent -l
This example does the following:
-
Sets the return address for the SMTP and SMS notification methods.
-
Sets the name of the email server.
-
Sets up and enables the SMTP notification method. Two recipients are specified.
-
Sets up and enables the HTML notification method. One recipient is specified.
-
Enables Reality service event 1002 and configures it to report daemon log events up to level 4. Recipients will be sent the default message.
-
Creates and enables user-defined event 4001 and configures it to send recipients the message
Application alert
. -
Creates filters 1 to 6 to allow events to send messages only between 6 pm and 9 am on Monday to Friday, and at weekends (from 6 pm on Friday to 9 am on Monday). On weekdays, alert messages are sent to one SMTP recipient and at weekends, to the other.
Note
Since no filters have been created for the HTML recipient, all alerts will be logged on the web page.
-
Finally the configuration is displayed:
param:myemail=[reality@deepspace.phi]
param:smtpserver=[mail.deepspace.phi]
param:smstemplate=[]
param:smsextra=[]
notify:smtp enabled, recipient=[fred.bloggs@deepspace.phi;bert.smith@deepspace.phi]
notify:sms disabled, recipient=[]
notify:html enabled, recipient=[c:\realman\html\alerts.htm]
notify:snmp disabled, recipient=[]
filter:1 fred.bloggs@deepspace.phi, Events=*, Days=mon-mon, Times=18:00-23:59
filter:2 fred.bloggs@deepspace.phi, Events=*, Days=tue-thu, Times=18:00-09:00
filter:3 fred.bloggs@deepspace.phi, Events=*, Days=fri-fri, Times=00:00-09:00
filter:4 bert.smith@deepspace.phi, Events=*, Days=fri-fri, Times=18:00-23:59
filter:5 bert.smith@deepspace.phi, Events=*, Days=sat-sun, Times=*
filter:6 bert.smith@deepspace.phi, Events=*, Days=mon-mon, Times=00:00-09:00
event:1001 disabled, bound=0, text=[Bad event code]
event:1002 enabled, bound=4, text=[Daemon event logged]
event:4001 enabled, bound=0, text=[Application alert]