interesting!!!
OK lets do some script logging. For some reason we either are not getting a successful status or SQL is not updating as expected in script.
Just to give you a bit of scripting logic we are using:
Name of script :P4A ESXi Health Monitor Service
Lines 1 - 29 deal with testing for and installing python3 and any supporting scripts and extensions to probing agent.
Line 30 and 31 test for Python script and make sure its readable as a script.
Line 33 we query for all ESX hosts that are assigned to Probing agent.
Line 34 we start to loop through the query of ESX hosts.
We use several line to validate the ESX data we have before executing the first of to probes against a single ESX host.
** On Line 47 we execute the first probe command which is not in Verbose mode so we should get just a simple return.
Code: Select all
C:\Python3\Python.exe -W ignore C:\Python3\check_esxi_hardware.py -H @ESXHOSTIP@ -U @ESXUsername@ -P "@ESXPassword@" -V @ESXVender@
This is the command that is returning what your seeing in the last post.
Line 48 we log this output to the agents script log (PROBE -> [ @PROBEDATA@ ])
Good point to verify that data is accurate in script log as SQL insert is the next step.
Line 49 we create a Script variable that hold the SQL Query value
Code: Select all
UPDATE plugin_p4l_vmware_healthmon_hosts SET LastScan = NOW(), Status = '@PROBEDATA@' WHERE ESXHost = '@ESXHOSTIP@' and ProbeID = %computerid%
Line 50 we execute the SQL query which at this point should be updating this views top status portion (above CIM data)
Line 51 we execute the same command again but with Verbose turned on which spits out all our CIM data, we then save that to SQL on line 54.
Code: Select all
C:\Python3\Python.exe -W ignore C:\Python3\check_esxi_hardware.py -v -H @ESXHOSTIP@ -U @ESXUsername@ -P "@ESXPassword@" -V @ESXVender@
Line 54
Code: Select all
INSERT IGNORE INTO `plugin_p4l_vmware_healthmon_cimdata` (`ClientID`,`LocationID`,`ProbeID`,`ESXHost`,`CIM_Item`,`CIM_Value`) VALUES @CIMSQLDATA@ ON DUPLICATE KEY UPDATE CIM_Value=VALUES(CIM_Value)
So first things to test is, Did we get correct data printed to agents script log for line 48? That will show us what it will be trying to input into SQL.
Then did SQL take that data or did it fail on line 50?
if you add a new script line before 50 that prints out to script log (like line 48)
Code: Select all
Here is SQL query -> [ @SCANSQL@ ]
This will print out the actual SQL query with all data included in query. Copy and paste that query into your SQL. Does SQL fail and if so with what return?