EV Observe - Action Templates

Last modified on 2023/05/04 12:41

Action templates perform actions on a host or service when there is a change in the status.

Each action template:

  •  Runs a predefined command that you can customize using a set of contextual parameters.
  • Is configured in host or service.

Examples

  • Restart the service or run a Powershell script on the COPCGRE61 server when the status server changes from OK Status icon - OK.png (normal operation) to Critical Status icon - Critical.png (non-operational).
  • Restart the Windows Update service automatically on the COPCGRE61 server if the service is stopped.

Notes

  • Predefined commands are provided by EasyVista.
    • You cannot create a new one or delete an existing one.
    • You can only customize them using the contextual parameters.
      Open url.png See List of predefined commands
  • A given predefined command can be called by several action templates with different values specified for each contextual parameter.
  • Action templates can use product variables, e.g. Nagios macros. Open url.png See List of product variables
  • Action templates will use the monitoring account information inherited from the associated host/service (account locked for the host/service), or alternatively, from the parent site of the host/service, from a higher-level site or from the company.

Menu access

  • Define an action template: Configuration > General > Action Templates
  • Assign an action template to a host/service: Configuration > Hosts / Services > click the host/service and select the Action tab

Screen description

         Action template.png

Name: Name of the action template.

  • The name must be unique.

Command: Predefined command run by the action template. Open url.png See List of predefined commands

  • The list of contextual parameters for the selected command will automatically appear.

example  Username, Domain, Syslog write format

  • Certain predefined commands enable you to select the status that will trigger the command in the action template.

example  write_syslog_host command

Description: Description of the action template.

Procedures

How to create an action template

Step 1: Create the new action template

1. Select the company where you want to implement the new action template.

  • Go to the Web app.
  • Select the company from the company tree structure.

Note

  • The selected company must be associated with a Box.
  • You can create a new company. Open url.png See the procedure

    Company tree structure.png

2. Create the new action template associated with the selected company.

  • Select Configuration > General > Action Templates in the menu.
  • Select the Host or Service tab depending on the type of component to be associated with the new action template.
  • Click + Add.
     

Step 2: Configure the action template

1. Specify the name of the new action template.

2. Select the predefined command to be run by the action template.

The list of contextual parameters for the command will appear.

3. Specify the contextual parameters for the command.

Best Practice icon.png  Click in each parameter field to display a contextual help tooltip.

4. Click Apply.

The new action template will be created.

How to use an action template

Step 1: Select the host/service to which you want to assign the action template

1. Select Configuration > Hosts in the menu to assign an action template to a host or select Configuration > Services in the menu to assign the action template to a service.

The list of hosts/services will appear.

2. Click the host/service to which you want to assign the action template.

The window for configuring the host/service will appear.
 

Step 2: Configure the action template for the host/service

1. Select the Action tab.

2. Select the action template you want to assign to the host/service.

The predefined command to be run by the action template and its list of contextual parameters will appear.

         Assign action template.png

3. Specify the contextual parameters for the predefined command.

Best Practice icon.png  Click in each parameter field to display a contextual help tooltip.

4. Click Apply.

List of predefined commands

Command Description

Commands applicable to hosts

write_syslog_host This writes to the syslog log of the Linux host associated with the action template.
launch_command_windows_host This runs a DOS or PowerShell command on a Windows host using Winexe on WinRM.
call_url_host This calls a URL using GET (read) or POST (write) by passing product variables in the URL or contents.

Commands applicable to services

launch_command_linux_debian This runs a command via SSH on any port of the host associated with the service.
launch_command_windows_service This runs a DOS or PowerShell command on a Windows host using Winexe on WinRM.
restart_service_linux_debian This restarts a service via SSH on a Debian Linux OS on the host associated with the service.
restart_service_windows This restarts a service via SSH on a Windows OS on the host associated with the service.
write_syslog_service This writes to the syslog log of the Linux host associated with the action template.

