/** * Define the uptime of the probe * * @param uptime in seconds */ public void setUptime(long uptime) { log(Level.TRACE, "Setting probe uptime to: %d", uptime); this.uptime = uptime; }
public void log(Level l, Throwable e, String format, Object... elements) { p.log(l, e, format, elements); }
public void log(Level l, String format, Object... elements) { p.log(l, format, elements); }
boolean interrupted = true; if(!finished) { log(Level.ERROR, "Using an unfinished probe"); return; log(Level.ERROR, "Hanged from a previous collect"); return; log(Level.DEBUG, "launching collect"); try { log(Level.WARN, ex, "Error while storing sample: %s", ex.getMessage()); } catch (Exception e) { Throwable rootCause = e; rootCause = upCause; } while (upCause != null); log(Level.ERROR, e, "Error while collecting: %s", message); } finally { stopCollect(); log(Level.DEBUG, "collect ran for %dms", (end - start)); Timer timer = (Timer) getParent().getParent(); if((end - start) > (timer.getSlowCollectTime() * 1000)) { log(Level.WARN, "slow collect time %.0fs", 1.0 * (end - start) / 1000); log(Level.DEBUG, "Interrupted after %.2fs", elapsed);
/** * Store the collected values in the sample * * @param oneSample */ public boolean injectSample(JrdsSample oneSample, Map<KeyType, ValueType> sampleVals) { log(Level.TRACE, "Collected values: %s", sampleVals); if(getUptime() * pd.getUptimefactor() < pd.getHeartBeatDefault()) { log(Level.INFO, "uptime too low: %.0f", getUptime() * pd.getUptimefactor()); return false; } // Set the default values that might be defined in the probe description for(Map.Entry<String, Double> e: getPd().getDefaultValues().entrySet()) { oneSample.put(e); } Map<?, String> nameMap = getCollectMapping(); log(Level.TRACE, "Collect keys: %s", nameMap); Map<KeyType, Number> filteredSamples = filterValues(sampleVals); log(Level.TRACE, "Filtered values: %s", filteredSamples); for(Map.Entry<KeyType, Number> e: filteredSamples.entrySet()) { String dsName = nameMap.get(e.getKey()); if(dsName != null) { oneSample.put(dsName, e.getValue()); } else { log(Level.TRACE, "Dropped entry: %s", e.getKey()); } } modifySample(oneSample, sampleVals); return true; }
/** * Check the final status of the probe. It must be called once before an * probe can be used * * Open the rrd backend of the probe. it's created if it's needed * */ public boolean checkStore() { ProbeDesc<KeyType> pd = getPd(); if(pd == null) { log(Level.ERROR, "Missing Probe description"); return false; } if(getHost() == null) { log(Level.ERROR, "Missing host"); return false; } // Name can be set by other means if(name == null) name = parseTemplate(pd.getProbeName()); finished = mainStore.checkStoreFile(archives); return finished; }