Scheduled reports usage

Hi there,

Seems to me an easy question, but being with Cognos software for a while, I never been asked this question: how can I report on daily scheduled reports activity. Please note, not batch reports activity, only scheduled reports. I just simply can’t find this option within Audit package. I need a status of last run as well as error (if any) and overall list of all scheduled user reports/queries.

I’m using Cognos 8.4 FP2 on Windows 2003 with Oracle 10G.

Thanks,
Alex

Alex,

i’m answering out of my head but i will check this later this week…

I believe the schedule reports can be viewed in the administration console from Cognos connection. There you can view the scheduled reports which were run the last 2, 4, 12 hours or so.

i also believe this information is stored in the content manager tables somewhere as well. I have to check this and i will come back to you within a few days.

Thank for the reply!

That would be too simple… :wink:
I need to have a report that I can run for daily schedule activity and see when reports are running, for how long, failure, etc. Again, I can’t just simply run all batch report activity as multiple user may run those reports manually and that what I don’t have a way to separate. Also I want to see all reports that being scheduled by users and compare them over time.

Location for all of those information in Content Store would be great help!

Thanks,
Alex

Alex,

did some checking in the content store tables. It is not plain text but yo can extract the if you really want to but it take a long time i’m afraid… :-\

but maybe this helps: the good old SDK. i’m wondering why Cognos does not have this option by default… ::slight_smile:

This code will query the Content Store and produce a list of the Names of all Scheduled Reports, their Search Paths and owners.

// Licensed Material - Property of IBM
// © Copyright IBM Corp. 2003, 2009

//  Copyright  2003 Cognos Incorporated. All Rights Reserved.
//  Cognos and the Cognos logo are trademarks of Cognos Incorporated.
//
//  Description: How to retrieve a list of all Scheduled Jobs from the Content Store

import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import org.apache.axis.AxisFault;
import org.apache.axis.client.Stub;
//import org.apache.taglibs.standard.lang.jpath.adapter.Convert;

import com.cognos.developer.schemas.bibus._3.BaseClass;
import com.cognos.developer.schemas.bibus._3.BiBusHeader;
import com.cognos.developer.schemas.bibus._3.CAM;
import com.cognos.developer.schemas.bibus._3.ContentManagerService_Port;
import com.cognos.developer.schemas.bibus._3.ContentManagerService_ServiceLocator;
import com.cognos.developer.schemas.bibus._3.FormFieldVar;
import com.cognos.developer.schemas.bibus._3.FormatEnum;
import com.cognos.developer.schemas.bibus._3.HdrSession;
import com.cognos.developer.schemas.bibus._3.OrderEnum;
import com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;
//import com.cognos.developer.schemas.bibus._3.Output;
import com.cognos.developer.schemas.bibus._3.PropEnum;
import com.cognos.developer.schemas.bibus._3.QueryOptions;
//import com.cognos.developer.schemas.bibus._3.ReportServiceResponse;
import com.cognos.developer.schemas.bibus._3.Sort;
import com.cognos.developer.schemas.bibus._3.StringProp;
import com.cognos.developer.schemas.bibus._3.TokenProp;

//import java.math.BigInteger;
//import java.io.*;

