org.hyperic.sigar.NetStat类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(198)

本文整理了Java中org.hyperic.sigar.NetStat类的一些代码示例,展示了NetStat类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NetStat类的具体详情如下:
包路径:org.hyperic.sigar.NetStat
类名称:NetStat

NetStat介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

.put("sys/net/inbound", (long) netStat.getAllInboundTotal())
  .put("sys/net/outbound", (long) netStat.getAllOutboundTotal())
  .put("sys/tcp/inbound", (long) netStat.getTcpInboundTotal())
  .put("sys/tcp/outbound", (long) netStat.getTcpOutboundTotal())
  .put(
    "sys/tcp/state/established",
    (long) netStat.getTcpEstablished()
  .put("sys/tcp/state/synSent", (long) netStat.getTcpSynSent())
  .put("sys/tcp/state/synRecv", (long) netStat.getTcpSynRecv())
  .put("sys/tcp/state/finWait1", (long) netStat.getTcpFinWait1())
  .put("sys/tcp/state/finWait2", (long) netStat.getTcpFinWait2())
  .put("sys/tcp/state/timeWait", (long) netStat.getTcpTimeWait())
  .put("sys/tcp/state/close", (long) netStat.getTcpClose())
  .put("sys/tcp/state/closeWait", (long) netStat.getTcpCloseWait())
  .put("sys/tcp/state/lastAck", (long) netStat.getTcpLastAck())
  .put("sys/tcp/state/listen", (long) netStat.getTcpListen())
  .put("sys/tcp/state/closing", (long) netStat.getTcpClosing())
  .put("sys/tcp/state/idle", (long) netStat.getTcpIdle())
  .put("sys/tcp/state/bound", (long) netStat.getTcpBound())
  .build();
for (Map.Entry<String, Long> entry : stats.entrySet()) {

代码示例来源:origin: scouter-project/scouter

void netstat() throws SigarException {
  long now = System.currentTimeMillis();
  if (now - last_time < 10000) {
    return;
  }
  last_time = now;
  NetStat net = sigar.getNetStat();
  this.net_in = net.getAllInboundTotal();
  this.net_out = net.getAllOutboundTotal();
  this.tcpstat_close = net.getTcpCloseWait();
  this.tcpstat_fin1 = net.getTcpFinWait1();
  this.tcpstat_fin2 = net.getTcpFinWait2();
  this.tcpstat_time = net.getTcpTimeWait();
  this.tcpstat_est = net.getTcpEstablished();
}

代码示例来源:origin: org.apache.geronimo/geronimo-metrics-sigar

definitions.add(new Definition("sigar.network.tcp.output.total", "Total Outbound",
      "Sent bytes", "bytes",
      () -> sigar.getNetStat().getTcpOutboundTotal()));
  definitions.add(new Definition("sigar.network.tcp.inbound.total", "Total Inbound",
      "Received bytes", "bytes",
      () -> sigar.getNetStat().getTcpInboundTotal()));
  definitions.add(new Definition("sigar.network.tcp.established", "TCP established",
      "TCP established", "count",
      () -> sigar.getNetStat().getTcpEstablished()));
  definitions.add(new Definition("sigar.network.tcp.idle", "TCP Idle",
      "TCP Idle", "count",
      () -> sigar.getNetStat().getTcpIdle()));
  definitions.add(new Definition("sigar.network.tcp.closing", "TCP Closing",
      "TCP Closing", "count",
      () -> sigar.getNetStat().getTcpClosing()));
  definitions.add(new Definition("sigar.network.tcp.bound", "TCP Bound",
      "TCP Bound", "count",
      () -> sigar.getNetStat().getTcpBound()));
  definitions.add(new Definition("sigar.network.tcp.close", "TCP Close",
      "TCP Close", "count",
      () -> sigar.getNetStat().getTcpClose()));
  definitions.add(new Definition("sigar.network.tcp.closewait", "TCP Close Wait",
      "TCP Close Wait", "count",
      () -> sigar.getNetStat().getTcpCloseWait()));
  definitions.add(new Definition("sigar.network.tcp.listen", "TCP Listen",
      "TCP Listen", "count",
      () -> sigar.getNetStat().getTcpListen()));
} catch (final Exception | Error  notAvailable) {

代码示例来源:origin: org.rhq/rhq-core-native-system

public void refresh(NetStat interfaceStat) {
  this.tcpStates = interfaceStat.getTcpStates();
  this.tcpInboundTotal = interfaceStat.getTcpInboundTotal();
  this.tcpOutboundTotal = interfaceStat.getTcpOutboundTotal();
  this.allInboundTotal = interfaceStat.getAllInboundTotal();
  this.allOutboundTotal = interfaceStat.getAllOutboundTotal();
}

代码示例来源:origin: griddynamics/jagger

@Override
public TcpData getTcpData() {
  TcpData data = new TcpData();
  try {
    NetStat stat = sigar.getNetStat();
    data.setTcpBound(stat.getTcpBound());
    data.setTcpEstablished(stat.getTcpEstablished());
    data.setTcpIdle(stat.getTcpIdle());
    data.setTcpListen(stat.getTcpListen());
    data.setTcpSynchronizedReceived(stat.getTcpSynRecv());
    long inboundBytes = 0;
    long outboundBytes = 0;
    for(String netInterface : sigar.getNetInterfaceList()) {
      for(String mask : interfaceNames) {
        if(netInterface.matches(mask)) {
          inboundBytes += sigar.getNetInterfaceStat(netInterface).getRxBytes();
          outboundBytes += sigar.getNetInterfaceStat(netInterface).getTxBytes();
        }
      }
    }
    data.setTcpInboundTotal(inboundBytes);
    data.setTcpOutboundTotal(outboundBytes);
    logger.debug("getTcpData: {}", data);
  } catch (SigarException e) {
    logger.warn("Exception during getTcpData", e);
  }
  return data;
}

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpInboundTotal() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpCloseWait() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpEstablished() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpOutboundTotal() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpClose() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpBound() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpIdle() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpFinWait1() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpClosing() );
  }
};

