protected PropertiesManager getPropertiesManager() { return Configuration.get().getPropertiesManager(); }
protected HostsList getHostsList() { return Configuration.get().getHostsList(); }
@Override public int getGeneration() { return Configuration.get().getHostsList().getGeneration(); }
@Override public void start(String[] args) throws Exception { System.setProperty("java.awt.headless", "true"); jrds.JrdsLoggerConfiguration.initLog4J(); Properties pm = new Properties(); File propFile = new File(propFileName); if(propFile.isFile()) pm.load(new FileReader(propFile)); pm.setProperty("withjmx", "yes"); jrds.Configuration.configure(pm); jrds.JrdsLoggerConfiguration.configure(jrds.Configuration.get().getPropertiesManager()); if(jrds.Configuration.get().getPropertiesManager().withjmx) { doJmx(jrds.Configuration.get().getPropertiesManager()); Management.register(propFile); } // Make it wait on himself to wait forever try { Thread.currentThread().join(); System.out.print("joined"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
@Override public int getHostsCount() { HostsList hl = Configuration.get().getHostsList(); Collection<HostInfo> hosts = hl.getHosts(); return hosts.size(); }
public GraphNode getGraphNode(JrdsServlet caller) { GraphNode gn = null; if(id != null) gn = hostlist.getGraphById(id); if(gn != null) { logger.debug(jrds.Util.delayedFormatString("Graph found: %s", gn)); } else if(pid != null && pid != 0 && dsName != null) { if(!caller.allowed(this, hostlist.getDefaultRoles())) return null; Probe<?, ?> p = getProbe(); if(p == null) { logger.error("Looking for unknown probe"); return null; } logger.debug(jrds.Util.delayedFormatString("Probe found: %s", p)); Graphics2D g2d = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB).createGraphics(); String graphDescName = p.getName() + "." + dsName; GraphDesc gd = new GraphDesc(); gd.setName(graphDescName); gd.setGraphName(p.getHost().getName() + "." + p.getName() + "." + dsName); gd.setGraphTitle(p.getName() + "." + dsName + " on ${host}"); gd.add(dsName, GraphDesc.LINE); gd.initializeLimits(g2d); gn = new GraphNode(p, gd); gn.addACL(Configuration.get().getPropertiesManager().defaultACL); } return gn; }
@Override public Map<String, Number> getLastValues(String host, String probeName) { Probe<?, ?> p = Configuration.get().getHostsList().getProbeByPath(host, probeName); return p.getLastValues(); }
@Override public int getProbesCount() { Configuration c = Configuration.get(); HostsList hl = c.getHostsList(); Collection<HostInfo> hosts = hl.getHosts(); int numProbes = 0; for(HostInfo h: hosts) { numProbes += h.getNumProbes(); } return numProbes; }
@Override public void run() { HostsList hl = Configuration.get().getHostsList(); try { for(Timer t: hl.getTimers()) { t.lockCollect(); } Thread.sleep(jrds.Util.parseStringNumber(arg, 1) * 1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } for(Timer t: hl.getTimers()) { t.releaseCollect(); } logger.info("collect restarted"); } };