Try adding Glances (Python's command line monitoring tool).

I happened to pick it up on Twitter's TL, so I put it in.

The reason is that the screenshots on pipy were good ^^;

Install

CentOS provides rpm, so you can install it with yum. (Python-glance-2012.2.4-3.el6.noarch)

In my case, I added it to Vagrant's CentOS 6.5. (Easy-install or pip, not yum)

I will start it

Just type the command.

bash


% glances 

screenshot

After a while after starting, the resource status will be drawn in a batch.

glances-capture.png

Help screen. By default, various information is displayed on one screen, but it seems that you can narrow down by option.

glances-help-capture.png

Start in client & server mode

Looking at the docs, it seems that there is some client & server mode. If you check the expression,

--Resource information provider: Server --The side that gets the resource status: Client

It will be. In addition, it is a prerequisite that Glances is installed in both environments.

This time, I tried to use the CentOS side of Vagrant as the server and the MacOS side as the client.

bash


[vagrant@centos-tare ~]$ glances -s #vagrant side/IP 192.168.33.Assigning to 11.
% glances -c @192.168.33.11 #MacOS side

Like this, you can get information from the client side through port: 61209.

glances-server-client-capture.png

It is displayed in green when there is no particular load.

When are you busy working?

If there is any load, it seems to be colored and visualized on the terminal depending on the situation.

I didn't have a good idea to put a load on it, but I decided to put a write load on the OS on the Vagrant side with a disk IO benchmark tool called bonnie ++.

Performance measurement is not the purpose (^^;

When I tried it, the bonnie ++ process buzzed around, the CPU value went up, and it changed to green-> pink-> red.

glances-check.png

There is an API

By the way, in addition to listening in server mode, it seems that it also has an API in XML-RPC. If it is python, it seems that data can be obtained in json format.

The port to listen to is also 61209.

If you take tcpdump while launching the process of the client on the MacOS side, you can see the information like this. (I will pick up the character string with the A option)

bash


% sudo tcpdump -i vboxnet1 -A

#Omission
…
"host": {"linux_distro": "CentOS 6.5", "platform": "64bit", "os_name": "Linux", "hostname": "centos-tare", "os_version": "2.6.32-431.el6.x86_64"}, 

It's simple, but I also had the option to export to CSV or HTML. I thought it would be good to read the source properly and study.

So it's easy, but it was an article about Glances.

Recommended Posts

Try adding Glances (Python's command line monitoring tool).
Command line tool for Chainer ChainerCMD
Introduced "Glances" command, a monitoring tool that can be understood at a glance, on Mac
Try to make a command standby tool with python