Use the createReport API to a report that is enabled, runs twice a day, and filters by task state and task alert.
########====CDP Server Configuration Start====########
#set CDP server host name
$HOST="10.230.131.25";
#set CDP server to access API
$PORT="9443";
#set CDP user
$USER="admin";
#set CDP user password
$PASS="admin";
########====CDP Server Configuration End====########
########====Report configuration start====########
### Set id of user who will be owner of the report being created(Optional). If not set, current user will be made report owner.
#$ID = "d1b43ea9-9a89-4a82-873a-677674a43ec0";
$ENABLED = true;
$REPORT_NAME = "reportName1";
$REPORT_SUBJECT = "reportSubject1";
$ALERT_AFTER_DAYS = 1;
$HARD_QUOTA = -1;
### See "FrequencyValues.FrequencyType" in Java Docs for more details.
$FREQUENCY_TYPE = "DAILY";
### See "FrequencyValues" in Java Docs for more details.
$FREQUENCY_VALUES->startingMinute = 5;
$FREQUENCY_VALUES->hoursOfDay = array("2","14");
### Recipient email addresses
$RECIPIENT_EMAIL_ADDRESSES = array("recipient1@test.com", "recipient2@test.com");
$FROM_ADDRESS = "from@test.com";
########====Report configuration End====########
########====Initialize a report object start====########
$reportObj->enabled = $ENABLED;
$reportObj->name = $REPORT_NAME;
$reportObj->subject = $REPORT_SUBJECT;
$reportObj->reportOwnerID = $ID;
$reportObj->reportFrequencyType = $FREQUENCY_TYPE;
$reportObj->reportFrequencyValues = $FREQUENCY_VALUES;
$reportObj->agentAlertAfterDays = $ALERT_AFTER_DAYS;
$reportObj->hardQuota = $HARD_QUOTA;
$reportObj->emailAddresses = $RECIPIENT_EMAIL_ADDRESSES;
$reportObj->sendIndividualEmails = true;
$reportObj->sendIfEmpty = false;
$reportObj->includeFullAlertDetails = false;
$reportObj->fromAddress = $FROM_ADDRESS;
########====Initialize a report object End====########
########====Set REPORT FILTERS start====########
### To enable "Filter by Server", provide UUIDs of existing servers
#$reportObj->agentIDsFilterList=array("88632b8e-b7d3-4111-a224-03cc1ba49264", "2823c163-6436-4084-bf5a-63d53a830c48");
### See "TaskState" in Java Docs for more details.
$reportObj->taskStateFilterList=array("QUEUED", "FINISHED");
### See "TaskType" in Java Docs for more details.
#$reportObj->taskTypeFilterList=array("DISK_SAFE_VERIFICATION", "TASK_HISTORY_CLEANUP");
### See "LogLevel" in Java Docs for more details.
#$reportObj->logLevelFilterList=array("INFO", "SEVERE");
### To select "Filter by Task Alert", this should be set to true or false depending if we want to include tasks with alerts or without alerts.
$reportObj->taskWithAlertsFilter=true;
########====Set REPORT FILTERS end====########
try {
$reportClient = new soapclient("https://$HOST:$PORT/Reporting?wsdl",
array(
'login'=>"$USER",
'password'=>"$PASS",
'cache_wsdl'=>WSDL_CACHE_NONE,
'features'=>SOAP_SINGLE_ELEMENT_ARRAYS,
'trace'=>1
)
);
$createdReport = $reportClient->createReport(array('report'=>$reportObj));
echo "Successfully executed create report \n";
}
catch(SoapFault $exception)
{
echo "Failed to create report \n";
echo $exception;
exit(1);