Getting all systems belonging to a defined business service

Hi Experts,

 

I need to get all our business services with their systems documented into a external database which we are using for our billing system.

 

For example:

 

Business Service:  Specific  Service - Energy Acquiring 

 

System :             Hosta

                              HostB

                              HostC

 

Business Service:  Specific  Service - Energy  Dispatching 

 

System :             HostZ

                              HostB

                              

 

 

 

So what I need to have is:

 

  1. For Service " Energy Acquiring" these server are involved   Hosta,  HostB and   HostC
  2. The HostB belong to service  "Energy  Dispatching" and "Energy  Acquiring"

 

How can I get this information out of BSM and save this into another Database? I looked into the RTSM Database but did not found any way to get this information together. 

It is somehow silly because on myBSM I get this information stored on the graphical views but I can't dump data into a files or in an external database.

 

Can please somehow help me?

 

Thanks a lot in advance.

 

Best Regards Chris

 

Parents
  • first, you need to create the integration adapter to your external system. it might be easier to do this from CMDB and not from RTSM since CMDB has reporting capability and then you can generate URL to a report.

    second, you need to create TQL which will return the dependencies between services and their hosts.

  • Hi Asaf_Shechter,

     

    Thanks a lot for taking some time to answer. I will try what you told me even if do not completely understand what you're telling about. May I ask you to point me out of some Manuals where I can retrieve some more information about what you're telling me.

    Sounds a little bit foolish from me but I am not configuring BSM as a full time job... 

     

    Best regards

    Chris

     

  • Hi all,

     

    I got it done with the ucmdb-api.jar

    I looks like this:

     

    package bsm2ewmssoap;

    import com.hp.ucmdb.api.ClientContext;
    import com.hp.ucmdb.api.Credentials;
    import com.hp.ucmdb.api.UcmdbService;
    import com.hp.ucmdb.api.UcmdbServiceFactory;
    import com.hp.ucmdb.api.UcmdbServiceProvider;
    import com.hp.ucmdb.api.view.ViewService;
    import com.hp.ucmdb.api.view.result.ViewResult;
    import com.hp.ucmdb.api.view.result.ViewResultTreeNode;
    import java.net.MalformedURLException;
    import java.util.List;
    import java.sql.*;


    public class BSM2EWMSSoap {

        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) throws Exception {
            // TODO code application logic here
            String strHost = null;
            String strServices = null;
            String strToDB = null;
            UcmdbService  ucmdbService = createSDKConnection();
            ViewService viewService = ucmdbService.getViewService();
            ViewResult  result = viewService.executeView("MYViewforThisJava");  //<-- name of the view I created for the script
            List<? extends ViewResultTreeNode> roots = result.roots();
            for (ViewResultTreeNode root : roots) {
                List<? extends ViewResultTreeNode> children = root.children();
                strHost = root.label().toString();
                for (ViewResultTreeNode child : children) {
                    strServices = child.label().toString();
                    strToDB = strHost "|" strServices;
                }
               System.out.println(strToDB);
                //connectToSql(strHost,strServices );
            }
        }
        
        
        private static void connectToSql(String Host,String Services ) {
            Connection conn = null;
            String userName = "DBUser";
            String password = "DBUser Password";
            String url = "jdbc:jtds:sqlserver://sqlserver:1433/instance;";
            String driver = "net.sourceforge.jtds.jdbc.Driver";
            try {
                Class.forName(driver);
                conn = DriverManager.getConnection(url, userName, password);
                System.out.println("Connection successful");
            } catch (Exception e) {
                System.err.println("Cannot connect to database server");
                e.printStackTrace();
            }
            try
            {
            Statement statement = conn.createStatement();
              System.out.println("Host: " Host "Service :" Services);
            statement.executeUpdate("INSERT INTO [EWMS].[dbo].[Weekly_BSM_Services] (Host,Services) VALUES ( '" Host "','" Services "')");
              conn.close();
            }
            catch (Exception e)
            {
                System.err.println("Insert Trouble");
                e.printStackTrace();
            
            }
        }
        public static UcmdbService createSDKConnection() throws MalformedURLException {
            //Server Address
        String HOST ="GW-IPAdress";
        //Server Protocol
        String PROTOCOL ="http";
        //Server Port
        Integer PORT = 8080;
        //Credentials
        String USER_NAME = "user";
        String PASSWORD = "Userpassword";
            UcmdbServiceProvider serviceProvider = UcmdbServiceFactory.getServiceProvider(PROTOCOL, HOST, PORT);
            ClientContext clientContext = serviceProvider.createClientContext("MyAppName");
            Credentials credentials = serviceProvider.createCredentials(USER_NAME, PASSWORD);
            return serviceProvider.connect(credentials,clientContext);
         }
    }

     

     

    So I got back my services with the systems belonging to this service.

     

    Now I am trying to get the Note filed from the Services, I have there a specific number with I need to retrieve.

    I read so far about the "ViewExecutionOptions withNote()" but I could not figure out how to let this run. Could please someone get me into the right direction or give me a hint where I could get an example or a way to make it work?

     

    Thank you so much for your help.

     

    Best Regads

    Chris

  • the "Note" is another attribute, so you need to:

    1) add it to the TQL element layout, so you will be able to query it in the API

    2) use it like any other attribute (for example: the Label you are already using).

  • Thanks you so much Asaf Shechter

     

    I tried it but it doesn't seems to work. Maybe I do something wrong.

    My View looks like that the Printscreen attached in the document and I update my script also copied in the document.

     

    Would you mind to take a look a it? I would really apreciate.

     

     

    TRhank you so much!

  • well, if you will look at the CIT manager, you will see that "Note" attribute is actually called "data_note" and this is what you need to use in your script.

  • Hi,

     

    Thank you again to help me on that. I am afraid that this is not yet the solution. I really apreciate your giving your time to help me.

    I checked the CIT Manager and it is indded data_note there but I do not have it available as object as shown in the printscreen I attached to this reply.

     

    Could you please help out?

     

    Thank you so much in advance for your help.

     

     

    Regads Chris

  • it's a CI's proprty so you should access it via the properties.

    it is not like the "Label" which as "shortcut" to the display label.

Reply Children