Today's applications are made on web-based form. This can be understand that web applications are easy to see on every devices. Since the trend of smartphones and tablets, the use of web based applications are increasing rapidly.
On Linux system, we have vmstat tool to monitor Linux system resources such as CPU, Memory, I/O and swap. Vmstat is run on Command Line Interface (CLI) mode. Now we can use vmstat on web mode application.
What is Web-vmstat
Basically, web-vmstat is a web interface of vmstat tool. It will convert vmstat output into a nice graphical display.
With vmstat, you will have an output something like this.
With web-vmstats, it will transform into a graph that we will see it later in this article.
The only features of web-vmstats is it's used to convert vmstat output on console mode into a graphical display. With graphical display, it will make system administrator more "aware" about the usage of server resources, because it's more eye-catching than seeing numbers on the console :-)
Web-vmstat is a tiny application as said on it’s website. Web-vmstat is using websocketd to be working. So the first step, we will need to download websocketd.
- Point your browser to Websocketd Download and Install link
- Download the appropriate websocketd for your system
- Extract it into the folder of your choice
- Add the location of websocketd to your PATH variable
On this article, I put websocketd into my home directory.
But then to fulfill the step number 4, I prefer to copy websocketd file into /usr/bin folder than to add more PATH variable. So then I can call websocketd file from anywhere.
The second step is download web-vmstat package
- Point your browser to https://github.com/joewalnes/web-vmstats . You will see the Download button on the right side.
- Extract web-vmstats-master.zip into location of your choice. On this article, I put it in /home/pungki/web-vmstats folder
- Done !
How to Run web-vmstats
Now we need to run websocketd first before access the web-vmstats. We already put websocketd inside /usr/bin folder. Now we can open the console and type command like this :
$ websocketd --port=9321 --staticdir=/home/pungki/web-vmstats/ /usr/bin/vmstats -n 1
The above command can be explained as below:
- Websocketd = the application
- --port = the port websocketd will be running
- --staticdir = location of web-vmstats application
- /usr/bin/vmstats = location of vmstats application which its output will be used
- -n 1 = refresh time interval for vmstats application (in seconds)
Once it done, we can test it using our browser. Open your browser and point it to http://IP_Address:9321/web
Here’s a full graph of web-vmstats
How to Read the information
We can see on every graphs, they have some parameters below it. Here’s how we can read those information.
Processes have r column and b column.
- r columns means the total number of processes that waiting access fot the processor
- b column means the total no processes in a sleep state
Memory have swpd, free, buff and cache columns.
- The swpd column show you about how much memory has been swapped to a swap file or disk
- The free column show you the unallocated memory available
- The buff column means how much in use memory
- The cache column show you about how much memory that can be swapped into swap file or disk if there are some application is needed by them
Swap show us how much memory is sent or retrieved from the swap system.
- si column tell us how much memory is moved from swap to real memory per second
- so column tell us how much memory that is moved from real memory to swap
- io show us the amount of input and output activity per second in terms of blocks read and blocks written
- bi column tell us about the number of blocks received and the bo tell us about the number of blocks sent
System show us the number of system operations per second.
- The in column tell us about the number system interrupts per second
- The cs column tell us the number of context switches that the system makes in order to process all tasks
CPU show us the use of CPU’s resources.
- us column tell us how much time that processor spends on non-kernel processes
- sy column tell us about how much time that processor spends on kernel related tasks
- id column tell us about how long the processor are idle
- wa column tell us how much time that the processor has been waiting for I/O operations to complete before being able to continue processing tasks
Graphical display is more eye-cathing than numbers on console mode. Web-vmstats can make administrators more “aware” of what happens on the systems. This may not the best monitoring on your Linux system, but it can help to convert a complicated vmstat output into a nice graphical display.