sureshanaparti commented on code in PR #11670:
URL: https://github.com/apache/cloudstack/pull/11670#discussion_r2358078030


##########
server/src/main/java/com/cloud/server/StatsCollector.java:
##########
@@ -937,12 +937,12 @@ private void getProcFileSystemData(@NotNull 
ManagementServerHostStatsEntry newEn
                 logger.info(String.format("used memory from /proc: %d", 
newEntry.getSystemMemoryUsed()));
             }
             try {
-                String bootTime = Script.runSimpleBashScript("uptime -s");
-                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 
hh:mm:ss", Locale.ENGLISH);
+                String bootTime = Script.runSimpleBashScript("date -d @$(grep 
btime /proc/stat | awk '{print $2}') '+%Y-%m-%d %H:%M:%S'");
+                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss", Locale.ENGLISH);

Review Comment:
   deserialization may fail with different formatters, use 
DateUtil.ZONED_DATETIME_FORMAT (check here: 
https://github.com/apache/cloudstack/pull/11506)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to