Nagios XI - Command Subsystem Architecture

Command Subsystem Overview

This command subsystem of Nagios XI is responsible for processing command that are initiated from the Nagios XI web UI.  Many commands initiated from the web UI require specialized scripts to be run on the system.  These scripts are executed by the command subsystem, which then returns their output and return code to the web UI.

 

Architecture Components And Execution Flow

The diagram below shows the different parts of the command subsystem and how they relate to each other.  Each part of the subsystem is explained in greater detail below.


 

The general flow of execution of the command subsystem works as follows:

  1. A user initiates a command from the web UI (e.g. reschedules a service check)

  2. The web UI saves the command in the "xi_commands" table of the nagiosxi mysql database (mariadb on cent/rhel 7 and postgresql on XI versions less than 5)

  3. The web UI displays a throbber icon while AJAX requests are made to check for the result of the submitted command

  4. The cmdsubsys.php script runs as a background process and watches for new commands added to the database.  The cmdsubsys.php script is located at /usr/local/nagiosxi/cron/cmdsubsys.php and runs under cron every minute.  The cron job is defined in /etc/cron.d/nagiosxi.  While the cron job itself runs every minute, the script enters into a loop that lasts 59 seconds - this ensures that the processing is done constantly as opposed to only once every 60 seconds.

  5. The cmdsubsys.php script executes the system command that is required to fulfill the command

  6. The cmdsubsys.php script saves the results of the system command in the "xi_commands" database table

  7. The AJAX poller in the web UI will get the completed status of the command and display a success or error message, depending on the result of the submitted command

 

Troubleshooting Problems

Some potential problems with the command subsystem, as well as troubleshooting information are listed below:

Problem: The throbber continues to spin and never stops when a command is submitted

Potential Causes:

  • The cmdsubsys.php scripts may not be running. Run the following command to see if the script is running:

    • ps axuw | grep cmdsubsys.php
  • There may be a problem with the cron job.  Check the cron file /etc/cron.d/nagiosxi to ensure the job is not commented out.

  • Check the /usr/local/nagiosxi/var/cmdsubsys.log log file for errors.

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

 

Posted by: - Thu, Feb 5, 2015 at 5:43 AM. This article has been viewed 1837 times.
Online URL: https://support.nagios.com/kb/article/nagios-xi-command-subsystem-architecture-58.html

Powered by PHPKB (Knowledge Base Software)