com.github.diceproject.qt.util.StormUICapacityMonitor Maven / Gradle / Ivy
package com.github.diceproject.qt.util;
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONArray;
import org.json.JSONObject;
/*
curl -H "Content-Type: application/json" -XPOST http://109.231.122.229:5001/dmon/v1/observer/query/json -d '{"DMON":{"fname":"output","ordering":"desc","queryString":"NOT _type=collectd","size": 100,"tstart":"2017-03-04T12:19:30.000Z","tstop":"2017-03-04T12:20:00.000Z"}}'
*/
public class StormUICapacityMonitor {
public static List DMONkeys = Arrays.asList("capacity");
public static double recurJSON(JSONObject jsonObj) {
Double maxcapacity = new Double(0.0);
Iterator> keys = jsonObj.keys();
while( keys.hasNext() ) {
String key = (String)keys.next();
if ( jsonObj.get(key) instanceof JSONArray ) {
JSONArray a = (JSONArray) jsonObj.get(key);
List list = new ArrayList<>();
for (int i=0; i list = new ArrayList<>();
for (int i=0; i