Remove network stats & info
This commit is contained in:
parent
50ec1b1f8e
commit
30892c4129
|
@ -30,7 +30,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.http.HttpInfo;
|
||||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
import org.elasticsearch.monitor.network.NetworkInfo;
|
||||
import org.elasticsearch.monitor.os.OsInfo;
|
||||
import org.elasticsearch.monitor.process.ProcessInfo;
|
||||
import org.elasticsearch.threadpool.ThreadPoolInfo;
|
||||
|
@ -65,9 +64,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
@Nullable
|
||||
private ThreadPoolInfo threadPool;
|
||||
|
||||
@Nullable
|
||||
private NetworkInfo network;
|
||||
|
||||
@Nullable
|
||||
private TransportInfo transport;
|
||||
|
||||
|
@ -81,7 +77,7 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
}
|
||||
|
||||
public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
|
||||
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network,
|
||||
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool,
|
||||
@Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsInfo plugins) {
|
||||
super(node);
|
||||
this.version = version;
|
||||
|
@ -92,7 +88,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
this.process = process;
|
||||
this.jvm = jvm;
|
||||
this.threadPool = threadPool;
|
||||
this.network = network;
|
||||
this.transport = transport;
|
||||
this.http = http;
|
||||
this.plugins = plugins;
|
||||
|
@ -165,14 +160,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
return this.threadPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Network level information.
|
||||
*/
|
||||
@Nullable
|
||||
public NetworkInfo getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TransportInfo getTransport() {
|
||||
return transport;
|
||||
|
@ -222,9 +209,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
if (in.readBoolean()) {
|
||||
threadPool = ThreadPoolInfo.readThreadPoolInfo(in);
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
network = NetworkInfo.readNetworkInfo(in);
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
transport = TransportInfo.readTransportInfo(in);
|
||||
}
|
||||
|
@ -281,12 +265,6 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
out.writeBoolean(true);
|
||||
threadPool.writeTo(out);
|
||||
}
|
||||
if (network == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
network.writeTo(out);
|
||||
}
|
||||
if (transport == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
|
@ -306,5 +284,4 @@ public class NodeInfo extends BaseNodeResponse {
|
|||
plugins.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,9 +111,6 @@ public class NodesInfoResponse extends BaseNodesResponse<NodeInfo> implements To
|
|||
if (nodeInfo.getThreadPool() != null) {
|
||||
nodeInfo.getThreadPool().toXContent(builder, params);
|
||||
}
|
||||
if (nodeInfo.getNetwork() != null) {
|
||||
nodeInfo.getNetwork().toXContent(builder, params);
|
||||
}
|
||||
if (nodeInfo.getTransport() != null) {
|
||||
nodeInfo.getTransport().toXContent(builder, params);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.indices.NodeIndicesStats;
|
|||
import org.elasticsearch.indices.breaker.AllCircuitBreakerStats;
|
||||
import org.elasticsearch.monitor.fs.FsStats;
|
||||
import org.elasticsearch.monitor.jvm.JvmStats;
|
||||
import org.elasticsearch.monitor.network.NetworkStats;
|
||||
import org.elasticsearch.monitor.os.OsStats;
|
||||
import org.elasticsearch.monitor.process.ProcessStats;
|
||||
import org.elasticsearch.threadpool.ThreadPoolStats;
|
||||
|
@ -62,9 +61,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
@Nullable
|
||||
private ThreadPoolStats threadPool;
|
||||
|
||||
@Nullable
|
||||
private NetworkStats network;
|
||||
|
||||
@Nullable
|
||||
private FsStats fs;
|
||||
|
||||
|
@ -82,7 +78,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
|
||||
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
|
||||
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
|
||||
@Nullable NetworkStats network, @Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http,
|
||||
@Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http,
|
||||
@Nullable AllCircuitBreakerStats breaker) {
|
||||
super(node);
|
||||
this.timestamp = timestamp;
|
||||
|
@ -91,7 +87,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
this.process = process;
|
||||
this.jvm = jvm;
|
||||
this.threadPool = threadPool;
|
||||
this.network = network;
|
||||
this.fs = fs;
|
||||
this.transport = transport;
|
||||
this.http = http;
|
||||
|
@ -147,14 +142,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
return this.threadPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Network level statistics.
|
||||
*/
|
||||
@Nullable
|
||||
public NetworkStats getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
/**
|
||||
* File system level stats.
|
||||
*/
|
||||
|
@ -203,9 +190,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
if (in.readBoolean()) {
|
||||
threadPool = ThreadPoolStats.readThreadPoolStats(in);
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
network = NetworkStats.readNetworkStats(in);
|
||||
}
|
||||
if (in.readBoolean()) {
|
||||
fs = FsStats.readFsStats(in);
|
||||
}
|
||||
|
@ -253,12 +237,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
out.writeBoolean(true);
|
||||
threadPool.writeTo(out);
|
||||
}
|
||||
if (network == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
network.writeTo(out);
|
||||
}
|
||||
if (fs == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
|
@ -313,9 +291,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
|
|||
if (getThreadPool() != null) {
|
||||
getThreadPool().toXContent(builder, params);
|
||||
}
|
||||
if (getNetwork() != null) {
|
||||
getNetwork().toXContent(builder, params);
|
||||
}
|
||||
if (getFs() != null) {
|
||||
getFs().toXContent(builder, params);
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@ import org.elasticsearch.monitor.fs.FsService;
|
|||
import org.elasticsearch.monitor.fs.JmxFsProbe;
|
||||
import org.elasticsearch.monitor.jvm.JvmMonitorService;
|
||||
import org.elasticsearch.monitor.jvm.JvmService;
|
||||
import org.elasticsearch.monitor.network.JmxNetworkProbe;
|
||||
import org.elasticsearch.monitor.network.NetworkProbe;
|
||||
import org.elasticsearch.monitor.network.NetworkService;
|
||||
import org.elasticsearch.monitor.os.JmxOsProbe;
|
||||
import org.elasticsearch.monitor.os.OsProbe;
|
||||
import org.elasticsearch.monitor.os.OsService;
|
||||
|
@ -56,13 +53,11 @@ public class MonitorModule extends AbstractModule {
|
|||
// bind default implementations
|
||||
bind(ProcessProbe.class).to(JmxProcessProbe.class).asEagerSingleton();
|
||||
bind(OsProbe.class).to(JmxOsProbe.class).asEagerSingleton();
|
||||
bind(NetworkProbe.class).to(JmxNetworkProbe.class).asEagerSingleton();
|
||||
bind(FsProbe.class).to(JmxFsProbe.class).asEagerSingleton();
|
||||
|
||||
// bind other services
|
||||
bind(ProcessService.class).asEagerSingleton();
|
||||
bind(OsService.class).asEagerSingleton();
|
||||
bind(NetworkService.class).asEagerSingleton();
|
||||
bind(JvmService.class).asEagerSingleton();
|
||||
bind(FsService.class).asEagerSingleton();
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.monitor.fs.FsService;
|
||||
import org.elasticsearch.monitor.jvm.JvmMonitorService;
|
||||
import org.elasticsearch.monitor.jvm.JvmService;
|
||||
import org.elasticsearch.monitor.network.NetworkService;
|
||||
import org.elasticsearch.monitor.os.OsService;
|
||||
import org.elasticsearch.monitor.process.ProcessService;
|
||||
|
||||
|
@ -42,20 +41,17 @@ public class MonitorService extends AbstractLifecycleComponent<MonitorService> {
|
|||
|
||||
private final JvmService jvmService;
|
||||
|
||||
private final NetworkService networkService;
|
||||
|
||||
private final FsService fsService;
|
||||
|
||||
@Inject
|
||||
public MonitorService(Settings settings, JvmMonitorService jvmMonitorService,
|
||||
OsService osService, ProcessService processService, JvmService jvmService, NetworkService networkService,
|
||||
OsService osService, ProcessService processService, JvmService jvmService,
|
||||
FsService fsService) {
|
||||
super(settings);
|
||||
this.jvmMonitorService = jvmMonitorService;
|
||||
this.osService = osService;
|
||||
this.processService = processService;
|
||||
this.jvmService = jvmService;
|
||||
this.networkService = networkService;
|
||||
this.fsService = fsService;
|
||||
}
|
||||
|
||||
|
@ -71,10 +67,6 @@ public class MonitorService extends AbstractLifecycleComponent<MonitorService> {
|
|||
return this.jvmService;
|
||||
}
|
||||
|
||||
public NetworkService networkService() {
|
||||
return this.networkService;
|
||||
}
|
||||
|
||||
public FsService fsService() {
|
||||
return this.fsService;
|
||||
}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.monitor.network;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class JmxNetworkProbe extends AbstractComponent implements NetworkProbe {
|
||||
|
||||
@Inject
|
||||
public JmxNetworkProbe(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkInfo networkInfo() {
|
||||
NetworkInfo info = new NetworkInfo();
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkStats networkStats() {
|
||||
NetworkStats stats = new NetworkStats();
|
||||
stats.timestamp = System.currentTimeMillis();
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String ifconfig() {
|
||||
return "NA";
|
||||
}
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.monitor.network;
|
||||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class NetworkInfo implements Streamable, ToXContent {
|
||||
|
||||
public static final Interface NA_INTERFACE = new Interface();
|
||||
|
||||
long refreshInterval;
|
||||
|
||||
Interface primary = NA_INTERFACE;
|
||||
|
||||
public long refreshInterval() {
|
||||
return this.refreshInterval;
|
||||
}
|
||||
|
||||
public long getRefreshInterval() {
|
||||
return this.refreshInterval;
|
||||
}
|
||||
|
||||
public Interface primaryInterface() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
public Interface getPrimaryInterface() {
|
||||
return primaryInterface();
|
||||
}
|
||||
|
||||
static final class Fields {
|
||||
static final XContentBuilderString NETWORK = new XContentBuilderString("network");
|
||||
static final XContentBuilderString REFRESH_INTERVAL = new XContentBuilderString("refresh_interval");
|
||||
static final XContentBuilderString REFRESH_INTERVAL_IN_MILLIS = new XContentBuilderString("refresh_interval_in_millis");
|
||||
static final XContentBuilderString PRIMARY_INTERFACE = new XContentBuilderString("primary_interface");
|
||||
static final XContentBuilderString ADDRESS = new XContentBuilderString("address");
|
||||
static final XContentBuilderString NAME = new XContentBuilderString("name");
|
||||
static final XContentBuilderString MAC_ADDRESS = new XContentBuilderString("mac_address");
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(Fields.NETWORK);
|
||||
builder.timeValueField(Fields.REFRESH_INTERVAL_IN_MILLIS, Fields.REFRESH_INTERVAL, refreshInterval);
|
||||
if (primary != NA_INTERFACE) {
|
||||
builder.startObject(Fields.PRIMARY_INTERFACE);
|
||||
builder.field(Fields.ADDRESS, primary.address());
|
||||
builder.field(Fields.NAME, primary.name());
|
||||
builder.field(Fields.MAC_ADDRESS, primary.macAddress());
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static NetworkInfo readNetworkInfo(StreamInput in) throws IOException {
|
||||
NetworkInfo info = new NetworkInfo();
|
||||
info.readFrom(in);
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
refreshInterval = in.readLong();
|
||||
primary = Interface.readNetworkInterface(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeLong(refreshInterval);
|
||||
primary.writeTo(out);
|
||||
}
|
||||
|
||||
public static class Interface implements Streamable {
|
||||
|
||||
private String name = "";
|
||||
private String address = "";
|
||||
private String macAddress = "";
|
||||
|
||||
private Interface() {
|
||||
}
|
||||
|
||||
public Interface(String name, String address, String macAddress) {
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.macAddress = macAddress;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public String address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address();
|
||||
}
|
||||
|
||||
public String macAddress() {
|
||||
return macAddress;
|
||||
}
|
||||
|
||||
public String getMacAddress() {
|
||||
return macAddress();
|
||||
}
|
||||
|
||||
public static Interface readNetworkInterface(StreamInput in) throws IOException {
|
||||
Interface inf = new Interface();
|
||||
inf.readFrom(in);
|
||||
return inf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
name = in.readString();
|
||||
address = in.readString();
|
||||
macAddress = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeString(name);
|
||||
out.writeString(address);
|
||||
out.writeString(macAddress);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.monitor.network;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface NetworkProbe {
|
||||
|
||||
NetworkInfo networkInfo();
|
||||
|
||||
NetworkStats networkStats();
|
||||
|
||||
String ifconfig();
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.monitor.network;
|
||||
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.SingleObjectCache;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public final class NetworkService extends AbstractComponent {
|
||||
|
||||
private final NetworkProbe probe;
|
||||
|
||||
private final NetworkInfo info;
|
||||
|
||||
private final SingleObjectCache<NetworkStats> networkStatsCache;
|
||||
|
||||
@Inject
|
||||
public NetworkService(Settings settings, NetworkProbe probe) {
|
||||
super(settings);
|
||||
this.probe = probe;
|
||||
|
||||
TimeValue refreshInterval = settings.getAsTime("monitor.network.refresh_interval", TimeValue.timeValueSeconds(5));
|
||||
|
||||
logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval);
|
||||
|
||||
this.info = probe.networkInfo();
|
||||
this.info.refreshInterval = refreshInterval.millis();
|
||||
networkStatsCache = new NetworkStatsCache(refreshInterval, probe.networkStats());
|
||||
if (logger.isDebugEnabled()) {
|
||||
StringBuilder netDebug = new StringBuilder("net_info");
|
||||
try {
|
||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||
String hostName = InetAddress.getLocalHost().getHostName();
|
||||
netDebug.append("\nhost [").append(hostName).append("]\n");
|
||||
while (interfaces.hasMoreElements()) {
|
||||
NetworkInterface net = interfaces.nextElement();
|
||||
|
||||
netDebug.append(net.getName()).append('\t').append("display_name [").append(net.getDisplayName()).append("]\n");
|
||||
Enumeration<InetAddress> addresses = net.getInetAddresses();
|
||||
netDebug.append("\t\taddress ");
|
||||
while (addresses.hasMoreElements()) {
|
||||
netDebug.append("[").append(addresses.nextElement()).append("] ");
|
||||
}
|
||||
netDebug.append('\n');
|
||||
netDebug.append("\t\tmtu [").append(net.getMTU()).append("] multicast [").append(net.supportsMulticast()).append("] ptp [").append(net.isPointToPoint())
|
||||
.append("] loopback [").append(net.isLoopback()).append("] up [").append(net.isUp()).append("] virtual [").append(net.isVirtual()).append("]")
|
||||
.append('\n');
|
||||
|
||||
Enumeration<NetworkInterface> subInterfaces = net.getSubInterfaces();
|
||||
if (subInterfaces != null && subInterfaces.hasMoreElements()) {
|
||||
netDebug.append("\t\t\tsub interfaces:\n");
|
||||
|
||||
while (subInterfaces.hasMoreElements()) {
|
||||
|
||||
net = subInterfaces.nextElement();
|
||||
|
||||
netDebug.append("\t\t\t").append(net.getName()).append("\t").append("display_name [").append(net.getDisplayName()).append("]\n");
|
||||
addresses = net.getInetAddresses();
|
||||
netDebug.append("\t\t\t\t\taddress ");
|
||||
while (addresses.hasMoreElements()) {
|
||||
netDebug.append("[").append(addresses.nextElement()).append("] ");
|
||||
}
|
||||
netDebug.append('\n');
|
||||
netDebug.append("\t\t\t\t\tmtu [").append(net.getMTU()).append("] multicast [").append(net.supportsMulticast()).append("] ptp [").append(net.isPointToPoint())
|
||||
.append("] loopback [").append(net.isLoopback()).append("] up [").append(net.isUp()).append("] virtual [").append(net.isVirtual()).append("]")
|
||||
.append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
netDebug.append("failed to get Network Interface Info [" + ex.getMessage() + "]");
|
||||
}
|
||||
logger.debug(netDebug.toString());
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("ifconfig\n\n" + ifconfig());
|
||||
}
|
||||
stats(); // pull the stats one time
|
||||
}
|
||||
|
||||
public NetworkInfo info() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
public NetworkStats stats() {
|
||||
return networkStatsCache.getOrRefresh();
|
||||
}
|
||||
|
||||
private class NetworkStatsCache extends SingleObjectCache<NetworkStats> {
|
||||
public NetworkStatsCache(TimeValue interval, NetworkStats initValue) {
|
||||
super(interval, initValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NetworkStats refresh() {
|
||||
return probe.networkStats();
|
||||
}
|
||||
}
|
||||
|
||||
public String ifconfig() {
|
||||
return probe.ifconfig();
|
||||
}
|
||||
}
|
|
@ -1,248 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.monitor.network;
|
||||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class NetworkStats implements Streamable, ToXContent {
|
||||
|
||||
long timestamp;
|
||||
|
||||
Tcp tcp = null;
|
||||
|
||||
NetworkStats() {
|
||||
|
||||
}
|
||||
|
||||
static final class Fields {
|
||||
static final XContentBuilderString NETWORK = new XContentBuilderString("network");
|
||||
static final XContentBuilderString TCP = new XContentBuilderString("tcp");
|
||||
static final XContentBuilderString ACTIVE_OPENS = new XContentBuilderString("active_opens");
|
||||
static final XContentBuilderString PASSIVE_OPENS = new XContentBuilderString("passive_opens");
|
||||
static final XContentBuilderString CURR_ESTAB = new XContentBuilderString("curr_estab");
|
||||
static final XContentBuilderString IN_SEGS = new XContentBuilderString("in_segs");
|
||||
static final XContentBuilderString OUT_SEGS = new XContentBuilderString("out_segs");
|
||||
static final XContentBuilderString RETRANS_SEGS = new XContentBuilderString("retrans_segs");
|
||||
static final XContentBuilderString ESTAB_RESETS = new XContentBuilderString("estab_resets");
|
||||
static final XContentBuilderString ATTEMPT_FAILS = new XContentBuilderString("attempt_fails");
|
||||
static final XContentBuilderString IN_ERRS = new XContentBuilderString("in_errs");
|
||||
static final XContentBuilderString OUT_RSTS = new XContentBuilderString("out_rsts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(Fields.NETWORK);
|
||||
if (tcp != null) {
|
||||
builder.startObject(Fields.TCP);
|
||||
builder.field(Fields.ACTIVE_OPENS, tcp.getActiveOpens());
|
||||
builder.field(Fields.PASSIVE_OPENS, tcp.getPassiveOpens());
|
||||
builder.field(Fields.CURR_ESTAB, tcp.getCurrEstab());
|
||||
builder.field(Fields.IN_SEGS, tcp.getInSegs());
|
||||
builder.field(Fields.OUT_SEGS, tcp.getOutSegs());
|
||||
builder.field(Fields.RETRANS_SEGS, tcp.getRetransSegs());
|
||||
builder.field(Fields.ESTAB_RESETS, tcp.getEstabResets());
|
||||
builder.field(Fields.ATTEMPT_FAILS, tcp.getAttemptFails());
|
||||
builder.field(Fields.IN_ERRS, tcp.getInErrs());
|
||||
builder.field(Fields.OUT_RSTS, tcp.getOutRsts());
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static NetworkStats readNetworkStats(StreamInput in) throws IOException {
|
||||
NetworkStats stats = new NetworkStats();
|
||||
stats.readFrom(in);
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
timestamp = in.readVLong();
|
||||
if (in.readBoolean()) {
|
||||
tcp = Tcp.readNetworkTcp(in);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeVLong(timestamp);
|
||||
if (tcp == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
tcp.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
||||
public long timestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp();
|
||||
}
|
||||
|
||||
public Tcp tcp() {
|
||||
return tcp;
|
||||
}
|
||||
|
||||
public Tcp getTcp() {
|
||||
return tcp();
|
||||
}
|
||||
|
||||
public static class Tcp implements Streamable {
|
||||
|
||||
long activeOpens;
|
||||
long passiveOpens;
|
||||
long attemptFails;
|
||||
long estabResets;
|
||||
long currEstab;
|
||||
long inSegs;
|
||||
long outSegs;
|
||||
long retransSegs;
|
||||
long inErrs;
|
||||
long outRsts;
|
||||
|
||||
public static Tcp readNetworkTcp(StreamInput in) throws IOException {
|
||||
Tcp tcp = new Tcp();
|
||||
tcp.readFrom(in);
|
||||
return tcp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
activeOpens = in.readLong();
|
||||
passiveOpens = in.readLong();
|
||||
attemptFails = in.readLong();
|
||||
estabResets = in.readLong();
|
||||
currEstab = in.readLong();
|
||||
inSegs = in.readLong();
|
||||
outSegs = in.readLong();
|
||||
retransSegs = in.readLong();
|
||||
inErrs = in.readLong();
|
||||
outRsts = in.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeLong(activeOpens);
|
||||
out.writeLong(passiveOpens);
|
||||
out.writeLong(attemptFails);
|
||||
out.writeLong(estabResets);
|
||||
out.writeLong(currEstab);
|
||||
out.writeLong(inSegs);
|
||||
out.writeLong(outSegs);
|
||||
out.writeLong(retransSegs);
|
||||
out.writeLong(inErrs);
|
||||
out.writeLong(outRsts);
|
||||
}
|
||||
|
||||
public long activeOpens() {
|
||||
return this.activeOpens;
|
||||
}
|
||||
|
||||
public long getActiveOpens() {
|
||||
return activeOpens();
|
||||
}
|
||||
|
||||
public long passiveOpens() {
|
||||
return passiveOpens;
|
||||
}
|
||||
|
||||
public long getPassiveOpens() {
|
||||
return passiveOpens();
|
||||
}
|
||||
|
||||
public long attemptFails() {
|
||||
return attemptFails;
|
||||
}
|
||||
|
||||
public long getAttemptFails() {
|
||||
return attemptFails();
|
||||
}
|
||||
|
||||
public long estabResets() {
|
||||
return estabResets;
|
||||
}
|
||||
|
||||
public long getEstabResets() {
|
||||
return estabResets();
|
||||
}
|
||||
|
||||
public long currEstab() {
|
||||
return currEstab;
|
||||
}
|
||||
|
||||
public long getCurrEstab() {
|
||||
return currEstab();
|
||||
}
|
||||
|
||||
public long inSegs() {
|
||||
return inSegs;
|
||||
}
|
||||
|
||||
public long getInSegs() {
|
||||
return inSegs();
|
||||
}
|
||||
|
||||
public long outSegs() {
|
||||
return outSegs;
|
||||
}
|
||||
|
||||
public long getOutSegs() {
|
||||
return outSegs();
|
||||
}
|
||||
|
||||
public long retransSegs() {
|
||||
return retransSegs;
|
||||
}
|
||||
|
||||
public long getRetransSegs() {
|
||||
return retransSegs();
|
||||
}
|
||||
|
||||
public long inErrs() {
|
||||
return inErrs;
|
||||
}
|
||||
|
||||
public long getInErrs() {
|
||||
return inErrs();
|
||||
}
|
||||
|
||||
public long outRsts() {
|
||||
return outRsts;
|
||||
}
|
||||
|
||||
public long getOutRsts() {
|
||||
return outRsts();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -102,7 +102,6 @@ public class NodeService extends AbstractComponent {
|
|||
monitorService.processService().info(),
|
||||
monitorService.jvmService().info(),
|
||||
threadPool.info(),
|
||||
monitorService.networkService().info(),
|
||||
transportService.info(),
|
||||
httpServer == null ? null : httpServer.info(),
|
||||
pluginService == null ? null : pluginService.info()
|
||||
|
@ -117,7 +116,6 @@ public class NodeService extends AbstractComponent {
|
|||
process ? monitorService.processService().info() : null,
|
||||
jvm ? monitorService.jvmService().info() : null,
|
||||
threadPool ? this.threadPool.info() : null,
|
||||
network ? monitorService.networkService().info() : null,
|
||||
transport ? transportService.info() : null,
|
||||
http ? (httpServer == null ? null : httpServer.info()) : null,
|
||||
plugin ? (pluginService == null ? null : pluginService.info()) : null
|
||||
|
@ -133,7 +131,6 @@ public class NodeService extends AbstractComponent {
|
|||
monitorService.processService().stats(),
|
||||
monitorService.jvmService().stats(),
|
||||
threadPool.stats(),
|
||||
monitorService.networkService().stats(),
|
||||
monitorService.fsService().stats(),
|
||||
transportService.stats(),
|
||||
httpServer == null ? null : httpServer.stats(),
|
||||
|
@ -151,7 +148,6 @@ public class NodeService extends AbstractComponent {
|
|||
process ? monitorService.processService().stats() : null,
|
||||
jvm ? monitorService.jvmService().stats() : null,
|
||||
threadPool ? this.threadPool.stats() : null,
|
||||
network ? monitorService.networkService().stats() : null,
|
||||
fs ? monitorService.fsService().stats() : null,
|
||||
transport ? transportService.stats() : null,
|
||||
http ? (httpServer == null ? null : httpServer.stats()) : null,
|
||||
|
|
|
@ -148,7 +148,7 @@ public class MockDiskUsagesTests extends ElasticsearchIntegrationTest {
|
|||
FsStats fsStats = new FsStats(System.currentTimeMillis(), infos);
|
||||
return new NodeStats(new DiscoveryNode(nodeName, null, Version.V_2_0_0),
|
||||
System.currentTimeMillis(),
|
||||
null, null, null, null, null, null,
|
||||
null, null, null, null, null,
|
||||
fsStats,
|
||||
null, null, null);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.stresstest.leaks;
|
|||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.monitor.jvm.JvmService;
|
||||
import org.elasticsearch.monitor.network.NetworkService;
|
||||
import org.elasticsearch.monitor.os.OsService;
|
||||
import org.elasticsearch.monitor.process.ProcessService;
|
||||
import org.elasticsearch.node.Node;
|
||||
|
@ -39,13 +38,11 @@ public class GenericStatsLeak {
|
|||
JvmService jvmService = node.injector().getInstance(JvmService.class);
|
||||
OsService osService = node.injector().getInstance(OsService.class);
|
||||
ProcessService processService = node.injector().getInstance(ProcessService.class);
|
||||
NetworkService networkService = node.injector().getInstance(NetworkService.class);
|
||||
|
||||
while (true) {
|
||||
jvmService.stats();
|
||||
osService.stats();
|
||||
processService.stats();
|
||||
networkService.stats();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ The second command selectively retrieves nodes information of only
|
|||
|
||||
By default, it just returns all attributes and core settings for a node.
|
||||
It also allows to get only information on `settings`, `os`, `process`, `jvm`,
|
||||
`thread_pool`, `network`, `transport`, `http` and `plugins`:
|
||||
`thread_pool`, `transport`, `http` and `plugins`:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -19,7 +19,7 @@ second command selectively retrieves nodes stats of only `nodeId1` and
|
|||
<<cluster-nodes,here>>.
|
||||
|
||||
By default, all stats are returned. You can limit this by combining any
|
||||
of `indices`, `os`, `process`, `jvm`, `network`, `transport`, `http`,
|
||||
of `indices`, `os`, `process`, `jvm`, `transport`, `http`,
|
||||
`fs`, `breaker` and `thread_pool`. For example:
|
||||
|
||||
[horizontal]
|
||||
|
@ -38,9 +38,6 @@ of `indices`, `os`, `process`, `jvm`, `network`, `transport`, `http`,
|
|||
JVM stats, memory pool information, garbage collection, buffer
|
||||
pools
|
||||
|
||||
`network`::
|
||||
TCP information
|
||||
|
||||
`os`::
|
||||
Operating system stats, load average, cpu, mem, swap
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"metric": {
|
||||
"type": "list",
|
||||
"options": ["settings", "os", "process", "jvm", "thread_pool", "network", "transport", "http", "plugins"],
|
||||
"options": ["settings", "os", "process", "jvm", "thread_pool", "transport", "http", "plugins"],
|
||||
"description": "A comma-separated list of metrics you wish returned. Leave empty to return all."
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"parts": {
|
||||
"metric" : {
|
||||
"type" : "list",
|
||||
"options" : ["_all", "breaker", "fs", "http", "indices", "jvm", "network", "os", "process", "thread_pool", "transport"],
|
||||
"options" : ["_all", "breaker", "fs", "http", "indices", "jvm", "os", "process", "thread_pool", "transport"],
|
||||
"description" : "Limit the information returned to the specified metrics"
|
||||
},
|
||||
"index_metric" : {
|
||||
|
|
Loading…
Reference in New Issue