Neptune-Crypto / neptune-core

anonymous peer-to-peer cash
Apache License 2.0
25 stars 7 forks source link

Display CPU temperature in Dashboard #138

Closed aszepieniec closed 4 months ago

aszepieniec commented 5 months ago

The dashboard has a field indicating the CPU temperature, but this field is currently unpopulated. It turns out there is a crate called systemstat that can return this number.

aszepieniec commented 5 months ago

(Note that this task does not have a very high priority; I just made the issue to save the link somewhere.)

elielnfinic commented 5 months ago

Can I work on this task?

dan-da commented 5 months ago

@aszepieniec note that the dashboard may be running on a different machine from neptune-core. If the goal is to display CPU temp of the machine hosting the node, then it seems this should be impl'd as a neptune-core rpc api. Do you agree, or you have something else in mind?

@elielnfinic sure. we'd welcome a PR. You can take a look at neptune-core/src/rpc_server.rs for adding a new rpc call, perhaps get_cpu_temps. Dashboard overview source is in src/bin/dashboard_src/overview_screen.rs.

That said, I'd suggest this functionality is outside the mission/scope of a cryptocurrency node, and there are plenty of dedicated tools for monitoring local or remote machines using all kinds of metrics so this might not be a long-lived feature, but I suppose it doesn't hurt to include for launch if it makes the dashboard a little more useful.

aszepieniec commented 5 months ago

If the goal is to display CPU temp of the machine hosting the node, then it seems this should be impl'd as a neptune-core rpc api.

I certainly agree that this feature should be implemented with an RPC call.

The statement about neptune-dashboard potentially running on a different machine from neptune-core is perhaps more true in the future than in the present, or true with a little engineering work but false without. Right now, there is no authentication between neptune-core and neptune-dashboard and to send coins you do not need to enter a password or anything like that. So anybody who connects the dashboard successfully can spend coins. Since this is a security hazard, neptune-core only admits connections coming from localhost. So in practice, you a) either run neptune-dashboard on the same machine as neptune-core or b) set up a SSH tunnel or something similar, which is the part that requires a little engineering..

elielnfinic commented 5 months ago

Alright, thanks @dan-da and @aszepieniec for the information. Let me go through the files/structure of the project and build something. If I have any questions, I will let you know. About the RPC call, I agree that this might be useful when CPU temperature is requested from another machine. I will explore the SSH possibility too.

Thanks.

dan-da commented 5 months ago

I will explore the SSH possibility too.

I don't believe there's any need to do anything with ssh as far as neptune code is concerned.

iiuc, @aszepieniec was referring to an end-user (manually) using ssh to tunnel a connection between machine A running dashboard and machine B running neptune-core. It would appear to neptune-core that the rpc request is coming from localhost, so it would process the request.