htop with web interface

ofstudio picture ofstudio · Dec 5, 2013 · Viewed 12k times · Source

Is there any simple and lightweight monitoring tool like well-known htop, but with web interface? For Debian / Repberry Pi. All solutions I've seen was complicated and resource-intensive.

Answer

ofstudio picture ofstudio · Dec 9, 2013

I've found an interesting solution to run htop (and any other interactive console application) in browser — shellinabox

Install shellinabox

[sudo] apt-get install shellinabox

Stop shellinabox daemon

[sudo] service shellinaboxd stop

Disable shellinaboxd autostart (in default configuration shellinaboxd serves http-ssh session on 4200 port)

[sudo] update-rc.d -f shellinaboxd remove

Now start shellinaboxd with own parameters

[sudo] shellinaboxd -t -b -p 8888 --no-beep \
       -s '/htop_app/:nobody:nogroup:/:htop -d 10'

Options:
-t — disable ssl (if necessary, not recommended for public servers)
-b — run in background
-p — web server port number
--no-beep — disable annoying beeps
-s '…commands…' — session configurstion, where
/htop_app/ — URL
nobody:nogroup — user and group for session (nobody:no group chosen for security reasons)
htop -d 10 — command (actually session shell): run htop with -d 10 argument (means update every second)

Now go to browser and navigate to

http://you_server_address:8888/htop_app/

Should look something like this (screenshot)