实现设备管理功能
This commit is contained in:
@@ -108,10 +108,15 @@ func HandleMetricsPost(c *gin.Context) {
|
||||
agentName = device.Name
|
||||
}
|
||||
|
||||
// 更新设备状态为active
|
||||
if err := deviceStorage.UpdateDeviceStatus(deviceID, "active"); err != nil {
|
||||
// 只记录警告,不影响指标处理
|
||||
log.Printf("Warning: Failed to update device status: %v", err)
|
||||
// 确保设备状态为active
|
||||
if device.Status != "active" {
|
||||
// 更新设备状态为active
|
||||
if err := deviceStorage.UpdateDeviceStatus(deviceID, "active"); err != nil {
|
||||
// 只记录警告,不影响指标处理
|
||||
log.Printf("Warning: Failed to update device status: %v", err)
|
||||
} else {
|
||||
log.Printf("Device %s activated successfully", deviceID)
|
||||
}
|
||||
}
|
||||
|
||||
// 创建基础标签,包含Agent名称
|
||||
|
||||
Reference in New Issue
Block a user