Page 1 of 1

Nagvis Error - Nagios XI

Posted: Thu Jun 10, 2021 8:48 am
by ABBsupervision
Hello,

we encountered a problem while accessing nagvis. ( (see attached - Nagvis_ErrorPHP.PNG )

Error: PHP Error

Code: Select all

Error: (0) Undefined property: CorePDOHandler::$data
URL: /nagvis/server/core/ajax_handler.php?mod=Overview&act=getObjectStates&i[]=map-Portail&_ajaxid=1623332224
File: /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php
Line: 306
#0 /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php(306): nagvisExceptionErrorHandler(8, 'Undefined prope...', '/usr/local/nagv...', 306, Array)
#1 /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php(332): CorePDOHandler->prep('SELECT\n ...')
#2 /usr/local/nagvis/share/server/core/classes/GlobalBackendPDO.php(615): CorePDOHandler->query('SELECT\n ...', Array)
#3 /usr/local/nagvis/share/server/core/classes/CoreBackendMgmt.php(474): GlobalBackendPDO->getServiceState(Array, 2, Array)
#4 /usr/local/nagvis/share/server/core/classes/CoreBackendMgmt.php(169): CoreBackendMgmt->fetchStateCounts('nagiosxidmz', 'serviceState', 2, Array)
#5 /usr/local/nagvis/share/server/core/classes/CoreModOverview.php(171): CoreBackendMgmt->execute()
#6 /usr/local/nagvis/share/server/core/classes/CoreModOverview.php(64): CoreModOverview->parseMapsJson(false, Array)
#7 /usr/local/nagvis/share/server/core/functions/index.php(120): CoreModOverview->handleAction()
#8 /usr/local/nagvis/share/server/core/ajax_handler.php(59): require('/usr/local/nagv...')
#9 {main}
I also inform you that when creating a new role on nagvis we receive another error message (see attached - Nagvis_Error Role.PNG )
Error : Syntax Error

Code: Select all

Invalid JSON response
Time: 1623332336
URL: /nagvis/server/core/ajax_handler.php?mod=RoleMgmt&act=view&_ajaxid=1623332336
Response:
Créer un Rôle
{"type":"error","message":"Error: (0) count(): Parameter must be an array or an object that implements Countable
URL: \/nagvis\/server\/core\/ajax_handler.php?mod=RoleMgmt&act=view&_ajaxid=1623332336
\nFile: \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php
\nLine: 38
\n
#0 \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php(38): nagvisExceptionErrorHandler(2, 'count(): Parame...', '\/usr\/local\/nagv...', 38, Array)
\n#1 \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php(300): ViewManageRoles->addForm()
\n#2 \/usr\/local\/nagvis\/share\/server\/core\/classes\/CoreModRoleMgmt.php(44): ViewManageRoles->parse()
\n#3 \/usr\/local\/nagvis\/share\/server\/core\/functions\/index.php(120): CoreModRoleMgmt->handleAction()
\n#4 \/usr\/local\/nagvis\/share\/server\/core\/ajax_handler.php(59): require('\/usr\/local\/nagv...')
\n#5 {main}<\/code>Output:
<h2>Créer un Rôle<\/h2><\/pre>","title":"Error: PHP Error"}
Please find attached the error message.

Could you help us?

Best Regards,
SOUHAIB

Re: Nagvis Error - Nagios XI

Posted: Thu Jun 10, 2021 5:00 pm
by benjaminsmith
HI Souhaib,

Thank you for posting the log output. Looking over that error message (Error: (0) Undefined property: CorePDOHandler::$data) this is related to a database connection issue. When did you start noticing the error, and have you made any system changes? Is the rest of the system working as expected?

Is the database local or offloaded?

Also, please send us the system profile and we'll review the logs. Thanks, Benjamin

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

Re: Nagvis Error - Nagios XI

Posted: Fri Jun 11, 2021 6:48 am
by ABBsupervision
Hello,

Mysql database is local and repaired every night by running your script : /usr/local/nagiosxi/scripts/repair_databases.sh

We made the last change on system 45 days ago : optimzation of PHP, PHP-FPM.

This optimization resolved the monitoring engine problem

Nagvis was working fine, but sometimes we get slow loading, recently we got more problems : slow pages and errors ( as shown on previous screenshots).

Please find attached the requested profile.

Best Regards,
SOUHAIB

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

Re: Nagvis Error - Nagios XI

Posted: Fri Jun 11, 2021 12:24 pm
by benjaminsmith
Hi ABBsupervision,

If you having a problem with the database tables crashing frequently, I would recommend converting the tables to innodb.

Database Storage Engine and High CPU usage in Nagios XI

Be sure to take a full backup or snapshot before making any changes. Also, be sure to enable regular scheduled backups to mitigate against any database failures that would require a restore.

Backing Up And Restoring Your Nagios XI System

Additionally, please increase the max connections on the database (if needed). I believe the slowness may be the result of a busy or slow responding database.0

Nagios XI - MySQL/MariaDB - Max Connection

Lastly, please post the output to the following command to check the table sizes. It may be necessary to adjust the command if you changed the default credentials.

Code: Select all

echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table
Thank you,
Benjamin

Re: Nagvis Error - Nagios XI

Posted: Mon Jun 14, 2021 4:57 am
by ABBsupervision
Hello benjaminsmith,

We don't have any blockage with databases, and also we have set up a repair script for this database tables every night.

I inform you that we have increase the max connections on the database :

Code: Select all

[root@DCPNAGIOSXIN1 libexec]# mysql -uroot -pnagiosxi -e "show variables like 'max_connections';"
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
Please find below the output of command to check the table sizes :

Code: Select all

[root@DCPNAGIOSXIN1 libexec]# echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------------------------+------------+
| Table                                      | Size in MB |
+--------------------------------------------+------------+
| nagios_acknowledgements                    |       0.00 |
| nagios_commands                            |       0.02 |
| nagios_commenthistory                      |       0.77 |
| nagios_comments                            |       0.00 |
| nagios_configfiles                         |       0.01 |
| nagios_configfilevariables                 |       0.01 |
| nagios_contact_addresses                   |       0.00 |
| nagios_contact_notificationcommands        |       0.01 |
| nagios_contactgroup_members                |       0.00 |
| nagios_contactgroups                       |       0.00 |
| nagios_contactnotificationmethods          |      45.24 |
| nagios_contactnotifications                |      31.61 |
| nagios_contacts                            |       0.00 |
| nagios_contactstatus                       |       0.00 |
| nagios_customvariables                     |       0.12 |
| nagios_customvariablestatus                |       0.10 |
| nagios_dbversion                           |       0.00 |
| nagios_downtimehistory                     |       0.00 |
| nagios_eventhandlers                       |       0.01 |
| nagios_externalcommands                    |       0.01 |
| nagios_flappinghistory                     |       0.14 |
| nagios_host_contactgroups                  |       0.00 |
| nagios_host_contacts                       |       0.01 |
| nagios_host_parenthosts                    |       0.00 |
| nagios_hostchecks                          |       0.15 |
| nagios_hostdependencies                    |       0.00 |
| nagios_hostescalation_contactgroups        |       0.00 |
| nagios_hostescalation_contacts             |       0.00 |
| nagios_hostescalations                     |       0.00 |
| nagios_hostgroup_members                   |       0.02 |
| nagios_hostgroups                          |       0.00 |
| nagios_hosts                               |       0.09 |
| nagios_hoststatus                          |       0.19 |
| nagios_instances                           |       0.00 |
| nagios_logentries                          |     227.51 |
| nagios_notifications                       |     154.31 |
| nagios_objects                             |       0.39 |
| nagios_processevents                       |       0.55 |
| nagios_programstatus                       |       0.00 |
| nagios_runtimevariables                    |       0.00 |
| nagios_scheduleddowntime                   |       0.00 |
| nagios_service_contactgroups               |       0.00 |
| nagios_service_contacts                    |       0.05 |
| nagios_service_parentservices              |       0.00 |
| nagios_servicechecks                       |       0.68 |
| nagios_servicedependencies                 |       0.00 |
| nagios_serviceescalation_contactgroups     |       0.00 |
| nagios_serviceescalation_contacts          |       0.00 |
| nagios_serviceescalations                  |       0.00 |
| nagios_servicegroup_members                |       0.00 |
| nagios_servicegroups                       |       0.00 |
| nagios_services                            |       0.48 |
| nagios_servicestatus                       |       1.04 |
| nagios_statehistory                        |      34.96 |
| nagios_systemcommands                      |       0.05 |
| nagios_timedeventqueue                     |       0.00 |
| nagios_timedevents                         |       0.00 |
| nagios_timeperiod_timeranges               |       0.00 |
| nagios_timeperiods                         |       0.00 |
| tbl_command                                |       0.06 |
| tbl_contact                                |       0.03 |
| tbl_contactgroup                           |       0.03 |
| tbl_contacttemplate                        |       0.03 |
| tbl_domain                                 |       0.03 |
| tbl_host                                   |       0.08 |
| tbl_hostdependency                         |       0.03 |
| tbl_hostescalation                         |       0.03 |
| tbl_hostextinfo                            |       0.03 |
| tbl_hostgroup                              |       0.03 |
| tbl_hosttemplate                           |       0.03 |
| tbl_info                                   |       0.17 |
| tbl_lnkContactToCommandHost                |       0.02 |
| tbl_lnkContactToCommandService             |       0.02 |
| tbl_lnkContactToContactgroup               |       0.02 |
| tbl_lnkContactToContacttemplate            |       0.02 |
| tbl_lnkContactToVariabledefinition         |       0.02 |
| tbl_lnkContactgroupToContact               |       0.02 |
| tbl_lnkContactgroupToContactgroup          |       0.02 |
| tbl_lnkContacttemplateToCommandHost        |       0.02 |
| tbl_lnkContacttemplateToCommandService     |       0.02 |
| tbl_lnkContacttemplateToContactgroup       |       0.02 |
| tbl_lnkContacttemplateToContacttemplate    |       0.02 |
| tbl_lnkContacttemplateToVariabledefinition |       0.02 |
| tbl_lnkHostToContact                       |       0.02 |
| tbl_lnkHostToContactgroup                  |       0.02 |
| tbl_lnkHostToHost                          |       0.02 |
| tbl_lnkHostToHostgroup                     |       0.02 |
| tbl_lnkHostToHosttemplate                  |       0.02 |
| tbl_lnkHostToVariabledefinition            |       0.02 |
| tbl_lnkHostdependencyToHost_DH             |       0.02 |
| tbl_lnkHostdependencyToHost_H              |       0.02 |
| tbl_lnkHostdependencyToHostgroup_DH        |       0.02 |
| tbl_lnkHostdependencyToHostgroup_H         |       0.02 |
| tbl_lnkHostescalationToContact             |       0.02 |
| tbl_lnkHostescalationToContactgroup        |       0.02 |
| tbl_lnkHostescalationToHost                |       0.02 |
| tbl_lnkHostescalationToHostgroup           |       0.02 |
| tbl_lnkHostgroupToHost                     |       0.02 |
| tbl_lnkHostgroupToHostgroup                |       0.02 |
| tbl_lnkHosttemplateToContact               |       0.02 |
| tbl_lnkHosttemplateToContactgroup          |       0.02 |
| tbl_lnkHosttemplateToHost                  |       0.02 |
| tbl_lnkHosttemplateToHostgroup             |       0.02 |
| tbl_lnkHosttemplateToHosttemplate          |       0.02 |
| tbl_lnkHosttemplateToVariabledefinition    |       0.02 |
| tbl_lnkServiceToContact                    |       0.02 |
| tbl_lnkServiceToContactgroup               |       0.02 |
| tbl_lnkServiceToHost                       |       0.05 |
| tbl_lnkServiceToHostgroup                  |       0.02 |
| tbl_lnkServiceToServicegroup               |       0.02 |
| tbl_lnkServiceToServicetemplate            |       0.02 |
| tbl_lnkServiceToVariabledefinition         |       0.02 |
| tbl_lnkServicedependencyToHost_DH          |       0.02 |
| tbl_lnkServicedependencyToHost_H           |       0.02 |
| tbl_lnkServicedependencyToHostgroup_DH     |       0.02 |
| tbl_lnkServicedependencyToHostgroup_H      |       0.02 |
| tbl_lnkServicedependencyToService_DS       |       0.02 |
| tbl_lnkServicedependencyToService_S        |       0.02 |
| tbl_lnkServicedependencyToServicegroup_DS  |       0.02 |
| tbl_lnkServicedependencyToServicegroup_S   |       0.02 |
| tbl_lnkServiceescalationToContact          |       0.02 |
| tbl_lnkServiceescalationToContactgroup     |       0.02 |
| tbl_lnkServiceescalationToHost             |       0.02 |
| tbl_lnkServiceescalationToHostgroup        |       0.02 |
| tbl_lnkServiceescalationToService          |       0.02 |
| tbl_lnkServiceescalationToServicegroup     |       0.02 |
| tbl_lnkServicegroupToService               |       0.02 |
| tbl_lnkServicegroupToServicegroup          |       0.02 |
| tbl_lnkServicetemplateToContact            |       0.02 |
| tbl_lnkServicetemplateToContactgroup       |       0.02 |
| tbl_lnkServicetemplateToHost               |       0.02 |
| tbl_lnkServicetemplateToHostgroup          |       0.02 |
| tbl_lnkServicetemplateToServicegroup       |       0.02 |
| tbl_lnkServicetemplateToServicetemplate    |       0.02 |
| tbl_lnkServicetemplateToVariabledefinition |       0.02 |
| tbl_lnkTimeperiodToTimeperiod              |       0.02 |
| tbl_logbook                                |       0.02 |
| tbl_mainmenu                               |       0.02 |
| tbl_permission                             |       0.02 |
| tbl_permission_inactive                    |       0.02 |
| tbl_service                                |       0.11 |
| tbl_servicedependency                      |       0.03 |
| tbl_serviceescalation                      |       0.03 |
| tbl_serviceextinfo                         |       0.03 |
| tbl_servicegroup                           |       0.03 |
| tbl_servicetemplate                        |       0.03 |
| tbl_session                                |       0.02 |
| tbl_session_locks                          |       0.02 |
| tbl_settings                               |       0.03 |
| tbl_submenu                                |       0.02 |
| tbl_timedefinition                         |       0.02 |
| tbl_timeperiod                             |       0.03 |
| tbl_user                                   |       0.03 |
| tbl_variabledefinition                     |       0.06 |
| xi_auditlog                                |     137.72 |
| xi_auth_tokens                             |       3.64 |
| xi_cmp_ccm_backups                         |       0.02 |
| xi_cmp_favorites                           |       0.03 |
| xi_cmp_nagiosbpi_backups                   |       0.17 |
| xi_cmp_trapdata                            |       0.03 |
| xi_cmp_trapdata_log                        |       0.03 |
| xi_commands                                |       0.52 |
| xi_deploy_agents                           |       0.02 |
| xi_deploy_jobs                             |       0.02 |
| xi_eventqueue                              |       0.03 |
| xi_events                                  |       0.23 |
| xi_meta                                    |       4.52 |
| xi_mibs                                    |       0.05 |
| xi_options                                 |       0.03 |
| xi_sessions                                |       0.03 |
| xi_sysstat                                 |       0.03 |
| xi_usermeta                                |       0.08 |
| xi_users                                   |       0.03 |
+--------------------------------------------+------------+

Best Regards,
SOUHAIB

Re: Nagvis Error - Nagios XI

Posted: Tue Jun 15, 2021 9:07 am
by benjaminsmith
Hi SOUHAIB,

Thanks for posting the table sizes, those look okay. A couple of questions to help us narrow this down.

1. How often is the is occurring?

2. Have you made any changes to the default Apache configurations in Nagios XI?

3. Please open up the developer tools in Chrome (right click and select inspect), then select Network (All) and load the page producing the error, then sort on the status, and let me know if you see any errors when loading the front-end scripts. Thanks, Benjamin
Untitled.png

Re: Nagvis Error - Nagios XI

Posted: Tue Jun 15, 2021 9:52 am
by ABBsupervision
Hello,

1 - We have encountered this issue since the beginning of this month but the first problem has been solved ( see attached - Nagvis_ErrorPHP.PNG ) , and the second problem is still relevant, we can't create a role ( see attached - Nagvis_Error Role.PNG ).

Code: Select all

Invalid JSON response
Time: 1623332336
URL: /nagvis/server/core/ajax_handler.php?mod=RoleMgmt&act=view&_ajaxid=1623332336
Response:
Créer un Rôle
{"type":"error","message":"Error: (0) count(): Parameter must be an array or an object that implements Countable
URL: \/nagvis\/server\/core\/ajax_handler.php?mod=RoleMgmt&act=view&_ajaxid=1623332336
\nFile: \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php
\nLine: 38
\n
#0 \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php(38): nagvisExceptionErrorHandler(2, 'count(): Parame...', '\/usr\/local\/nagv...', 38, Array)
\n#1 \/usr\/local\/nagvis\/share\/server\/core\/classes\/ViewManageRoles.php(300): ViewManageRoles->addForm()
\n#2 \/usr\/local\/nagvis\/share\/server\/core\/classes\/CoreModRoleMgmt.php(44): ViewManageRoles->parse()
\n#3 \/usr\/local\/nagvis\/share\/server\/core\/functions\/index.php(120): CoreModRoleMgmt->handleAction()
\n#4 \/usr\/local\/nagvis\/share\/server\/core\/ajax_handler.php(59): require('\/usr\/local\/nagv...')
\n#5 {main}<\/code>Output:
<h2>Créer un Rôle<\/h2><\/pre>","title":"Error: PHP Error"}
2 - We didn't made any changes.

3 - Please find attached the screenshots.


Best Regards,
SOUHAIB

Re: Nagvis Error - Nagios XI

Posted: Tue Jun 15, 2021 4:07 pm
by benjaminsmith
Hi @ABBsupervision,

Thanks for helping us troubleshoot this so far, one of the team members here was able to come up with a solution. It's a Cent 8/ 7 PHP issue.

Please edit the following file:

Code: Select all

/usr/local/nagvis/share/server/core/classes/ViewManageRoles.php
Change this line from:

Code: Select all

if (count($name) > AUTH_MAX_ROLENAME_LENGTH)
To this:

Code: Select all

if (strlen($name) > AUTH_MAX_ROLENAME_LENGTH)
Then test this once more and let us know if the issue is resolved.

Regards,
Benjamin

Re: Nagvis Error - Nagios XI

Posted: Tue Jun 15, 2021 9:50 pm
by ABBsupervision
Hi benjaminsmith,

We made the change on Nagvis scripts as you recommended.
It seems working fine, we didn't get any error on adding a new role or associating a user to this new role.

We're going to make other check just to be sure that everything is fine, and we'll let you know if you can close this post.

Thanks & regards

Re: Nagvis Error - Nagios XI

Posted: Wed Jun 16, 2021 8:55 am
by benjaminsmith
Hi,
We're going to make other check just to be sure that everything is fine, and we'll let you know if you can close this post.
Sounds good. We'll keep this open and wait for an update.