mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-10 23:22:05 +00:00
Add hostMetrics user string to config.yaml and trunk
This commit is contained in:
parent
ea7d3cd442
commit
ad6ad03e81
@ -197,6 +197,7 @@ Webserver:
|
||||
HostMetrics:
|
||||
# ReportInterval: 30 # Interval in minutes between HostMetrics report packets, or 0 for disabled
|
||||
# Channel: 0 # channel to send Host Metrics over. Defaults to the primary channel.
|
||||
# UserStringCommand: cat /sys/firmware/devicetree/base/serial-number # Command to execute, to send the results as the userString
|
||||
|
||||
|
||||
General:
|
||||
|
@ -30,8 +30,8 @@ bool HostMetricsModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
|
||||
#ifdef DEBUG_PORT
|
||||
const char *sender = getSenderShortName(mp);
|
||||
|
||||
LOG_INFO("(Received Host Metrics from %s): uptime=%u, diskfree=%lu, memory free=%lu, load=%04.2f, %04.2f, %04.2f, %s", sender,
|
||||
t->variant.host_metrics.uptime_seconds, t->variant.host_metrics.diskfree1_bytes,
|
||||
LOG_INFO("(Received Host Metrics from %s): uptime=%u, diskfree=%lu, memory free=%lu, load=%04.2f, %04.2f, %04.2f, %s",
|
||||
sender, t->variant.host_metrics.uptime_seconds, t->variant.host_metrics.diskfree1_bytes,
|
||||
t->variant.host_metrics.freemem_bytes, static_cast<float>(t->variant.host_metrics.load1) / 100,
|
||||
static_cast<float>(t->variant.host_metrics.load5) / 100,
|
||||
static_cast<float>(t->variant.host_metrics.load15) / 100, t->variant.host_metrics.user_string);
|
||||
@ -110,9 +110,8 @@ meshtastic_Telemetry HostMetricsModule::getHostMetrics()
|
||||
if (settingsStrings[hostMetrics_user_command] != "") {
|
||||
std::string userCommandResult = exec(settingsStrings[hostMetrics_user_command].c_str());
|
||||
if (userCommandResult.length() > 1) {
|
||||
strncpy(t.variant.host_metrics.user_string, userCommandResult.c_str(), 200);
|
||||
t.variant.host_metrics.has_user_string = true;
|
||||
|
||||
strncpy(t.variant.host_metrics.user_string, userCommandResult.c_str(), 200);
|
||||
t.variant.host_metrics.has_user_string = true;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
|
@ -604,7 +604,6 @@ bool loadConfig(const char *configPath)
|
||||
settingsMap[hostMetrics_channel] = (yamlConfig["HostMetrics"]["Channel"]).as<int>(0);
|
||||
settingsMap[hostMetrics_interval] = (yamlConfig["HostMetrics"]["ReportInterval"]).as<int>(0);
|
||||
settingsStrings[hostMetrics_user_command] = (yamlConfig["HostMetrics"]["UserStringCommand"]).as<std::string>("");
|
||||
|
||||
}
|
||||
|
||||
if (yamlConfig["General"]) {
|
||||
|
Loading…
Reference in New Issue
Block a user