Hi ,
I tried to setup users (with monitoring contacts) and trying to give read only access to only few process checks following below link
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
For example -
say user1 mapped to contact1 and contactgroup1 have contact1 .
Mapped contactgroup1 to hosts & services which I need to provide read-only access to user1.
When logged in with user1 in another browser, he can't see any services & hosts that are mapped to.
Note: I have implemented above in couple of other projects which worked like breeze, but for current new project struggling to setup as per requirement.
Tried below points already.
* executed repair scripts (repairmysql.sh and repair_databases.sh)
* tried checking nagios.log - no errors found
* found below errors in /var/log/messages while executing "apply configuration" - not sure if this could be related
Jun 14 15:08:17 mon01 ndo2db: Error: mysql_query() failed for 'DELETE FROM nagios_contacts WHERE instance_id='1''
Jun 14 15:08:17 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
Jun 14 15:08:18 mon01 ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='4242', alias='XXXXXX', email_address='XXXXXXX', pager_address='', host_timeperiod_object_id='4241', service_timeperiod_object_id='4241', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='1', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='1', notify_host_flapping='1', notify_host_downtime='1', minimum_importance='0' ON DUPLICATE KEY UPDATE instance_id='1', config_type='1', contact_object_id='4242', alias='XXXXXXXXX', email_address='XXXXX', pager_address='', host_timeperiod_object_id='4241', service_timeperiod_object_id='4241', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='1', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='1', notify_host_flapping='1', notify_host_downtime='1', minimum_importance='0''
Jun 14 15:08:18 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
Jun 14 15:08:18 mon01 ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='262', alias='Nagios Administrator', email_address='XXXXXX', pager_address='', host_timeperiod_object_id='229', service_timeperiod_object_id='229', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='0', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='0', notify_host_flapping='1', notify_host_downtime='0', minimum_importance='0' ON DUPLICATE KEY UPDATE instance_id='1', config_type='1', contact_object_id='262', alias='Nagios Administrator', email_address='XXXXX', pager_address='', host_timeperiod_object_id='229', service_timeperiod_object_id='229', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='0', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='0', notify_host_flapping='1', notify_host_downtime='0', minimum_importance='0''
Jun 14 15:08:18 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
Jun 14 15:08:18 mon01 ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='4234', alias='XXXXXX', email_address='XXXXXX', pager_address='', host_timeperiod_object_id='4233', service_timeperiod_object_id='4233', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='1', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='1', notify_host_flapping='1', notify_host_downtime='1', minimum_importance='0' ON DUPLICATE KEY UPDATE instance_id='1', config_type='1', contact_object_id='4234', alias='XXXXX', email_address='XXXXX', pager_address='', host_timeperiod_object_id='4233', service_timeperiod_object_id='4233', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='1', notify_service_warning='1', notify_service_unknown='1', notify_service_critical='1', notify_service_flapping='1', notify_service_downtime='1', notify_host_recovery='1', notify_host_down='1', notify_host_unreachable='1', notify_host_flapping='1', notify_host_downtime='1', minimum_importance='0''
Jun 14 15:08:18 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
Jun 14 15:08:18 mon01 ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='266', alias='Default Contact', email_address='root@localhost', pager_address='', host_timeperiod_object_id='246', service_timeperiod_object_id='246', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='0', notify_service_warning='0', notify_service_unknown='0', notify_service_critical='0', notify_service_flapping='0', notify_service_downtime='0', notify_host_recovery='0', notify_host_down='0', notify_host_unreachable='0', notify_host_flapping='0', notify_host_downtime='0', minimum_importance='0' ON DUPLICATE KEY UPDATE instance_id='1', config_type='1', contact_object_id='266', alias='Default Contact', email_address='root@localhost', pager_address='', host_timeperiod_object_id='246', service_timeperiod_object_id='246', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='0', notify_service_warning='0', notify_service_unknown='0', notify_service_critical='0', notify_service_flapping='0', notify_service_downtime='0', notify_host_recovery='0', notify_host_down='0', notify_host_unreachable='0', notify_host_flapping='0', notify_host_downtime='0', minimum_importance='0''
Jun 14 15:08:18 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
* I have contacts.cfg file without any issues which is listed in the nagios.cfg file as well
* why would nagios complain about "mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'"
* Why mysql_error looks for files ? ideally MySQL should complain about tables right ?
* why nagios trying to delete instance id 1 " Error: mysql_query() failed for 'DELETE FROM nagios_contacts WHERE instance_id='1''"
After troubleshooting for 3-4 hours, still couldn't fix the issue , thought of seeking help from forum.
Please help to advise fix for above.
Reading many other posts mostly it will be gone by repair MySQL but in my case this was not fixed.
NagiosXI :: Contacts and users issue
-
gsl_ops_practice
- Posts: 151
- Joined: Thu Apr 09, 2015 9:14 pm
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: NagiosXI :: Contacts and users issue
Hi,
Thanks for posting the error output, it does look like a database issue.
Also, please try running the following command to repair the database and let me know if you notice any improvement.
Lastly, please pm the system profile.
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Regards,
Benjamin
Thanks for posting the error output, it does look like a database issue.
Let's make sure the nagios_contacts file exists with the proper permissions. Please post the output to the following command.Jun 14 15:08:18 mon01 ndo2db: mysql_error: 'Can't find file: 'nagios_contacts' (errno: 2)'
Code: Select all
ls -la /var/lib/mysql/nagios/nagios_contacts*
Code: Select all
mysqlcheck -r -f -uroot -pnagiosxi --all-databases
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Regards,
Benjamin
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
gsl_ops_practice
- Posts: 151
- Joined: Thu Apr 09, 2015 9:14 pm
Re: NagiosXI :: Contacts and users issue
Please see the o/p and attached the profile file
Moderator's Note: The profile has been shared with the support team but has been removed from the public forum.
Code: Select all
# ls -la /var/lib/mysql/nagios/nagios_contacts*
-rw-rw---- 1 mysql mysql 10026 Sep 6 2015 /var/lib/mysql/nagios/nagios_contacts.frm
-rw-rw---- 1 mysql mysql 1088 Aug 7 2017 /var/lib/mysql/nagios/nagios_contacts.MYD
-rw-rw---- 1 mysql mysql 9240 Sep 6 2015 /var/lib/mysql/nagios/nagios_contactstatus.frm
-rw-rw---- 1 mysql mysql 204 Jun 22 13:38 /var/lib/mysql/nagios/nagios_contactstatus.MYD
-rw-rw---- 1 mysql mysql 3072 Jun 22 13:45 /var/lib/mysql/nagios/nagios_contactstatus.MYI
#
Code: Select all
# mysqlcheck -r -f -uroot -pnagiosxi --all-databases
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
nagios.nagios_acknowledgements OK
nagios.nagios_commands OK
nagios.nagios_commenthistory OK
nagios.nagios_comments OK
nagios.nagios_configfiles OK
nagios.nagios_configfilevariables OK
nagios.nagios_conninfo OK
nagios.nagios_contact_addresses OK
nagios.nagios_contact_notificationcommands OK
nagios.nagios_contactgroup_members OK
nagios.nagios_contactgroups OK
nagios.nagios_contactnotificationmethods OK
nagios.nagios_contactnotifications OK
nagios.nagios_contacts
Error : Can't find file: 'nagios_contacts' (errno: 2)
status : Operation failed
nagios.nagios_contactstatus OK
nagios.nagios_customvariables OK
nagios.nagios_customvariablestatus OK
nagios.nagios_dbversion OK
nagios.nagios_downtimehistory OK
nagios.nagios_eventhandlers OK
nagios.nagios_externalcommands OK
nagios.nagios_flappinghistory OK
nagios.nagios_host_contactgroups OK
nagios.nagios_host_contacts OK
nagios.nagios_host_parenthosts OK
nagios.nagios_hostchecks OK
nagios.nagios_hostdependencies OK
nagios.nagios_hostescalation_contactgroups OK
nagios.nagios_hostescalation_contacts OK
nagios.nagios_hostescalations OK
nagios.nagios_hostgroup_members OK
nagios.nagios_hostgroups OK
nagios.nagios_hosts OK
nagios.nagios_hoststatus OK
nagios.nagios_instances OK
nagios.nagios_logentries OK
nagios.nagios_notifications OK
nagios.nagios_objects OK
nagios.nagios_processevents OK
nagios.nagios_programstatus OK
nagios.nagios_runtimevariables OK
nagios.nagios_scheduleddowntime OK
nagios.nagios_service_contactgroups OK
nagios.nagios_service_contacts OK
nagios.nagios_service_parentservices OK
nagios.nagios_servicechecks OK
nagios.nagios_servicedependencies OK
nagios.nagios_serviceescalation_contactgroups OK
nagios.nagios_serviceescalation_contacts OK
nagios.nagios_serviceescalations OK
nagios.nagios_servicegroup_members OK
nagios.nagios_servicegroups OK
nagios.nagios_services OK
nagios.nagios_servicestatus OK
nagios.nagios_statehistory OK
nagios.nagios_systemcommands OK
nagios.nagios_timedeventqueue OK
nagios.nagios_timedevents OK
nagios.nagios_timeperiod_timeranges OK
nagios.nagios_timeperiods OK
nagiosql.tbl_command OK
nagiosql.tbl_contact OK
nagiosql.tbl_contactgroup OK
nagiosql.tbl_contacttemplate OK
nagiosql.tbl_domain OK
nagiosql.tbl_host OK
nagiosql.tbl_hostdependency OK
nagiosql.tbl_hostescalation OK
nagiosql.tbl_hostextinfo OK
nagiosql.tbl_hostgroup OK
nagiosql.tbl_hosttemplate OK
nagiosql.tbl_info OK
nagiosql.tbl_lnkContactToCommandHost OK
nagiosql.tbl_lnkContactToCommandService OK
nagiosql.tbl_lnkContactToContactgroup OK
nagiosql.tbl_lnkContactToContacttemplate OK
nagiosql.tbl_lnkContactToVariabledefinition OK
nagiosql.tbl_lnkContactgroupToContact OK
nagiosql.tbl_lnkContactgroupToContactgroup OK
nagiosql.tbl_lnkContacttemplateToCommandHost OK
nagiosql.tbl_lnkContacttemplateToCommandService OK
nagiosql.tbl_lnkContacttemplateToContactgroup OK
nagiosql.tbl_lnkContacttemplateToContacttemplate OK
nagiosql.tbl_lnkContacttemplateToVariabledefinition OK
nagiosql.tbl_lnkHostToContact OK
nagiosql.tbl_lnkHostToContactgroup OK
nagiosql.tbl_lnkHostToHost OK
nagiosql.tbl_lnkHostToHostgroup OK
nagiosql.tbl_lnkHostToHosttemplate OK
nagiosql.tbl_lnkHostToVariabledefinition OK
nagiosql.tbl_lnkHostdependencyToHost_DH OK
nagiosql.tbl_lnkHostdependencyToHost_H OK
nagiosql.tbl_lnkHostdependencyToHostgroup_DH OK
nagiosql.tbl_lnkHostdependencyToHostgroup_H OK
nagiosql.tbl_lnkHostescalationToContact OK
nagiosql.tbl_lnkHostescalationToContactgroup OK
nagiosql.tbl_lnkHostescalationToHost OK
nagiosql.tbl_lnkHostescalationToHostgroup OK
nagiosql.tbl_lnkHostgroupToHost OK
nagiosql.tbl_lnkHostgroupToHostgroup OK
nagiosql.tbl_lnkHosttemplateToContact OK
nagiosql.tbl_lnkHosttemplateToContactgroup OK
nagiosql.tbl_lnkHosttemplateToHost OK
nagiosql.tbl_lnkHosttemplateToHostgroup OK
nagiosql.tbl_lnkHosttemplateToHosttemplate OK
nagiosql.tbl_lnkHosttemplateToVariabledefinition OK
nagiosql.tbl_lnkServiceToContact OK
nagiosql.tbl_lnkServiceToContactgroup OK
nagiosql.tbl_lnkServiceToHost OK
nagiosql.tbl_lnkServiceToHostgroup OK
nagiosql.tbl_lnkServiceToServicegroup OK
nagiosql.tbl_lnkServiceToServicetemplate OK
nagiosql.tbl_lnkServiceToVariabledefinition OK
nagiosql.tbl_lnkServicedependencyToHost_DH OK
nagiosql.tbl_lnkServicedependencyToHost_H OK
nagiosql.tbl_lnkServicedependencyToHostgroup_DH OK
nagiosql.tbl_lnkServicedependencyToHostgroup_H OK
nagiosql.tbl_lnkServicedependencyToService_DS OK
nagiosql.tbl_lnkServicedependencyToService_S OK
nagiosql.tbl_lnkServiceescalationToContact OK
nagiosql.tbl_lnkServiceescalationToContactgroup OK
nagiosql.tbl_lnkServiceescalationToHost OK
nagiosql.tbl_lnkServiceescalationToHostgroup OK
nagiosql.tbl_lnkServiceescalationToService OK
nagiosql.tbl_lnkServicegroupToService OK
nagiosql.tbl_lnkServicegroupToServicegroup OK
nagiosql.tbl_lnkServicetemplateToContact OK
nagiosql.tbl_lnkServicetemplateToContactgroup OK
nagiosql.tbl_lnkServicetemplateToHost OK
nagiosql.tbl_lnkServicetemplateToHostgroup OK
nagiosql.tbl_lnkServicetemplateToServicegroup OK
nagiosql.tbl_lnkServicetemplateToServicetemplate OK
nagiosql.tbl_lnkServicetemplateToVariabledefinition OK
nagiosql.tbl_lnkTimeperiodToTimeperiod OK
nagiosql.tbl_logbook OK
nagiosql.tbl_mainmenu OK
nagiosql.tbl_service OK
nagiosql.tbl_servicedependency OK
nagiosql.tbl_serviceescalation OK
nagiosql.tbl_serviceextinfo OK
nagiosql.tbl_servicegroup OK
nagiosql.tbl_servicetemplate OK
nagiosql.tbl_settings OK
nagiosql.tbl_submenu OK
nagiosql.tbl_timedefinition OK
nagiosql.tbl_timeperiod OK
nagiosql.tbl_user OK
nagiosql.tbl_variabledefinition OK
---------------------------------------------------------------------------------
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: NagiosXI :: Contacts and users issue
Hi,
It's missing the MYI file for that table, however, this should get be regenerated when running a repair on that table. Please run the following commands to try to correct this.
Then check to see if /var/lib/mysql/nagios/nagios_contacts.MYI has been re-created. If so, then try to set up your user accounts once more and let me know if the issue is resolved now.
If that did correct this issue, it may be necessary to recreate the table from a backup. Let me know if you have recent backups available.
Regards,
Benjamin
It's missing the MYI file for that table, however, this should get be regenerated when running a repair on that table. Please run the following commands to try to correct this.
Code: Select all
systemctl start mariadb
echo 'repair table nagios_contacts use_frm;' | mysql -t -u root -pnagiosxi nagios
systemctl restart mariadb
Code: Select all
ls -la /var/lib/mysql/nagios/nagios_contacts*
Regards,
Benjamin
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
gsl_ops_practice
- Posts: 151
- Joined: Thu Apr 09, 2015 9:14 pm
Re: NagiosXI :: Contacts and users issue
Hi Benjamin,
Hope the first command is "systemctl stop mariadb " not "systemctl start mariadb" as the db is already running.
Hope the first command is "systemctl stop mariadb " not "systemctl start mariadb" as the db is already running.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: NagiosXI :: Contacts and users issue
Hi,
If the service is already running, then go ahead and run the repair query and then let me know if the MYI file for the table has been recreated.
Thanks,
Benjamin
If the service is already running, then go ahead and run the repair query and then let me know if the MYI file for the table has been recreated.
Code: Select all
echo 'repair table nagios_contacts use_frm;' | mysql -t -u root -pnagiosxi nagiosBenjamin
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!