Exemplo n.º 1
0
static void json_out_stats(stats_state *my_state) {
	const char *version;
        int i;
	TSDebug(PLUGIN_TAG, "recordTypes: '0x%x'", my_state->recordTypes);
	APPEND("{ \"ats\": {\n");
        TSRecordDump(my_state->recordTypes, json_out_stat, my_state);
	version = TSTrafficServerVersionGet();
	APPEND("   \"server\": \"");
	APPEND(version);
	APPEND("\"\n");
	APPEND("  }");

	if (my_state->recordTypes & SYSTEM_RECORD_TYPE) {
		APPEND(",\n \"system\": {\n");
		appendSystemState(my_state);
		APPEND_STAT("configReloadRequests", "%d", configReloadRequests);
		APPEND_STAT("lastReloadRequest", "%" PRIu64, lastReloadRequest);
		APPEND_STAT("configReloads", "%d", configReloads);
		APPEND_STAT("lastReload", "%" PRIu64, lastReload);
		APPEND_STAT("astatsLoad", "%" PRIu64, astatsLoad);
		APPEND("\"something\": \"here\"");
		APPEND("\n  }");
	}

	APPEND("\n}\n");
}
Exemplo n.º 2
0
static void
json_out_stats(stats_state * my_state)
{
  const char *version;
  APPEND("{ \"global\": {\n");

  TSRecordDump(TS_RECORDTYPE_PROCESS, json_out_stat, my_state);
  version = TSTrafficServerVersionGet();
  APPEND("\"server\": \"");
  APPEND(version);
  APPEND("\"\n");
  APPEND("  }\n}\n");
}