Objective
Objective: Understand how stock models work and how to use them.
The action model
Definition
An action model is a predefined command that can be used in the configuration of a user service, a piece of equipment or a unitary service.
This command will only be executed when the status changes from confirmed OK to CRITICAL.
Its implementation is related to the resolution of problems which include for example the restart of a service (Windows or Linux) or the execution of a linux command.
This model catalogue will be enriched according to the needs of our customers.
Predefined action commands
Action templates support the following commands:
Applicable A | Description | Action command |
User Service | Writing a variable in the external application PCvue | write_arcinfo_pcvue_variable |
Hosts | Write to the syslog file of the Linux device associated with the action. | write_syslog_host |
Run a Dos or Powershell command on any Windows device via winexe on winrm. | launch_command_windows_host | |
Call a URL in GET or POST by passing product variables in the URL or content. | call_url_host | |
Unitary Service | Execute a command via SSH on any port, on the device associated with the service | launch_command_linux_debian |
Run a Dos or Powershell command on any Windows device via winexe on winrm. | launch_command_windows_service | |
Restarting a service on Debian Linux OS, via SSH, and on the device associated with the service. | restart_service_linux_debian | |
Restart a service on Windows OS, via SSH, and on the device associated with the service. | restart_service_windows | |
Write to the syslog file of the Linux device associated with the action. Possibility to not execute this action if the device is in CRITICAL or UNKNOWN state. Possibility of not executing this action if the equipment or service is under maintenance. | write_syslog_service | |
Call a URL in GET or POST by passing product variables in the URL or content. | call_url_service |
Variables Product
The product variables (Nagios macros) that can be used in the action template parameters are as follows:
For equipment :
- $_HOSTCOMPANYNAME$
- $_HOSTDOCUMENTATION$
- $_HOSTHOST_CATEGORY_NAME$
- $_HOSTIDHOST$
- $_HOSTINSTRUCTIONS$
- $HOSTADDRESS$
- $HOSTALIAS$
- $HOSTDOWNTIME$
- $HOSTOUTPUT$
- $HOSTSTATE$
- $HOSTSTATETYPE$
- $_HOSTCRITICALITY$
For unitary services :
- $_HOSTCOMPANYNAME$
- $_HOSTHOST_CATEGORY_NAME$
- $_SERVICEDISPLAYNAME$
- $_DOCUMENTATION_SERVICE$
- $_SERVICEHOSTALIAS$
- $_SERVICEIDSERVICE$
- $_SERVICEINSTRUCTIONS
- $HOSTADDRESS$
- $HOSTDOWNTIME$
- $HOSTSTATE$
- $SERVICEDOWNTIME$
- $SERVICEORPUT$
- $SERVICESTATE$
- $SERVICESTATETYPE$
- $_HOSTCRITICALITY$
- $_SERVICECRITICALITY$
Configuration
Creating the action template
To add an action template, go to the Configuration then in the menu General > Action models.
Click on "Add": a configuration window opens.
Fill in the general information and click on "Validate".
You can add action templates for a User Service, Equipment or Unit Service.
Modifying an action template
You can edit an action template. To do so, click on the name of the template you want to modify.
Deleting an action template
Select the action template to be deleted and click on the "Delete" button.
Confirm that you want to delete the action template.
Using the action model
Assignment of the model to a user service, equipment or unit service
To assign an action template to a unitary service, go to the Monitoring then in the menu Technical Operations.
Example I would like to automatically restart the Windows Update service if it stops on my COPCGRE61 server.
Select the unit service to be configured. The configuration window opens. Position yourself on the Action and choose the action model.
Enter the service to be restarted and click on Click Apply.
Note The configuration is the same for a user service or a device.
Changing the assignment of an action template
To modify an action template, proceed as for the assignment. Select the command to be used from the list of action templates.
Deleting the assignment of an action template
To delete an action template from a unitary service, go to the Monitoring then in the menu Technical Operations.
Select the unit service to be modified. The configuration window opens. Move to the Action then select the empty field in the list Model.
Then click on Click Apply.