Skip to main content
Version: 3.2.0

3. Monitoring with notifiers

This guide explains how to plan and monitor the execution of a shell command. This guide is the continuation of the previous section, if you have not yet completed it, start here. We will use two different runnerty notifiers, the console notifier and the email notifier. You can see the rest of available notifiers here. The console notifier will display the messages from:

- Chain start
- Start of process execution
- End of process execution
- Process execution error
- End of chain

The email notifier will only be used for the:

- Process execution error

In addition, a log file will be created that will record a summary at the end of the process.

Let´s go#

1. The first step will be to add the email notifier to our project.#

From the route of our project we execute:

runnerty add @runnerty/notifier-mail

When we install a module with the Runnerty add command, one or more example configurations will be created in our config.json file as well as a plan with an example of use of the installed module.

In this case three different configuration examples will be included in config.json. Keep the settings that suit you best and modify the data with those of your account:

{
"notifiers": [
{
"id": "mail_smtp",
"type": "@runnerty-executor-mail"
// ...
},
{
"id": "mail_aws_ses",
"type": "@runnerty-executor-mail"
// ...
},
{
"id": "mail_sparkpost",
"type": "@runnerty-executor-mail"
// ...
}
]
}

2. We include the notification in the fail event of our process PROCESS_ONE in the file chain-one.json:#

{
"processes": [
{
"id": "PROCESS_ONE",
//...
"notifications": {
"on_fail": [
{
"id": "mail_error",
"subject": "Error @GV(PROCESS_ID) of the chain @GV(CHAIN_ID)",
"message": "Cmd. executed:<br> @GV(PROCESS_EXEC_COMMAND_EXECUTED) <br>Error:<br> @GV(PROCESS_EXEC_ERR_OUTPUT)"
}
]
}
}
]
}

3. Let's try#

Run

runnerty

In the next minute the string will be executed returning through the terminal the notifications that we have configured.

4. Force the error in the process to check that your notification mail is working correctly.#

You can force the error by running an unknown command for the system
"exec": {
"id": "shell_default",
"command": "unknown_cmd"
}

And run:

runnerty
You can force the execution of a chain without waiting for its trigger
runnerty -f CHAIN_ONE --end