# Moogsoft Docs

## Introduction

Situation Server Tools are tools that enable a user to execute a utility on a remote host.

These tools specify a command and arguments that are run using the Tool Runner servlet (which is configured to connect to the remote host).

• The command can be anything you can run on the host in a Linux terminal command line, such as an inbuilt part of the OS (e.g ping) or your own script
• The arguments are extracted from Situation attributes by prefixing the attribute name with '$', such as$description  for the Situation description

### Note

Please note : In Moogsoft AIOps, the Situation Server Tools managed here are only available form ChatOps in the Situation Room. See "Take Additional Actions" in the Operator Guide .

The steps below describe how to create a Situation Server Tool, its availability filter, command and arguments.

You can also create Situation Server Tools via a command prompt.

## Configuration

Go to System Settings > Tools > Situation Server Tools to open the configuration window:

Button
Description

This can be used to add a new Situation Server Tool

This can be used to delete any selected Situation Server Tool

This can be used to copy any selected Situation Server Tool

## Create a new Situation Server Tool

1. Click the to create a new tool.

2. Fill in the available fields to define the tool. These are listed in the table below:

Field
Input
Description
Name String (Mandatory) The name for the Situation Server Tool (up to 100 characters). This appears in ChatOps when accessing the tool
Description String
(Optional)
The text description of the tool
Context Filter Filter
(Optional)

Click the icon to create a filter for specific criteria which Situations must match for this tool to be available

Command String
(Mandatory)

This is the file path of the command

### Note

Please note : This command must be an accessible path on the host system. The host system and access information is defined in the Tool Runner servlet

Arguments String
This is the specific input for the command , which can use Situation attributes.

## Edit a Situation Server Tool

1. Select the Situation Server Tool you want to edit or type in the search box to find the required tool.

2. Edit fields as described above.

### Note

Please note: You cannot edit the tool Name. If you need to do this, create a duplicate with the name you want. You can then delete the original

3. Click Save Changes .

## Create a Tool with a Command Prompt

You can create Situation Server Tools via a command prompt.

This is useful for efficient creation of multiple tools using a scripted process, for example.

1. Open a new Terminal window on the Moogsoft AIOps system and type the following:

moog_add_sitn_server_tool

2. Type any flags and arguments for the tool settings. See the examples below.

### Note

Moogsoft AIOps command line tools are located here:
 /usr/share/moogsoft/bin/utils 
To display the help information for this tool, type:  moog_add_sitn_server_tool  and press Enter .
Use a double-dash prefix "  --  " to define all following text as arguments. This ensures arguments are not misinterpreted as flags.
For example, "  -- -c  " to define the argument "  -c  ", which would otherwise be interpreted as the command flag

3. When you have defined the tool, press Enter .

If successful,  T ool was added  appears.

### Note

• If there is a mistype, the help information appears
• If the tool name already exists,  Error: A tool named: [ toolname ] already exists.  appears
• If a Run for time of less than 5 seconds is typed,  Error: The run_for value is too small. Please provide a value no smaller than 5 seconds.  appears

Once the UI is refreshed, newly created tools will appear in the Situation Server Tools configuration window.

### Examples

moog_add_sitn_server_tool --name "Sitn Id" --desc "Get the Situation ID" --cmd echo --args "Situation ID = \$sig_id" --run_for 42 This creates a tool with the following settings: • Name : Sitn ID (  --name "Sitn ID"  ). Quotes are required because there is a space in the name • Description : Get the Situation ID (  --desc "Get the Situation ID"  ) • Context Filter : none • Command : echo (  --cmd echo  ) • Arguments : display 'Situation ID = ID ' • (  --args "Situation ID = \$sig_id"  ). The backslash is required to escape the '\$' because it is an environment variable
• Run for : 42 seconds (  --run_for 42  )
moog_add_sitn_server_tool -d "five pings" -m "sig_id<10" -c ping -a -- -c 5

This creates a tool with the following settings:

• Description : five pings (  -d "five pings"  )
• Context Filter : ID < 10 (  -m "sig_id<10"  )
• Command : ping (  -c ping  )
• Arguments : ping five times (  -- -c 5  ). The argument starts with  -c  which is itself a tool flag. Therefore the "--" double-dash prefix is used to interpret  -c 5  as an argument, and not a flag
• Run for : no time set (no -r flag and argument)
• Name : ping. The name is not defined here (no -n flag and argument) so the Command is used as the name by default

## Available Situation Attributes

These are the Situation attributes available:

affected_entities
category
created_at
delta_entities
delta_priority
description
first_event_time
internal_priority
last_event_time
last_state_change
moderator_id
participants
process_list
queue
rating.rating
service_list
sig_id
status
story_id
teams
username