From 5ca2032a71734c64bd28650c39aed027f5e47834 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 20 Dec 2023 18:30:07 +0800 Subject: [PATCH] * Adjust zagent heart time save. --- api/v1/entries/hostheartbeat.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/v1/entries/hostheartbeat.php b/api/v1/entries/hostheartbeat.php index fd1207de98..da84bd307b 100644 --- a/api/v1/entries/hostheartbeat.php +++ b/api/v1/entries/hostheartbeat.php @@ -70,7 +70,6 @@ class hostHeartbeatEntry extends baseEntry { foreach($vms as $vm) { - $heartbeat = strtotime(substr($vm->heartbeat, 0, 19)); $vmData = array( 'vnc' => $vm->vncPortOnHost, 'zap' => $vm->agentPortOnHost, @@ -79,11 +78,10 @@ class hostHeartbeatEntry extends baseEntry 'ssh' => $vm->sshPortOnHost, 'status' => $vm->status, 'extranet' => $vm->ip, + 'heartbeat' => helper::now() ); - + if(!$vm->sshPortOnHost) unset($vmData['ssh']); - if($heartbeat > 0) $vmData['heartbeat'] = date("Y-m-d H:i:s", $heartbeat); - if($isPhysicsNode) { unset($vmData['extranet']); @@ -98,7 +96,7 @@ class hostHeartbeatEntry extends baseEntry $vmData['status'] = $vm->status = $node->status; $this->dao->update(TABLE_ZAHOST)->data($vmData)->where('mac')->eq($vm->macAddress)->exec(); } - + if($vm->status == 'running' && !$isPhysicsNode) { if(!empty($node))