A simple dashboard to monitor your server's CPU, Memory and Disk Usage (Auto-refreshed every 15 seconds)
- A python script reads the CPU, Memory, Disk usage on the server and sends it to Pusher API
- You view the results using a simple HTML/js file which pulls the data from Pusher API
- The results are only accessible using your secure Pusher API key
- No need to open up ports, configure security/firewall rules, setup https, encryption etc... on your server
- You can view the results using a simple HTML file on your desktop/laptop/mobile phone.
Sign-up for an account on https://pusher.com/ . Please make a note of your APP_ID, KEY, SECRET, CLUSTER values from the pusher dashboard. Free version allows you to send up to 200K messages a day. This is enough for monitoring 1 server every 15 seconds.
Login to your Ubuntu VPS server
- Install Python3
sudo apt-get install python3
- Install PIP
sudo apt-get install python3-pip
- Install pusher API & psutil
pip3 install pusher
pip3 install psutil
- Download the server-monitor scripts to your server
wget https://raw.githubusercontent.com/mirrormirage0/server-monitor/master/pusher_config.py
wget https://raw.githubusercontent.com/mirrormirage0/server-monitor/master/server_push.py
- Login to your pusher.com account and make a note of the APP_ID, KEY, SECRET, CLUSTER values.
- Edit pusher_config.py and replace the values for my_app_id, my_key, my_secret,my_cluster
nano pusher_config.py
After you have replaced the values, press CTRL-O, CTRL-X to write the file and exit. - Execute the server_push.py script to start reading your CPU/Memory/Disk usage values and publishing to pusher.
python3 server_push.py
You will see the following output Sleeping for 15 second Sending a message
When you see this, You can login to your pusher dashboard and see the messages being received. Each message will have the CPU, Memory and Disk usage percentage.
Download the server_monitor.js and server_monitor.html files to your Desktop/Mobile. Edit server_monitor.js and replace the value for PUSHERKEY and PUSHERCLUSTER. Open server_monitor.html in your browser.
You will find this in the server_push.py
The easiest way to run the server process in the background is as follows
tmux new-session -s server-push
python3 server_push.py
Then press CTRL-b , and then press d
This will detach you from tmux session
To reconnect back to the session, use
tmux attach
Pressing CTRL-c inside the tmux session will kill the process and stop broadcasting the values.