check_json
check_json copied to clipboard
Doesn't seem to handle 302 connections
We're trying to pull json data back from ntop ntopng server. It works fine with wget and curl but on the command line it fails with a 302 error
Check JSON status API CRITICAL - Connection failed: 302 Found
If I run a curl command:
$ curl -s "http://10.10.0.99:3000/lua/host_get_json.lua?ifname=0&host=10.10.0.67"
we get good output:
HTTP/1.1 200 OK
Cache-Control: max-age=0, no-cache, no-store
Server: ntopng 2.0.150531 [Debian jessie/sid (x86_64)]
Pragma: no-cache
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Set-Cookie: session=; max-age=3600; path=/; HttpOnly
Content-Type: application/json
Last-Modified: Thu, 09 September 2015 20:10:54 GMT
{ "mac_address": "00:23:AE:A0:89:1B", "asn": 0, "symbolic_name": "10.10.0.67", "category": "safe", "ip": { "ipVersion": 4, "localHost": false, "ip": "10.10.0.67" }, "localHost": true, "systemHost": false, "tcp_sent": { "packets": 1958033, "bytes": 318127095 }, "tcp_rcvd": { "packets": 1784791, "bytes": 1119715863 }, "udp_sent": { "packets": 12190, "bytes": 3046196 }, "udp_rcvd": { "packets": 0, "bytes": 0 }, "icmp_sent": { "packets": 0, "bytes": 0 }, "icmp_rcvd": { "packets": 0, "bytes": 0 }, "other_ip_sent": { "packets": 0, "bytes": 0 }, "other_ip_rcvd": { "packets": 0, "bytes": 0 }, "pktStats.sent": { "upTo64": 1106380, "upTo128": 468681, "upTo256": 2091, "upTo512": 50494, "upTo1024": 354549, "upTo1518": 10 }, "pktStats.recv": { "upTo64": 787311, "upTo128": 475369, "upTo256": 169050, "upTo512": 78722, "upTo1024": 158387, "upTo1518": 14365, "upTo2500": 3749, "upTo6500": 44319, "upTo9000": 10807, "above9000": 43407 }, "throughput_bps": 19409.199219, "throughput_trend_bps": "Down", "throughput_pps": 62.200001,SNIPPED FOR EASE OF POSTING
It looks like it's not following the redirect but curl/wget do. Tried a few things with
push @{ $ua->requests_redirectable }, 'POST';
but that didn't help. Any ideas?
You could try to change line 123 to:
if ($response->is_redirect) {
Or remove this content check for testing. Maybe this works.