public class GetSchedules
{
	public static void main(String[] args) throws MalformedURLException, ServiceException
	{
		// Attempt a simple CM query.

		SearchPathMultipleObject searchPath = new SearchPathMultipleObject();
		searchPath.setValue("//schedule");
		String userName = "username";
		String userPassword = "password";
		String userNamespace = "SDK";

		// Process command-line arguments.
		//
		// cmQuery accepts these arguments:
		//
		// --search=searchPath
		// --uid=userName
		// --pwd=userPassword
		// --namespace=userNamespace
		try
		{
			for (int i = 0; i < args.length; i++)
			{
				String[] command =
					{
						args[i].substring(0, args[i].indexOf('=')),
						args[i].substring(args[i].indexOf('=') + 1)};

				if (command[0].compareTo("--search") == 0)
				{
					//searchPath = command[1];
				}
				else if (command[0].compareTo("--uid") == 0)
				{
					userName = command[1];
				}
				else if (command[0].compareTo("--pwd") == 0)
				{
					userPassword = command[1];
				}
				else if (command[0].compareTo("--namespace") == 0)
				{
					userNamespace = command[1];
				}
				else
				{
					throw new Exception("Unknown argument: " + args[i]);
				}
			}
		}

		catch (Exception ex)
		{
			System.out.println(ex.getMessage());
			System.exit(-1);
		}

		// Concatenate the read filter to the searchPath this way we 
		// ask CM to only return the objects we have read acces on.
		// searchPath += "[permission('read')]";

		ContentManagerService_Port cmService = null;
		String dispatcherURL = "http://localhost:9300/p2pd/servlet/dispatch";


		ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();
		
		

		try {
			cmService = cmServiceLocator
					.getcontentManagerService(new java.net.URL(dispatcherURL));
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
			

		// Search properties: we need the defaultName and the searchPath.
		PropEnum[] properties =
			{ PropEnum.defaultName, PropEnum.searchPath, PropEnum.owner };

		// Sort options: ascending sort on the defaultName property.
		//
		// The cmQuery.pl sample doesn't do this, it returns the default unsorted response.
		Sort[] sortBy = { new Sort() };
		sortBy[0].setOrder(OrderEnum.ascending);
		sortBy[0].setPropName(PropEnum.defaultName);

		// Add the authentication information, if any.
		//
		// Another option would be to use the logon() and logonAs() methods...
		CAM cam = new CAM();
		cam.setAction("logonAs");

		HdrSession header = new HdrSession();
		if (userName != null)
		{
			FormFieldVar[] vars = new FormFieldVar[3];

			vars[0] = new FormFieldVar();
			vars[0].setName("CAMNamespace");
			vars[0].setValue(userNamespace);
			vars[0].setFormat(FormatEnum.not_encrypted);

			vars[1] = new FormFieldVar();
			vars[1].setName("CAMUsername");
			vars[1].setValue(userName);
			vars[1].setFormat(FormatEnum.not_encrypted);

			vars[2] = new FormFieldVar();
			vars[2].setName("CAMPassword");
			vars[2].setValue(userPassword);
			vars[2].setFormat(FormatEnum.not_encrypted);

			header.setFormFieldVars(vars);
		}
		else
		{
			cam.setAction("logon");
		}

		BiBusHeader bibus = new BiBusHeader();
		bibus.setCAM(cam);
		bibus.setHdrSession(header);

		((Stub)cmService).setHeader("", "biBusHeader", bibus);

		// Make the query.
		try
		{
			// Query options; use the defaults.
			QueryOptions options = new QueryOptions();

			//Use the options below for performance tuning:
			//				BigInteger maxObjs = new BigInteger("5");
			//				options.setMaxObjects(maxObjs);

			//				BigInteger skipObjs = new BigInteger("5");
			//				options.setSkipObjects(skipObjs);

			BaseClass[] results =
				cmService.query(searchPath, properties, sortBy, options);

			// Display the results.
			System.out.println("Results: ");

			System.out.print("\t");
			System.out.print("Schedule Name");
			System.out.print("\t");
			System.out.println("Schedule SearchPath");
			System.out.print("\t");
			System.out.println("Schedule Owner (Searchpath)");

			for (int i = 0; i < results.length; i++)
			{
				TokenProp theDefaultName = results[i].getDefaultName();
				StringProp theSearchPath = results[i].getSearchPath();

				System.out.print("\t");
				System.out.print(theDefaultName.getValue());
				System.out.print("\t");
				System.out.println(theSearchPath.getValue());
				System.out.print("\t");
				System.out.println(results[i].getOwner().getValue()[0].getSearchPath().getValue());
			}
		}

		catch (AxisFault ex)
		{
			// Fault details can be found via ex.getFaultDetails(),
			// which returns an Element array.

			System.out.println("SOAP Fault:");
			System.out.println(ex.toString());
		}

		catch (RemoteException ex)
		{
			BiBusHeader theException =
				(BiBusHeader)((Stub)cmService).getHeaderObject(
					"",
					"biBusHeader");

			// You can now use theException to find out more information 
			// about the problem.
			System.out.println(theException.toString());

			System.out.println("ReportNet threw an RMI exception:");
			System.out.println(ex.getMessage());
			System.out.println("Stack trace:");
			ex.printStackTrace();
		}
	}
}

That is perferct! Thank you very much sir! I’ll run some testing later today.