statusjson.cgi failing truncate response output
Posted: Tue Sep 01, 2015 8:24 pm
I'm using a perl/LWP query from a bash shell that should return all of the status detail of the services with STATUS=CRITICAL, and fairly consistently (most of the time, but not always - maybe due to the current number of outstanding CRITICAL issues to process), the JSON response output is truncated which results in bad data that can't be parsed due to imbalanced JSON syntax.
Environment Info:
CentOS release 6.3 (Final)
glibc: Version 2.12, 1.149.el6_6.9
Nagios Core 4.1.1 (compiled from source)
Nagios Plugins 2.1.1 (compiled from source)
Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips SVN/1.6.11
At the time of the query, there were roughly 17 services currently with critical status
Query (which is truncated):
perl -MLWP::Simple -e "getprint 'https://{user}:{pwd}@hostname/nagios/cg ... s=critical'"
{
"format_version": 0,
"result": {
"query_time": 1441155089000,
"cgi": "statusjson.cgi",
"user": "{user}",
"query": "servicelist",
"query_status": "beta",
"program_start": 1441150670000,
"last_data_update": 1441155082000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"service_status": 16
},
"servicelist": {
"xxxxxxxxxxxxx": {
"{xxxxxxxxxxxxx}": {
"host_name": "xxxxxxxxxxxxx",
"description": "{xxxxxxxxxxxxx}",
"plugin_output": "Log backup status. File does not exist: {xxxxxxxxxxxxx}. Aborting.",
"long_plugin_output": "",
"perf_data": "",
"max_attemps": 1,
"current_attempt": 1,
"status": 16,
"last_update": 1441155081000,
"has_been_checked": true,
"should_be_scheduled": false,
"last_check": 1441152347000,
"check_options": 0,
"check_type": 1,
"checks_enabled": false,
"last_state_change": 1441152347000,
"last_hard_state_change": 1441152347000,
"last_hard_state": 2,
"last_time_ok": 1441152347000,
"last_time_warning": 0,
"last_time_unknown": 0,
"last_time_critical": 0,
"state_type": 1,
"last_notification": 1441152347000,
"next_notification": 1441155947000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 1,
"accept_passive_checks": true,
"event_handler_enabled": true,
"flap_detection_enabled": false,
"is_flapping": false,
"percent_state_change": 6.25,
"latency": 0.63,
"execution_time": 0.00,
"scheduled_downtime_depth": 0,
"process_performance_data": false,
"obsess": true
}
},
"{xxxxxxxxxxxxx}": {
"{xxxxxxxxxxxxx}": {
"host_name": "{xxxxxxxxxxxxx}",
"description": "{xxxxxxxxxxxxx}",
From Apache /etc/httpd/logs/ssl_error_log at the exact time of query failure:
…
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] *** glibc detected *** /usr/local/nagios/sbin/statusjson.cgi: realloc(): invalid next size: 0x0000000002d0fa00 ***
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ======= Backtrace: =========
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6[0x3f81e75e66]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6[0x3f81e7b937]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6(realloc+0xe5)[0x3f81e7baf5]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x42fbb2]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x43166d]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x40918f]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6(__libc_start_main+0xfd)[0x3f81e1ed5d]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x401b49]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ======= Memory map: ========
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 00400000-00445000 r-xp 00000000 fc:01 661238 /usr/local/nagios/sbin/statusjson.cgi
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 00645000-0064b000 rw-p 00045000 fc:01 661238 /usr/local/nagios/sbin/statusjson.cgi
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 0064b000-00651000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 023b9000-02d1a000 rw-p 00000000 00:00 0 [heap]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81a00000-3f81a20000 r-xp 00000000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c1f000-3f81c20000 r--p 0001f000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c20000-3f81c21000 rw-p 00020000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c21000-3f81c22000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81e00000-3f81f8a000 r-xp 00000000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81f8a000-3f8218a000 ---p 0018a000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218a000-3f8218e000 r--p 0018a000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218e000-3f8218f000 rw-p 0018e000 fc:01 27128 /lib64/libc
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] -2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218f000-3f82194000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85200000-3f85216000 r-xp 00000000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85216000-3f85415000 ---p 00016000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85415000-3f85416000 rw-p 00015000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecef5000-7f1aecefc000 r--s 00000000 fc:01 35745 /usr/lib64/gconv/gconv-modules.cache
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecefc000-7f1aecf1d000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecf1d000-7f1af2dae000 r--p 00000000 fc:01 35861 /usr/lib/locale/locale-archive
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1af2dae000-7f1af2db1000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1af2db7000-7f1af2dba000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7fff75ec1000-7fff75ed6000 rw-p 00000000 00:00 0 [stack]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7fff75fa4000-7fff75fa5000 r-xp 00000000 00:00 0 [vdso]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
I suspect I will be opening a Bug report, but wanted to post here first in the event anybody else has seen this, and if they know of a fix.
Appreciate any help, thanks!
Michael
Environment Info:
CentOS release 6.3 (Final)
glibc: Version 2.12, 1.149.el6_6.9
Nagios Core 4.1.1 (compiled from source)
Nagios Plugins 2.1.1 (compiled from source)
Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips SVN/1.6.11
At the time of the query, there were roughly 17 services currently with critical status
Query (which is truncated):
perl -MLWP::Simple -e "getprint 'https://{user}:{pwd}@hostname/nagios/cg ... s=critical'"
{
"format_version": 0,
"result": {
"query_time": 1441155089000,
"cgi": "statusjson.cgi",
"user": "{user}",
"query": "servicelist",
"query_status": "beta",
"program_start": 1441150670000,
"last_data_update": 1441155082000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"service_status": 16
},
"servicelist": {
"xxxxxxxxxxxxx": {
"{xxxxxxxxxxxxx}": {
"host_name": "xxxxxxxxxxxxx",
"description": "{xxxxxxxxxxxxx}",
"plugin_output": "Log backup status. File does not exist: {xxxxxxxxxxxxx}. Aborting.",
"long_plugin_output": "",
"perf_data": "",
"max_attemps": 1,
"current_attempt": 1,
"status": 16,
"last_update": 1441155081000,
"has_been_checked": true,
"should_be_scheduled": false,
"last_check": 1441152347000,
"check_options": 0,
"check_type": 1,
"checks_enabled": false,
"last_state_change": 1441152347000,
"last_hard_state_change": 1441152347000,
"last_hard_state": 2,
"last_time_ok": 1441152347000,
"last_time_warning": 0,
"last_time_unknown": 0,
"last_time_critical": 0,
"state_type": 1,
"last_notification": 1441152347000,
"next_notification": 1441155947000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 1,
"accept_passive_checks": true,
"event_handler_enabled": true,
"flap_detection_enabled": false,
"is_flapping": false,
"percent_state_change": 6.25,
"latency": 0.63,
"execution_time": 0.00,
"scheduled_downtime_depth": 0,
"process_performance_data": false,
"obsess": true
}
},
"{xxxxxxxxxxxxx}": {
"{xxxxxxxxxxxxx}": {
"host_name": "{xxxxxxxxxxxxx}",
"description": "{xxxxxxxxxxxxx}",
From Apache /etc/httpd/logs/ssl_error_log at the exact time of query failure:
…
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] *** glibc detected *** /usr/local/nagios/sbin/statusjson.cgi: realloc(): invalid next size: 0x0000000002d0fa00 ***
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ======= Backtrace: =========
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6[0x3f81e75e66]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6[0x3f81e7b937]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6(realloc+0xe5)[0x3f81e7baf5]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x42fbb2]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x43166d]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x431ad8]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x40918f]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /lib64/libc.so.6(__libc_start_main+0xfd)[0x3f81e1ed5d]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] /usr/local/nagios/sbin/statusjson.cgi[0x401b49]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ======= Memory map: ========
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 00400000-00445000 r-xp 00000000 fc:01 661238 /usr/local/nagios/sbin/statusjson.cgi
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 00645000-0064b000 rw-p 00045000 fc:01 661238 /usr/local/nagios/sbin/statusjson.cgi
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 0064b000-00651000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 023b9000-02d1a000 rw-p 00000000 00:00 0 [heap]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81a00000-3f81a20000 r-xp 00000000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c1f000-3f81c20000 r--p 0001f000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c20000-3f81c21000 rw-p 00020000 fc:01 20881 /lib64/ld-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81c21000-3f81c22000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81e00000-3f81f8a000 r-xp 00000000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f81f8a000-3f8218a000 ---p 0018a000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218a000-3f8218e000 r--p 0018a000 fc:01 27128 /lib64/libc-2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218e000-3f8218f000 rw-p 0018e000 fc:01 27128 /lib64/libc
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] -2.12.so
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f8218f000-3f82194000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85200000-3f85216000 r-xp 00000000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85216000-3f85415000 ---p 00016000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 3f85415000-3f85416000 rw-p 00015000 fc:01 32163 /lib64/libgcc_s-4.4.7-20120601.so.1
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecef5000-7f1aecefc000 r--s 00000000 fc:01 35745 /usr/lib64/gconv/gconv-modules.cache
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecefc000-7f1aecf1d000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1aecf1d000-7f1af2dae000 r--p 00000000 fc:01 35861 /usr/lib/locale/locale-archive
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1af2dae000-7f1af2db1000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7f1af2db7000-7f1af2dba000 rw-p 00000000 00:00 0
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7fff75ec1000-7fff75ed6000 rw-p 00000000 00:00 0 [stack]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] 7fff75fa4000-7fff75fa5000 r-xp 00000000 00:00 0 [vdso]
[Wed Sep 02 00:51:30 2015] [error] [client aa.bbb.ccc.ddd] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
I suspect I will be opening a Bug report, but wanted to post here first in the event anybody else has seen this, and if they know of a fix.
Appreciate any help, thanks!
Michael