-
Notifications
You must be signed in to change notification settings - Fork 1.2k
use /prod/stat to get uptime instead of the uptime command #11670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested locally and the old one seems to work fine as well. But as per java docs, it should be |
||
| Date date = formatter.parse(bootTime); | ||
| newEntry.setSystemBootTime(date); | ||
| } catch (ParseException e) { | ||
| logger.error("can not retrieve system uptime"); | ||
| logger.error("can not retrieve system uptime", e); | ||
vishesh92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| String maxuse = Script.runSimpleBashScript(String.format("ps -o vsz= %d", newEntry.getPid())); | ||
| newEntry.setSystemMemoryVirtualSize(Long.parseLong(maxuse) * 1024); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.