lgeeklee / pyvinga

Python pyVmomi plugin for Icinga
MIT License
14 stars 4 forks source link

Checking datastore usage gives error: float() argument must be a string or a number #10

Open IanRarity opened 7 years ago

IanRarity commented 7 years ago

As described in title. If I try:

./pyvinga.py -s VCENTREHOST -u VCUSER -p VCPASSWD -n datastore -e DATASTORE -r status

I get "OK - Datastore Status is green (Type: VMFS)" - all good.

If I try the other counter, though:

./pyvinga.py -s VCENTREHOST -u VCUSER -p VCPASSWD -n datastore -e DATASTORE -r space

I get "Caught exception : float() argument must be a string or a number"

stdevel commented 6 years ago

Verified, having the same issue in combination with vSphere 6.7 on Debian. EDIT: Turned out, that it is required to manually specify the warning/critical thresholds. Settings from vCenter are not derived - did not find this information in the documentation.

It would be great to have a clear error message about this.

# ./pyvinga.py -s xxx -u icinga2@vsphere.local -p xxx -n datastore -e datastore01 -r space
Caught exception : float() argument must be a string or a number
# ./pyvinga.py -s xxx -u icinga2@vsphere.local -p xxx -n datastore -e datastore01 -r space -w 20 -c 10
CRITICAL - Datastore Used Space is 82.2% (Used 1682.7 GB of 2047.8 GB) | 'Datastore Used Space'=82.2%;20.0;10.0
stdevel commented 6 years ago

This can be fixed easily by setting default thresholds (which is really common for monitoring plugins). I wrote a fix for this (https://github.com/stdevel/pyvinga/commit/8af961364be38982482483bb3c099936577c6b45) - see also pull request 11 (https://github.com/lgeeklee/pyvinga/pull/11).

stdevel commented 6 years ago

Hello @IanRarity, is the new version working for you?