NagiosXI 5.5.5 ( installed from nagiosxi repo)
OS: RHEL 7.5
Am doing bulk deletion of 2000+ services using parallel excecution nagiosxi api ( http://localhost/nagiosxi/api/v1/config/service )
It works, but the process seems to be extremely slow ( 20+ mins approx )
I do see sequential execution of the below script in the back-end :
Can you share the commands you're running against the API? Do they have the &applyconfig=1 option? This could be causing it to be slow if it is set for each command. It would be best to run most of the DELETE commands without this option and then run the final command with this option. Doing it this way removes the object and then applies the config once afterwards.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
# loop run thru deletion of 2000 services
loop for i = 1 to 2000
curl -XDELETE http://localhost/nagiosxi/api/v1/config/service?apikey=NAGIOSXI_APIKEY&host_name=service[i]&service_description=host[i]&force=1&pretty=1
loop ends
# runs applyconfig after services deletion
curl -XPOST http://localhost/nagiosxi/api/v1/system/applyconfig?apikey=NAGIOSXI_APIKEY&pretty=1
Also, while performing this bulk removal noticed the below in the NagiosXI UI :
Warning: mysqli_real_connect(): (HY000/1040): Too many connections in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 125
Warning: mysqli_real_connect(): (HY000/1040): Too many connections in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 125
Warning: mysqli_real_connect(): (08004/1040): Too many connections in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 125
Databse Error
A database connection error has been detected, please follow the repair prompt below. If the issue persists, please contact Nagios support.
Run the following from the CLI as root to attempt to repair the DB:
/usr/local/nagiosxi/scripts/repair_databases.sh
Warning: mysqli_real_connect(): (HY000/1040): Too many connections in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysqli.inc.php on line 125
I would recommend that you increase the max_connections value in the /etc/my.cnf file to a higher number. This should speed up your Nagios XI server (and the REST API commands). For more information, see our KB article on the topic:
mysql -uroot -pnagiosxi -e "show variables like 'max_connections';"
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
How many users log in the Nagios XI server at the same time? This value (819) is quite high... You may need to increase the max_connections value in the /etc/my.cnf even more if you are reaching this number.
Be sure to check out our Knowledgebase for helpful articles and solutions!