UCMDB API CIs to Record Set

Hi,

I am trying to pull the information from UCMDB using the api(Version 8). This extract needs to be stored in a database. I am able to connect to the server and then iterate thru each of the topology. But all topology CI's have 0 properties.

Please let me know how to read the Topology to convert it to a recorset. I wanted somthing like the way we export it to CSV, so we can store it as a database base.

 

 

P.S. This thread has been moevd from Application Perf Mgmt (BAC / BSM) Support and News Forum to CMS and Discovery Support and News Forum. - Hp Forum Moderator

Parents
  • Hi,

    Make sure you specified the properties go get with the query definition, for example:

    Interface QueryDefinition

    --------------------------------------------------------------------------------

    public interface QueryDefinitionDefinition of a uCMDB TQL query.

    Examples of simple queries:

    Query CIs by list of IDs
    QueryDefinition queryDefinition = topologyQueryFactory.createQueryDefinition("Get Hosts by IDs");
    QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host").withIds(ids);
    queryNode.queryPropertiesWithQualifier("COMPARABLE").queryProperties("host_key", "host_iscomplete");
    Query CIs by their properties
    QueryDefinition queryDefinition = factory.createQueryDefinition("Get Hosts");
    QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host");
    queryNode.property("host_key").like("T%").caseInsensitive().and(queryNode.property("host_iscomplete").isNull());
    queryNode.queryKeyProperties();
    Query CIs' neighbors
    QueryDefinition queryDefinition = factory.createQueryDefinition("Get hosts' neighbors");
    QueryNode cisNode = queryDefinition.addNode("CIs").ofType("host").withIdsOf(hosts);
    QueryNode neighborsNode = queryDefinition.addNode("Neighbors").ofAnyType();
    neighborsNode.queryKeyProperties();
    cisNode.linkedTo(neighborsNode).withLinkOfAnyType();


    Once you got the Topology, you need to get TopologyCI collection from it, and use getPropertyValue method on the TopologyCI

Reply
  • Hi,

    Make sure you specified the properties go get with the query definition, for example:

    Interface QueryDefinition

    --------------------------------------------------------------------------------

    public interface QueryDefinitionDefinition of a uCMDB TQL query.

    Examples of simple queries:

    Query CIs by list of IDs
    QueryDefinition queryDefinition = topologyQueryFactory.createQueryDefinition("Get Hosts by IDs");
    QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host").withIds(ids);
    queryNode.queryPropertiesWithQualifier("COMPARABLE").queryProperties("host_key", "host_iscomplete");
    Query CIs by their properties
    QueryDefinition queryDefinition = factory.createQueryDefinition("Get Hosts");
    QueryNode queryNode = queryDefinition.addNode("Hosts").ofType("host");
    queryNode.property("host_key").like("T%").caseInsensitive().and(queryNode.property("host_iscomplete").isNull());
    queryNode.queryKeyProperties();
    Query CIs' neighbors
    QueryDefinition queryDefinition = factory.createQueryDefinition("Get hosts' neighbors");
    QueryNode cisNode = queryDefinition.addNode("CIs").ofType("host").withIdsOf(hosts);
    QueryNode neighborsNode = queryDefinition.addNode("Neighbors").ofAnyType();
    neighborsNode.queryKeyProperties();
    cisNode.linkedTo(neighborsNode).withLinkOfAnyType();


    Once you got the Topology, you need to get TopologyCI collection from it, and use getPropertyValue method on the TopologyCI

Children
No Data