Nagios XI Reconfiguration Collisions and Conflicts
Posted: Sat Feb 14, 2015 12:16 pm
I am working on a universal utility (shell script) to perform nearly every common "add/delete" function that you can do in the Nagios XI GUI. The mechanism for this is, of course, the manipulation of the appropriate configuration files and then execution of the reconfigure_nagios.sh script. When done properly, this works every time.
I've learned how Nagios keeps reconfigurations isolated through the use of a lock file, which again, works perfectly. However, I have concern that I don't know how to address exactly. A scenario would best explain:
- User A is in the GUI and has made a change to a service Y belonging to host X
- User A then saves the change, but does not apply it yet as they have other changes to make (at this point Nagios XI indicates changes need to be applied)
- User B is using an external automation tool to disable the event handler associated with that same service Y on host X.
- The external tool captures the current state of the host X service Y configuration by looking at the current /usr/local/nagios/etc/services/X.cfg file
- The external tool sets the event_handler_enabled value to 0 and creates a modified X.cfg service configuration file and places it in the /usr/local/nagios/etc/import directory
- The external tool then executes reconfigure_nagios.sh and the change is applied
At this point user A has a certain expectation of the what the state of service Y will be for host X. However, that state was changed "underneath" the GUI by user B and external automation.
While Nagios will certainly function, this can create confusion. In fact, I don't recall ever seeing anything about the effect of multiple GUI users modifying the same object in different manners and how Nagios would handle that. I know that any reconfiguration will be handled serially because only one reconfiguration can be occurring at the same time.
One way to help the external automation stay "in sync" with the GUI would be if it could know that there were pending changes. How would we know that the "Changes detected!" flag was set?
I've learned how Nagios keeps reconfigurations isolated through the use of a lock file, which again, works perfectly. However, I have concern that I don't know how to address exactly. A scenario would best explain:
- User A is in the GUI and has made a change to a service Y belonging to host X
- User A then saves the change, but does not apply it yet as they have other changes to make (at this point Nagios XI indicates changes need to be applied)
- User B is using an external automation tool to disable the event handler associated with that same service Y on host X.
- The external tool captures the current state of the host X service Y configuration by looking at the current /usr/local/nagios/etc/services/X.cfg file
- The external tool sets the event_handler_enabled value to 0 and creates a modified X.cfg service configuration file and places it in the /usr/local/nagios/etc/import directory
- The external tool then executes reconfigure_nagios.sh and the change is applied
At this point user A has a certain expectation of the what the state of service Y will be for host X. However, that state was changed "underneath" the GUI by user B and external automation.
While Nagios will certainly function, this can create confusion. In fact, I don't recall ever seeing anything about the effect of multiple GUI users modifying the same object in different manners and how Nagios would handle that. I know that any reconfiguration will be handled serially because only one reconfiguration can be occurring at the same time.
One way to help the external automation stay "in sync" with the GUI would be if it could know that there were pending changes. How would we know that the "Changes detected!" flag was set?