Page 1 of 2

Could not parse JSON alarm

Posted: Tue Aug 27, 2019 6:30 am
by vijilants
Nagios XI version: 5.6.5
XI installed from: manual
XI UUID: 1a0c8662-0bed-4b2e-8b4b-d8409007c87d
Release info: cedarnms1 3.10.0-957.5.1.el7.x86_64 x86_64
CentOS Linux release 7.6.1810 (Core)
Gnome is not installed

Hi,

Can someone from Nagios Customer Support please advise:

On a daily basis we are getting the following alarm when the system is monitoring itself (See Below). It then clears about a minute later but it is occurring daily.

Code: Select all

019-08-27 06:53:19	cedarnms1	Nagios XI Daemons	CRITICAL	SOFT	1 of 5	Error: Could not parse JSON from http://192.168.42.3/nagiosxi/ (false
2019-08-27 06:53:15	cedarnms1	Nagios XI Jobs	CRITICAL	SOFT	1 of 5	Error: Could not parse JSON from http://192.168.42.3/nagiosxi/ (false

Re: Could not parse JSON alarm

Posted: Tue Aug 27, 2019 1:31 pm
by benjaminsmith
Hi @vijilants,

Since this is happening on and off, the server might be too busy at times to return json data fast enough.

Try increasing timeout settings to 30 seconds ( --timeout=30 ) on the check command for Nagios XI Daemons and Nagios XI Jobs.

Example:

Code: Select all

/usr/local/nagios/libexec/check_nagiosxiserver.php --address=$HOSTADDRESS$ --url='http://<ip-address>/nagiosxi/' --apikey='abc123' --mode=daemons --timeout=30
Let me know if that takes care of the issue.

Re: Could not parse JSON alarm

Posted: Wed Aug 28, 2019 4:16 am
by vijilants
Before I submit the command is the only variable I need to change <ip-address> ?

Is there anything else I need to change ?

Thank you

Re: Could not parse JSON alarm

Posted: Wed Aug 28, 2019 12:34 pm
by benjaminsmith
Hi @vijilants,

You would need to change the IP address and the apikey, or you can modify the $ARG1$ string in the service definition. Go to Configure > CCM > Services and search for the correct one to modify.
timout.png
Let us know if the issue is resolved.

Re: Could not parse JSON alarm

Posted: Wed Sep 04, 2019 9:07 am
by vijilants
I keep getting the following error:

Code: Select all

[root@XXXX libexec]# /usr/local/nagios/libexec/check_nagiosxiserver.php --address=$HOSTADDRESS$ --url='http://192.168.42.3/nagiosxi/' --apikey=0jksm202 --mode=daemons --timeout=30
: No such file or directoryheck_nagiosxiserver.php: line 1: ?php
: No such file or directoryheck_nagiosxiserver.php: line 2: //
/usr/local/nagios/libexec/check_nagiosxiserver.php: line 3: syntax error near unexpected token `('
/usr/local/nagios/libexec/check_nagiosxiserver.php: line 3: `// Copyright (c) 2008-2019 Nagios Enterprises, LLC. All rights reserved'
[root@cedarnms1 libexec]#

Re: Could not parse JSON alarm

Posted: Wed Sep 04, 2019 12:47 pm
by benjaminsmith
Hello @vijilants,

The api is a string and should be in single quotes. You can run the wizard to setup the commands, just add the --timeout=30 to the end.

Example:

Code: Select all

[nagios@bs-nagiosxi-test ~]$ /usr/bin/php /usr/local/nagios/libexec/check_nagiosxiserver.php --address=$HOSTADDRESS$ --url='http://192.168.1.10/nagiosxi/' --apikey='IJlnZSlfbH98sHe6GtOTDfVkQRRvUktC38gjZUBaRJhjHPoDCsssKnPQvWmpgShD' --mode=daemons --timeout=30
All daemons are running okay.

Re: Could not parse JSON alarm

Posted: Mon Sep 09, 2019 9:10 am
by vijilants
Thank you....your example appears to have worked at my end with the correct IP address and api key.

I will keep an eye on it and see if it fixes the issue.

Re: Could not parse JSON alarm

Posted: Mon Sep 09, 2019 11:50 am
by benjaminsmith
Hello @vijilants,
Thank you....your example appears to have worked at my end with the correct IP address and api key.

I will keep an eye on it and see if it fixes the issue.
Sounds good. I'll keep this open if you need further assistance.

Re: Could not parse JSON alarm

Posted: Tue Sep 17, 2019 4:25 am
by vijilants
Hi ,

Still the same problem every morning I'm afraid....

Error: Could not parse JSON from http://192.168.42.3/nagiosxi/ (false

Re: Could not parse JSON alarm

Posted: Tue Sep 17, 2019 10:40 am
by benjaminsmith
Hello @vijilants,

Well, the issue is intermittent and occurring on a schedule basis. A couple of questions to further troubleshoot.

1. Did increasing the timeout on the check command make any improvements?

2. This issue is happening every morning. Is anything else happening on the server on a scheduled basis (e.g backup) that maybe causing the load to increase?

3. Let's check the table sizes of your database. Please post the output for the following queries.

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');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table

Code: Select all

echo "SELECT relname as Table, pg_size_pretty(pg_total_relation_size(relid)) As Size, pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as ExternalSize FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;" | psql nagiosxi nagiosxi
4. Since this is intermittent, please download a new system profile at the time of the error, so we can take a log which processes are running and any errors in the logs. Thanks.