private Period makePeriod() { Period p = null; try { String scaleStr = getValue("scale"); // Changed name for this attribute if(scaleStr == null) scaleStr = getValue("autoperiod"); int scale = jrds.Util.parseStringNumber(scaleStr, -1); String end = getValue("end"); String begin = getValue("begin"); if(scale > 0) p = new Period(scale); else if(end != null && begin != null) p = new Period(begin, end); else p = new Period(); if(params.containsKey("periodnext")) p = p.next(); else if(params.containsKey("periodprevious")) p = p.previous(); } catch (NumberFormatException | ParseException e) { logger.error("Period cannot be parsed: " + e.getMessage()); } return p; }
String packed = getValue("p"); if(packed != null && !"".equals(packed)) unpack(packed); String host = getValue("host"); String probe = getValue("probe"); gid = jrds.Util.parseStringNumber(getValue("gid"), 0); String idStr = getValue("id"); String graph = getValue("graphname"); if(idStr != null && !"".equals(idStr)) id = Util.parseStringNumber(idStr, 0); String pidStr = getValue("pid"); if(pidStr != null) pid = jrds.Util.parseStringNumber(pidStr, 0); dsName = getValue("dsName"); if("".equals(dsName)) dsName = null; String sortArg = getValue("sort"); if(sortArg != null && "true".equals(sortArg.toLowerCase())) sorted = true; String historyArg = getValue("history"); if("1".equals(historyArg)) history = true;
if(params.getValue("sync") != null) { configthread.run(); } else {
/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { ParamsBean params = new ParamsBean(req, getHostsList(), "command", "arg"); String command = params.getValue("command"); if(command == null || "".equals(command)) { command = req.getServletPath().substring(1); } logger.debug(Util.delayedFormatString("Command found: %s", command)); if(!allowed(params, getPropertiesManager().adminACL, req, res)) return; if("reload".equalsIgnoreCase(command)) { ServletContext ctxt = getServletContext(); // only one reload allowed to run, just ignore synchronous reload if(ReloadHostList.reloading.tryAcquire()) { reload(ctxt); } res.sendRedirect(req.getContextPath() + "/"); } else if("pause".equalsIgnoreCase(command)) { ServletContext ctxt = getServletContext(); pause(ctxt, params.getValue("arg")); res.sendRedirect(req.getContextPath() + "/"); } }
res.addHeader("content-disposition", "attachment; filename=" + fileName); DateFormat exportDateFormat = humanDateFormat.get(); if(params.getValue("epoch") != null) { exportDateFormat = epochFormat.get();
if(params.getValue("json") != null) { JrdsJSONWriter writer = new JrdsJSONWriter(res); try {
ParamsBean params = new ParamsBean(req, hl, "host", "probe", "dsname", "period", "cf"); long period = jrds.Util.parseStringNumber(params.getValue("period"), new Long(hl.getStep())); String cfName = params.getValue("cf"); if(cfName == null || cfName.trim().isEmpty()) cfName = "AVERAGE"; String ds = params.getValue("dsname");
try { w.object(); doVariable(w, "pid", params.getValue("pid")); doVariable(w, "id", params.getValue("id")); doVariable(w, "gid", params.getValue("gid")); doVariable(w, "sort", params.getValue("sort")); String pathString = params.getValue("path"); if(pathString != null && !"".equals(pathString)) { doVariable(w, "path", new JSONArray(pathString)); doVariable(w, "dsName", params.getValue("dsName")); doVariable(w, "begin", params.getBegin()); doVariable(w, "end", params.getEnd());