Search in sources :

Example 1 with PluginInfo

use of org.elasticsearch.plugins.PluginInfo in project elasticsearch by elastic.

the class ClusterStatsNodes method toXContent.

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject(Fields.COUNT);
    counts.toXContent(builder, params);
    builder.endObject();
    builder.startArray(Fields.VERSIONS);
    for (Version v : versions) {
        builder.value(v.toString());
    }
    builder.endArray();
    builder.startObject(Fields.OS);
    os.toXContent(builder, params);
    builder.endObject();
    builder.startObject(Fields.PROCESS);
    process.toXContent(builder, params);
    builder.endObject();
    builder.startObject(Fields.JVM);
    jvm.toXContent(builder, params);
    builder.endObject();
    builder.field(Fields.FS);
    fs.toXContent(builder, params);
    builder.startArray(Fields.PLUGINS);
    for (PluginInfo pluginInfo : plugins) {
        pluginInfo.toXContent(builder, params);
    }
    builder.endArray();
    builder.startObject(Fields.NETWORK_TYPES);
    networkTypes.toXContent(builder, params);
    builder.endObject();
    return builder;
}
Also used : Version(org.elasticsearch.Version) PluginInfo(org.elasticsearch.plugins.PluginInfo)

Example 2 with PluginInfo

use of org.elasticsearch.plugins.PluginInfo in project elasticsearch by elastic.

the class PluginsAndModules method toXContent.

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startArray("plugins");
    for (PluginInfo pluginInfo : getPluginInfos()) {
        pluginInfo.toXContent(builder, params);
    }
    builder.endArray();
    // TODO: not ideal, make a better api for this (e.g. with jar metadata, and so on)
    builder.startArray("modules");
    for (PluginInfo moduleInfo : getModuleInfos()) {
        moduleInfo.toXContent(builder, params);
    }
    builder.endArray();
    return builder;
}
Also used : PluginInfo(org.elasticsearch.plugins.PluginInfo)

Example 3 with PluginInfo

use of org.elasticsearch.plugins.PluginInfo in project elasticsearch by elastic.

the class RestPluginsAction method buildTable.

private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
    DiscoveryNodes nodes = state.getState().nodes();
    Table table = getTableWithHeader(req);
    for (DiscoveryNode node : nodes) {
        NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
        for (PluginInfo pluginInfo : info.getPlugins().getPluginInfos()) {
            table.startRow();
            table.addCell(node.getId());
            table.addCell(node.getName());
            table.addCell(pluginInfo.getName());
            table.addCell(pluginInfo.getVersion());
            table.addCell(pluginInfo.getDescription());
            table.endRow();
        }
    }
    return table;
}
Also used : DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) Table(org.elasticsearch.common.Table) NodeInfo(org.elasticsearch.action.admin.cluster.node.info.NodeInfo) PluginInfo(org.elasticsearch.plugins.PluginInfo) DiscoveryNodes(org.elasticsearch.cluster.node.DiscoveryNodes)

Example 4 with PluginInfo

use of org.elasticsearch.plugins.PluginInfo in project elasticsearch by elastic.

the class NodeInfoStreamingTests method createNodeInfo.

