STEP 10:RUNNING THE MONITORING TOOLS

Under Linux, you have a countless list of more powerful monitoring tools than any other. You are of course free to choose to use all those who will suit you. In this tutorial, we will introduce four tools:

  • htop: overview and manage running process on the VPS

  • nmon: indicate the processor load

  • nload: check the bandwidth used

  • df command: indicate the free space on your disk

HTOP

Move to an unused panel and type:

htop

You will be able to sort all process by pressing a function key. For example, if you press F6 function key, a panel will appear on the left side of the htop panel, and it will allow you to sort the process by memory consumption.

You can also directly see the uptime, cpu load, free memory. But one of the most useful function with htop is to be able to stop/kill a process if needed. You just have to highlight in blue a process and then press the F9 function key. A menu will also appear on the left side and just move to option ‘9 SIGKILL’ and press Enter to kill the selected process.

NMON (CPU LOAD)

Move to an unused panel and type:

nmon

Then type “C” key, and you will be able to see your VPS CPU load.

NLOAD (NETWORK TRAFFIC)

Move to another unused panel and type:

nload

You will then see the network traffic of your VPS:

DF COMMAND (DISK SPACE)

You can also use the “df” command to visualize the disk space used by the SWT database, which will grow with time.

df -h

USEFUL TMUX COMMANDS

1. If you want to list your current sessions:

tmux ls

2. If you want to access to the right session (replace “myname” by your session name):

tmux a -t myname

3. If you want to visit your different sessions:

tmux w

4. If you want to restart programs from the beginning:

sudo reboot

5. If you want to kill a specific session (replace “myname” by your session name):

tmux kill-session -t myname

6. Then, the following line will be enough to access to your current session:

tmux a

7. If you want to open another Tmux window

CTRL-B + C

8. If you want to close a Tmux window

CTRL-B + &

USEFUL APPLICATION

Creating an apport application to get the core dumped file

The apport application automatically reports only managed packaged applications. When application crash, the core dump files are put in /var/crash.

The SWT client app is not a packaged application, so let's configure apport to get the core dump file. It helps SWT team to identify issues when you get some troubles with your node.

1. Create and edit an apport settings file in .config

sudo mkdir ~/.config/apport/
sudo nano ~/config/apport/settings

2. Put this in the settings file

[main]
unpackaged=true

Save changes by CTRL +X, type Y and then press ENTER.

3. Restart apport

sudo service apport restart

4. After a crash, unpack the crash file generated by apport:

cd /var/crash
mkdir /tmp/report
apport unpack _home_swt_swtnode_client.1000.crash /tmp/report

The previous line has to be written in a single line, beginning with “apport-unpack”, then SPACE, then “_home_swt_swtnode_client.1000.crash /tmp/report”

5. Then, type this last line:

ls -l /tmp/report

Then you will have your core dumped file (it can take a while to unpack: ~1 or 2 min).

NB: The pattern of the core dumped file is here. You can modify it if you want, but it's not recommended:

cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport %p %s %c %d %P

Last updated