Page 1 of 2

NagVis error

Posted: Thu Jan 14, 2021 8:03 am
by robinjporter
Hi there

We are trying to get NagVis working on a new XI server - however we see the error in the attached screenshot:
image002.jpeg
Any ideas on why this might occur, and how we could fix it?

Many thanks,

Robin

Re: NagVis error

Posted: Thu Jan 14, 2021 6:37 pm
by ssax
You can try adding this under your /etc/my.cnf [mysqld] section:

Code: Select all

init-connect='SET NAMES utf8'
If you're running EL8, put it in /etc/my.cnf.d/client.cnf under both [client] and [client-mariadb] sections, then restart mysql/mariadb.

Then restart mysql/mariadb:

Code: Select all

systemctl restart mariadb
systemctl restart mysql
systemctl restart mysqld
Then try again.

If it still fails, please PM me a copy of your profile, you can download it from Admin > System Profile by clicking the Download Profile button.

If you're unable to generate the the profile through the web interface, please try generating it from the command line by running these commands as root:

Code: Select all

rm -rf /usr/local/nagiosxi/var/components/profile*​​
/usr/local/nagiosxi/scripts/components/getprofile.sh SUPPORT
Then send me the resulting /usr/local/nagiosxi/var/components/profile.zip​ file.​

If the profile script fails, please include the ENTIRE output.

Re: NagVis error

Posted: Fri Jan 15, 2021 6:29 am
by DennisPR
Adding init-connect='SET NAMES utf8' to /etc/my.cnf and restarting the offloaded database didn"t solve the issue.
Might the offloaded database be the issue ?

Re: NagVis error

Posted: Fri Jan 15, 2021 5:07 pm
by ssax
Not likely related.

Please PM me a copy of your profile.zip, you can download it from Admin > System Profile by clicking the Download Profile button.

Include the output of this command:

Code: Select all

rpm -qa | grep php
Additionally, what XI version are you running?

Re: NagVis error

Posted: Fri Jan 15, 2021 5:16 pm
by ssax
If you're running PHP 7.4 I think that is the reason, you will need to edit this file:

Code: Select all

/usr/local/nagvis/share/server/core/functions/oldPhpVersionFix.php
Change line 273 from this:

Code: Select all

$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
To this (replacing those braces with brackets):

Code: Select all

$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
EDIT: What specific place in Nagvis did you go to in order to get that error?

Re: NagVis error

Posted: Mon Jan 18, 2021 5:24 am
by DennisPR
I am indeed running PHP 7.4.
A lot more {} needed to be replaced by []
I have attached the file where I changed all needed entries and commented the original lines

Re: NagVis error

Posted: Mon Jan 18, 2021 10:07 am
by DennisPR
After changing the php file as mentionned before I can start using Nagvis.
I was able to :
  • Delete all demo maps
    Create a new map
    Upload a background
    Set the background for the new map
However when I want to add a host or service to the map I get the following error

Code: Select all

Failed to get objects: Error: (0) Undefined property: CorePDOHandler::$data<div class="details">URL: /nagvis/server/core/ajax_handler.php?mod=Map&act=addModify&show=action-nagios&type=host&x=329&y=195&_ajaxid=1610982102<br> File: /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php<br> Line: 306<br> <code>#0 /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php(306): nagvisExceptionErrorHandler(8, 'Undefined prope...', '/usr/local/nagv...', 306, Array)<br> #1 /usr/local/nagvis/share/server/core/classes/CorePDOHandler.php(332): CorePDOHandler->prep('SELECT name1,na...')<br> #2 /usr/local/nagvis/share/server/core/classes/GlobalBackendPDO.php(248): CorePDOHandler->query('SELECT name1,na...', Array)<br> #3 /usr/local/nagvis/share/server/core/mapcfg/default.php(145): GlobalBackendPDO->getObjects('host', '', '')<br> #4 /usr/local/nagvis/share/server/core/mapcfg/default.php(159): getObjectNames('host', Object(GlobalMapCfg), NULL, Array)<br> #5 /usr/local/nagvis/share/server/core/classes/ViewMapAddModify.php(394): listHostNames(Object(GlobalMapCfg), NULL, Array)<br> #6 /usr/local/nagvis/share/server/core/classes/ViewMapAddModify.php(509): ViewMapAddModify->drawField('host_name', Array, Array)<br> #7 /usr/local/nagvis/share/server/core/classes/ViewMapAddModify.php(537): ViewMapAddModify->drawFields(Array)<br> #8 /usr/local/nagvis/share/server/core/classes/ViewMapAddModify.php(620): ViewMapAddModify->drawForm()<br> #9 /usr/local/nagvis/share/server/core/classes/CoreModMap.php(133): ViewMapAddModify->parse()<br> #10 /usr/local/nagvis/share/server/core/functions/index.php(120): CoreModMap->handleAction()<br> #11 /usr/local/nagvis/share/server/core/ajax_handler.php(59): require('/usr/local/nagv...')<br> #12 {main}</code>Output: <pre><form id="addmodify" name="addmodify" action="javascript:submitForm('/nagvis/server/core/ajax_handler.php?mod=Map&amp;act=addModify', 'addmodify');" method="POST"> <input type="hidden" id="_form_name" name="_form_name" value="addmodify" /> <input type="hidden" id="_update" name="_update" value="0" /> <input type="hidden" id="sec" name="sec" value="general" /> <ul class="nav" id="nav"><li id="nav_general" class="active"><a href="javascript:toggle_section('general')">General</a></li><li id="nav_appearance" ><a href="javascript:toggle_section('appearance')">Appearance</a></li><li id="nav_state" ><a href="javascript:toggle_section('state')">Status</a></li><li id="nav_actions" ><a href="javascript:toggle_section('actions')">Actions</a></li><li id="nav_label" ><a href="javascript:toggle_section('label')">Label</a></li><li id="nav_worldmap" ><a href="javascript:toggle_section('worldmap')">Worldmap</a></li></ul><div id="sec_general" class="section" style=""><table class="mytable"><tr class="must"><td class=tdlabel>host_name</td><td class=tdbox></td><td class=tdfield></pre>
Is this also related to PHP 7.4 compatibility issues ?

Re: NagVis error

Posted: Tue Jan 19, 2021 6:08 pm
by ssax
It may be related, I'll need to lab this up, I'm currently installing XI and setting up PHP 7.4 to test against. If you don't hear from me by tomorrow midday, reply to the post so it pops up on our dashboard.

Thank you!

Re: NagVis error

Posted: Thu Jan 21, 2021 11:28 am
by DennisPR
pop up :-)

Re: NagVis error

Posted: Thu Jan 21, 2021 7:44 pm
by ssax
It's working properly for me with your changes.

Please create a ticket for this and include a link back to this forum thread so we can get a remote session setup to debug further:

https://support.nagios.com/tickets/

Thank you!