|
@@ -12,7 +12,9 @@ import com.monitor.middleware.memcached.constant.MemConstants; |
|
@@ -12,7 +12,9 @@ import com.monitor.middleware.memcached.constant.MemConstants; |
12
|
import com.monitor.middleware.memcached.model.MemcachedInfo;
|
12
|
import com.monitor.middleware.memcached.model.MemcachedInfo;
|
13
|
import com.monitor.zabbix.comp.InfluxdbComp;
|
13
|
import com.monitor.zabbix.comp.InfluxdbComp;
|
14
|
import net.rubyeye.xmemcached.MemcachedClient;
|
14
|
import net.rubyeye.xmemcached.MemcachedClient;
|
|
|
15
|
+import net.rubyeye.xmemcached.MemcachedClientBuilder;
|
15
|
import net.rubyeye.xmemcached.XMemcachedClient;
|
16
|
import net.rubyeye.xmemcached.XMemcachedClient;
|
|
|
17
|
+import net.rubyeye.xmemcached.XMemcachedClientBuilder;
|
16
|
import net.rubyeye.xmemcached.exception.MemcachedException;
|
18
|
import net.rubyeye.xmemcached.exception.MemcachedException;
|
17
|
import net.rubyeye.xmemcached.utils.AddrUtil;
|
19
|
import net.rubyeye.xmemcached.utils.AddrUtil;
|
18
|
import org.apache.commons.lang.StringUtils;
|
20
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -181,6 +183,19 @@ public class MemcachedMonitorImpl { |
|
@@ -181,6 +183,19 @@ public class MemcachedMonitorImpl { |
181
|
info.setMaxMemory(new DecimalFormat("0.00").format(limit_maxbytes * 1.0 / 1024 / 1024 / 1024) + " G");
|
183
|
info.setMaxMemory(new DecimalFormat("0.00").format(limit_maxbytes * 1.0 / 1024 / 1024 / 1024) + " G");
|
182
|
info.setUpTime(uptime / (60 * 60 * 24) + " Days");
|
184
|
info.setUpTime(uptime / (60 * 60 * 24) + " Days");
|
183
|
info.setUseMemory(new DecimalFormat("0.00").format(bytes * 1.0 / 1024 / 1024 / 1024) + " G");
|
185
|
info.setUseMemory(new DecimalFormat("0.00").format(bytes * 1.0 / 1024 / 1024 / 1024) + " G");
|
|
|
186
|
+ MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil.getAddresses(url));
|
|
|
187
|
+ try {
|
|
|
188
|
+ MemcachedClient client = builder.build();
|
|
|
189
|
+ long setTime = System.currentTimeMillis();
|
|
|
190
|
+ client.set("hello",3,"Hello");
|
|
|
191
|
+ client.get("hello");
|
|
|
192
|
+ long diff = System.currentTimeMillis()-setTime;
|
|
|
193
|
+ info.setDiff(diff);
|
|
|
194
|
+ client.shutdown();
|
|
|
195
|
+ } catch (Exception e) {
|
|
|
196
|
+ LOGGER.error("memcached get set occurs Exception"+e.getMessage());
|
|
|
197
|
+ }
|
|
|
198
|
+
|
184
|
MemConstants.MEMCACHED_INFO_MAP.put(url, info);
|
199
|
MemConstants.MEMCACHED_INFO_MAP.put(url, info);
|
185
|
LOGGER.info("MemConstants.MEMCACHED_INFO_MAP all key is {}", MemConstants.MEMCACHED_INFO_MAP.keySet());
|
200
|
LOGGER.info("MemConstants.MEMCACHED_INFO_MAP all key is {}", MemConstants.MEMCACHED_INFO_MAP.keySet());
|
186
|
}
|
201
|
}
|