本文整理汇总了Java中org.elasticsearch.monitor.os.OsStats类的典型用法代码示例。如果您正苦于以下问题:Java OsStats类的具体用法?Java OsStats怎么用?Java OsStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OsStats类属于org.elasticsearch.monitor.os包,在下文中一共展示了OsStats类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: NodeStats
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable AllCircuitBreakerStats breaker,
@Nullable ScriptStats scriptStats,
@Nullable DiscoveryStats discoveryStats,
@Nullable IngestStats ingestStats) {
super(node);
this.timestamp = timestamp;
this.indices = indices;
this.os = os;
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.fs = fs;
this.transport = transport;
this.http = http;
this.breaker = breaker;
this.scriptStats = scriptStats;
this.discoveryStats = discoveryStats;
this.ingestStats = ingestStats;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:NodeStats.java
示例2: readFrom
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
timestamp = in.readVLong();
if (in.readBoolean()) {
indices = NodeIndicesStats.readIndicesStats(in);
}
os = in.readOptionalWriteable(OsStats::new);
process = in.readOptionalWriteable(ProcessStats::new);
jvm = in.readOptionalWriteable(JvmStats::new);
threadPool = in.readOptionalWriteable(ThreadPoolStats::new);
fs = in.readOptionalWriteable(FsInfo::new);
transport = in.readOptionalWriteable(TransportStats::new);
http = in.readOptionalWriteable(HttpStats::new);
breaker = in.readOptionalWriteable(AllCircuitBreakerStats::new);
scriptStats = in.readOptionalWriteable(ScriptStats::new);
discoveryStats = in.readOptionalWriteable(DiscoveryStats::new);
ingestStats = in.readOptionalWriteable(IngestStats::new);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:NodeStats.java
示例3: NodeStats
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable AllCircuitBreakerStats breaker,
@Nullable ScriptStats scriptStats) {
super(node);
this.timestamp = timestamp;
this.indices = indices;
this.os = os;
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.fs = fs;
this.transport = transport;
this.http = http;
this.breaker = breaker;
this.scriptStats = scriptStats;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:NodeStats.java
示例4: sendNodeOsStats
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
private void sendNodeOsStats(OsStats osStats)
{
String type = buildMetricName("node.os");
if (osStats.cpu() != null) {
sendGauge(type + ".cpu", "sys", osStats.cpu().sys());
sendGauge(type + ".cpu", "idle", osStats.cpu().idle());
sendGauge(type + ".cpu", "user", osStats.cpu().user());
}
if (osStats.mem() != null) {
sendGauge(type + ".mem", "freeBytes", osStats.mem().free().bytes());
sendGauge(type + ".mem", "usedBytes", osStats.mem().used().bytes());
sendGauge(type + ".mem", "freePercent", osStats.mem().freePercent());
sendGauge(type + ".mem", "usedPercent", osStats.mem().usedPercent());
sendGauge(type + ".mem", "actualFreeBytes", osStats.mem().actualFree().bytes());
sendGauge(type + ".mem", "actualUsedBytes", osStats.mem().actualUsed().bytes());
}
if (osStats.swap() != null) {
sendGauge(type + ".swap", "freeBytes", osStats.swap().free().bytes());
sendGauge(type + ".swap", "usedBytes", osStats.swap().used().bytes());
}
}
开发者ID:swoop-inc,项目名称:elasticsearch-statsd-plugin,代码行数:25,代码来源:StatsdReporter.java
示例5: sendNodeOsStats
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
private void sendNodeOsStats(OsStats osStats) {
String type = buildMetricName("node.os");
if (osStats.cpu() != null) {
sendInt(type + ".cpu", "sys", osStats.cpu().sys());
sendInt(type + ".cpu", "idle", osStats.cpu().idle());
sendInt(type + ".cpu", "user", osStats.cpu().user());
}
if (osStats.mem() != null) {
sendInt(type + ".mem", "freeBytes", osStats.mem().free().bytes());
sendInt(type + ".mem", "usedBytes", osStats.mem().used().bytes());
sendInt(type + ".mem", "freePercent", osStats.mem().freePercent());
sendInt(type + ".mem", "usedPercent", osStats.mem().usedPercent());
sendInt(type + ".mem", "actualFreeBytes", osStats.mem().actualFree().bytes());
sendInt(type + ".mem", "actualUsedBytes", osStats.mem().actualUsed().bytes());
}
if (osStats.swap() != null) {
sendInt(type + ".swap", "freeBytes", osStats.swap().free().bytes());
sendInt(type + ".swap", "usedBytes", osStats.swap().used().bytes());
}
}
开发者ID:spinscale,项目名称:elasticsearch-graphite-plugin,代码行数:24,代码来源:GraphiteReporter.java
示例6: testValuesSmokeScreen
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
public void testValuesSmokeScreen() throws IOException, ExecutionException, InterruptedException {
internalCluster().startNodes(randomIntBetween(1, 3));
index("test1", "type", "1", "f", "f");
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
String msg = response.toString();
assertThat(msg, response.getTimestamp(), Matchers.greaterThan(946681200000L)); // 1 Jan 2000
assertThat(msg, response.indicesStats.getStore().getSizeInBytes(), Matchers.greaterThan(0L));
assertThat(msg, response.nodesStats.getFs().getTotal().getBytes(), Matchers.greaterThan(0L));
assertThat(msg, response.nodesStats.getJvm().getVersions().size(), Matchers.greaterThan(0));
assertThat(msg, response.nodesStats.getVersions().size(), Matchers.greaterThan(0));
assertThat(msg, response.nodesStats.getVersions().contains(Version.CURRENT), Matchers.equalTo(true));
assertThat(msg, response.nodesStats.getPlugins().size(), Matchers.greaterThanOrEqualTo(0));
assertThat(msg, response.nodesStats.getProcess().count, Matchers.greaterThan(0));
// 0 happens when not supported on platform
assertThat(msg, response.nodesStats.getProcess().getAvgOpenFileDescriptors(), Matchers.greaterThanOrEqualTo(0L));
// these can be -1 if not supported on platform
assertThat(msg, response.nodesStats.getProcess().getMinOpenFileDescriptors(), Matchers.greaterThanOrEqualTo(-1L));
assertThat(msg, response.nodesStats.getProcess().getMaxOpenFileDescriptors(), Matchers.greaterThanOrEqualTo(-1L));
NodesStatsResponse nodesStatsResponse = client().admin().cluster().prepareNodesStats().setOs(true).get();
long total = 0;
long free = 0;
long used = 0;
for (NodeStats nodeStats : nodesStatsResponse.getNodes()) {
total += nodeStats.getOs().getMem().getTotal().getBytes();
free += nodeStats.getOs().getMem().getFree().getBytes();
used += nodeStats.getOs().getMem().getUsed().getBytes();
}
assertEquals(msg, free, response.nodesStats.getOs().getMem().getFree().getBytes());
assertEquals(msg, total, response.nodesStats.getOs().getMem().getTotal().getBytes());
assertEquals(msg, used, response.nodesStats.getOs().getMem().getUsed().getBytes());
assertEquals(msg, OsStats.calculatePercentage(used, total), response.nodesStats.getOs().getMem().getUsedPercent());
assertEquals(msg, OsStats.calculatePercentage(free, total), response.nodesStats.getOs().getMem().getFreePercent());
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:39,代码来源:ClusterStatsIT.java
示例7: generateMetrics
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
@Override
public void generateMetrics(PrometheusFormatWriter writer, OsStats osStats) {
writer.addGauge("es_cpu_percentage")
.withHelp("ElasticSearch CPU percentage")
.value(osStats.getCpu().getPercent());
writer.addGauge("es_cpu_loadavg")
.withHelp("Elasticsearch CPU loadavg")
.value(osStats.getCpu().getLoadAverage()[0],"loadavg", "1m")
.value(osStats.getCpu().getLoadAverage()[1],"loadavg", "5m")
.value(osStats.getCpu().getLoadAverage()[2],"loadavg", "15m");
writer.addGauge("es_memory")
.withHelp("Elasticsearch memory stats")
.value(osStats.getMem().getFree().getBytes(), "memtype", "free")
.value(osStats.getMem().getUsed().getBytes(), "memtype", "used")
.value(osStats.getMem().getTotal().getBytes(), "memtype", "total");
writer.addGauge("es_memory_free_percentage")
.withHelp("Elasticsearch memory free percentage")
.value(osStats.getMem().getFreePercent());
writer.addGauge("es_swap")
.withHelp("Elasticsearch swap stats")
.value(osStats.getSwap().getFree().getBytes(), "memtype", "free")
.value(osStats.getSwap().getUsed().getBytes(), "memtype", "used")
.value(osStats.getSwap().getTotal().getBytes(), "memtype", "total");
}
开发者ID:jsuchenia,项目名称:elasticsearch-prometheus-metrics,代码行数:29,代码来源:OsMetricsGenerator.java
示例8: NodeMemoryExpression
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
public NodeMemoryExpression(final OsStats stats) {
addChildImplementations(stats.getMem());
childImplementations.put(PROBE_TIMESTAMP, new SysNodeExpression<Long>() {
@Override
public Long value() {
return stats.getTimestamp();
}
});
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:NodeMemoryExpression.java
示例9: addChildImplementations
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
private void addChildImplementations(final OsStats.Mem mem) {
childImplementations.put(FREE, new MemoryExpression() {
@Override
public Long value() {
if (mem != null) {
return mem.getFree().bytes();
}
return -1L;
}
});
childImplementations.put(USED, new MemoryExpression() {
@Override
public Long value() {
if (mem != null) {
return mem.getUsed().bytes();
}
return -1L;
}
});
childImplementations.put(FREE_PERCENT, new MemoryExpression() {
@Override
public Short value() {
if (mem != null) {
return mem.getFreePercent();
}
return -1;
}
});
childImplementations.put(USED_PERCENT, new MemoryExpression() {
@Override
public Short value() {
if (mem != null) {
return mem.getUsedPercent();
}
return -1;
}
});
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:39,代码来源:NodeMemoryExpression.java
示例10: readFrom
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
timestamp = in.readVLong();
if (in.readBoolean()) {
indices = NodeIndicesStats.readIndicesStats(in);
}
if (in.readBoolean()) {
os = OsStats.readOsStats(in);
}
if (in.readBoolean()) {
process = ProcessStats.readProcessStats(in);
}
if (in.readBoolean()) {
jvm = JvmStats.readJvmStats(in);
}
if (in.readBoolean()) {
threadPool = ThreadPoolStats.readThreadPoolStats(in);
}
if (in.readBoolean()) {
fs = FsInfo.readFsInfo(in);
}
if (in.readBoolean()) {
transport = TransportStats.readTransportStats(in);
}
if (in.readBoolean()) {
http = HttpStats.readHttpStats(in);
}
breaker = AllCircuitBreakerStats.readOptionalAllCircuitBreakerStats(in);
scriptStats = in.readOptionalStreamable(new ScriptStats());
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:33,代码来源:NodeStats.java
示例11: getOs
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
/**
* Operating System level statistics.
*/
@Nullable
public OsStats getOs() {
return this.os;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:NodeStats.java
示例12: execute
import org.elasticsearch.monitor.os.OsStats; //导入依赖的package包/类
@Override
public void execute() throws Exception {
// If Elasticsearch is started then only start the monitoring
if (!ElasticsearchProcessMonitor.isElasticsearchRunning()) {
String exceptionMsg = "Elasticsearch is not yet started, check back again later";
logger.info(exceptionMsg);
return;
}
OsStatsBean osStatsBean = new OsStatsBean();
try {
NodesStatsResponse nodesStatsResponse = ElasticsearchTransportClient.getNodesStatsResponse(config);
NodeStats nodeStats = null;
List<NodeStats> nodeStatsList = nodesStatsResponse.getNodes();
if (nodeStatsList.size() > 0) {
nodeStats = nodeStatsList.get(0);
}
if (nodeStats == null) {
logger.info("OS stats is not available (node stats is not available)");
return;
}
OsStats osStats = nodeStats.getOs();
if (osStats == null) {
logger.info("OS stats is not available");
return;
}
//Memory
osStatsBean.freeInBytes = osStats.getMem().getFree().getBytes();
osStatsBean.usedInBytes = osStats.getMem().getUsed().getBytes();
osStatsBean.actualFreeInBytes = osStats.getMem().getFree().getBytes();
osStatsBean.actualUsedInBytes = osStats.getMem().getUsed().getBytes();
osStatsBean.freePercent = osStats.getMem().getFreePercent();
osStatsBean.usedPercent = osStats.getMem().getUsedPercent();
//CPU
osStatsBean.cpuSys = osStats.getCpu().getPercent();
osStatsBean.cpuUser = 0;
osStatsBean.cpuIdle = 0;
osStatsBean.cpuStolen = 0;
//Swap
osStatsBean.swapFreeInBytes = osStats.getSwap().getFree().getBytes();
osStatsBean.swapUsedInBytes = osStats.getSwap().getUsed().getBytes();
//Uptime
osStatsBean.uptimeInMillis = 0;
//Timestamp
osStatsBean.osTimestamp = osStats.getTimestamp();
} catch (Exception e) {
logger.warn("Failed to load OS stats data", e);
}
osStatsReporter.osStatsBean.set(osStatsBean);
}
开发者ID:Netflix,项目名称:Raigad,代码行数:62,代码来源:OsStatsMonitor.java
注:本文中的org.elasticsearch.monitor.os.OsStats类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论