private static NodeInfo createNodeInfo() {
    Build build = Build.CURRENT;
    DiscoveryNode node = new DiscoveryNode("test_node", buildNewFakeTransportAddress(), emptyMap(), emptySet(), VersionUtils.randomVersion(random()));
    Settings settings = randomBoolean() ? null : Settings.builder().put("test", "setting").build();
    OsInfo osInfo = null;
    if (randomBoolean()) {
        int availableProcessors = randomIntBetween(1, 64);
        int allocatedProcessors = randomIntBetween(1, availableProcessors);
        long refreshInterval = randomBoolean() ? -1 : randomNonNegativeLong();
        String name = randomAsciiOfLengthBetween(3, 10);
        String arch = randomAsciiOfLengthBetween(3, 10);
        String version = randomAsciiOfLengthBetween(3, 10);
        osInfo = new OsInfo(refreshInterval, availableProcessors, allocatedProcessors, name, arch, version);
    }
    ProcessInfo process = randomBoolean() ? null : new ProcessInfo(randomInt(), randomBoolean(), randomNonNegativeLong());
    JvmInfo jvm = randomBoolean() ? null : JvmInfo.jvmInfo();
    ThreadPoolInfo threadPoolInfo = null;
    if (randomBoolean()) {
        int numThreadPools = randomIntBetween(1, 10);
        List<ThreadPool.Info> threadPoolInfos = new ArrayList<>(numThreadPools);
        for (int i = 0; i < numThreadPools; i++) {
            threadPoolInfos.add(new ThreadPool.Info(randomAsciiOfLengthBetween(3, 10), randomFrom(ThreadPool.ThreadPoolType.values()), randomInt()));
        }
        threadPoolInfo = new ThreadPoolInfo(threadPoolInfos);
    }
    Map<String, BoundTransportAddress> profileAddresses = new HashMap<>();
    BoundTransportAddress dummyBoundTransportAddress = new BoundTransportAddress(new TransportAddress[] { buildNewFakeTransportAddress() }, buildNewFakeTransportAddress());
    profileAddresses.put("test_address", dummyBoundTransportAddress);
    TransportInfo transport = randomBoolean() ? null : new TransportInfo(dummyBoundTransportAddress, profileAddresses);
    HttpInfo httpInfo = randomBoolean() ? null : new HttpInfo(dummyBoundTransportAddress, randomLong());
    PluginsAndModules pluginsAndModules = null;
    if (randomBoolean()) {
        int numPlugins = randomIntBetween(0, 5);
        List<PluginInfo> plugins = new ArrayList<>();
        for (int i = 0; i < numPlugins; i++) {
            plugins.add(new PluginInfo(randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10)));
        }
        int numModules = randomIntBetween(0, 5);
        List<PluginInfo> modules = new ArrayList<>();
        for (int i = 0; i < numModules; i++) {
            modules.add(new PluginInfo(randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10)));
        }
        pluginsAndModules = new PluginsAndModules(plugins, modules);
    }
    IngestInfo ingestInfo = null;
    if (randomBoolean()) {
        int numProcessors = randomIntBetween(0, 5);
        List<ProcessorInfo> processors = new ArrayList<>(numProcessors);
        for (int i = 0; i < numProcessors; i++) {
            processors.add(new ProcessorInfo(randomAsciiOfLengthBetween(3, 10)));
        }
        ingestInfo = new IngestInfo(processors);
    }
    ByteSizeValue indexingBuffer = null;
    if (randomBoolean()) {
        // pick a random long that sometimes exceeds an int:
        indexingBuffer = new ByteSizeValue(random().nextLong() & ((1L << 40) - 1));
    }
    return new NodeInfo(VersionUtils.randomVersion(random()), build, node, settings, osInfo, process, jvm, threadPoolInfo, transport, httpInfo, pluginsAndModules, ingestInfo, indexingBuffer);
}
Also used : DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) JvmInfo(org.elasticsearch.monitor.jvm.JvmInfo) ProcessorInfo(org.elasticsearch.ingest.ProcessorInfo) HashMap(java.util.HashMap) PluginsAndModules(org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules) ArrayList(java.util.ArrayList) ThreadPool(org.elasticsearch.threadpool.ThreadPool) ByteSizeValue(org.elasticsearch.common.unit.ByteSizeValue) HttpInfo(org.elasticsearch.http.HttpInfo) OsInfo(org.elasticsearch.monitor.os.OsInfo) Build(org.elasticsearch.Build) IngestInfo(org.elasticsearch.ingest.IngestInfo) PluginInfo(org.elasticsearch.plugins.PluginInfo) Settings(org.elasticsearch.common.settings.Settings) ThreadPoolInfo(org.elasticsearch.threadpool.ThreadPoolInfo) TransportInfo(org.elasticsearch.transport.TransportInfo) ProcessInfo(org.elasticsearch.monitor.process.ProcessInfo) PluginInfo(org.elasticsearch.plugins.PluginInfo) OsInfo(org.elasticsearch.monitor.os.OsInfo) ThreadPoolInfo(org.elasticsearch.threadpool.ThreadPoolInfo) ProcessInfo(org.elasticsearch.monitor.process.ProcessInfo) IngestInfo(org.elasticsearch.ingest.IngestInfo) JvmInfo(org.elasticsearch.monitor.jvm.JvmInfo) ProcessorInfo(org.elasticsearch.ingest.ProcessorInfo) HttpInfo(org.elasticsearch.http.HttpInfo) TransportInfo(org.elasticsearch.transport.TransportInfo) NodeInfo(org.elasticsearch.action.admin.cluster.node.info.NodeInfo) NodeInfo(org.elasticsearch.action.admin.cluster.node.info.NodeInfo) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress)

Aggregations

PluginInfo (org.elasticsearch.plugins.PluginInfo)4 NodeInfo (org.elasticsearch.action.admin.cluster.node.info.NodeInfo)2 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Build (org.elasticsearch.Build)1 Version (org.elasticsearch.Version)1 PluginsAndModules (org.elasticsearch.action.admin.cluster.node.info.PluginsAndModules)1 DiscoveryNodes (org.elasticsearch.cluster.node.DiscoveryNodes)1 Table (org.elasticsearch.common.Table)1 Settings (org.elasticsearch.common.settings.Settings)1 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)1 ByteSizeValue (org.elasticsearch.common.unit.ByteSizeValue)1 HttpInfo (org.elasticsearch.http.HttpInfo)1 IngestInfo (org.elasticsearch.ingest.IngestInfo)1 ProcessorInfo (org.elasticsearch.ingest.ProcessorInfo)1 JvmInfo (org.elasticsearch.monitor.jvm.JvmInfo)1 OsInfo (org.elasticsearch.monitor.os.OsInfo)1 ProcessInfo (org.elasticsearch.monitor.process.ProcessInfo)1 ThreadPool (org.elasticsearch.threadpool.ThreadPool)1