mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
Online state with the time it came up, down/up alerts, a UGC column in the health history, /api/servers (every server with its process memory and CPU) and /api/servers/ugc, and UGC gauges for Prometheus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
997 B
C++
32 lines
997 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
/**
|
|
* Running the server: health history (a sample a minute: players, worlds, auth/chat/UGC up, memory), the running
|
|
* server processes, crash dumps from dump_folder, and searching the servers' log files. Prometheus metrics are in
|
|
* PrometheusMetrics.h.
|
|
*/
|
|
void RegisterServerRoutes();
|
|
|
|
namespace ServerRoutes {
|
|
// Main loop: take a health sample once a minute
|
|
void Update();
|
|
|
|
// A running DarkflameServer process from this build
|
|
struct Process {
|
|
std::string program; // the binary: "WorldServer", "UgcServer", ...
|
|
uint32_t pid{};
|
|
uint64_t memoryKb{}; // resident
|
|
double cpuPercent{}; // of one core, since this process was last looked at (0 the first time)
|
|
int64_t startedAt{}; // unix time
|
|
uint32_t zoneId{}; // world servers: from the command line
|
|
uint32_t instanceId{};
|
|
};
|
|
|
|
// Main thread: every server process of this build (Linux: /proc; elsewhere none)
|
|
std::vector<Process> Processes();
|
|
}
|