Skip to end of metadata
Go to start of metadata

The following example demonstrates how to display the statuses of all Policies.

A PHP file called Get_Status_Of_All_Policies.php can be found in <installdir>/apisamples. Read more in Accessing Example API Functions.

The PHP script searches all Policies in the the system and prints result messages on the screen, providing the following information:

  • Policy ID, name, description, state, or "Failed to find all status of all policies."

Sequence of Automated Actions

The following steps can be accomplished by using this script:

  1. Find all Policies. 
  2. Display their ID, name, description, or state.

How to Fulfill Appropriate Actions in CDP User Interface

Below, you can find the steps to perform these actions using the program user interface. Screen-shots are provided to illustrate the scripts for each step.



Defining server configuration variables

########====CDP Server Configuration Start====######## #set CDP server host name $HOST="127.0.0.1"; #set CDP server to access API $PORT="9443"; #set CDP user $USER="admin"; #set CDP user password $PASS="admin"; ########====CDP Server Configuration End====########

Log in to the CDP Server user interface using your username and password.

Displaying Policies' States

try{ $policyClient = new soapclient("https://$HOST:$PORT/Policy2?wsdl", array( 'login'=>"$USER", 'password'=>"$PASS", 'trace'=>1, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS) ); $allPoliciesForUser = $policyClient->getPolicies(); foreach($allPoliciesForUser->return as $tmp) { echo "$tmp->id \n"; echo "$tmp->name \n"; echo "$tmp->description \n"; if ($tmp->state == "UNKNOWN"){ echo "Policy is in a UNKNOWN state \n"; } else if ($tmp->state == "ERROR"){ echo "Policy has ERROR \n"; } else if ($tmp->state == "ALERT"){ echo "Policy has ALERT(s) \n"; } else { echo "Policy State is OK \n"; } echo "\n"; } exit(0); } catch (SoapFault $exception) { echo "Failed to find all status of all policies"; echo $exception; exit(1); } ?>

1. Click on "Policy" in the Main Menu to open the "Policies" window.

2. Click on the "Show All" button located in the top right-hand corner of the interface to show the list of all Policies.

3. The Policy State is graphically displayed in the "State" column. The green icon indicates the Policies that run without errors; the yellow icon indicates the Policies that have warnings while processing; the red icon indicates the Policies that run with errors; the blue icon indicates the Policies with an unknown state. If nothing is shown in this column, then the State is OK.

If one or more Policy runs with errors, the "Error" icon is displayed in the upper area of the interface, proceeded by a table containing information on the Policies' statuses.

Read more about this panel in Accessing Policies.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.