Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
87a6180e
Commit
87a6180e
authored
May 05, 2020
by
ZhengJie
Browse files
[新增功能](el-admin v2.5): v2.5 beta
详情
https://www.ydyno.com/archives/1225.html
parent
7b268b75
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java
View file @
87a6180e
...
...
@@ -57,7 +57,7 @@ public class MonitorServiceImpl implements MonitorService {
// 交换区信息
resultMap
.
put
(
"swap"
,
getSwapInfo
(
hal
.
getMemory
()));
// 磁盘
resultMap
.
put
(
"disk"
,
getDiskInfo
(
hal
.
getDiskStores
(),
os
));
resultMap
.
put
(
"disk"
,
getDiskInfo
(
os
));
resultMap
.
put
(
"time"
,
DateUtil
.
format
(
new
Date
(),
"HH:mm:ss"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -67,19 +67,10 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 获取磁盘信息
* @param diskStores /
* @return /
*/
private
Map
<
String
,
Object
>
getDiskInfo
(
HWDiskStore
[]
diskStores
,
OperatingSystem
os
)
{
private
Map
<
String
,
Object
>
getDiskInfo
(
OperatingSystem
os
)
{
Map
<
String
,
Object
>
diskInfo
=
new
LinkedHashMap
<>();
long
total
=
0
;
for
(
HWDiskStore
disk
:
diskStores
)
{
boolean
readwrite
=
disk
.
getReads
()
>
0
||
disk
.
getWrites
()
>
0
;
total
=
disk
.
getSize
();
diskInfo
.
put
(
"reads"
,
readwrite
?
FormatUtil
.
formatBytes
(
disk
.
getReadBytes
())
:
"?"
);
diskInfo
.
put
(
"writes"
,
readwrite
?
FormatUtil
.
formatBytes
(
disk
.
getWriteBytes
())
:
"?"
);
break
;
}
FileSystem
fileSystem
=
os
.
getFileSystem
();
OSFileStore
[]
fsArray
=
fileSystem
.
getFileStores
();
for
(
OSFileStore
fs
:
fsArray
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment