13 Replies Latest reply on Nov 22, 2019 1:09 AM by Vishnu Parihar

    AWS Custom Tag

    Vishnu Parihar
      Share This:

      I am trying to sync the AWS tags in CMDB in BMC_Tag class and I also go through with document - Sync TAGS data using older versions of Remedy and RemedyForce this helped me a lot but this is creating saperate CI in CMDB for every tag. in my scenario, we want to create only one CI in CMDB and will have multiple custom attributes in CMDB. Not sure how to do that:


      Discovery Tags:

      What I tried:


      ApplicationName := tag_set["Application"],

      BMC_BusinessUnit := tag_set["BMC_BusinessUnit"],



      I am getting below error while syncing:


      Mapping error in extension 'CMDB.Tags.Tags': CMDB.Tags.Tags:100: Missing key 'Application'
        • 1. Re: AWS Custom Tag
          Brice-Emmanuel Loiseaux

          You do not provide a lot of information about what you did for someone to help. The error complains that Application is not a tag that you defined. Looking at your screenshot and the syncmapping fragment, the error seems expected because your tag is actually named BMC_Application.

          • 2. Re: AWS Custom Tag
            Lisa Keeler

            It says there is a missing key.  Did you remove the "key" attribute from the sample pattern?  (That may cause the error).


            If you change the way it is done, then you will never be able to use the OOTB mechanism, even after you upgrade your Remedy system.

            This seems less than ideal.


            And, I can't imagine a way to have an attribute name on the BMC_Tags class for every tag that could ever be.

            Can't people make up new Tag names at any time?


            BMC_Application is the name of a class in the CMDB.  I hope it is not also a tag name.  I'm not sure the CMDB would allow an attribute named "BMC_Application"


            What does your BMC_Tag class look like?  Did you add already add a set of new attributes to it?

            And, you would need to send your entire pattern.

            1 of 1 people found this helpful
            • 3. Re: AWS Custom Tag
              Vishnu Parihar



              Below is the pattern.


              We are trying to maintain a some standard tags. Those tag name will start from BMC_xxxxxx, only these tags we need to sync.

              BMC_Application is name of tag present in AWS Tags that will sync in CMDB in "Application" attribute.


              Yes..we have already added custom attributes in CMDB like ApplicationName, ITSupportedBy and etc.



              tpl 1.12 module CMDB.Tags_AWS;  //OVERRIDE_CHANGE ... module needs a new name



                  origin    := "Custom";                                //OVERRIDE_CHANGE

                   tree_path := "Custom", "CMDB Synchronization", "VirtualMachine->PublicCloudAPITags"; //OVERRIDE_CHANGE

              end metadata;



                        from CMDB.SoftwareInstance_VirtualSystemEnabler import VirtualMachine_VirtualSystemEnabler 1.3;

                        from CMDB.AdminCollection_AdminDomain           import AdminCollection_AdminDomain 1.1;

                        from CMDB.Deployment_ConcreteCollection         import Deployment_ConcreteCollection 1.2;

                        from CMDB.Database                              import Database 2.3;

                        from CMDB.Database                              import CloudDatabase 1.1;

                        from CMDB.SoftwareInstance_SoftwareServer       import SoftwareInstance_SoftwareServer 4.2;

                        from CMDB.SoftwareInstance_ApplicationSystem    import SoftwareInstance_ApplicationSystem 1.2;

                        from CMDB.SoftwareCluster_Cluster               import SoftwareCluster_Cluster 1.2;

                        from CMDB.CloudLoadBalancing                    import CloudLoadBalancing 1.2;

                        from CMDB.CloudCluster                          import CloudCluster 1.0;

                        from CMDB.Tags import Tags 1.0;                //OVERRIDE_CHANGE, must import the TPL you are overriding


              syncmapping Tags_PublicCloud 1.0  



                      tags CMDB, Core_Mapping, Override;  //OVERRIDE_CHANGE_AWS

                      datamodel 0, 1, 2, 3, 4, 5, 6;

                      overrides Tags;   //OVERRIDE_CHANGE, this statement makes it official

                  end overview;



                  mapping from VirtualMachine_VirtualSystemEnabler.vm_node         where tag_set defined

                          from AdminCollection_AdminDomain.admin_node              where tag_set defined

                          from Deployment_ConcreteCollection.deployment_node       where tag_set defined

                          from SoftwareInstance_SoftwareServer.softwareinstance    where tag_set defined

                          from SoftwareInstance_ApplicationSystem.softwareinstance where tag_set defined

                          from SoftwareCluster_Cluster.softwarecluster             where tag_set defined

                          from Database.database_node                              where tag_set defined

                          from CloudDatabase.database_node                         where tag_set defined

                          from CloudLoadBalancing.lb_service                       where tag_set defined

                          from CloudCluster.cluster                                where tag_set defined

                          as node



                      tag_ci -> BMC_Tag;



                  end mapping;




                      ci := CloudCluster.cluster_ci                              or

                            CloudLoadBalancing.service_ci                        or

                            CloudDatabase.database_ci                            or

                            Database.database_ci                                 or

                            SoftwareCluster_Cluster.cluster_ci                   or

                            SoftwareInstance_ApplicationSystem.applicationsystem or

                            SoftwareInstance_SoftwareServer.softwareserver       or

                            Deployment_ConcreteCollection.deployment_ci          or

                            AdminCollection_AdminDomain.admin_ci                 or



                             log.debug("OVERRIDE Tags TPL");               //OVERRIDE_CHANGE, new log message



                      tag_set := node.tag_set;


                      for tag_name in tag_set do

                          tag_value := tag_set[tag_name];


              //OVERRIDE_CHANGE ...with additional logic

                          revised_key := "%node.key%/%tag_name%";


                             tag_ci  := sync.shared.BMC_Tag(

                             key                        := revised_key,   

                             Name                     := ci.Name,

                             ShortDescription    := ci.Type,

                             Description             := ci.Description,

                             ApplicationName    := tag_set["BMC_Application"],

                             Department            := tag_set["BMC_BusinessUnit"],

                             ITSupportedBy       := tag_set["BMC_SupportedBy"],

                              Company               := ci.Company,

                              Category                := "Miscellaneous",

                              Type                       := "Metadata",

                              Item                        := "Tag"




                              Source      := ci,

                              Destination := tag_ci,

                              Name        := "AWSITEMWITHTAG");



                      end for;


                  end body;


              end syncmapping;

              • 4. Re: AWS Custom Tag
                Brice-Emmanuel Loiseaux

                Did you say that you want to create one BMC_Tag that includes many custom attributes for each of your tags?


                This syncmapping is still trying to create a BMC_Tag per tag...


                Stop iterating on tag_name and set a BMC_Tag key that is just the node_key in order to infer only one BMC_Tag.

                • 5. Re: AWS Custom Tag
                  Vishnu Parihar

                  Thanks for your swift reply Brice.

                  Now what I understands is we just need to write a pattern like

                                 key     :=     node.key,

                  and remaining all will be same ?

                  • 6. Re: AWS Custom Tag
                    Lisa Keeler

                    Brice also said to stop iterating over all the tags (using a "for" loop).


                    In other words, remove these 2 lines from the pattern to remove the "for" loop:

                            for tag_name in tag_set do 

                            end for;


                    And, you can remove these 2 lines:

                    //OVERRIDE_CHANGE ...with additional logic

                                revised_key := "%node.key%/%tag_name%";


                    And, as you said:  change this line:

                    OLD:               key                        := revised_key,  

                    NEW:              key                        := node.key,

                    1 of 1 people found this helpful
                    • 7. Re: AWS Custom Tag
                      Vishnu Parihar



                      I have modified the pattern now I am getting error like below if any of BMC_XXXXX attribute is not present on the vm:



                      could you please assist....how we can can fix it if any of the attribute is not present on the vm ?

                      • 8. Re: AWS Custom Tag
                        Lisa Keeler

                        I don't know what you mean "not present on the VM".


                        The error says missing key for BMC_Owner at line 112.


                        I don't see BMC_Owner in your pattern, so I don't know what to make of it.


                        Is the pattern the same as what you sent previously?  Which line is 112?


                        Send new pattern, and point out which line is 112.


                        You can attach a file using the "advanced editor", FYI.

                        • 9. Re: AWS Custom Tag
                          Vishnu Parihar

                          Hi Lisa,


                          Please check the attached pattern.

                          1. Tags present on VM, I am able to sync successfully if not, getting above error. I want that if tag is not available we should not get any error while syncing.

                          2. I am able to sync public ip and private ip(line - 103 & 104), but I am not sure why node.image_id(line 106) is not getting sync in CMDB.


                          Please assist.

                          • 10. Re: AWS Custom Tag
                            Brice-Emmanuel Loiseaux

                            If tag_set["BMC_Owner"] results in "missing key 'BMC_Owner"" error, this means the tag is NOT present on the VM node, unlike you stated it.


                            If you are unsure that all your tags are present on the node you sync, you would need to test their presence before accessing them. I would use variables that are set to "" by default and set to the tag value if tag name exists in the tag set. The method below is maybe not the best but this illustrates my point.


                            owner := "";

                            application := "";


                            for tag_name in tag_set do

                              if (tag_name = "BMC_Owner")

                                owner := tag_set[tag_name];


                              else if (tag_name = "BMC_Application")

                                application := tag_set[tag_name];


                              else if ...

                              end if;

                            end for;


                            tag_ci := sync.shared.BMC_Tag(

                                key := node.key,

                                Name := ci.Name,


                                OwnerName := owner,

                                PB_ApplicationName := application,


                            • 11. Re: AWS Custom Tag
                              Vishnu Parihar

                              Hi Brice,


                              I have added enhanced the pattern like above, this time data is not getting sync in CMDB. I mean this patern created another CI in CMDB and old one marked as deleted = Yes and whatever has created by this pattern doesn't sync any details.


                              in the earlier pattern we were able to sync some data. Please


                              owner := "";

                              application := "";

                              supportedby := "";

                              environment := "";

                              unit := "";

                              role := "";




                              for tag_name in tag_set do

                              if (tag_name = "BMC_Owner") then

                              owner := tag_set["BMC_Owner"];


                              end if;


                              if (tag_name = "BMC_Application") then

                              application := tag_set["BMC_Application"];


                              end if;


                              if (tag_name = "BMC_SupportedBy") then

                              supportedby := tag_set["BMC_SupportedBy"];


                              end if;


                              if (tag_name = "BMC_Environment") then

                              environment := tag_set["BMC_Environment"];


                              end if;


                              if (tag_name = "BMC_BusinessUnit") then

                              unit := tag_set["BMC_BusinessUnit"];


                              end if;


                              if (tag_name = "BMC_ServerRole") then

                              role := tag_set["BMC_ServerRole"];


                              end if;

                              end for;


                                      //for tag_name in tag_set do

                                          //tag_value := tag_set[tag_name];





                              //OVERRIDE_CHANGE ... begin additional logic

                                          //revised_key := "%node.key%/%tag_name%";

                              //OVERRIDE_CHANGE ... end additional logic



                                          tag_ci := sync.shared.BMC_Tag(

                                            //key              := revised_key,

                              key := node.key,

                                            //Name              := "%tag_name% : %ci.Name%",

                              Name              := ci.Name,

                                            //ShortDescription := tag_name,

                              ShortDescription := ci.Type,

                                            //Description      := "%tag_name% : %ci.Description%",

                              Description      := ci.Description,            

                                     //TagName          := tag_name,

                                     //TagValue          := tag_value,

                              PB_OSArchitecture := node.os_arch,

                                   //PB_OSArchitecture := ci.'Os Arch',

                              PB_PublicIP := node.public_ip_addr,

                              PB_PrivateIP := node.private_ip_addr,

                                     //PB_HyperVisor :=

                              PB_ImageID := node.image_id,

                              PB_CloudInstanceID := node.instance_id,

                              Model := node.cloud_class,

                              PB_CloudZone := node.availability_zones,

                              PB_OSName := node.os_class,

                              OwnerName := owner,

                              PB_ApplicationName := application,

                              PB_ITSupportedByContact := supportedby,

                              Department := unit,

                              PB_ServerRole := role,

                              Company          := ci.Company,

                              Category          := "AWS Public Cloud",

                              Type              := "Metadata",

                              Item              := "Tag"



                              getting below error while syncing:


                              • 12. Re: AWS Custom Tag
                                Lisa Keeler

                                Hi Vishnu,


                                You said: I mean this pattern created another CI in CMDB and old one marked as deleted = Yes and whatever has created by this pattern doesn't sync any details.


                                So, it sounds like the pattern did cause a new BMC_Tags CI to be created. 


                                Have you tried opening a ticket with Support for this problem?

                                Support would need your full pattern, the cmdbsync logs to see what was the error, and screenshots of the CI that was created.

                                I would gladly help with this specific problem.  You wrote your own pattern, and you just need some help testing it and getting it working.



                                1 of 1 people found this helpful
                                • 13. Re: AWS Custom Tag
                                  Vishnu Parihar

                                  Support ticket is - Case 00793575, please check.