org.elasticsearch.monitor.process.ProcessProbe Java Examples

The following examples show how to use org.elasticsearch.monitor.process.ProcessProbe. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SystemMonitorTarget.java    From fess with Apache License 2.0 6 votes vote down vote up
private void appendProcessStats(final StringBuilder buf) {
    buf.append("\"process\":{");
    final ProcessProbe processProbe = ProcessProbe.getInstance();
    buf.append("\"file_descriptor\":{");
    append(buf, "open", () -> processProbe.getOpenFileDescriptorCount()).append(',');
    append(buf, "max", () -> processProbe.getMaxFileDescriptorCount());
    buf.append("},");
    buf.append("\"cpu\":{");
    append(buf, "percent", () -> processProbe.getProcessCpuPercent()).append(',');
    append(buf, "total", () -> processProbe.getProcessCpuTotalTime());
    buf.append("},");
    buf.append("\"virtual_memory\":{");
    append(buf, "total", () -> processProbe.getTotalVirtualMemorySize());
    buf.append('}');
    buf.append("},");
}
 
Example #2
Source File: NodeEnvironment.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private void maybeWarnFileDescriptors() {
    long maxFileDescriptorCount = ProcessProbe.getInstance().getMaxFileDescriptorCount();
    if (maxFileDescriptorCount == -1) {
        return;
    }
    int fileDescriptorCountThreshold = (1 << 16);
    if (maxFileDescriptorCount < fileDescriptorCountThreshold) {
        logger.warn(
                "max file descriptors [{}] for elasticsearch process likely too low, consider increasing to at least [{}]",
                maxFileDescriptorCount,
                fileDescriptorCountThreshold);
    }
}
 
Example #3
Source File: MonitorModule.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    // bind default implementations
    bind(ProcessProbe.class).toInstance(ProcessProbe.getInstance());
    bind(OsProbe.class).toInstance(OsProbe.getInstance());
    bind(FsProbe.class).asEagerSingleton();

    // bind other services
    bind(ProcessService.class).asEagerSingleton();
    bind(OsService.class).asEagerSingleton();
    bind(JvmService.class).asEagerSingleton();
    bind(FsService.class).asEagerSingleton();

    bind(JvmMonitorService.class).asEagerSingleton();
}
 
Example #4
Source File: BootstrapProxy.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
}
 
Example #5
Source File: Bootstrap.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
}
 
Example #6
Source File: ProcessProbeFileDescriptorProvider.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
public long getFileDescriptorCount() {
  return ProcessProbe.getInstance().getMaxFileDescriptorCount();
}
 
Example #7
Source File: ThumbnailGenerator.java    From fess with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
    JvmInfo.jvmInfo();
}
 
Example #8
Source File: SuggestCreator.java    From fess with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
    JvmInfo.jvmInfo();
}
 
Example #9
Source File: Crawler.java    From fess with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
    JvmInfo.jvmInfo();
}
 
Example #10
Source File: BootstrapProxy.java    From crate with Apache License 2.0 4 votes vote down vote up
static void initializeProbes() {
    // Force probes to be loaded
    ProcessProbe.getInstance();
    OsProbe.getInstance();
    JvmInfo.jvmInfo();
}
 
Example #11
Source File: BootstrapChecks.java    From crate with Apache License 2.0 4 votes vote down vote up
long getMaxFileDescriptorCount() {
    return ProcessProbe.getInstance().getMaxFileDescriptorCount();
}
 
Example #12
Source File: NodeStatsContextTest.java    From crate with Apache License 2.0 4 votes vote down vote up
@Test
public void testStreamContext() throws Exception {
    NodeStatsContext ctx1 = new NodeStatsContext(true);
    ctx1.id("93c7ff92-52fa-11e6-aad8-3c15c2d3ad18");
    ctx1.name("crate1");
    ctx1.hostname("crate1.example.com");
    ctx1.timestamp(100L);
    ctx1.version(Version.CURRENT);
    ctx1.build(Build.CURRENT);
    ctx1.httpPort(4200);
    ctx1.transportPort(4300);
    ctx1.restUrl("10.0.0.1:4200");
    ctx1.jvmStats(JvmStats.jvmStats());
    ctx1.osInfo(DummyOsInfo.INSTANCE);
    ProcessProbe processProbe = ProcessProbe.getInstance();
    ctx1.processStats(processProbe.processStats());
    OsProbe osProbe = OsProbe.getInstance();
    ctx1.osStats(osProbe.osStats());
    ctx1.extendedOsStats(extendedNodeInfo.osStats());
    ctx1.threadPools(threadPool.stats());
    ctx1.clusterStateVersion(10L);

    ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
    StreamOutput out = new OutputStreamStreamOutput(outBuffer);
    ctx1.writeTo(out);

    ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
    InputStreamStreamInput in = new InputStreamStreamInput(inBuffer);
    NodeStatsContext ctx2 = new NodeStatsContext(in, true);

    assertThat(ctx1.id(), is(ctx2.id()));
    assertThat(ctx1.name(), is(ctx2.name()));
    assertThat(ctx1.hostname(), is(ctx2.hostname()));
    assertThat(ctx1.timestamp(), is(100L));
    assertThat(ctx1.version(), is(ctx2.version()));
    assertThat(ctx1.build().hash(), is(ctx2.build().hash()));
    assertThat(ctx1.restUrl(), is(ctx2.restUrl()));
    assertThat(ctx1.httpPort(), is(ctx2.httpPort()));
    assertThat(ctx1.transportPort(), is(ctx2.transportPort()));
    assertThat(ctx1.pgPort(), is(ctx2.pgPort()));
    assertThat(ctx1.jvmStats().getTimestamp(), is(ctx2.jvmStats().getTimestamp()));
    assertThat(ctx1.osInfo().getArch(), is(ctx2.osInfo().getArch()));
    assertThat(ctx1.processStats().getTimestamp(), is(ctx2.processStats().getTimestamp()));
    assertThat(ctx1.osStats().getTimestamp(), is(ctx2.osStats().getTimestamp()));
    assertThat(ctx1.extendedOsStats().uptime(), is(ctx2.extendedOsStats().uptime()));
    assertThat(ctx1.threadPools().iterator().next().getActive(), is(ctx2.threadPools().iterator().next().getActive()));
    assertThat(ctx1.clusterStateVersion(), is(ctx2.clusterStateVersion()));
}