Added RAM usage bars
This commit is contained in:
24
src/main.rs
24
src/main.rs
@@ -35,10 +35,14 @@ struct DiskInfo {
|
|||||||
|
|
||||||
#[derive(Serialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
struct RamInfo {
|
struct RamInfo {
|
||||||
total_memory: String,
|
total_memory: u64,
|
||||||
used_memory: String,
|
used_memory: u64,
|
||||||
total_swap: String,
|
total_swap: u64,
|
||||||
used_swap: String,
|
used_swap: u64,
|
||||||
|
total_memory_pretty: String,
|
||||||
|
used_memory_pretty: String,
|
||||||
|
total_swap_pretty: String,
|
||||||
|
used_swap_pretty: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
@@ -118,10 +122,14 @@ fn get_system_info(network_if_names: &Vec<String>) -> SysInfo {
|
|||||||
disks: disks_context,
|
disks: disks_context,
|
||||||
components: components_context,
|
components: components_context,
|
||||||
ram: RamInfo {
|
ram: RamInfo {
|
||||||
total_memory: Byte::from(sys.total_memory()).to_string(),
|
total_memory: sys.total_memory(),
|
||||||
used_memory: Byte::from(sys.used_memory()).to_string(),
|
used_memory: sys.used_memory(),
|
||||||
total_swap: Byte::from(sys.total_swap()).to_string(),
|
total_swap: sys.total_swap(),
|
||||||
used_swap: Byte::from(sys.used_swap()).to_string(),
|
used_swap: sys.used_swap(),
|
||||||
|
total_memory_pretty: Byte::from(sys.total_memory()).to_string(),
|
||||||
|
used_memory_pretty: Byte::from(sys.used_memory()).to_string(),
|
||||||
|
total_swap_pretty: Byte::from(sys.total_swap()).to_string(),
|
||||||
|
used_swap_pretty: Byte::from(sys.used_swap()).to_string(),
|
||||||
},
|
},
|
||||||
network_ifs: network_ifs,
|
network_ifs: network_ifs,
|
||||||
network_ifs_errored: network_ifs_errored,
|
network_ifs_errored: network_ifs_errored,
|
||||||
|
|||||||
@@ -79,8 +79,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="infocard">
|
<div class="infocard">
|
||||||
<h2>RAM</h2>
|
<h2>RAM</h2>
|
||||||
<p><span class="node_data">{{ system.ram.used_memory }}</span> of <span class="node_data">{{ system.ram.total_memory }}</span> RAM current in use</p>
|
<p><span class="node_data">{{ system.ram.used_memory_pretty }}</span> of <span class="node_data">{{ system.ram.total_memory_pretty }}</span> RAM current in use</p>
|
||||||
<p><span class="node_data">{{ system.ram.used_swap }}</span> of <span class="node_data">{{ system.ram.total_swap }}</span> swap currently in use</p>
|
<progress class="ramspace" max="{{ system.ram.total_memory }}" value="{{ system.ram.used_memory }}"></progress>
|
||||||
|
<p><span class="node_data">{{ system.ram.used_swap_pretty }}</span> of <span class="node_data">{{ system.ram.total_swap_pretty }}</span> swap currently in use</p>
|
||||||
|
<progress class="ramspace" max="{{ system.ram.total_swap }}" value="{{ system.ram.used_swap }}"></progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="infocard">
|
<div class="infocard">
|
||||||
<h2>Network Interfaces</h2>
|
<h2>Network Interfaces</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user