How to monitor Real Time System Statistics using Web-Vmstat
Real Time System Statistics Monitoring By Using Web-Vmstat
Web-VMstat is a very simple web application program that provides a real time system information usage from CPU to RAM, Swap and input/output information in HTML format. Web vmstat application is written in Java and HTML.
To Download the web-vmstat package
Download the web-vmstat package by using the following command.
[root@linuxhelp Desktop]# wget https://github.com/joewalnes/web-vmstats/archive/master.zip
--2016-05-04 22:07:54-- https://github.com/joewalnes/web-vmstats/archive/master.zip
Resolving github.com... 192.30.252.130
Connecting to github.com|192.30.252.130|:443... connected.
HTTP request sent, awaiting response... 302 Found
.
.
.
Saving to: “ master.zip”
[ < => ] 135,179 71.7K/s in 1.8s
2016-05-04 22:07:59 (71.7 KB/s) - “ master.zip” saved [135179]
Now Extract the Downloaded package by using the unzip command.
[root@linuxhelp Desktop]# unzip master.zip Archive: master.zip a9646c6f6837f02404251fed067160e4ac504a2a creating: web-vmstats-master/ extracting: web-vmstats-master/.gitignore . . . inflating: web-vmstats-master/web/js/sugar-1.4.1.min.js inflating: web-vmstats-master/web/stats.css inflating: web-vmstats-master/web/stats.js [root@linuxhelp Desktop]# cd web-vmstats-master/ [root@linuxhelp web-vmstats-master]# ls LICENSE README.md run screenshot.png web
To Create the directory in /opt location
Create the directory in /opt location and move the web directory into that directory.
[root@linuxhelp web-vmstats-master]# mkdir /opt/web-stat [root@linuxhelp web-vmstats-master]# cp -r web/* /opt/web-stat/
To Download and install the websocketd streaming program
Execute the following command to download and install the websocketd streaming program.
[root@linuxhelp ~]# wget https://github.com/joewalnes/websocketd/releases/download/v0.2.9/websocketd-0.2.9-linux_amd64.zip
--2016-05-04 22:17:15-- https://github.com/joewalnes/websocketd/releases/download/v0.2.9/websocketd-0.2.9-linux_amd64.zip
Resolving github.com... 192.30.252.121
.
.
.
Length: 2211144 (2.1M) [application/octet-stream]
Saving to: “ websocketd-0.2.9-linux_amd64.zip”
100%[=================================================> ] 2,211,144 279K/s in 21s
2016-05-04 22:17:40 (102 KB/s) - “ websocketd-0.2.9-linux_amd64.zip” saved [2211144/2211144]
Now Extract the downloaded package by using unzip command.
[root@linuxhelp ~]# unzip websocketd-0.2.9-linux_amd64.zip
Archive: websocketd-0.2.9-linux_amd64.zip
extracting: .built
inflating: websocketd
inflating: INSTALL
inflating: README.md
inflating: LICENSE
Now copy the websocketd file into following location.
[root@linuxhelp ~]# cp -r websocketd /usr/local/bin/
Now run the websocketd program by using the following command
[root@linuxhelp ~]# websocketd --port=8080 --staticdir=/opt/web-stat/ /usr/bin/vmstat -n 1
Wed, 04 May 2016 22:31:03 +0530 | INFO | server | | Serving using application : /usr/bin/vmstat -n 1
Wed, 04 May 2016 22:31:03 +0530 | INFO | server | | Serving static content from : /opt/web-stat/
Wed, 04 May 2016 22:31:03 +0530 | INFO | server | | Starting WebSocket server : ws://:8080/
Wed, 04 May 2016 22:31:03 +0530 | INFO | server | | Serving CGI or static files : http://:8080/
--port To connect HTTP protocol
--staticdir path for all Web-Vmstat web files are hosted.
/usr/bin/vmstat -n Linux Vmstat command which updates its status every second.
Manage WebSocket process as a system daemon create a init service file on /etc/init.d/ path with the following content
[root@linuxhelp ~]# vim /etc/init.d/web-stat
To Give the execute permission
[root@linuxhelp ~]# chmod +x /etc/init.d/web-stat
Now run the websocket process by executing below command.
[root@linuxhelp ~]# /etc/init.d/web-stat start
Starting webvmstats process...
Wed, 04 May 2016 22:48:02 +0530 | INFO | server | | Serving using application : /usr/bin/vmstat -n 1
Wed, 04 May 2016 22:48:02 +0530 | INFO | server | | Serving static content from : /opt/web-stat/
Wed, 04 May 2016 22:48:02 +0530 | INFO | server | | Starting WebSocket server : ws://:8080/
Wed, 04 May 2016 22:48:02 +0530 | INFO | server | | Serving CGI or static files : http://:8080/
Wed, 04 May 2016 22:48:02 +0530 | FATAL | server | | Can' t start server: listen tcp :8080: bind: address
Now assign port 8080 to access the web-stat and also add this to firewall configuration.
[root@linuxhelp ~]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
Now restart the iptables service and web-stat service
[root@linuxhelp ~]# service
iptables restart iptables: Setting chains to policy ACCEPT: filter mangle na[ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@linuxhelp ~]# service web-stat restart
Finally open the browser use the following URL to display web-Vmstat system statistics.
http://your-server-ip:8080


Comments ( 1 )