Running a user-defined script when an event is raised

The root user has the option to create a callback script that is triggered when an event is raised.

This callback script will be called every time for a new event, irrespective of whether it is an information event or a state-changing event. For state-changing events the script will be triggered when the event becomes active. For more information about the different events, see Event type and monitoring status for system health.

When the script is created, ensure that:
  • The script must to be saved in the /var/mmfs/etc/ location, and must be named eventsCallback.
  • The script is created by a root user. The script will only be called if it is created by the root user. The uid of the root user is 0.
The script will be called with following space-separated arguments list:
version date time timezone event_name component_name identifier severity_abbreviation state_abbreviation message event_arguments where:
version
The version argument displays the version number of the script. The version is set to1 by default. This value is incremented by 1 for every change in the callout's format or functionality. In the sample output, the version is 1.
date
The date is in the yyyy-mm-dd format. In the sample output, the date is 2018-02-23.
time
The time is in the hour:minutes:seconds.milliseconds format. In the sample output, the time is 00:01:07.499834.
timezone
The timezone is based on the server settings. In the sample output, the timezone is EST.
event_name
The event_name argument displays the name of the event. In the sample output, the event_name is pmsensors_up.
component_name
The component_name argument displays the name of the reporting component. In the sample output, the component_name is perfmon.
identifier
The identifier argument displays the entity's name if the require_unique value for the event is set to True. If there is no identifier, ‘’ will be returned. In the sample output, the identifier is ''.
severity_abbreviation
The severity_abbreviation argument usually displays the first letter of Info, TIP, Warning or Error. In the sample output, the severity_abbreviation is I.
message
The message is framed with a single quotation mark (' '). Single ticks in the message are encoded to \\'. The event_arguments are already included in the message, so parsing from the customer is not needed. In the sample output, the message is pmsensors service as expected, state is started.
event_arguments
The event_arguments is framed with single quotation mark (' '). Single ticks in the arguments are encoded to \\'. Arguments are already included in the message. The arguments are comma separated, and without a space. Arguments are %-encoded, so the following characters will be encoded into their hexadecimal unicode representative starting with a %-character:

\t\n !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~

For example, % is encoded to %25, and # is encoded to %23.

A sample call of the script is displayed:
/var/mmfs/etc/eventsCallback 1 2018-02-23 00:01:07.499834 EST pmsensors_up perfmon
 '' I H 'pmsensors service as expected, state is started' 'started'  
Important: The script is started synchronously within the monitoring cycle, therefore it must be lightweight and return a value quickly. The recommended runtime is less than 1second. Long running scripts will be detected, logged and killed. The script has a hard timeout of 60 seconds.