Table of Contents

IT Automation Omnishell

Introduction to Omnishell

Enterprise version.Version NG 741 or higher.

Omnishell is a Pandora FMS Enterprise features used for IT orchestration/automation. It is a fully native and Pandora FMS console and agent integrated console that allows defining commands or blocks of commands and selecting targets where they can be executed. Learn more about it in our video tutorial «IT automation in Pandora FMS: Omnishell».

Omnishell is based on communication between the different components of Pandora FMS through Tentacle, to safely coordinate executions and responses of the commands you wish to program.


You must have installed in Pandora FMS console the dependency php-yaml and in Software GNU/Linux agents, the dependency perl-YAML-Tiny.

Additional Tentacle server settings

Only for version NG 742 or previous version.

 # Filters (regexp:dir,regexp:dir...)
 filters .*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.lock:trans**;.*\.rcmd:commands**
/var/spool/pandora/data_in/commands
 chown pandora:apache -R /var/spool/pandora/data_in/commands
 chmod g+s /var/spool/pandora/data_in/commands

Performance

An Omnishell task is defined by three elements:

Precondition

Through one or several commands with each sequential execution that must be satisfying for all of them (result errorlevel 0 ).

Commands

To be executed in the target software agent, in a sequential list.

Postcondition

Through one or several commands with each sequential execution that must be satisfying for all of them (result errorlevel 0 ).

If any of the commands defined in Precondition, Commands or Postconditions goes into interactive mode, blocking the execution flow, the task will be interrupted. The Software agent itself will destroy the process after the timeout configured for that task.

Usage example

Example in GNU Linux

An example shall be explained to better understand the working process of the new Omnishell tool.

Problem: The objective is configuring the auto-start of the HTTPD service on CentOS 6 systems in a massive way.

For example:

[ `rpm -qa | grep -i httpd | wc -l` -lt 1 ] || yum install -y httpd

This line will verify whether the service is installed and will install it in case it is not.

To that end, the following commands must be used:

 /etc/init.d/httpd restart
 chkconfig httpd on

This will start the service on the remote machine and will configure the system to start it up.

[ `netstat -lptn | grep 80 | grep LISTEN | wc -l` -gt 0 ]

Once the action the agents must perform is clearly set, create the command in Omnishell:

After creating the command, assign the needed agents.

The progress of the command execution can be seen in the selected agents:

Accessing the view, you will see the estimated time left for command execution:

When mass command execution is applied, the view will be as the following one from the example:

Once the agent's response is received, execution results will be displayed. By clicking on its box, a modal can be obtained with extra information:

Example in MS Windows

For this environment, Omnishell is still in process, so some of its features are still subject to changes or are not available yet. This is only temporarily and we apologize for that.

Regarding the configuration process in Pandora FMS console, repeat exactly the same steps carried out with the previous example in GNU/Linux and only the code to be executed will change.

Due to the simplicity of this example, only the precondition and the main task stages are used, respectively:

powershell.exe -command "Start-Sleep -Seconds 1"
powershell.exe -command "$mode = Get-Executionpolicy ; if ( $mode -like "restricted" ) {Write-Error -Message "0"}"

PowerShell is a new Windows shell that has been specifically conceived for system admins. This includes an interactive system symbol and a scripting environment that can be used together or separately. It comes installed with said operating system, although you may install PowerShell Core from its repository in GitHub to get the latest updated version. You may get more interesting information about PowerShell in Pandora FMS blog.

In the precondition it is checked that PowerShell is installed and can be used, otherwise it will return an error and it will not be able to be executed in the next step.

In the main task, it is investigated about the possibilities of executing scripts written in PowerShell. If its properly executed you may add code at the checking stage to use one and carry out longer and more complex tasks. To learn more, check the documentation about how to execute scripts in a module or how tu use a template to create a module that uses PowerShell.

During the Software agent installation check the option Enable remote config. If you already have that agent installed, modify the file %PROGRAMFILES%\pandora_agent\pandora_agent.conf with admin rights and add (or modify) the following line: remote_config 1. In the group of the Pandora FMS program from the home menu there is a direct access to the script %PROGRAMFILES%\pandora_agent\scripts\edit_config_file.bat to make things easy.

Comments

Go back to Pandora FMS documentation index