This project provides a powerful all-in-one monitoring and management service stack that can help you keep detailed realtime insights and remote control over your Raspberry PI or Linux machines via an intuitive web interface and API.
The project has been tested on Linux systems, including the Raspberry Pi, but it can also run on other devices.
The web interface is responsive, it has desktop and mobile modes.
It monitors:
CPU: usage, load, temperatureMemory: total, used, free, cached, available, swap, videoServices: listed in:configs/api.yamlunder:on_runtime.services_listsectionTop processesNetwork traffic: realtime per-interface throughput chartsStorageUptimeWeb terminal: interactive shell session on a PTY served over WebSocket
Management features:
restartorshutdownthe devicestart/stop/restartorenable/disableservicesrunprograms,scriptsorcommandsdefined in:configs/api.linux|raspbian.yamlkillspecific processes
Parts:
You can choose to download the pre-built binaries or build the service yourself.
If you didn't install go, and you don't want to install it, you can download the latest pre-built binaries with: get-latest-binaries.sh.
-
Install the latest release for your architecture
bash -c "$(wget -q --no-check-certificate --no-cache --no-cookies -O- https://raw.githubusercontent.com/takattila/monitor/master/scripts/get-latest-binaries.sh)"
If you cannot find the correct OS/architecture in the releases, you can optionally build the services yourself.
-
Download and install Go
- The
go versioncan be fetched from the go.mod file. - Please follow the instructions here: https://go.dev/doc/install
- The
-
Clone repository:
sudo git clone git@github.com:takattila/monitor.git /opt/monitor -
Change ownership of the /opt/monitor directory to $USER:
sudo chown $USER:$USER /opt/monitor sudo chown -R $USER:$USER /opt/monitor -
Change directory:
cd /opt/monitor -
Install dependencies:
go mod tidy -
Build programs:
go build -o cmd internal/api/app/api.go go build -o cmd internal/web/app/web.go go build -o cmd internal/credentials/app/credentials.go
-
Save your credentials:
sudo ./cmd/credentials -
Copy service files:
sudo cp tools/*.service /etc/systemd/system -
Reload daemon:
sudo systemctl daemon-reload -
Enable services:
sudo systemctl enable monitor-api.service monitor-web.service sudo systemctl is-enabled monitor-api.service monitor-web.service -
Start services:
sudo systemctl start monitor-api.service monitor-web.service sudo systemctl is-active monitor-api.service monitor-web.service -
Open the web interface
You can fetch the IP of the device with this command:
hostname -I | awk '{print $1}'http://<IP-OF-THE-DEVICE>:8383/monitor
API service provides hardware statistics information from the Raspberry PI, by serving a JSON file.
go build -o cmd internal/api/app/api.go && ./cmd/api
http://<IP-OF-THE-DEVICE>:7070/all
Web interface for monitoring the Raspberry PI with management features:
- restart or shutdown the device
- start/stop/restart or enable/disable services
go build -o cmd internal/web/app/web.go && sudo ./cmd/web
http://<IP-OF-THE-DEVICE>:8383/monitor
rm go.*
go mod init github.com/takattila/monitor
go mod tidy
Optional: m
go mod vendor
-
Keep running the API service in the background
Do not need to stop or restart the API service, let's keep running it in the background.
You can check it's status by running:
sudo systemctl status monitor-api.serviceIf the service status is not "active", you can start it by running the command bellow:
sudo systemctl start monitor-api.service -
Edit the
configs/web.{raspbian|linux}.yamlconfiguration file:Replace the port to: 443 and add your domain:
static: - port: 8383 - domain: example.net + port: 443 + domain: yourdomain.com
If you want to use the base path as:
/instead of:/monitor, you can simply change the routes as the followings:routes: - index: /monitor - login: /monitor/login - logout: /monitor/logout - internal: /monitor/internal - api: /monitor/api/{statistics} - systemctl: /monitor/systemctl/{action}/{service} - power: /monitor/power/{action} - toggle: /monitor/toggle/{section}/{status} - web: /monitor/web - run: /monitor/run/{action}/{name} + index: / + login: /login + logout: /logout + internal: /internal + api: /api/{statistics} + systemctl: /systemctl/{action}/{service} + power: /power/{action} + toggle: /toggle/{section}/{status} + web: /web + run: /run/{action}/{name}
After that you can reach the web interface on:
http://<IP-OF-THE-DEVICE>:8383 -
Rebuild the program
sudo systemctl stop monitor-web.service go build -o cmd internal/web/app/web.go -
Start the service
sudo systemctl start monitor-web.service
Caddy is an open source web server with automatic HTTPS.
If you installed it on your Raspberry PI, you can add a custom route, where the service can be reached.
Example Caddyfile:
yurdomain.com {
route /monitor* {
reverse_proxy http://127.0.0.1:8383 {
header_up X-Real-IP {remote}
}
}
}
This project uses the directory structure as explained in: golang-standards/project-layout.
You can find the configuration under the configs directory.
Each YAML file is a configuration for each service.
Each configuration has two big sections: on_startup and on_runtime.
The on_startup section means that all settings belonging to this section are applied when the service starts.
The on_runtime section means that all settings belonging to this section can be applied during the service running.
on_start: # These settings can be applied only, when the service starts.
port: 7070 # - The service can be reached under this port.
routes: # - URL schema, which describe the interfaces for making requests to the service.
all: /all # - All hardware information merged into one JSON.
model: /model # - Provides a model name JSON.
cpu: /cpu # - Provides a cpu statistics JSON.
memory: /memory # - Provides a memory statistics JSON.
processes: /processes # - Provides a top 10 processes JSON.
storages: /storages # - Provides a storages JSON.
services: /services # - Provides a services list JSON.
network: /network # - Provides a network traffic JSON.
toggle: /toggle/{section}/{status} # - The processes, storages, services, network JSON provision can be turned on or off.
run: # - Specific commands or programs can be executed.
list: /run/list # - List the pre-definied commands or programs.
exec: /run/exec/{name} # - Execute a specific command or program.
stdout: /run/stdout/{name} # - Returns the output of a specific command or program after it is executed.
skins: /skins # - Returns a list from available skins.
logger: # - Setup logging functionality.
level: debug # - From debug to none levels, the detail of the logging can be set.
color: on # - Colorizing the log output.
on_runtime: # - These settings can be applied during the service running.
physical_memory: 1GB # - Set the memory amount 'by hand'. It can be commented out, and the program will get the total memory.
commands: # - Commands to get hardware information.
... #
processes: # - List processes ordered by CPU usage
- dash # - The Dash linux shell roughly 4x times faster than Bash.
- -c #
- | # - We can use 'pipe' in YAML to write multi-line blocks...
ps -ewwo pid,user,%mem,%cpu,cmd \ #
--sort=-%cpu --no-headers \ #
| head -n 10 \ #
| tail -n 10 #
... #
services_list: # - List of services which we want to manage.
- smbd # - The service checks in the background, whether the service is:
- sshd # - active or enabled,
- syslog # - and also we can start, stop, restart, enable, disable it.
run: # - Under this section can be defined commands, scripts or programs that can be executed.
services: # - Run command: lists services.
- | #
systemctl list-units \ #
--type=service #
on_start: # These settings can be applied only, when the service starts.
port: 8383 # - The service can be reached under this port.
domain: example.net # - If you want to run this service as a stand-alone web service, you can set your domain here.
web_sources_directory: /web # - The source files of the web interface can be found under this directory.
auth_file: /configs/auth.db # - Usernames and bcrypt-hashed passwords are stored here (SQLite database).
save_credentials: false # - Do we want to initialize the user credentials each time when the service starts?
terminal_user: "" # - If set to a valid system user, the web terminal shell runs as that user
# (e.g. your own username), so the shell uses that user's home and history.
routes: # - URL schema, which describe the interfaces for making requests to the service.
index: /monitor # - Route to the index page.
login: /monitor/login # - Route to the login page. (Login required)
logout: /monitor/logout # - Route to the logout page. (Login required)
internal: /monitor/internal # - Route to the internal page. (Login required)
api: /monitor/api/{statistics} # - Route to the api page. (Login required)
systemctl: /monitor/systemctl/{action}/{service} # - Route to the systemctl page. (Login required)
power: /monitor/power/{action} # - Route to the power page. (Login required)
kill: /monitor/kill/{pid} # - Route to the kill page. (Login required)
toggle: /monitor/toggle/{section}/{status} # - Route to the toggle page. (Login required)
web: /monitor/web # - The files: html, js, css can be served under this route.
run: /monitor/run/{action}/{name} # - Route to the run commands page. (Login required)
pages: # - HTML files path.
login: /html/login.html # - Index file path.
internal: /html/monitor.html # - The internal page file path.
logger: # - Setup logging functionality.
level: debug # - From debug to none levels, the detail of the logging can be set.
color: on # - Colorizing the log output.
on_runtime: # - These settings can be applied during the service running.
allowed_ip: 0.0.0.0 # - We can set the IP, from where the service can be reached.
# - 0.0.0.0 -> means: any IP will be accepted.
# - 10.1.1.34,10.3.4.5 -> means: multiple IP can be accepted.
interval_seconds: 1 # - How many seconds are we want to query the API?
api: # - API service related stuff.
url: "http://127.0.0.1" # - URL of the API.
port: 7070 # - Port of the API.
commands: # - Commands for the device management.
systemctl: # - Start, Stop, Restart, Enable, Disable a service
- dash #
- -c #
- systemctl {action} {service} #
init: # - Restart or shutdown.
- dash #
- -c #
- init {number} #
You can switch between light and dark modes by clicking the header or the footer.
Both the skin and the logo of the web service can be modified in the web interface, under the Settings section.
- cachyos
- candy
- centos
- cyber
- debian
- fedora
- forest
- github_blue
- github_green
- github_purple
- github_red
- github_yellow
- ice
- lava
- linuxmint
- manjaro
- matrix
- midnight
- mint
- ocean
- opi
- proxmox
- redhat
- retro
- royal
- rpi
- steel
- sunset
- suse
- synthwave
- tokyo
- ubuntu
- vanilla
You can find the available skins under web/css directory. The logos can be found under the web/img directory.
- Each
CSSfile is a skin. - Each
PNGis a favicon. - Each
SVGfile is a logo.
| Dark | |
| Desktop | Mobile |
![]() |
![]() |
| Light | |
| Desktop | Mobile |
![]() |
![]() |
If the service crashes, panics delete the .cache/go-build folder:
sudo rm -rf $HOME/.cache/go-build














































































