dpiquet / pve-monitor

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

Illegal division by zero at /usr/lib/nagios/plugins/pve-monitor.pl line 670. #2

Closed clancyian closed 11 years ago

clancyian commented 11 years ago

Hi, I'm recieving the following error when monitoring a qemu guest with a raw disk. This is because a zero value is returned for $item->{maxdisk} . As a workaround to allow the script to run i've replace line

$mqemu->{curdisk} = sprintf("%.2f", $item->{disk} / $item->{maxdisk} * 100);

with

$mqemu->{curdisk} = "1";

Rgds Ian

dpiquet commented 11 years ago

Hi,

I could not reproduce this issue. What version of pve are you using ? I am using the lastest (3.0) PVE. Anyway, i have to add a test to be sure i'm not dividing by 0.

Here is my result for a qemu vm with a raw disk:

  "cpu" : 0.00398241644658661,
  "disk" : 0,
  "diskread" : 14336,
  "diskwrite" : 0,
  "id" : "qemu/107",
  "maxcpu" : 1,
  "maxdisk" : 34359738368,
  "maxmem" : 536870912,
  "mem" : 5705697,
  "name" : "qemu-raw",
  "netin" : 30736,
  "netout" : 36372,
  "node" : "pyrit",
  "status" : "running",
  "template" : 0,
  "type" : "qemu",
  "uptime" : 1852,
  "vmid" : 107

Thanks for your help.

Damien

clancyian commented 11 years ago

Hi Damien, I was running 3.0.20 but just upgraded to 3.0.23. Results is the same . I will investigate further . Either way, i always get value 0 for "disk" so dividing disk by maxdisk does not give me a sensible output :) Rgds Ian

dpiquet commented 11 years ago

I am using the exact same version. what about the rights ? Did you gave at least PVEAuditor role on "/" to your monitor user and checked recursive ?

Do you have the same value when using pvesh on a node with user root ?