public int getInt(String key, int def) { try { String v = getValue(key); if (v != null) return Integer.parseInt(v); } catch (Exception e) { } return def; }
public boolean getBoolean(String key, boolean def) { try { String v = getValue(key); if (v != null) return Boolean.parseBoolean(v); } catch (Exception e) { } return def; }
public long getLong(String key, long def) { try { String v = getValue(key); if (v != null) return Long.parseLong(v); } catch (Exception e) { } return def; }
public int getInt(String key, int def) { try { String v = getValue(key); if (v != null) return Integer.parseInt(v); } catch (Exception e) { } return def; }
public long getLong(String key, long def) { try { String v = getValue(key); if (v != null) return Long.parseLong(v); } catch (Exception e) { } return def; }
public long getLong(String key, long def) { try { String v = getValue(key); if (v != null) return Long.parseLong(v); } catch (Exception e) { } return def; }
public boolean getBoolean(String key, boolean def) { try { String v = getValue(key); if (v != null) return Boolean.parseBoolean(v); } catch (Exception e) { } return def; }
public int getInt(String key, int def) { try { String v = getValue(key); if (v != null) return Integer.parseInt(v); } catch (Exception e) { } return def; }
public boolean getBoolean(String key, boolean def) { try { String v = getValue(key); if (v != null) return Boolean.parseBoolean(v); } catch (Exception e) { } return def; }
public int getInt(String key, int def, int min) { try { String v = getValue(key); if (v != null) { return Math.max(Integer.parseInt(v), min); } } catch (Exception e) { } return Math.max(def, min); }
public int getInt(String key, int def, int min) { try { String v = getValue(key); if (v != null) { return Math.max(Integer.parseInt(v), min); } } catch (Exception e) { } return Math.max(def, min); }
public int getInt(String key, int def, int min) { try { String v = getValue(key); if (v != null) { return Math.max(Integer.parseInt(v), min); } } catch (Exception e) { } return Math.max(def, min); }
public synchronized void resetObjInfo() { String detected = CounterConstants.HOST; if (SystemUtil.IS_LINUX) { detected = CounterConstants.LINUX; } else if (SystemUtil.IS_WINDOWS) { detected = CounterConstants.WINDOWS; } else if (SystemUtil.IS_MAC_OSX) { detected = CounterConstants.OSX; } else if (SystemUtil.IS_AIX) { detected = CounterConstants.AIX; } else if (SystemUtil.IS_HP_UX) { detected = CounterConstants.HPUX; } this.objDetectedType = detected; this.monitoring_group_type = getValue("monitoring_group_type"); this.obj_type = StringUtil.isEmpty(this.monitoring_group_type) ? getValue("obj_type", detected) : this.monitoring_group_type; this.obj_name = getValue("obj_name", SysJMX.getHostName()); this.objName = "/" + this.obj_name; this.objHash = HashUtil.hash(objName); }
this.monitoring_group_type = getValue("monitoring_group_type"); this.obj_type = StringUtil.isEmpty(this.monitoring_group_type) ? getValue("obj_type", detected) : this.monitoring_group_type; this.objExtType = ObjTypeDetector.objExtType; detected = CounterConstants.HPUX; this.obj_host_type = getValue("obj_host_type", detected); this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName()); this.objHostName = "/" + this.obj_host_name; this.objHostHash = HashUtil.hash(objHostName); defaultName = this.obj_type + "1"; this.obj_name = getValue("obj_name", System.getProperty("jvmRoute", defaultName)); this.objName = objHostName + "/" + this.obj_name; this.objHash = HashUtil.hash(objName);
this.monitoring_group_type = getValue("monitoring_group_type"); this.obj_type = StringUtil.isEmpty(this.monitoring_group_type) ? getValue("obj_type", detected) : this.monitoring_group_type; this.objExtType = ObjTypeDetector.objExtType; detected = CounterConstants.HPUX; this.obj_host_type = getValue("obj_host_type", detected); this.obj_host_name = getValue("obj_host_name", SysJMX.getHostName()); this.objHostName = "/" + this.obj_host_name; this.objHostHash = HashUtil.hash(objHostName); defaultName = this.obj_type + "1"; this.obj_name = getValue("obj_name", System.getProperty("jvmRoute", defaultName)); this.objName = objHostName + "/" + this.obj_name; this.objHash = HashUtil.hash(objName);
private StringSet getStringSet(String key, String deli) { StringSet set = new StringSet(); String v = getValue(key); if (v != null) { String[] vv = StringUtil.split(v, deli); for (String x : vv) { x = StringUtil.trimToEmpty(x); if (x.length() > 0) set.put(x); } } return set; }
private StringSet getStringSet(String key, String deli) { StringSet set = new StringSet(); String v = getValue(key); if (v != null) { String[] vv = StringUtil.split(v, deli); for (String x : vv) { x = StringUtil.trimToEmpty(x); if (x.length() > 0) set.put(x); } } return set; }
private StringSet getStringSet(String key, String deli) { StringSet set = new StringSet(); String v = getValue(key); if (v != null) { String[] vv = StringUtil.split(v, deli); for (String x : vv) { x = StringUtil.trimToEmpty(x); if (x.length() > 0) set.put(x); } } return set; }
public void process(CounterBasket pw) throws IOException { Configure conf = Configure.getInstance(); boolean redisEnabled = conf.getBoolean("redis_enabled", false); if (redisEnabled) { String serverIp = conf.getValue("redis_server_ip", "127.0.0.1"); int serverPort = conf.getInt("redis_server_port", 6379); String perfInfo = getRedisPerfInfo(serverIp, serverPort); String[] lines = perfInfo.split("\n"); PerfCounterPack p = pw.getPack(conf.getObjName(), TimeTypeEnum.REALTIME); for (String line : lines) { String key = line.substring(0, line.indexOf(':')); String value = line.substring(line.indexOf(':') + 1); if (floatSet.contains(key)) { p.put(key, new FloatValue(Float.valueOf(value.trim()))); } if (decimalSet.contains(key)) { p.put(key, new DecimalValue(Long.valueOf(value.trim()))); } } } }
this.mgr_log_ignore_ids = getStringSet("mgr_log_ignore_ids", ","); this.net_local_udp_ip = getValue("net_local_udp_ip"); this.net_local_udp_port = getInt("net_local_udp_port", 0); this.net_collector_ip = getValue("net_collector_ip", getValue("server.addr", "127.0.0.1")); this.net_collector_udp_port = getInt("net_collector_udp_port", getInt("server.port", NetConstants.SERVER_UDP_PORT)); this.net_collector_tcp_port = getInt("net_collector_tcp_port", getInt("server.port", NetConstants.SERVER_TCP_PORT)); this.counter_netstat_enabled = getBoolean("counter_netstat_enabled", true); this.log_dir = getValue("log_dir", "./logs"); this.log_rotation_enalbed = getBoolean("log_rotation_enalbed", true); this.log_keep_days = getInt("log_keep_days", 365); this.counter_object_registry_path = getValue("counter_object_registry_path", "/tmp/scouter");