Added most node_info information
That I've found relevant or interesting at least
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
[default]
|
[default]
|
||||||
template_dir = "templates"
|
template_dir = "templates"
|
||||||
#address = "0.0.0.0"
|
address = "0.0.0.0"
|
||||||
|
|||||||
10
src/main.rs
10
src/main.rs
@@ -129,12 +129,18 @@ fn get_node_info() -> NodeInfoInner {
|
|||||||
let node_info = task::block_in_place(move || {
|
let node_info = task::block_in_place(move || {
|
||||||
let client = reqwest::blocking::Client::new();
|
let client = reqwest::blocking::Client::new();
|
||||||
// TODO: Properly handle this unwrap - half the point of this is to capture
|
// TODO: Properly handle this unwrap - half the point of this is to capture
|
||||||
// when the node is down
|
// when the node is down - don't want it crashing when
|
||||||
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
|
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
|
||||||
// TODO: Figure out _why_ this part needs to be inside this closure
|
// TODO: Figure out _why_ this part needs to be inside this closure
|
||||||
resp.json::<NodeInfo>()
|
resp.json::<NodeInfo>()
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
node_info.result
|
let mut node_info = node_info.result;
|
||||||
|
// TODO: Put this into a Serialize method
|
||||||
|
let approx_uptime = node_info.adjusted_time - node_info.start_time;
|
||||||
|
node_info.time_up_pretty = UptimeFull::from(approx_uptime).to_string();
|
||||||
|
node_info.db_size_pretty = Byte::from(node_info.database_size).to_string();
|
||||||
|
node_info.free_space_pretty = Byte::from(node_info.free_space).to_string();
|
||||||
|
node_info
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ pub struct NodeInfo {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfoInner {
|
pub struct NodeInfoInner {
|
||||||
adjusted_time: u64,
|
pub adjusted_time: u64,
|
||||||
alt_blocks_count: u64,
|
alt_blocks_count: u64,
|
||||||
block_size_limit: u64,
|
block_size_limit: u64,
|
||||||
block_size_median: u64,
|
block_size_median: u64,
|
||||||
@@ -20,10 +20,10 @@ pub struct NodeInfoInner {
|
|||||||
credits: u64,
|
credits: u64,
|
||||||
cumulative_difficulty: u64,
|
cumulative_difficulty: u64,
|
||||||
cumulative_difficulty_top64: u64,
|
cumulative_difficulty_top64: u64,
|
||||||
database_size: u64,
|
pub database_size: u64,
|
||||||
difficulty: u64,
|
difficulty: u64,
|
||||||
difficulty_top64: u64,
|
difficulty_top64: u64,
|
||||||
free_space: u64,
|
pub free_space: u64,
|
||||||
grey_peerlist_size: u64,
|
grey_peerlist_size: u64,
|
||||||
height: u64,
|
height: u64,
|
||||||
height_without_bootstrap: u64,
|
height_without_bootstrap: u64,
|
||||||
@@ -35,7 +35,7 @@ pub struct NodeInfoInner {
|
|||||||
restricted: bool,
|
restricted: bool,
|
||||||
rpc_connections_count: u64,
|
rpc_connections_count: u64,
|
||||||
stagenet: bool,
|
stagenet: bool,
|
||||||
start_time: u64,
|
pub start_time: u64,
|
||||||
status: String,
|
status: String,
|
||||||
synchronized: bool,
|
synchronized: bool,
|
||||||
target: u64,
|
target: u64,
|
||||||
@@ -53,13 +53,13 @@ pub struct NodeInfoInner {
|
|||||||
wide_cumulative_difficulty: String,
|
wide_cumulative_difficulty: String,
|
||||||
wide_difficulty: String,
|
wide_difficulty: String,
|
||||||
#[serde(skip_deserializing, default = "none")]
|
#[serde(skip_deserializing, default = "none")]
|
||||||
time_up_pretty: Option<String>,
|
pub time_up_pretty: String,
|
||||||
#[serde(skip_deserializing, default = "none")]
|
#[serde(skip_deserializing, default = "none")]
|
||||||
space_left_pretty: Option<String>,
|
pub free_space_pretty: String,
|
||||||
#[serde(skip_deserializing, default = "none")]
|
#[serde(skip_deserializing, default = "none")]
|
||||||
db_size_pretty: Option<String>,
|
pub db_size_pretty: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn none() -> Option<String> {
|
fn none() -> String {
|
||||||
None
|
"".to_string()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
}
|
}
|
||||||
.warning {
|
.warning {
|
||||||
color: yellow;
|
color: yellow;
|
||||||
|
}
|
||||||
.node_data {
|
.node_data {
|
||||||
font-family: monospace, monospace;
|
font-family: monospace, monospace;
|
||||||
}
|
}
|
||||||
@@ -77,31 +78,38 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
<p>
|
<p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<h1>Monerod Status</h1>
|
<h1>Monerod Status</h1>
|
||||||
<div class="monerodstatus">
|
<div class="infocards">
|
||||||
<div class="monerodinfocard">
|
<div class="infocard">
|
||||||
{% if node_info.synchronized %}
|
{% if node_info.synchronized %}
|
||||||
<p><span class="success">Synchronised</span> to {{ node_info.nettype }}</p>
|
<p><span class="success">Synchronised</span> to {{ node_info.nettype }}</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><span class="warning">Synchronising</span> to {{ node_info.nettype }}</p>
|
<p><span class="warning">Synchronising</span> to {{ node_info.nettype }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p> Running version {{ node_info.version }}
|
<p> Running version <span class="node_data">{{ node_info.version }}</span>
|
||||||
{% if node_info.update_available %}
|
{% if node_info.update_available %}
|
||||||
<p class="warning">Which can be updated</p>
|
<span class="warning">Which can be updated</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
<p>Monerod Time Up: <span class="node_data">{{ node_info.time_up_pretty }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="monerodinfocard">
|
<div class="infocard">
|
||||||
<p>Txs in pool: <span>{{ node_info.tx_pool_size }}</span></p>
|
<p>Txs in pool: <span class="node_data">{{ node_info.tx_pool_size }}</span></p>
|
||||||
<p>Total Txs: <span>{{ node_info.tx_count }}</span></p>
|
<p>Total Txs: <span class="node_data">{{ node_info.tx_count }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="moneroinfocard">
|
<div class="infocard">
|
||||||
<p>Incoming Connections: <span>{{ node_info.incoming_connections_count }}</span></p>
|
<p>Incoming Connections: <span class="node_data">{{ node_info.incoming_connections_count }}</span></p>
|
||||||
<p>Outgoing Connections: <span>{{ node_info.outgoing_connections_count }}</span></p>
|
<p>Outgoing Connections: <span class="node_data">{{ node_info.outgoing_connections_count }}</span></p>
|
||||||
<p>RPC Connections: <span>{{ node_info.rpc_connections_count }}</span></p>
|
<p>RPC Connections: <span class="node_data">{{ node_info.rpc_connections_count }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="moneroinfocard">
|
<div class="infocard">
|
||||||
<p>Blockheight: <span>{{ node_info.height }}</span></p>
|
<p>Blockheight: <span class="node_data">{{ node_info.height }}</span></p>
|
||||||
<p>Latest block hash: <span>{{ node_info.top_block_hash }}</span></p>
|
<p>Latest block hash: <span class="node_data">{{ node_info.top_block_hash }}</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="infocard">
|
||||||
|
<p>Free Space: <span class="node_data">{{ node_info.free_space_pretty }}</span></p>
|
||||||
|
<p>Database Size: <span class="node_data"> {{ node_info.db_size_pretty }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user