Retrieving data from an LDAP data source
You can retrieve data, by key, filter, or link, from an LDAP data source by using the GETbyKey, GetByFilter, and GetByLinks functions when you write a policy.
The following table describes the functions that retrieve LDAP data.
Function |
Description |
|---|---|
|
Retrieves data items, or entities in the LDAP directory tree, whose key fields match the specified key expression. The key field is configured in the Key search field entry in the data type. |
|
Retrieves data items whose field values match the specified LDAP filter string. |
|
Retrieves data items that are dynamically or statically linked to another data item using the Netcool®/Impact GUI. |
Example
The following example shows how
to use GetByKey to retrieve data items, or entities
in the LDAP directory tree, whose key field matches the specified
key expression. In this example, the LDAP data type associated with
a search scope in the tree is Customer and the key
expression is 12345.
DataType = "Customer";
Key = 12345;
MaxNum = 1;
MyCustomer = GetByKey(DataType, Key, MaxNum);The following
example shows how to use GetByFilter to retrieve
data items whose field values match the specified LDAP filter string.
The LDAP filter is part of the specification that is described in
Internet RFC 2254. In this example, the LDAP data type is Facility and
the filter string is (|(facility=Wall St.)(facility=Midtown)(facility=Jersey
City)).
DataType = "Facility";
Filter = "(|(facility=Wall St.)(facility=Midtown)(facility=Jersey City))";
CountOnly = False;
MyFacilities = GetByFilter(DataType, Filter, CountOnly);If
the filter does not return any LDAP entities when you think it should,
sometimes this can be fixed be adding a * to the
end of the search text. For example, instead of Filter =
"(cn=myuser)", try Filter= "(cn=myuser*)";
The
following example shows how to use GetByLinks to
retrieve data items that are statically or dynamically linked to another
data item by using the Netcool/Impact GUI.
In this example, you use GetByLinks to retrieve data
items of type Customer that are linked to data items
in the MyFacilities array that is returned in the
previous example.
DataType = {"Customer"};
Filter = "";
MaxNum = 1000;
DataItems = MyFacilities;
MyCustomers = GetByLinks(DataType, Filter, MaxNum, DataItems);GetByFilter or GetByKey functions
when querying an LDAP data source.To stop this exception from being generated, add the following property to $IMPACT_HOME/etc/<ImpactServerName>_server.props:
impact.jndi.suppressnull=true
Restart the Impact server for change to take effect.
For detailed syntax descriptions of these functions, see the Policy Reference Guide.