Author Topic: Monitor qemu-kvm processes  (Read 5451 times)

Anders

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Monitor qemu-kvm processes
« on: January 04, 2013, 03:25:08 pm »
Hi,

I'm facing a problem where I need to monitor the availability of a number of qemu-kvm processes (virtual machines) in Linux.

Normally you can gather statistics by for example defining: Process.CPUTime(qemu-kvm) but what if I have a number of qemu-kvm processes that I'd like to monitor individually? The only way to tell the processes a part is by --name XXXX attribute, which states the virtual machines name and/or id.

I guess the ideal scenario would be to setup the monitoring and DCI collection on a cluster-object and associate all the qemu-kvm hosts underneath it, then the monitoring and the stats would keep collecting even if a virtual machine is migrate to a different host. But my problem is that I can't filter running processes by attributes, or at least, I haven't found out how...

Hopefully someone can give me a hint in which way to go, thanks!

Anders

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 7140
    • View Profile
Re: Monitor qemu-kvm processes
« Reply #1 on: January 04, 2013, 04:58:39 pm »
Hi!

You can specify command line filter in all Process.* parameters. Full syntax of Process.CPUTime (and others Process.*) is following:

Process.CPUTime(process, type, cmdline)

Where

process - process name. If cmdline is not given, only processes with matched name will be counted and read. If cmdline is given, process interpreted as regular expression.
type     - representation type (meaningful when more than one process with the same name exists). Valid values are:
         min - minimal value among all processes named <process>
         max - maximal value among all processes named <process>
         avg - average value for all processes named <process>
         sum - sum of values for all processes named <process>
cmdline  - command line (regular expression to match).

So to match all processes named qemu-kvm with word test in command line, you can use

Process.CPUTime(^qemu-kvm$, sum, test)

Don't forget that both process name and command line are regular expressions when extended format is used, so if you use "qemu-kvm" as process name (without ^ and $), processes contained this in the name (like qemu-kvm2) will also be matched.

Best regards,
Victor

Anders

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Monitor qemu-kvm processes
« Reply #2 on: January 04, 2013, 07:01:41 pm »
Great news, thank you Victor! Does the Process.Count() work in a similar way?

Btw, what is the most up to date source for reference information for all supported attributes for a command such as: Process.Count() or Process.CPUTime() ? I haven't been able to find any related information in the wiki.

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 7140
    • View Profile
Re: Monitor qemu-kvm processes
« Reply #3 on: January 06, 2013, 11:29:32 pm »
For counting processes there are separate parameter Process.CountEx, which has two arguments - process name and command line, both are regular expressions.

Wiki is supposed to be most up-to-date information source, but unfortunately it still missing lot of information, including detailed description of agent parameters. We are updating wiki, but it's a slow process.

Best regards,
Victor

mrugani

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Monitor qemu-kvm processes
« Reply #4 on: March 20, 2013, 12:29:58 pm »
Hi, I am also working on qemu.
I want to get all active qemu processes running on host.
I tried using 'top | grep qemu' , i got all qemu processes.
But when I migrate a VM from hostA to hostB , I can still find its entry on hostA.
Did you come across this? Please help.

Anders

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Monitor qemu-kvm processes
« Reply #5 on: March 26, 2013, 09:14:06 am »
Hi mrugani,

This sounds more of an Qemu related question than NetXMS related, but I'll give it a try.

Are you using some sort of management wrapper such as: libvirt (virsh) or similar to manage your virtual machines? or are you using the native Qemu-monitor to migrate your virtual machines?