2011-08-20 21:37:37 +03:00
|
|
|
/*
|
2014-01-06 22:48:02 +01:00
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-08-20 21:37:37 +03:00
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package org.elasticsearch.node.service;
|
|
|
|
|
2011-12-06 02:42:25 +02:00
|
|
|
import com.google.common.collect.ImmutableMap;
|
2013-12-30 13:59:37 +01:00
|
|
|
import org.elasticsearch.Build;
|
2012-12-06 15:22:44 +01:00
|
|
|
import org.elasticsearch.Version;
|
2011-08-20 21:37:37 +03:00
|
|
|
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
|
|
|
|
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
2013-04-07 20:22:48 -07:00
|
|
|
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
2011-08-20 21:37:37 +03:00
|
|
|
import org.elasticsearch.common.Nullable;
|
|
|
|
import org.elasticsearch.common.collect.MapBuilder;
|
|
|
|
import org.elasticsearch.common.component.AbstractComponent;
|
|
|
|
import org.elasticsearch.common.inject.Inject;
|
|
|
|
import org.elasticsearch.common.settings.Settings;
|
2011-12-12 20:22:19 +02:00
|
|
|
import org.elasticsearch.discovery.Discovery;
|
2011-08-20 21:37:37 +03:00
|
|
|
import org.elasticsearch.http.HttpServer;
|
|
|
|
import org.elasticsearch.indices.IndicesService;
|
2014-05-21 13:37:03 +02:00
|
|
|
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
2011-08-20 21:37:37 +03:00
|
|
|
import org.elasticsearch.monitor.MonitorService;
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
import org.elasticsearch.plugins.PluginsService;
|
2012-01-10 17:45:10 +02:00
|
|
|
import org.elasticsearch.threadpool.ThreadPool;
|
2011-08-20 21:37:37 +03:00
|
|
|
import org.elasticsearch.transport.TransportService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
public class NodeService extends AbstractComponent {
|
|
|
|
|
2012-01-10 17:45:10 +02:00
|
|
|
private final ThreadPool threadPool;
|
2011-08-20 21:37:37 +03:00
|
|
|
private final MonitorService monitorService;
|
|
|
|
private final TransportService transportService;
|
|
|
|
private final IndicesService indicesService;
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
private final PluginsService pluginService;
|
2014-01-02 15:04:47 -07:00
|
|
|
private final CircuitBreakerService circuitBreakerService;
|
2011-12-06 02:42:25 +02:00
|
|
|
@Nullable
|
|
|
|
private HttpServer httpServer;
|
2011-08-20 21:37:37 +03:00
|
|
|
|
2011-12-11 18:54:07 +02:00
|
|
|
private volatile ImmutableMap<String, String> serviceAttributes = ImmutableMap.of();
|
2011-08-20 21:37:37 +03:00
|
|
|
|
2012-12-06 15:37:03 +01:00
|
|
|
private final Version version;
|
2012-12-06 15:22:44 +01:00
|
|
|
|
2013-08-15 11:34:27 +02:00
|
|
|
private final Discovery disovery;
|
|
|
|
|
2011-12-06 02:42:25 +02:00
|
|
|
@Inject
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
public NodeService(Settings settings, ThreadPool threadPool, MonitorService monitorService, Discovery discovery,
|
2013-08-15 11:34:27 +02:00
|
|
|
TransportService transportService, IndicesService indicesService,
|
2014-01-02 15:04:47 -07:00
|
|
|
PluginsService pluginService, CircuitBreakerService circuitBreakerService, Version version) {
|
2011-08-20 21:37:37 +03:00
|
|
|
super(settings);
|
2012-01-10 17:45:10 +02:00
|
|
|
this.threadPool = threadPool;
|
2011-08-20 21:37:37 +03:00
|
|
|
this.monitorService = monitorService;
|
|
|
|
this.transportService = transportService;
|
|
|
|
this.indicesService = indicesService;
|
2013-08-15 11:34:27 +02:00
|
|
|
this.disovery = discovery;
|
2011-12-12 20:22:19 +02:00
|
|
|
discovery.setNodeService(this);
|
2013-07-27 22:13:48 +02:00
|
|
|
this.version = version;
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
this.pluginService = pluginService;
|
2014-01-02 15:04:47 -07:00
|
|
|
this.circuitBreakerService = circuitBreakerService;
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setHttpServer(@Nullable HttpServer httpServer) {
|
|
|
|
this.httpServer = httpServer;
|
|
|
|
}
|
|
|
|
|
2011-12-11 18:54:07 +02:00
|
|
|
@Deprecated
|
|
|
|
public void putNodeAttribute(String key, String value) {
|
|
|
|
putAttribute(key, value);
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|
|
|
|
|
2011-12-11 18:54:07 +02:00
|
|
|
@Deprecated
|
|
|
|
public void removeNodeAttribute(String key) {
|
|
|
|
removeAttribute(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public synchronized void putAttribute(String key, String value) {
|
2014-03-27 15:54:45 +01:00
|
|
|
serviceAttributes = new MapBuilder<>(serviceAttributes).put(key, value).immutableMap();
|
2011-12-11 18:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public synchronized void removeAttribute(String key) {
|
2014-03-27 15:54:45 +01:00
|
|
|
serviceAttributes = new MapBuilder<>(serviceAttributes).remove(key).immutableMap();
|
2011-12-11 18:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes different services in the node can add to be reported as part of the node info (for example).
|
|
|
|
*/
|
|
|
|
public ImmutableMap<String, String> attributes() {
|
|
|
|
return this.serviceAttributes;
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public NodeInfo info() {
|
2014-01-09 16:41:50 +01:00
|
|
|
return new NodeInfo(version, Build.CURRENT, disovery.localNode(), serviceAttributes,
|
2012-01-10 17:45:10 +02:00
|
|
|
settings,
|
|
|
|
monitorService.osService().info(),
|
|
|
|
monitorService.processService().info(),
|
|
|
|
monitorService.jvmService().info(),
|
|
|
|
threadPool.info(),
|
|
|
|
monitorService.networkService().info(),
|
|
|
|
transportService.info(),
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
httpServer == null ? null : httpServer.info(),
|
|
|
|
pluginService == null ? null : pluginService.info()
|
2012-01-10 17:45:10 +02:00
|
|
|
);
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|
|
|
|
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
public NodeInfo info(boolean settings, boolean os, boolean process, boolean jvm, boolean threadPool,
|
|
|
|
boolean network, boolean transport, boolean http, boolean plugin) {
|
2014-01-09 16:41:50 +01:00
|
|
|
return new NodeInfo(version, Build.CURRENT, disovery.localNode(), serviceAttributes,
|
2012-01-09 15:24:17 +02:00
|
|
|
settings ? this.settings : null,
|
|
|
|
os ? monitorService.osService().info() : null,
|
|
|
|
process ? monitorService.processService().info() : null,
|
|
|
|
jvm ? monitorService.jvmService().info() : null,
|
2012-01-10 17:45:10 +02:00
|
|
|
threadPool ? this.threadPool.info() : null,
|
2012-01-09 15:24:17 +02:00
|
|
|
network ? monitorService.networkService().info() : null,
|
|
|
|
transport ? transportService.info() : null,
|
List of existing plugins with Node Info API
We want to display information about loaded plugins in Node Info API using plugin option:
```sh
curl http://localhost:9200/_nodes?plugin=true
```
For example, on a 4 nodes cluster, it could provide the following output:
```javascript
{
"ok" : true,
"cluster_name" : "test-cluster-MacBook-Air-de-David.local",
"nodes" : {
"lodYfbFTRnmwE6rjWGGyQQ" : {
"name" : "node1",
"transport_address" : "inet[/172.18.58.139:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9200]",
"plugins" : [ ]
},
"hJLXmY_NTrCytiIMbX4_1g" : {
"name" : "node4",
"transport_address" : "inet[/172.18.58.139:9303]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9203]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "test-no-version-plugin",
"description" : "test-no-version-plugin description",
"site" : true,
"jvm" : false
}, {
"name" : "dummy",
"description" : "No description found for dummy.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"bnoySsBfTrSzbDRZ0BFHvg" : {
"name" : "node2",
"transport_address" : "inet[/172.18.58.139:9301]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9201]",
"plugins" : [ {
"name" : "dummy",
"description" : "This is a description for a dummy test site plugin.",
"url" : "/_plugin/dummy/",
"site" : false,
"jvm" : true
} ]
},
"0Vwil01LSfK9YgRrMce3Ug" : {
"name" : "node3",
"transport_address" : "inet[/172.18.58.139:9302]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.0.Beta2-SNAPSHOT",
"http_address" : "inet[/172.18.58.139:9202]",
"plugins" : [ {
"name" : "test-plugin",
"description" : "test-plugin description",
"site" : true,
"jvm" : false
} ]
}
}
}
```
Information are cached for 10 seconds by default. Modify `plugins.info_refresh_interval` property if needed.
Setting `plugins.info_refresh_interval` to `-1` will cause infinite caching.
Setting `plugins.info_refresh_interval` to `0` will disable caching.
Closes #2668.
2013-03-15 19:28:01 +01:00
|
|
|
http ? (httpServer == null ? null : httpServer.info()) : null,
|
|
|
|
plugin ? (pluginService == null ? null : pluginService.info()) : null
|
2012-01-09 15:24:17 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-08-20 21:37:37 +03:00
|
|
|
public NodeStats stats() {
|
2011-08-25 20:20:14 +03:00
|
|
|
// for indices stats we want to include previous allocated shards stats as well (it will
|
|
|
|
// only be applied to the sensible ones to use, like refresh/merge/flush/indexing stats)
|
2014-01-09 16:41:50 +01:00
|
|
|
return new NodeStats(disovery.localNode(), System.currentTimeMillis(),
|
2012-01-10 17:45:10 +02:00
|
|
|
indicesService.stats(true),
|
|
|
|
monitorService.osService().stats(),
|
|
|
|
monitorService.processService().stats(),
|
|
|
|
monitorService.jvmService().stats(),
|
|
|
|
threadPool.stats(),
|
|
|
|
monitorService.networkService().stats(),
|
2012-01-18 21:00:09 +02:00
|
|
|
monitorService.fsService().stats(),
|
2012-01-10 17:45:10 +02:00
|
|
|
transportService.stats(),
|
2014-01-02 15:04:47 -07:00
|
|
|
httpServer == null ? null : httpServer.stats(),
|
|
|
|
circuitBreakerService.stats()
|
2012-01-10 17:45:10 +02:00
|
|
|
);
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|
2012-01-09 18:01:41 +02:00
|
|
|
|
2014-01-02 15:04:47 -07:00
|
|
|
public NodeStats stats(CommonStatsFlags indices, boolean os, boolean process, boolean jvm, boolean threadPool, boolean network,
|
|
|
|
boolean fs, boolean transport, boolean http, boolean circuitBreaker) {
|
2012-01-09 18:01:41 +02:00
|
|
|
// for indices stats we want to include previous allocated shards stats as well (it will
|
|
|
|
// only be applied to the sensible ones to use, like refresh/merge/flush/indexing stats)
|
2014-01-09 16:41:50 +01:00
|
|
|
return new NodeStats(disovery.localNode(), System.currentTimeMillis(),
|
2013-04-07 20:22:48 -07:00
|
|
|
indices.anySet() ? indicesService.stats(true, indices) : null,
|
2012-01-09 18:01:41 +02:00
|
|
|
os ? monitorService.osService().stats() : null,
|
|
|
|
process ? monitorService.processService().stats() : null,
|
|
|
|
jvm ? monitorService.jvmService().stats() : null,
|
2012-01-10 17:45:10 +02:00
|
|
|
threadPool ? this.threadPool.stats() : null,
|
2012-01-09 18:01:41 +02:00
|
|
|
network ? monitorService.networkService().stats() : null,
|
2012-01-18 21:00:09 +02:00
|
|
|
fs ? monitorService.fsService().stats() : null,
|
2012-01-09 18:01:41 +02:00
|
|
|
transport ? transportService.stats() : null,
|
2014-01-02 15:04:47 -07:00
|
|
|
http ? (httpServer == null ? null : httpServer.stats()) : null,
|
|
|
|
circuitBreaker ? circuitBreakerService.stats() : null
|
2012-01-10 17:45:10 +02:00
|
|
|
);
|
2012-01-09 18:01:41 +02:00
|
|
|
}
|
2011-08-20 21:37:37 +03:00
|
|
|
}
|