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.
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:
A user initiates a command from the web UI (e.g. reschedules a service check)
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)
The web UI displays a throbber icon while AJAX requests are made to check for the result of the submitted command
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.
The cmdsubsys.php script executes the system command that is required to fulfill the command
The cmdsubsys.php script saves the results of the system command in the "xi_commands" database table
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
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
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.
For any support related questions please visit the Nagios Support Forums at:
Article ID: 58
Created On: Thu, Feb 5, 2015 at 5:43 AM
Last Updated On: Tue, May 17, 2016 at 2:18 PM
Authored by: egalstad
Online URL: https://support.nagios.com/kb/article/nagios-xi-command-subsystem-architecture-58.html