check_json icon indicating copy to clipboard operation
check_json copied to clipboard

Use of uninitialized value $output_value in concatenation (.) or string at check_json.pl line 252

Open alexandruvilceloiu opened this issue 7 years ago • 4 comments

When having multiple records like:

{ "from": "0.050", "error": false, "test": { "test01": { "alive": true, "value": 147.43, "rate_below_threshold": false, "last_time": "Mon, 03 Jul 2017 11:31:46 GMT" } } }

I got empty response for value ('{test}->{test01}->{value}') e.g.: /usr/lib64/nagios/plugins/check_json.pl --url "https://example.com/test.json" --attribute '{test}->{test01}->{value}' --warning 140: --critical 110: --perfvars '{test}->{test01}->{value}' --outputvars '{test}->{test01}->{value}' Use of uninitialized value $output_value in concatenation (.) or string at /usr/lib64/nagios/plugins/check_json.pl line 252.

And no value returned..

alexandruvilceloiu avatar Jul 03 '17 13:07 alexandruvilceloiu

I have the same problem.


XYZ@icinga:~# /omd/sites/PVM/local/lib/icinga/plugins/check_json.pl --url http://ABC.int.XYZ.de/solar_api/v1/GetPowerFlowRealtimeData.fcgi --attribute '{Body}->{Data}->{Inverters}->{1}->{SOC}' --warning 2: --critical 1: --perfvars * -o '{Body}->{Data}->{Inverters}->{1}->{SOC}'

Use of uninitialized value $output_value in concatenation (.) or string at /omd/sites/PVM/local/lib/icinga/plugins/check_json.pl line 252.

Check JSON status API OK - SOC:


expected result: Check JSON status API OK - SOC:3


file GetPowerFlowRealtimeData.fcgi contains: { "Body" : { "Data" : { "Inverters" : { "1" : { "Battery_Mode" : "nearly depleted", "DT" : 99, "E_Day" : 750.20001220703125, "E_Total" : 7241021.5, "E_Year" : 248388, "P" : 108, "SOC" : 3 } ...

Marcus-Raphael-Schuel avatar Feb 10 '19 14:02 Marcus-Raphael-Schuel

I have the same problem.

pswired avatar Apr 23 '19 19:04 pswired

Having same issue, when value is not with '' or ""

e.g.: "value1": 0, <- not ok e.g.: "value1": "0", <- ok

can please somebody fix this?

danja95 avatar Nov 25 '19 08:11 danja95

this commit fixed my problem! https://github.com/c-kr/check_json/pull/38/commits/e73d74a8e23dba9b56015cdc231a3719e4ab59d5

danja95 avatar Nov 25 '19 09:11 danja95