Skip to content

Basic System Find Example

Chris Smith edited this page Feb 15, 2017 · 7 revisions

This sample invokes and displays the results of a “system find” remote command via the ePO DXL service. The results of the find command are displayed in JSON format.

The majority of the sample code is shown below:

Sample Code

# The ePO unique identifier
EPO_UNIQUE_ID = None

# The search text
SEARCH_TEXT = "broker"

# Create the client
with DxlClient(config) as client:

    # Connect to the fabric
    client.connect()

    # Create the ePO client
    epo_client = EpoClient(client, EPO_UNIQUE_ID)

    # Run the system find command
    res = epo_client.run_command("system.find",
                                 {"searchText": SEARCH_TEXT},
                                 output_format=OutputFormat.JSON)

    # Load find result into dictionary
    res_dict = json.loads(res, encoding='utf-8')

    # Display the results
    print json.dumps(res_dict, sort_keys=True, indent=4, separators=(',', ': '))

Next, the :func:dxlepoclient.client.EpoClient.run_command method is invoked with an output format of json and a searchText parameter that is specified with the value of broker.

Finally, the JSON response text is loaded into a Python dictionary (dict), formatted, and displayed to the screen.

Output

The output should appear similar to the following:

[
    {
        "EPOBranchNode.AutoID": 7,
        "EPOComputerProperties.CPUSerialNum": "N/A",
        "EPOComputerProperties.CPUSpeed": 2794,
        "EPOComputerProperties.CPUType": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz",
        "EPOComputerProperties.ComputerName": "broker1",
        "EPOComputerProperties.DefaultLangID": "0409",
        "EPOComputerProperties.Description": null,

        ...
    }
]

The properties for each system found will be displayed.

Home

McAfee ePolicy Orchestrator (ePO) Python Client Library

SDK Modules

Examples

Clone this wiki locally