Codota Logo
HostInfo
Code IndexAdd Codota to your IDE (free)

How to use
HostInfo
in
jrds

Best Java code snippets using jrds.HostInfo (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: fbacchella/jrds

  @Override
  String toString(Object o) {
    return ((HostInfo) o).getName();
  }
},
origin: fbacchella/jrds

public HostInfo makeHost(JrdsDocument n) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
  JrdsElement hostNode = n.getRootElement();
  String hostName = hostNode.getAttribute("name");
  String dnsHostname = hostNode.getAttribute("dnsName");
  if(hostName == null) {
    return null;
  }
  HostInfo host;
  if(dnsHostname != null) {
    host = new HostInfo(hostName, dnsHostname);
  } else {
    host = new HostInfo(hostName);
  }
  host.setHostDir(new File(pm.rrddir, host.getName()));
  String hidden = hostNode.getAttribute("hidden");
  host.setHidden(hidden != null && Boolean.parseBoolean(hidden));
  Map<String, Set<String>> collections = new HashMap<String, Set<String>>();
  parseFragment(hostNode, host, collections, null);
  return host;
}
origin: fbacchella/jrds

public HostStarter(HostInfo host) {
  super();
  this.host = host;
  this.runningname = host.getName() + ":notrunning";
  registerStarter(new Resolver(host.getDnsName()));
}
origin: fbacchella/jrds

public void configure() throws InvocationTargetException {
  Map<String, String> empty = Collections.emptyMap();
  setMainStore(new RrdDbStoreFactory(), empty);
  ProbeDesc<String> pd = new ProbeDesc<>();
  pd.setName("DummyProbe");
  pd.setProbeName("dummyprobe");
  setPd(pd);
  if(getHost() == null) {
    HostInfo host = new HostInfo("DummyHost");
    host.setHostDir(new File("tmp"));
    setHost(new HostStarter(host));
  }
  Map<String, Object> dsMap = new HashMap<String, Object>();
  dsMap.put("dsName", "ds0");
  dsMap.put("dsType", DsType.COUNTER);
  dsMap.put("collectKey", "/jrdsstats/stat[@key='a']/@value");
  pd.add(dsMap);
  dsMap = new HashMap<String, Object>();
  dsMap.put("dsName", "ds1");
  dsMap.put("dsType", DsType.COUNTER);
  dsMap.put("collectKey", "/jrdsstats/stat[@key='b']/@value");
  pd.add(dsMap);
  dsMap = new HashMap<String, Object>();
  dsMap.put("dsName", "ds2");
  dsMap.put("dsType", DsType.COUNTER);
  pd.add(dsMap);
}
origin: fbacchella/jrds

