5 Replies Latest reply on Jun 17, 2019 8:50 AM by Brian Morris

    sync virtual machine details

    Maurizio Zaccaria
      Share:|

      Hi all

      I need to sync into cmdb some details about the virtual machine. For example the "instance_id"

      but I have some issue to do this.

      I've tried with a cust tpl but I'm not able to get this value. Here a piece of my tpl.

      Any suggestion?

       

      from CMDB.SoftwareInstance_VirtualSystemEnabler import VirtualMachine_VirtualSystemEnabler 1.0;

      from CMDB.Host_ComputerSystem import Host_ComputerSystem 2.0;

      from CMDB.MFPart_ComputerSystem import MFPart_ComputerSystem 2.0;

      from CMDB.CloudService_CloudInstance import CloudService_CloudInstance 1.0;

       

      mapping from VirtualMachine_VirtualSystemEnabler.vm_node as vm_node

          end mapping;

          body

              vse := VirtualMachine_VirtualSystemEnabler.vse;

              vse.ComponentAlias := vm_node.instance_id;

       

      log.info('Value of istance  <<<<<<%instance_id%>>>>>');

       

      thanks

      Maurizio

        • 2. Re: sync virtual machine details
          Lisa Keeler

          I don’t have a system to look at, but is instance_id really an attribute on a VirtualMachine node in Discovery??

          It sounds so much like something in the CMDB.

           

          If so, fine.

           

          One problem is your debug log message.

           

          The variable called instance_id has not been set to anything.  Maybe you want vm_node.instance_id?

           

          Sent from my iPhone

          1 of 1 people found this helpful
          • 3. Re: sync virtual machine details
            Brian Morris

            Instance_id does exist, but seems to be only for VM's that are discovered from a cloud provider, based on my demo appliance data anyway. I don't see it assigned for any other objects.

            cloud.PNG

             

            So, I think this code snippet could work for you, but why are you assigning this new value to ComponentAlias? I would recommend creating a new overlay field on your BMC_VirtualSystemEnabler form to hold this value. (I'll call it VMInstanceID in the code below). ComponentAlias is used for Service Impact modeling and TrueSight I believe.

             

             

            from CMDB.SoftwareInstance_VirtualSystemEnabler import VirtualMachine_VirtualSystemEnabler 1.2;

             

            ....

             

            mapping from VirtualMachine_VirtualSystemEnabler.vm_node as vm_node

                end mapping;

              

                body

              

                vm_vse := VirtualMachine_VirtualSystemEnabler.vse;

              

                if (vm_vse = void) or (not vm_vse) then

                         stop;

                         //No vm or mapping failed

                end if;

             

                if vm_node then

                     // Sync the new values

                  

                    if vm_node.instance_id then

                    vm_vse.VMInstanceID := vm_node.instance_id;

                    end if;

             

            ...

            1 of 1 people found this helpful
            • 4. Re: sync virtual machine details
              Maurizio Zaccaria

              Hi all and thanks for your answer ;-)

               

              infact our team want populate the ComponentAlias attribute to use it with Service Impact modeling and TrueSight.

              I'll try the code, but looking at the screen you sent I suppose that this solution can be applied only for the AWS VirtualMachine, because I see on the screen that the instance_id for the Azure VM is not unique ....... maybe we need to looking for another unique attribute to sync

               

              thanks

              Maurizio

              • 5. Re: sync virtual machine details
                Brian Morris

                Ah ok I see. ComponentAlias as far as SIM is concerned can be just Hostname or BMC_ComputerSystem:Hostname:Domain maybe. These vm objects are BMC_VirtualSystemEnabler though. Also, if you're publishing them from Atrium, the publishing server should construct a valid ComponentAlias for you.