Note: You can choose not to run the action if the status of the host/service is Critical or Unknown, or if the host/service is undergoing maintenance.

call_url_service This calls a URL using GET (read) or POST (write) by passing product variables in the URL or contents.

List of product variables

Hosts

Nagios macro Description
$_HOSTCOMPANYNAME$ Name of the company associated with the host.
$_COMPANY_EXTERNAL_ID$ External ID of the company associated with the host.
$_HOSTIDHOST$ Internal ID of the host.
$_ITSM_ID$ External ID of the host.
$_HOSTDOCUMENTATION$ Contents of the Documentation field in the Details form of the host.
$_HOSTHOST_CATEGORY_NAME$ Contents of the Category field in the Details form of the host.
$_HOSTINSTRUCTIONS$ Contents of the Instruction field in the Details form of the host.
$_HOSTCRITICALITY$ Contents of the Business Impact field in the Details form of the host.
$HOSTADDRESS$ Address of the host. This value is taken from the address parameter in the host definition.
$HOSTALIAS$ Long name and description of the host. This value is taken from the alias parameter in the host definition.
$HOSTDOWNTIME$ Number indicating the scheduled downtime depth for the host.
  • If the host is currently in a period of scheduled downtime, the value will be greater than zero.
  • If the host is not currently in a period of scheduled downtime, the value will be zero.
$HOSTOUTPUT$ Text output from the last host check.
example Ping OK
$HOSTSTATE$ String indicating the current state of the host, i.e. UP, DOWN, or UNREACHABLE.
$HOSTSTATETYPE$ String indicating the current state type for the host check, i.e. HARD or SOFT.
  • The = SOFT state occurs when the host check returns a non-OK (non-UP) state and is in the process of being retried.
  • The = HARD state occurs when the host check has been run a specified maximum number of times.

Services

Nagios macro Description
$_HOSTCOMPANYNAME$ Parent company of the host associated with the service.
$_HOSTCOMPANY_EXTERNAL_ID$ External ID of the host associated with the service.
$_SERVICEDISPLAYNAME$ Name of the service.
$_SERVICEIDSERVICE$ Internal ID of the service.
$_HOSTITSM_ID$ External ID of the host associated with the service.
$_SERVICEDOCUMENTATION$ Contents of the Documentation field in the Details form of the service.
$_HOSTHOST_CATEGORY_NAME$ Contents of the Category field in the Details form of the host associated with the service.
$_SERVICEINSTRUCTIONS$ Contents of the Instruction field in the Details form of the service.
$_HOSTCRITICALITY$ Contents of the Business Impact field in the Details form of the host associated with the service.
$_SERVICECRITICALITY$ Contents of the Business Impact field in the Details form of the service.
$_SERVICEHOSTALIAS$ Long name and description of the host. This value is taken from the alias parameter in the host definition.
$HOSTADDRESS$ Address of the host. This value is taken from the address parameter in the host definition.
$HOSTDOWNTIME$ Number indicating the scheduled downtime depth for the host.
  • If the host is currently in a period of scheduled downtime, the value will be greater than zero.
  • If the host is not currently in a period of scheduled downtime, the value will be zero.
$HOSTSTATE$ String indicating the current state of the host, i.e. UP, DOWN, or UNREACHABLE.
$SERVICEDOWNTIME$ Number indicating the scheduled downtime depth for the service.
  • If the service is currently in a period of scheduled downtime, the value will be greater than zero.
  • If the service is not currently in a period of scheduled downtime, the value will be zero.
$SERVICEOUTPUT$ Text output from the last service check.
example Ping OK
$SERVICESTATE$ String indicating the current state of the service, i.e. OK, WARNING, UNKNOWN, or CRITICAL.
$SERVICESTATETYPE$ String indicating the current state type for the service check, i.e. HARD or SOFT.
  • The = SOFT state occurs when the service check returns a non-OK state and is in the process of being retried.
  • The = HARD state occurs when the service check has been run a specified maximum times.
Tags:
Powered by XWiki © EasyVista 2024