dpiquet / pve-monitor

pve-monitor is a tool to monitor hypervisor and virtual machines in a proxmox cluster
37 stars 24 forks source link

Monitoring VMs on nodes #19

Open doque opened 9 years ago

doque commented 9 years ago

Is it possible to include the VMs running on a node in the monitoring? For example: I've created the VM monitoring on farm4. Farm4 is monitored in the PVE cluster, can I find any details about this specific VM?

screen shot 2015-03-05 at 11 48 16

dpiquet commented 9 years ago

Add something like this to pve-monitor's configuration file

qemu monitoring { mem 80 90 cpu 80 95 disk 80 90 }

doque commented 9 years ago

Thank you, this works. Is there any way to do this automatically everytime I add a new VM?

dpiquet commented 9 years ago

You can use pools to group your vms inside PVE. Then monitor this pool using the pool keyword like this

pool Sample { mem 98 100 cpu 90 95 disk 90 95 }

Every vm in the monitored pool will be automatically monitored with the pool's values.

doque commented 9 years ago

I see. Unfortunately, appending this to my pve-monitor.conf yields

Invalid token pool in configuration file /usr/local/nagios/etc/configs/pve-nodes.conf !

I've uploaded my complete conf file here.

/edit: Sorry, it seems I was using an older version, which didn't include --pools yet. I've replaced it with the latest version. But - running the script with --pools yields this output:

root@proxmox-monitoring:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/pve-monitor.pl --pools -- conf /usr/local/nagios/etc/configs/pve-nodes.conf
  Usage: /usr/lib/nagios/plugins/pve-monitor.pl [--nodes] [--storages] [--qemu] [--openvz] [--pools] [--perfdata] [--html] --conf <file>

--nodes
  Check the state of the cluster's members
--storages
  Check the state of the cluster's storages
--qemu
  Check the state of the cluster's Qemu virtual machines
--openvz
  Check the state of the cluster's OpenVZ virtual machines
--pools
  Check the state of the cluster's virtual machines and/or storages in defined pools
--qdisk
  Check the state of the cluster's quorum disk
--singlenode
  Consider there is no cluster, just a single node
--perfdata
  Print nagios performance data for graphs (PNP4Nagios supported check_multi style)
--html
  Replace linebreaks with <br> in output
--debug
  Get more log output

All other parameters seem to work fine

dpiquet commented 9 years ago

I was about to ask you the version you were using. If this is an exact copy/paste, you have a space between -- and conf which should be --conf

doque commented 9 years ago

Sorry, that was messed up formatting. There is no space between those two. Running it with nodes gives the desired result. But just so I understand - can I use pool {} to define the properties for mem, cpu etc? Or can I set it up so that all qemu VMs running on farm4 will automatically be monitored? Right now I'm adding each qemu separately to the .conf file.

dpiquet commented 9 years ago

the pool argument just tells pve-monitor to use pool defined ressources. You have to specify --qemu, --storage or --openvz to get results.

pve-monitor does not to monitor if vms are running on a particular node but only if it is running on the cluster (so no checks for only vms running on farm4 node). Maybe this could be a feature, where a vm should be hosted by a particular node and a warning would be generated if it is not the case.

You can use pools to monitor vms defined in a pve pool with common values (defined in the pool section of your pve-monitor configuration file). This way, you just have to add your new vms in the pool from proxmox interface without having to update your nagios configuraton.

flantel commented 9 years ago

[edit] Sorry - posted into wrong issue!

nexusguy59 commented 6 years ago

Has anyone got this to work successfully on Nagios Core 4.3.4, if So may I get some instructions, I am having a heck of a time trying to get this to work.

Thanks, Michael