Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Script to show OpenVZ container process informtion
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Script to show OpenVZ container process informtion

MicrolinuxMicrolinux Member
edited May 2014 in Tutorials

Here is a little Python script to show OpenVZ container process info from the hardware node.

I only have a minimal dev system to test on. If any values look wrong, let me know.

Must be run as root, requires iotop.

https://dl.dropboxusercontent.com/u/19515814/vzpsi

vzpsi [-s sort_field (pid)] [-n show_top_n (all)] [-q] [ctid]

-s is one of ctid, name, pid, ppid, cpu, mem, io_rd, io_wr
-n is an integer
-q suppresses output header

If no ctid is specified, all processes are shown.

sudo ./vzpsi -s mem -n 5 101

ctid  name            pid      ppid      cpu     mem (rss)   io_rd      io_wr
----  --------------  -------  --------  ------  ----------  ---------  ---------
101   httpd           12691    12155     0.0 %   3.6 MB      0 KB/s     0 KB/s
101   httpd           13371    12691     0.0 %   3.0 MB      0 KB/s     0 KB/s
101   httpd           12694    12691     0.0 %   2.9 MB      0 KB/s     0 KB/s
101   sendmail        12675    12155     0.0 %   2.3 MB      0 KB/s     0 KB/s
101   sendmail        12683    12155     0.0 %   2.0 MB      0 KB/s     0 KB/s
Thanked by 1serverian

Comments

  • MicrolinuxMicrolinux Member
    edited May 2014

    I updated this to fix I/O speeds and add IOPs.

    Some internal changes as well. Removed external dependencies, cleaned things up.

  • zionvpszionvps Member

    nice work. will try out in one of our nodes

  • MicrolinuxMicrolinux Member
    edited May 2014

    Cool, let me know if you see anything funky`

  • Very good. But I'm a bit sceptic about /proc/%s/io I'm not sure if it's the correct values.

  • MicrolinuxMicrolinux Member
    edited May 2014

    @serverian said:
    Very good. But I'm a bit sceptic about /proc/%s/io I'm not sure if it's the correct values.

    I'm fairly certain it is, it has checked out against tests I have run (i.e. ioping) -- but it's certainly possible there are situations where it may not be. If you happen to notice anything that seems overtly wrong, please let me know.

Sign In or Register to comment.