OpenVZ Virtual Machine (VPS) Management

Now, my VPS is up and running. How do I manage my hardware node and VPS? How do I see a list of all running VPSes? How do I see memory usage and other stuff?

ADVERTISEMENTS

This FAQ covers various containers utilities which may be used to solve many problems and tune overall hardware as per your setup.

How Do I List All Running VPSs?

The command vzlist is used for listing containers and their parameters. The -a option list all containers:
# vzlist -a
Outputs:

     CTID      NPROC STATUS  IP_ADDR         HOSTNAME                        
        10         12 running 123.xx.yyy.zz   vps.nixcraft.in

The -o option can display only parameters specified by names, for e.g. just display hostname, disk and memory info:
# vzlist -o ctid,hostname,kmemsize,kmemsize.l,diskspace
See vzlist man page for more information.

How Do I Calculate The Container’s Resources Usage?

The vzcalc utility displays the share of the host system resources a particular container is using. If the container is running, the current usage is displayed. High utilization values (>100%) mean the system is overloaded (or the container has an invalid configuration).
# vzcalc -v 10
Sample Outputs:

Resource     Current(%)  Promised(%)  Max(%)
Low Mem          0.30       5.23       5.23
Total RAM        0.43        n/a        n/a 
Mem + Swap       0.21       2.95        n/a
Alloc. Mem       0.34       3.69       7.13
Num. Proc        0.04        n/a       0.73
--------------------------------------------
Memory           0.43       5.23       7.13

How Do I Shows Information About The CPU Power and Utilization?

Use vzcpucheck command:
# vzcpucheck -v
Outputs:

VEID		CPUUNITS
-------------------------
0		1000
10		1000
Current CPU utilization: 2000
Power of the node: 299281

Further readings:

  1. Read man pages – vzctl, vzcpucheck, vzcalc, and vzlist
  2. The official OpenVZ wiki.
  3. The official CentOS Linux project.

Summary:

In this series, you learned how to work with OpenVZ virtualization under CentOS / RHEL Linux environment. OpenVZ has a completely different approach to virtualization, it almost works like FreeBSD jails or Solaris zones. I highly recommend the official OpenVZ wiki for further details.

This entry is 5 of 5 in the RHEL / CentOS Linux OpenVZ Virtualization Tutorial series. Keep reading the rest of the series:
  1. How To Setup OpenVZ under RHEL / CentOS Linux
  2. CentOS Linux Install OpenVZ Virtualization Software
  3. How To Create OpenVZ Virtual Machines (VPS)
  4. OpenVZ Iptables: Allow Traffic To Pass Via venet0 To All VPS
  5. OpenVZ Virtual Machine (VPS) Management
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Ap.Muthu Aug 8, 2009 @ 4:11

    http://pve.proxmox.com has a nice baremetal installer that installs Debian 5 (Lenny) and has a nice web interface to control the Virtual machines, Server and Cluster.

    The Proxmox VE v1.3 scripts are in the /usr/share/pve-manager/ folder and can be adapted to suit RHEL / CentOS based installs.

  • Scott Dowdle Aug 8, 2009 @ 19:17

    Good tutorial. I did notice one thing to comment on though. The CTID you gave in your example was 10 BUT according to the OpenVZ Users Guide, CTIDs 1-100 are reserved and should not be used. While you probably won’t have any issues using CTIDs between 1-100, it isn’t recommended.

    Thanks for the tutorial! I’ve been using OpenVZ for close to 4 years now and it is fantastic.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.