Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions Pryde.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Pryde.Core", "src\Pryde.Cor
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Pryde.Data", "src\Pryde.Data\Pryde.Data.fsproj", "{D21EAEA5-3187-4FAB-835F-ADB5004BB849}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Pryde.Polling", "src\Pryde.Polling\Pryde.Polling.fsproj", "{133614EE-6876-4822-BC54-31B463EDF60A}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Pryde.Api", "src\Pryde.Api\Pryde.Api.fsproj", "{6B9D5F89-631E-4279-B2DA-249A45F41560}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
Expand Down Expand Up @@ -51,18 +49,6 @@ Global
{D21EAEA5-3187-4FAB-835F-ADB5004BB849}.Release|x64.Build.0 = Release|Any CPU
{D21EAEA5-3187-4FAB-835F-ADB5004BB849}.Release|x86.ActiveCfg = Release|Any CPU
{D21EAEA5-3187-4FAB-835F-ADB5004BB849}.Release|x86.Build.0 = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|x64.ActiveCfg = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|x64.Build.0 = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|x86.ActiveCfg = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Debug|x86.Build.0 = Debug|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|Any CPU.Build.0 = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|x64.ActiveCfg = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|x64.Build.0 = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|x86.ActiveCfg = Release|Any CPU
{133614EE-6876-4822-BC54-31B463EDF60A}.Release|x86.Build.0 = Release|Any CPU
{6B9D5F89-631E-4279-B2DA-249A45F41560}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B9D5F89-631E-4279-B2DA-249A45F41560}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B9D5F89-631E-4279-B2DA-249A45F41560}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -94,7 +80,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{36386E3F-B740-4A58-869A-61D612174958} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{D21EAEA5-3187-4FAB-835F-ADB5004BB849} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{133614EE-6876-4822-BC54-31B463EDF60A} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{6B9D5F89-631E-4279-B2DA-249A45F41560} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{0BB1D565-7519-4BA7-9EA5-641CCE9C3C30} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
Expand Down
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Pryde

Honestly this was more of a project to practice my Fsharp skills but I reckon there'd be some sort of use case for others so I've left it public.

Pryde is a self-hosted metrics API for your windows devices. It includes CPU, disk, memory, GPU and network information exposed over one local HTTP API.


## Setup

1) Navigate to the [releases page](https://github.com/MathusanP/pryde/releases) and download & extract the zip file to a location of your choice.
2) Run `install.ps1` in powershell.
- If prompted by user account control, click yes, the installer requires admin privileges to register the windows service (and its also required to read from the temperature sensors)
3) Once finished, Pryde sits in C:/Pryde and will run as a Windows Service. It will now start automatically every time the machine boots so you don't need to keep a terminal open.
4) You can confirm if it works by opening `https://localhost:5000/system/cpu` in a browser, you should be able to see the json output with your CPU usage, name and temperature.

## Managing the service

Pryde runs as a standard Windows Service named Pryde, so it can be managed the same was as any other service.

```powershell
Start-Service Pryde #start
Stop-Service Pryde #stop
Restart-Service Pryde #retart
Get-Service Pryde #status
```

**Via the services app:** Open `services.msc`, find Pryde in the list, and use the Start/Stop/Restart buttons or right-click menu.

## Uninstalling
Run `uninstall.ps1` as Administrator (from the original releases folder. This stops the service and removes it from Windows.

## Endpoints

| Endpoint | Description |
|---|---|
| `GET /system/cpu` | CPU usage, core count, name, temperature |
| `GET /system/disk` | Per-drive space and filesystem info |
| `GET /system/graphics` | GPU name, driver, VRAM, temperature, load |
| `GET /system/uptime` | System uptime since last boot |
| `GET /network/throughput` | Per-adapter upload/download rates |
| `GET /network/port/{port}` | Whether a specific TCP port is currently listening |

All endpoints return JSON and require no authentication in this version — Pryde is intended to run on `localhost` or be reached only over a private network (e.g. [Tailscale](https://tailscale.com)). See **Exposing this remotely** below before opening it up any further than that.

## Exposing this remotely

By default, Pryde only answers requests reaching it directly — it does not open any ports on your router or make itself reachable from the internet on its own. If you want to check on your device while away from home, I'd reccomend doing this over a virtual private netowrk (vpn)
or by using a tunnel instead of port forwarding, this can be done using a service like Tailscale or using a Cloudflare tunnel.

## A note on admin privileges

Pryde runs under the `LocalSystem` account so it can read CPU temperature sensors, which requires elevated access on Windows. This means the service runs with full system privileges. If you don't need temperature monitoring and would rather run with reduced privileges, you can change the service's logon account via `services.msc` → Pryde → Properties → Log On - CPU (and GPU) temperature will simply come back empty in that case, everything else will keep working normally.

## Building from source

```bash
dotnet publish src/Pryde.Api -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true
```
The resulting `Pryde.Api.exe` will be under `src/Pryde.Api/bin/Release/net9.0/win-x64/publish/`. Copy it alongside `install.ps1` and `uninstall.ps1` to reproduce a release package.
4 changes: 4 additions & 0 deletions src/Pryde.Api/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ namespace Pryde.Api
open Giraffe
open Pryde.Api.Routes
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.DependencyInjection


Expand All @@ -13,6 +16,7 @@ module Program =
[<EntryPoint>]
let main args =
let builder = WebApplication.CreateBuilder(args)
builder.Host.UseWindowsService() |> ignore
builder.Services.AddGiraffe() |> ignore

let app = builder.Build()
Expand Down
2 changes: 1 addition & 1 deletion src/Pryde.Api/Pryde.Api.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

<ItemGroup>
<ProjectReference Include="..\Pryde.Core\Pryde.Core.fsproj" />
<ProjectReference Include="..\Pryde.Polling\Pryde.Polling.fsproj" />
<ProjectReference Include="..\Pryde.Data\Pryde.Data.fsproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Giraffe" Version="8.3.0" />
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.7-pre714" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.12" />
</ItemGroup>

</Project>
Loading