Added most node_info information
That I've found relevant or interesting at least
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
[default]
|
||||
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 client = reqwest::blocking::Client::new();
|
||||
// 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();
|
||||
// TODO: Figure out _why_ this part needs to be inside this closure
|
||||
resp.json::<NodeInfo>()
|
||||
}).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("/")]
|
||||
|
||||
@@ -9,7 +9,7 @@ pub struct NodeInfo {
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct NodeInfoInner {
|
||||
adjusted_time: u64,
|
||||
pub adjusted_time: u64,
|
||||
alt_blocks_count: u64,
|
||||
block_size_limit: u64,
|
||||
block_size_median: u64,
|
||||
@@ -20,10 +20,10 @@ pub struct NodeInfoInner {
|
||||
credits: u64,
|
||||
cumulative_difficulty: u64,
|
||||
cumulative_difficulty_top64: u64,
|
||||
database_size: u64,
|
||||
pub database_size: u64,
|
||||
difficulty: u64,
|
||||
difficulty_top64: u64,
|
||||
free_space: u64,
|
||||
pub free_space: u64,
|
||||
grey_peerlist_size: u64,
|
||||
height: u64,
|
||||
height_without_bootstrap: u64,
|
||||
@@ -35,7 +35,7 @@ pub struct NodeInfoInner {
|
||||
restricted: bool,
|
||||
rpc_connections_count: u64,
|
||||
stagenet: bool,
|
||||
start_time: u64,
|
||||
pub start_time: u64,
|
||||
status: String,
|
||||
synchronized: bool,
|
||||
target: u64,
|
||||
@@ -53,13 +53,13 @@ pub struct NodeInfoInner {
|
||||
wide_cumulative_difficulty: String,
|
||||
wide_difficulty: String,
|
||||
#[serde(skip_deserializing, default = "none")]
|
||||
time_up_pretty: Option<String>,
|
||||
pub time_up_pretty: String,
|
||||
#[serde(skip_deserializing, default = "none")]
|
||||
space_left_pretty: Option<String>,
|
||||
pub free_space_pretty: String,
|
||||
#[serde(skip_deserializing, default = "none")]
|
||||
db_size_pretty: Option<String>,
|
||||
pub db_size_pretty: String,
|
||||
}
|
||||
|
||||
fn none() -> Option<String> {
|
||||
None
|
||||
fn none() -> String {
|
||||
"".to_string()
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
}
|
||||
.warning {
|
||||
color: yellow;
|
||||
}
|
||||
.node_data {
|
||||
font-family: monospace, monospace;
|
||||
}
|
||||
@@ -77,31 +78,38 @@
|
||||
{% endfor %}
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
<h1>Monerod Status</h1>
|
||||
<div class="monerodstatus">
|
||||
<div class="monerodinfocard">
|
||||
<div class="infocards">
|
||||
<div class="infocard">
|
||||
{% if node_info.synchronized %}
|
||||
<p><span class="success">Synchronised</span> to {{ node_info.nettype }}</p>
|
||||
{% else %}
|
||||
<p><span class="warning">Synchronising</span> to {{ node_info.nettype }}</p>
|
||||
{% endif %}
|
||||
<p> Running version {{ node_info.version }}
|
||||
<p> Running version <span class="node_data">{{ node_info.version }}</span>
|
||||
{% if node_info.update_available %}
|
||||
<p class="warning">Which can be updated</p>
|
||||
<span class="warning">Which can be updated</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>Monerod Time Up: <span class="node_data">{{ node_info.time_up_pretty }}</span></p>
|
||||
</div>
|
||||
<div class="monerodinfocard">
|
||||
<p>Txs in pool: <span>{{ node_info.tx_pool_size }}</span></p>
|
||||
<p>Total Txs: <span>{{ node_info.tx_count }}</span></p>
|
||||
<div class="infocard">
|
||||
<p>Txs in pool: <span class="node_data">{{ node_info.tx_pool_size }}</span></p>
|
||||
<p>Total Txs: <span class="node_data">{{ node_info.tx_count }}</span></p>
|
||||
</div>
|
||||
<div class="moneroinfocard">
|
||||
<p>Incoming Connections: <span>{{ node_info.incoming_connections_count }}</span></p>
|
||||
<p>Outgoing Connections: <span>{{ node_info.outgoing_connections_count }}</span></p>
|
||||
<p>RPC Connections: <span>{{ node_info.rpc_connections_count }}</span></p>
|
||||
<div class="infocard">
|
||||
<p>Incoming Connections: <span class="node_data">{{ node_info.incoming_connections_count }}</span></p>
|
||||
<p>Outgoing Connections: <span class="node_data">{{ node_info.outgoing_connections_count }}</span></p>
|
||||
<p>RPC Connections: <span class="node_data">{{ node_info.rpc_connections_count }}</span></p>
|
||||
</div>
|
||||
<div class="moneroinfocard">
|
||||
<p>Blockheight: <span>{{ node_info.height }}</span></p>
|
||||
<p>Latest block hash: <span>{{ node_info.top_block_hash }}</span></p>
|
||||
<div class="infocard">
|
||||
<p>Blockheight: <span class="node_data">{{ node_info.height }}</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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user