Page 3 of 5

Re: Runtime Error for host and service notification

Posted: Wed Dec 21, 2016 4:04 pm
by tgriep
The script crashed before the var_dump so that didn't help much.
Lets try and add data to the Postgres table manually and see if it gets written.
Run the following as root and post the output.

Code: Select all

echo "INSERT INTO xi_eventqueue (event_time, event_source, event_type, event_meta) VALUES (1482353376, 2, 2, 'test');" |psql nagiosxi nagiosxi
echo 'select * from xi_eventqueue;' | psql nagiosxi nagiosxi
Also, can you post this file from the server?

Code: Select all

/usr/local/nagiosxi/html/config.inc.php

Re: Runtime Error for host and service notification

Posted: Wed Dec 21, 2016 4:17 pm
by valmberg
Here is the output of the insert into xi_eventqueue:

[root@nagios tools]# echo "INSERT INTO xi_eventqueue (event_time, event_source, event_type, event_meta) VALUES (1482353376, 2, 2, 'test');" |psql nagiosxi nagiosxi
INSERT 0 1

[root@nagios tools]# echo 'select * from xi_eventqueue;' | psql nagiosxi nagiosxi
eventqueue_id | event_time | event_source | event_type | event_meta
---------------+------------+--------------+------------+------------
(0 rows)

Re: Runtime Error for host and service notification

Posted: Wed Dec 21, 2016 5:29 pm
by tgriep
I added more debugging to the handle_nagioscore.inc.php file that is attached to the post.

Upload the file to the /usr/local/nagiosxi/scripts/ folder and run the following to make a backup of the existing file.

Code: Select all

cp  /usr/local/nagiosxi/scripts/handle_nagioscore.inc.php  /usr/local/nagiosxi/scripts/handle_nagioscore.inc.php.bak
Run this to use the new script

Code: Select all

cp  /usr/local/nagiosxi/scripts/handle_nagioscore.inc.php.txt  /usr/local/nagiosxi/scripts/handle_nagioscore.inc.php
Then run this to see where it fails in the script.

Code: Select all

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
echo $?

Re: Runtime Error for host and service notification

Posted: Wed Dec 21, 2016 5:44 pm
by valmberg
[root@nagios tools]# /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
[root@nagios tools]# echo $?
255

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 11:58 am
by tgriep
I have added more debugging to the handle_nagioscore.inc.php file that is attached to this post, replace the existing one and run the following and post the output. Remember to remove the .txt from the name.

Code: Select all

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
php -v

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 2:26 pm
by valmberg
[root@nagios tools]# /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
[root@nagios tools]# php -v
PHP 5.3.3 (cli) (built: Aug 11 2016 20:33:53)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 2:56 pm
by tgriep
Replace this file
/usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
with the one that is attached and post the output after running the command again.

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 3:50 pm
by valmberg
[root@nagios tools]# /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
[root@nagios tools]# php -v
PHP 5.3.3 (cli) (built: Aug 11 2016 20:33:53)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 4:02 pm
by tgriep
Can you post this file here?

Code: Select all

/usr/local/nagiosxi/scripts/handle_nagioscore_notification.php
Also, run this and post the output here.

Code: Select all

which php

Re: Runtime Error for host and service notification

Posted: Thu Dec 22, 2016 6:23 pm
by valmberg
I assume you want the old 'handle_nagioscore_notification.php" file? You sent me one earlier. I've included the new one I uploaded with 'new' in front of the title

[root@nagios tools]# which php
/usr/bin/php