host.addConnection(cnx);
String textContent = tagElem.getTextContent();
if(textContent != null) {
  host.addTag(Util.parseTemplate(textContent.trim(), host, properties));
  makeProbe(probeNode, host, properties);
} catch (InvocationTargetException e) {
  logger.error("Probe creation failed for host " + host.getName() + ": " + e.getMessage());
  if(logger.isDebugEnabled()) {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  logger.error("Probe creation failed for host " + host.getName() + ": ");
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  e.printStackTrace(new PrintStream(buffer));
host.addProbe(graphprobe);
for(JrdsElement graphNode: fragment.getChildElementsByName("graph")) {
  GraphDesc gd = graphDescMap.get(graphNode.getAttribute("type"));
  if(gd == null) {
    logger.error(String.format("Graph %s not found for host %s", graphNode.getAttribute("type"), host.getName()));
    continue;
origin: fbacchella/jrds

for(final Probe<?, ?> p: host.getProbes()) {
  final Runnable runUpgrade = new Runnable() {
    private Probe<?, ?> lp = p;
origin: fbacchella/jrds

@Test
public void testProbe2() throws Exception {
  JrdsDocument d = Tools.parseString(goodProbeXml2);
  PropertiesManager pm = Tools.makePm(testFolder);
  HostBuilder hb = new HostBuilder();
  hb.setProbeFactory(new MokeProbeFactory());
  hb.setPm(pm);
  hb.setTimers(Tools.getSimpleTimerMap());
  HostInfo host = new HostInfo("testProbe2");
  host.setHostDir(pm.rrddir);
  Probe<?, ?> p = hb.makeProbe(d.getRootElement(), host, null);
  Assert.assertNotNull(p);
  Assert.assertEquals(host.getName() + "/" + p.getName(), p.toString());
}
origin: fbacchella/jrds

ExtractInfo ei = ExtractInfo.get().make(ConsolFun.AVERAGE).make(start, now).make(step);
for (HostInfo hi: hostsList.getHosts()) {
  System.out.println(hi.getName());
  for (Probe<?, ?> p: hi.getProbes()) {
    System.out.println("    " + p.getName());
    try (Extractor ex = p.fetchData()) {
origin: fbacchella/jrds

static public HostInfo getHost() {
  return new HostInfo("MokeHost");
}
origin: fbacchella/jrds

  logger.error("Invalid timer '" + timerName + "' for probe " + host.getName() + "/" + type);
  return null;
} else {
      logger.trace(Util.delayedFormatString("Looking for connection %s in %s", connectionName, host.getConnections()));
    ConnectionInfo ci = host.getConnection(connectionName);
    if (ci != null)
      ci.register(shost);
origin: fbacchella/jrds

  @Override
  String toString(Object o) {
    return ((HostInfo) o).getDnsName();
  }
},
origin: fbacchella/jrds

@Test
public void instantiate() throws InvocationTargetException {
  Map<String, String> empty = Collections.emptyMap();
  ConnectionInfo ci = new ConnectionInfo(JdbcConnection.class, "jrds.probe.jdbc.JdbcConnection", Collections.emptyList(), empty);
  HostInfo hi = new HostInfo("localhost");
  hi.addConnection(ci);
  HostStarter hs = new HostStarter(hi);
  ci.register(hs);
  Assert.assertEquals("connection not found", "jrds.probe.jdbc.JdbcConnection@localhost", hs.find(JdbcConnection.class).toString());
}
origin: fbacchella/jrds

public Set<String> getTags() {
  return host.getTags();
}
origin: fbacchella/jrds

p.getHost().setHostDir(testFolder.getRoot());
origin: fbacchella/jrds

private HostStarter addConnection(Starter cnx) throws IOException {
  String truststore = getClass().getClassLoader().getResource("localhost.jks").getFile();
  PropertiesManager pm = Tools.makePm(testFolder, "timeout=1", "collectorThreads=1",
      "ssl.protocol=TLS", "ssl.strict=true", "ssl.truststore=" + truststore, "ssl.trustpassword=123456");
  HostStarter localhost = new HostStarter(new HostInfo("localhost"));
  Timer t = Tools.getDefaultTimer();
  localhost.setParent(t);
  localhost.getHost().setHostDir(testFolder.getRoot());
  t.registerStarter(new SSLStarter());
  t.registerStarter(new SocketFactory());
  t.configureStarters(pm);
  localhost.registerStarter(cnx);
  cnx.configure(pm);
  return localhost;
}
origin: fbacchella/jrds

@Test
public void testMacroFill() throws Exception {
  JrdsDocument d = Tools.parseString(goodMacroXml);
  Macro m = doMacro(d, "macrodef");
  JrdsDocument hostdoc = Tools.parseString(goodHostXml);
  HostBuilder hb = getBuilder(m);
  HostInfo host = hb.makeHost(hostdoc);
  Collection<String> probesName = new ArrayList<String>();
  for(Probe<?, ?> p: host.getProbes()) {
    probesName.add(p.toString());
  }
  logger.trace(probesName);
  Assert.assertTrue("MacroProbe1 not found", probesName.contains("myhost/MacroProbe1"));
  Assert.assertTrue("MacroProbe2 not found", probesName.contains("myhost/MacroProbe2"));
}
origin: fbacchella/jrds

@Test
public void manageArgs() throws Exception {
  URL url = getClass().getResource("/ressources/xmldata.xml");
  List<Object> args = new ArrayList<Object>(1);
  args.add("a");
  args.add("/jrdsstats/stat[@key='a']/@value");
  HttpXml p = new jrds.probe.HttpXml() {
    @Override
    public String getName() {
      return "Moke";
    }
  };
  HostStarter host = new HostStarter(new HostInfo("moke"));
  p.setHost(host);
  p.setPd(pd);
  p.configure(url, args);
  Map<String, String> keys = p.getCollectMapping();
  logger.trace("Collect keys: " + p.getCollectMapping());
  logger.trace("Collect strings: " + pd.getCollectMapping());
  Assert.assertTrue(keys.containsKey("/jrdsstats/stat[@key='%1$s']/@value"));
  Assert.assertTrue(keys.containsKey("/jrdsstats/stat[@key='b']/@value"));
  Assert.assertTrue(keys.containsKey("c"));
}
origin: fbacchella/jrds

public String getDnsName() {
  return host.getDnsName();
}
origin: fbacchella/jrds

public Set<String> getTags() {
  return getHost().getTags();
}
origin: fbacchella/jrds

public String getName() {
  return host.getName();
}
jrdsHostInfo

Most used methods

  • getName
  • getProbes
  • <init>
  • addConnection
  • getDnsName
  • getTags
  • setHostDir
  • addProbe
  • addTag
  • getConnection
  • getConnections
  • getHostDir
  • getConnections,
  • getHostDir,
  • getNumProbes,
  • isHidden,
  • setHidden,
  • toString

Popular in Java

  • Updating database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
  • getContentResolver (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Notification (javax.management)
  • BoxLayout (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now