SQL errors "nagiosql - Duplicate entry for ..." limited user

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

SQL errors "nagiosql - Duplicate entry for ..." limited user

Postby gzaloprgm » Mon Mar 11, 2019 7:46 am

Hi
A non-admin user is seeing this type of messages when they log in or enter a dashboard:

Image

I think that the table that's failing is tbl_permission (from nagiosql DB), it seems to be recalculating and reinserting the permissions of the user, even if they are already in the table. Is there any way to fix it?

I'm using Nagios XI version 5.5.10. As a side note which might not be related, the nagiosxi database is running on postgres (this is an old installation which was upgraded multiple times)

Thanks, Gonzalo
gzaloprgm
 
Posts: 19
Joined: Mon Aug 06, 2018 8:46 am

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby lmiltchev » Mon Mar 11, 2019 9:13 am

These errors should be fixed in Nagios XI 5.5.10 - I am surprised you are getting them.

Fixed MySQL nagiosql errors in cmdsubsys.log for regular users with limited CCM access [TPS#14045] -JO

https://www.nagios.com/downloads/nagios-xi/change-log/

Can you try rerunning the upgrade script or upgrading to 5.5.11 to see if this is going to fix the issue?

These errors could show up in some instances, when someone would have their cached permissions updating at exactly the same time as the apply config. They should not show up on 5.5.10 once the cron updates.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 11891
Joined: Mon May 23, 2011 12:15 pm

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby gzaloprgm » Wed Mar 13, 2019 12:03 pm

I didn't mention it, but the error message disappears after refreshing the page. It seems to reappear when the limited user logs in after a configuration apply. I don't have subsystem logging enabled so I am not seing it in /usr/local/nagiosxi/var/cmdsubsys.log

lmiltchev wrote: Can you try rerunning the upgrade script or upgrading to 5.5.11 to see if this is going to fix the issue?


Sure, I've just uppgraded to 5.5.11, I'll keep you updated and tell you if we see the error again.

Thanks, Gonzalo
gzaloprgm
 
Posts: 19
Joined: Mon Aug 06, 2018 8:46 am

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby lmiltchev » Wed Mar 13, 2019 12:31 pm

Sounds good! We will keep the thread open for the time being. Let us know if you have any further questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 11891
Joined: Mon May 23, 2011 12:15 pm

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby gzaloprgm » Fri Mar 15, 2019 9:21 am

Unfortunately, it's still happening after upgrading to 5.5.11.

Image
Image

Is there any log or DB dump you can analyse to help track down the issue?

Many thanks, Gonzalo
gzaloprgm
 
Posts: 19
Joined: Mon Aug 06, 2018 8:46 am

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby jomann » Fri Mar 15, 2019 1:50 pm

I have a solution for you for now to remove the errors from the screen. The errors won't hurt anything but we will stop it from happening in future versions. It seems like the apply config permissions updates have not finished by the time the cached permissions rebuild which also triggers an update to the tbl_permissions database.

Also, approximately how many limited CCM users do you have and how many hosts/services do you have? Approximately how many hosts/services per user would you estimate?

To get the messages to not show, you can edit /usr/local/nagiosxi/html/includes/components/ccm/ccm.inc.php and replace the following two lines:

For line 796 replace with:
Code: Select all
exec_sql_query(DB_NAGIOSQL, "INSERT INTO tbl_permission (user_id, object_id, type) VALUES (".$user_id.", ".$o['id'].", ".OBJECTTYPE_HOST.");", false);


For line 809 replace with:
Code: Select all
exec_sql_query(DB_NAGIOSQL, "INSERT INTO tbl_permission (user_id, object_id, type) VALUES (".$user_id.", ".$s['id'].", ".OBJECTTYPE_SERVICE.");", false);


Adding the false to those functions will stop the errors from being displayed to the screen for now until the next version.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
jomann
Development Lead / Senior Developer
 
Posts: 570
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby gzaloprgm » Wed Mar 20, 2019 7:01 am

Thanks a lot, I will patch those files.

As a reference,
How many limited CCM users do you have 24 non/admin users, just 1 with limited CCM access
and how many hosts/services do you have? ~300 / ~4000
Approximately how many hosts/services per user would you estimate? 6 hosts / 24 services (assigned to the limited user)
gzaloprgm
 
Posts: 19
Joined: Mon Aug 06, 2018 8:46 am

Re: SQL errors "nagiosql - Duplicate entry for ..." limited

Postby lmiltchev » Wed Mar 20, 2019 4:57 pm

Sounds good - let us know if you have any further questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 11891
Joined: Mon May 23, 2011 12:15 pm


Return to Nagios XI

Who is online

Users browsing this forum: Bing [Bot] and 32 guests