Related to:
Configuration changes pushed through the UI/Nacoma cannot be saved. Error messages such as "The database is currently being exported by USER" or "Changes could not be saved" may be displayed.
Problem
- Saving configuration change shows "changes could not be saved."
- Saving configuration change shows import errors.
Possible Cause(s)
- Root Cause 1: Incorrect permissions for configuration files.
- Root Cause 2: Invalid configuration files.
- Root Cause 3: Database object locks.
- Root Cause 4: Duplicate entries in configuration files.
Possible Solution(s)
General checks to perform.
On the UI, if an error showing "Changes could not be saved" is shown, you can try to undo the changes by clicking the "Undo" button. If a prompt for a "Complete re-import" is shown, click that. Try to re-do your change and issue a save once more.
Alternatively, you can run the following command on the command line:
php /opt/monitor/op5/nacoma/api/monitor.php -u monitor -a undo_config
Then try to re-do your change and issue a save once more.
Solution Root Cause 1: For incorrect permissions for configuration files.
The UI will issue errors about incorrect permissions for files if it cannot access or write to them:
Issue the command below to view the file permissions for configuration files:
ls -l /opt/monitor/etc/
OP5 Monitor .cfg files should have the ownership properties to monitor:apache. and have file permissions set to 664, with the exception of resource.cfg, which should have the permissions set to 600.
To set these, run the following commands (replace <file_here> with whatever files has the incorrect ownership or permission):
chown monitor:apache /opt/monitor/etc/<file_here>
chmod 664 /opt/monitor/etc/etc/<file_here>
Restart the Naemon service:
systemctl restart naemon
Try to re-do your change and/or issue a save once more.
Solution Root Cause 2: For invalid configuration files.
In some instances, the error shown may or not be helpful in pointing out what the problem is. You can check for the validity of the configuration files to make sure that this is not what is breaking the save. If you made manual changes to your configuration file, there is a likelihood some form of corruption took place.
Run the following command to check for any errors:
asmonitor /usr/bin/naemon --verify-config /opt/monitor/etc/naemon.cfg
An erroneous configuration may return output similar to below:
Warning: host_inter_check_delay_method is deprecated and will be removed. Host checks are delayed sanely - check your configuration
Read main config file okay...
Error: Unexpected EOF in file '/opt/monitor/etc/checkcommands.cfg' on line 45779 - check for a missing closing bracket.
Error processing object config files!
In most instances, the verification check will indicate what file is incorrect and on what line. Inspect the file in question (in this scenario, /opt/monitor/etc/checkcommands.cfg) and check that there are no invalid characters or that brackets for the objects are properly closed. The error shown will typically indicate why the configuration is incorrect.
Solution Root Cause 3: For database object locks.
Object lock errors typically show the message "The database is currently being exported by USER. This should merely take a few seconds, but while it's going on, no other users may edit the database." when saving. In some instances, this message does not go away and can prevent you from making further changes.
Run the following command to check for an object lock:
mysql nacoma -e 'SELECT * FROM objlocks\G'
If there is any output, you may want to check on your changelog as well so that you can re-do any changes if you still need them:
# mysql nacoma -e 'SELECT * FROM changelog\G'
If there are no problems, truncate the table:
# mysql nacoma -e 'TRUNCATE objlocks\G'
Issue a config undo:
php /opt/monitor/op5/nacoma/api/monitor.php -u monitor -a undo_config
Then re-do your changes and save.
Solution Root Cause 4: For duplicate entries on the configuration file.
An error will be shown on the save page when you try to save a configuration with duplicate entries:
No Imported configuration exists
index mismatch: Duplicate entry for service object: 'foo;bar'
The message will indicate what object is problematic (in this case "service object") and which ones (in this case, a host named "foo" and a service named "bar").
Inspect the relevant .cfg file for the object that is highlighted. In this scenario, it is /opt/monitor/etc/services.cfg. If you find there are duplicates, use a text editor such as vim or nano to edit this and remove the duplicates. Manually editing .cfg files are typically discouraged; if you are doubtful, then please consult with Support and raise a ticket along with providing the necessary information.
Once the duplicate entries have been removed, do the following:
First, verify your on disk configuration. Run this and do not proceed if it throws errors:
# asmonitor /usr/bin/naemon --verify-config /opt/monitor/etc/naemon.cfg
Run the following to remove any locks present:
# mysql nacoma -e "truncate objlocks"
Run the following to re-import the (now validated) configuration into the database:
# php /opt/monitor/op5/nacoma/api/monitor.php -u monitor -a undo_config
Finally, restart to apply the config change live:
# mon restart
Related Articles
If Issue Persists
- Please contact our Client Services team via the chat service box available on any of our websites or via email to support@itrsgroup.com
- Make sure you provide to us:
- Screenshot of the error received
- Send us the ist-collect and diagnostic file
-Any troubleshooting step already verified from the ones described in this article.
Comments
0 comments
Please sign in to leave a comment.