Hello,
I'm trying to build an adapter that would update the AWS instance state based on data coming from CMDB rather than using AWS connector.
UPDATE
CloudServiceInstance_MT set VMEnabledStateID=
SELECT CASE
WHEN imported.[state] IN('Terminated','Cancelled') then 5
WHEN imported.[state] IN('On','Stopping','Pausing','Terminating') then 1
WHEN imported.[state] = 'Off' THEN 2
WHEN imported.[state] = 'Paused' THEN 3
END
FROM XXXXXXXX imported
WHERE CloudServiceInstance_MT.InstanceCloudID=imported.object_id
I'm using the above custom query to update the records and it works but after reconciliation all the instances change their Last known state in Cloud Service Provider Inventory view back to either 'unknown' or 'started'.
Any ideas why? Should I use some SP maybe? Any thoughts are welcome.
Best,
Paweł
Feb 20, 2024 05:19 AM
If the behaviour you described is typical of the Reconciliation process and cannot be changed, could you run your business adapter after Reconciliation ends to reset the values to those that you prefer? Having said this, though, I wonder what would happen if someone requested a manual Reconcile, both with and without inventory updates.
About your UPDATE statement, what happens if the value of "imported.[state]" isn't one of the values in your SELECT CASE statement?
--Mark
Feb 20, 2024 08:49 AM
Hey @mfeinman,
About your UPDATE statement, what happens if the value of "imported.[state]" isn't one of the values in your SELECT CASE statement?
Thanks for pointing this out, you are right. It replaced the existing value with null. I have modified the UPDATE query by adding
ELSE VMEnabledStateID
to the CASE statement. Now it just leaves it as is if the imported.[state] value does not match the pattern.
If the behaviour you described is typical of the Reconciliation process and cannot be changed, could you run your business adapter after Reconciliation ends to reset the values to those that you prefer? Having said this, though, I wonder what would happen if someone requested a manual Reconcile, both with and without inventory updates.
I'd say it's typical to Inventory update. Manual running Reconciliation without Inventory update does not reset the states.
Running the adapter after overnight inventory import and reconciliation would be obvious choice but then I would have to manually start reconciliation (only) job again. The goal, after all, is to exclude the terminated instances from license calculations, so they don't consume entitlements. Unless I got it wrong, this is what the instance state property is collected and used for, right?
Paweł
Feb 21, 2024 07:11 AM
Hi,
two things to mention here as you're not relaying on the flexera solution.
1.) You're receiving data from an external CMDB. I assume, this CMDB needs to have an adapter/conntector to talk to your Cloud, too.
2.) I've seen an translation error of the Status to be displayed correctly when an AWS System is build up freshly - in most cases the status within AWS is "pending" or "Stopping" - before a translatable status can be determined by any 3rd party connector. And in FNMS (with an active connector/integrated solution) I've seen those Systems are marked as "unknown". Also keep in Mind, that you can build-up Systems in a Cloud very fastly and shut them down after a Pipeline-Run from your DevOps-Team. But those Systems are treeted in a diffrent way, and they might never be visible from a connector. Regardless what you do to discover it.
3.) As you're using a 3rd Party-tool I would speak to them, to discover the actual state.
Feb 21, 2024 09:31 AM