Page 1 of 2

Apply config don't work first time

Posted: Mon Jul 29, 2019 9:52 am
by parisa
Hi,
I use Nagios XI 5.6.5 and I faced with a issue, when I attempt to apply config, it takes some seconds and it seems, it's done without error but changed configurations are not applied but when I attempt for it the second time, it's applied fast.
I have tried the case by GUI and API, but I observed the same results, Apply config doesn't work first time but it works next time.

Would you please help me about it ?

Also the API of delete (host delete) don't work as "config/host/<host_name>" , I wanted to delete a host, I faced with error as below:

Code: Select all

curl -XDELETE "http://Server-IP/nagiosxi/api/v1/config/host/testapihost?apikey=API-KEY&pretty=1&applyconfig=1"
{
    "error": "Missing required variables",
    "missing": [
        "host_name"
    ]
}
but I could delete host as below:

Code: Select all

curl -XDELETE "http://Server-IP/nagiosxi/api/v1/config/host?apikey=API-KEY&pretty=1&host_name=testapihost"
Thanks

Re: Apply config don't work first time

Posted: Tue Jul 30, 2019 9:54 am
by lmiltchev
On the apply configuration issue - please PM me your latest profile.

Admin > System Config > System Profile > Download Profile


On the REST API issue - I was able to recreate the problem. Our developers are looking into this. I will get back to you when I get some more info. As of now, it seems like this works:

Code: Select all

curl -XDELETE "http://Server-IP/nagiosxi/api/v1/config/host?host_name=testapihost&apikey=API-KEY&pretty=1&applyconfig=1"
This:

Code: Select all

curl -XDELETE "http://Server-IP/nagiosxi/api/v1/config/host/testapihost?apikey=API-KEY&pretty=1&applyconfig=1"
*should* also work, but it doesn't. I expect that our developers will be fixing this soon.

Re: Apply config don't work first time

Posted: Wed Jul 31, 2019 12:57 am
by parisa
Hi,
@lmiltchev Thanks for your answer
The profile has been attached.
I had used from below API, but it was only for your kindly information.

BR.
Parisa

Moderator's Note: The profile has been shared with the support team but has been removed from the public forum.

Re: Apply config don't work first time

Posted: Wed Jul 31, 2019 4:10 pm
by benjaminsmith
Hi @Parisa,

Looking over your system profile, we noticed possible issues with your database. However, since the database is offloaded, the log was not in the system profile.

Can you retrieve the database logs from the offloaded server? Thanks

Code: Select all

# For Cent OS7 the database is MariaDB
/var/log/mariadb/mariadb.log

Re: Apply config don't work first time

Posted: Sat Aug 03, 2019 1:01 am
by parisa
Hi @ benjaminsmith and thanks for your answer
I don't have mariadb.log, I just have mariadb.log.rpmsave and the log is old and related to a month ago. (before the problem)
I don't know why the log isn't existed but before I face with case I reboot the server (because I had upgraded Nagios XI from version 5.6.1 to 5.6.5) and I observed the mariadb service on Nagios server (local Mariadb) was run by mistake, now I disable it.
Is it possible another solution for investigation the issue?

BR.
Parisa

Re: Apply config don't work first time

Posted: Sun Aug 04, 2019 5:37 am
by parisa
Hi
I don't have mariadb.log, In my.cnf , it is defined but I don't have the log file. I just have mariadb.log.rpmsave and it is old.
Service mariadb was restart, at least it should be in the log.
would you please guide me about it.


BR.
Parisa

Re: Apply config don't work first time

Posted: Mon Aug 05, 2019 1:32 pm
by benjaminsmith
Hi Parisa,

I believe that file is an archive from when the database or server was upgraded. There should be a database log file on the host. Can you post the my.cnf file, so we can find its path.

Alternatively, if you can log into the mysql console, the following command will output the log location.

Code: Select all

show global variables like 'log_error';
Also, with regards to the Apply Configuration issue. The first time it fails and the second time it woks. Please run the following tail command while you apply configuration and post the output for both cases for us to compare. Thanks.

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log

Re: Apply config don't work first time

Posted: Tue Aug 06, 2019 12:01 am
by parisa
Hi
Thanks for your guidance.
The problem related to apply config was solve after rebooting and repairing DB.
But I have checked the path of DB error log that was in my.cnf but In that path there was not mariadb.log.

Code: Select all

[mysqld]
bind-address=x.x.x.x
port=3306
query_cache_size=16M
query_cache_limit=4M
tmp_table_size=64M
max_heap_table_size=64M
key_buffer_size=32M
table_open_cache=32
innodb_file_per_table=1
innodb_buffer_pool_size=2G
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

Code: Select all

MariaDB [(none)]> show global variables like 'log_error';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_error     |       |
+---------------+-------+
1 row in set (0.001 sec)
BR.
Parisa

Re: Apply config don't work first time

Posted: Tue Aug 06, 2019 7:05 am
by scottwilkerson
Glad to hear the problem was resolved.

Are you saying that /var/log/mariadb/mariadb.log doesn't exist on the DB server?

Re: Apply config don't work first time

Posted: Tue Aug 06, 2019 7:32 am
by parisa
Thanks,

Yes, there was not /var/log/mariadb/mariadb.log on DB server, I copied "log-error=/var/log/mariadb/mariadb.log" in first part of my.cnf , after "[mysqld]". Then restarted mariadb.services, the file mariadb.log was created.

I offloaded and upgraded DB around 25 days ago, and I have not checked it till yesterday, I'm not sure but it seems after upgrading and offloading DB, the default configuration my.cnf is not complete to generate the mariadb.log, because I had the file before that. (on Nagios server)


BR.
Parisa