Could not parse JSON alarm

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
vijilants
Posts: 215
Joined: Wed Jun 12, 2013 2:50 pm

Could not parse JSON alarm

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Could not parse JSON alarm

Post 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.
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!
vijilants
Posts: 215
Joined: Wed Jun 12, 2013 2:50 pm

Re: Could not parse JSON alarm

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Could not parse JSON alarm

Post 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.
You do not have the required permissions to view the files attached to this post.
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!
vijilants
Posts: 215
Joined: Wed Jun 12, 2013 2:50 pm

Re: Could not parse JSON alarm

Post 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]#
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Could not parse JSON alarm

Post 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.
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!
vijilants
Posts: 215
Joined: Wed Jun 12, 2013 2:50 pm

Re: Could not parse JSON alarm

Post 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Could not parse JSON alarm

Post 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.
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!
vijilants
Posts: 215
Joined: Wed Jun 12, 2013 2:50 pm

Re: Could not parse JSON alarm

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Could not parse JSON alarm

Post 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.
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!
Locked