Icinga / icingaweb2-module-vspheredb

The easiest way to monitor a VMware vSphere environment.
https://icinga.com/docs/vsphere/latest
GNU General Public License v2.0
100 stars 34 forks source link

Integrity constraint violation: 1048 Column 'effective_cpu_mhz' cannot be null during Compute Resources task #467

Closed gianlucapiccolo closed 1 year ago

gianlucapiccolo commented 1 year ago

Expected Behavior

The task Compute Resources should never fail.

Current Behavior

In the logs of the daemon I've found this:

 [db] Task Compute Resources failed. Storing compute_resource[c6cc8cc2-f875-5b73-9d4e-169c05a928d7] failed: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'effective_cpu_mhz' cannot be null, query was: INSERT INTO compute_resource (uuid, vcenter_uuid, effective_cpu_mhz, effective_memory_size_mb, cpu_cores, cpu_threads, effective_hosts, hosts, total_cpu_mhz, total_memory_size_mb) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) {array (
  'uuid' => '̌u[sN(',
  'vcenter_uuid' => '1/ɵ)CȜܶBm',
  'effective_cpu_mhz' => NULL,
  'effective_memory_size_mb' => NULL,
  'cpu_cores' => NULL,
  'cpu_threads' => NULL,
  'effective_hosts' => NULL,
  'hosts' => NULL,
  'total_cpu_mhz' => NULL,
  'total_memory_size_mb' => NULL,
)}: /usr/share/icingaweb2/modules/vspheredb/library/Vspheredb/Db/DbObject.php (828)

Steps to Reproduce

I don't have a way to reproduce it but I have some context:

  1. We have 2 vcenters configured
  2. One works fine (we connect to it with a user with read only permission on everything)
  3. The other one gives this error (we connect to it with LIMITED read only user)

Your Environment

Thomas-Gelf commented 1 year ago

Hi @gianlucapiccolo,

a Compute Resource with no CPU and no Memory (null, not zero) is suspicious. The "LIMITED user" might be a hint to the problem here. Please run...

mysql --binary-as-hex vspheredb -e "SELECT * from object where uuid = UNHEX('c6cc8cc2f8755b73-9d4e169c05a928d7')\G"

...and then check in your vCenter, whether your user is able to see this ComputeResource.

Thanks, Thomas

Thomas-Gelf commented 1 year ago

Confirmed: root cause here is a restricted User, which sees those Cluster Compute Resources, but isn't allowed to read their properties.