代码示例来源:origin: com.axway.ats.framework.agent.standalone/ats-agent-monitoring

@Override
  public float poll() {
    return fixLongValue( sigarWrapper.netstat.getTcpFinWait2() );
  }
};

代码示例来源:origin: rhq-project/rhq

public void refresh(NetStat interfaceStat) {
  this.tcpStates = interfaceStat.getTcpStates();
  this.tcpInboundTotal = interfaceStat.getTcpInboundTotal();
  this.tcpOutboundTotal = interfaceStat.getTcpOutboundTotal();
  this.allInboundTotal = interfaceStat.getAllInboundTotal();
  this.allOutboundTotal = interfaceStat.getAllOutboundTotal();
}

代码示例来源:origin: griddynamics/jagger

private static Map<String, String> toMap(NetStat netStat) {
  Map<String, String> result = Maps.newHashMap();
  result.put("allInboundTotal", "" + netStat.getAllInboundTotal());
  result.put("allOutboundTotal", "" + netStat.getAllOutboundTotal());
  result.put("tcpBound", "" + netStat.getTcpBound());
  result.put("tcpClose", "" + netStat.getTcpClose());
  result.put("tcpCloseWait", "" + netStat.getTcpCloseWait());
  result.put("tcpClosing", "" + netStat.getTcpClosing());
  result.put("tcpEstablished", "" + netStat.getTcpEstablished());
  result.put("tcpFinWait1", "" + netStat.getTcpFinWait1());
  result.put("tcpFinWait2", "" + netStat.getTcpFinWait2());
  result.put("tcpIdle", "" + netStat.getTcpIdle());
  result.put("tcpInboundTotal", "" + netStat.getTcpInboundTotal());
  result.put("tcpLastAck", "" + netStat.getTcpLastAck());
  result.put("tcpListen", "" + netStat.getTcpListen());
  result.put("tcpOutboundTotal", "" + netStat.getTcpOutboundTotal());
  result.put("tcpStates", "" + netStat.getTcpStates());
  result.put("tcpSynRecv", "" + netStat.getTcpSynRecv());
  result.put("tcpSynSent", "" + netStat.getTcpSynSent());
  result.put("tcpTimeWait", "" + netStat.getTcpTimeWait());
  return result;
}

代码示例来源:origin: kg.apc/perfmon

switch (type) {
  case BOUND:
    val = stat.getTcpBound();
    break;
  case CLOSE:
    val = stat.getTcpClose();
    break;
  case CLOSE_WAIT:
    val = stat.getTcpCloseWait();
    break;
  case CLOSING:
    val = stat.getTcpClosing();
    break;
  case ESTAB:
    val = stat.getTcpEstablished();
    break;
  case FIN_WAIT1:
    val = stat.getTcpFinWait1();
    break;
  case FIN_WAIT2:
    val = stat.getTcpFinWait2();
    break;
  case IDLE:
    val = stat.getTcpIdle();
    break;
  case INBOUND_TOTAL:
    val = stat.getTcpInboundTotal();
    break;
  case LAST_ACK:

代码示例来源:origin: undera/perfmon-agent

switch (type) {
  case BOUND:
    val = stat.getTcpBound();
    break;
  case CLOSE:
    val = stat.getTcpClose();
    break;
  case CLOSE_WAIT:
    val = stat.getTcpCloseWait();
    break;
  case CLOSING:
    val = stat.getTcpClosing();
    break;
  case ESTAB:
    val = stat.getTcpEstablished();
    break;
  case FIN_WAIT1:
    val = stat.getTcpFinWait1();
    break;
  case FIN_WAIT2:
    val = stat.getTcpFinWait2();
    break;
  case IDLE:
    val = stat.getTcpIdle();
    break;
  case INBOUND_TOTAL:
    val = stat.getTcpInboundTotal();
    break;
  case LAST_ACK:

代码示例来源:origin: metamx/java-util

.put("sys/net/inbound", (long) netStat.getAllInboundTotal())
                      .put("sys/net/outbound", (long) netStat.getAllOutboundTotal())
                      .put("sys/tcp/inbound", (long) netStat.getTcpInboundTotal())
                      .put("sys/tcp/outbound", (long) netStat.getTcpOutboundTotal())
                      .put(
                        "sys/tcp/state/established",
                        (long) netStat.getTcpEstablished()
                      .put("sys/tcp/state/synSent", (long) netStat.getTcpSynSent())
                      .put("sys/tcp/state/synRecv", (long) netStat.getTcpSynRecv())
                      .put("sys/tcp/state/finWait1", (long) netStat.getTcpFinWait1())
                      .put("sys/tcp/state/finWait2", (long) netStat.getTcpFinWait2())
                      .put("sys/tcp/state/timeWait", (long) netStat.getTcpTimeWait())
                      .put("sys/tcp/state/close", (long) netStat.getTcpClose())
                      .put("sys/tcp/state/closeWait", (long) netStat.getTcpCloseWait())
                      .put("sys/tcp/state/lastAck", (long) netStat.getTcpLastAck())
                      .put("sys/tcp/state/listen", (long) netStat.getTcpListen())
                      .put("sys/tcp/state/closing", (long) netStat.getTcpClosing())
                      .put("sys/tcp/state/idle", (long) netStat.getTcpIdle())
                      .put("sys/tcp/state/bound", (long) netStat.getTcpBound())
                      .build();
for (Map.Entry<String, Long> entry : stats.entrySet()) {

相关文章