private static void startStatCollector(String host, int port, final Connector connector) {
		
		connector.setStatsOn(true);
		
		logger.fine("Starting stats collector: " + host + ":" + port);
		GangliaStat statCollector = new GangliaStat(host, port, 30, 60);
		statCollector.addMetric(new StatReporter("os_cs_keys_registered", "keys") {
			@Override
			public double getValue() {
				int length = CommunityDAO.get().getRegisteredKeys().length;
				logger.finest("Stats collector: reg users=" + length);
				return length;
			}
		});
		
		statCollector.addMetric(new StatReporter("os_connections_opened", "Connections open") {
			public double getValue() {
				return connector.getConnectionsOpen();
			}});
		
		statCollector.addMetric(new StatReporter("os_connections", "Connections") {
			public double getValue() {
				return connector.getConnections();
			}});
		
		statCollector.addMetric(new StatReporter("os_requests", "Requests") {
			public double getValue() {
				return connector.getRequests();
			}});
		
		statCollector.addMetric(new StatReporter("os_connection_duration", "ms") {
			public double getValue() {
				double v = connector.getConnectionsDurationAve();
				connector.statsReset();
				return v;
			}
		});

		statCollector.addMetric(new StatReporter("os_cs_users_online", "users") {
			@Override
			public double getValue() {
				/*
				 * users are online for 2x the refresh limit + 60 seconds
				 */
				long online_limit = Long.parseLong(System.getProperty(Setting.REFRESH_INTERVAL.getKey())) * 60 * 1000 + 60 * 1000;
				int onlineUsers = 0;
				KeyRegistrationRecord[] registeredKeys = CommunityDAO.get().getRegisteredKeys();
				for (KeyRegistrationRecord rec : registeredKeys) {
					if ((System.currentTimeMillis() - rec.getLastRefreshedDate().getTime()) < online_limit) {
						onlineUsers++;
					}
				}
				logger.finest("Stats collector: online users=" + onlineUsers);
				return onlineUsers;
			}
		});

		statCollector.addMetric(new StatReporter("os_cs_ram_used", "Bytes") {
			@Override
			public double getValue() {
				Runtime runtime = Runtime.getRuntime();
//				System.gc();
//				System.gc();
				long mem_used = runtime.totalMemory() - runtime.freeMemory();
				logger.finest("Stats collector: mem used=" + mem_used);
				return mem_used;
			}
		});

	}