private AgentStatus getStatus() {
        AgentStatus data = new AgentStatus();
        data.setAgentIp(conf.get(AGENT_LOCAL_IP));
        data.setTag(conf.get(AGENT_CLUSTER_TAG));
        data.setCluster(conf.get(AGENT_CLUSTER_NAME));
        data.setAgentVersion(TaskManager.class.getPackage().getImplementationVersion());
        data.setAgentStartTime(processStartupTime);
        data.setCpuCore(String.valueOf(runtime.availableProcessors()));
        data.setProcCpu(String.valueOf(twoDecimal(getProcessCpu())));
        data.setFreeMem(String.valueOf(twoDecimal((double) runtime.freeMemory() / GB)));
        data.setMaxMem(String.valueOf(twoDecimal((double) runtime.maxMemory() / GB)));
        data.setUseMem(String.valueOf(twoDecimal((double) runtime.totalMemory() / GB)));
        data.setOs(System.getProperty("os.version"));
        data.setInstallPlatform(conf.get(AGENT_INSTALL_PLATFORM, ""));
        data.setUsrDir(System.getProperty("user.dir"));
        data.setUsrName(System.getProperty("user.name"));
        data.setProcessId(String.valueOf(getProcessId()));
        if (AgentManager.getAgentConfigInfo() != null) {
            data.setGlobalConfigMd5(AgentManager.getAgentConfigInfo().getMd5());
        }
        data.setTaskMd5(agentManager.getTaskManager().getTaskResultMd5());
        data.setTaskNum(String.valueOf(agentManager.getTaskManager().getTaskStore().getTasks().size()));
        data.setInstanceNum(String.valueOf(OffsetManager.getInstance().getRunningInstanceCount()));
        data.setBootTime(systemStartupTime);
        data.setSendPackageCount(String.valueOf(sendPackageCount.getAndSet(0)));
        data.setSendDataLen(String.valueOf(sendDataLen.getAndSet(0)));
        data.setSourcePermitLeft(
                String.valueOf(MemoryManager.getInstance().getLeft(AGENT_GLOBAL_READER_SOURCE_PERMIT)));
        data.setQueuePermitLeft(String.valueOf(MemoryManager.getInstance().getLeft(AGENT_GLOBAL_READER_QUEUE_PERMIT)));
        data.setWriterPermitLeft(String.valueOf(MemoryManager.getInstance().getLeft(AGENT_GLOBAL_WRITER_PERMIT)));
        data.setActiveThreadCount(String.valueOf(threadMXBean.getThreadCount()));
        return data;
    }
Collect various indicators of agent processes for backend problem analysis
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/AgentStatusManager.java