Addressing Failing Schedules

MetaManager™ Use Case: Failing schedules due to invalid credentials

This article describes how to use the MetaManager’s™ script runner module to notify users when their schedules fail due to invalid credentials.

Problem

When a user schedules a report or job, the schedule will use their credentials to logon and execute the object.
When the user’s password is changed the schedule will begin to fail. While there has been some progress in IBM Cognos to automatically renew user’s stored credentials this problem still wreaks havoc in some situations, particularly when using Single Sign On.

Solution 1

MetaManager™ has two options to help solve this problem. The first option is to assign all of the schedules to a single account designated for executing schedules.
This can be done in the Object Editor module by selecting all of the content that has a schedule and assigning a new schedule credential to that object. The entire process takes only a few minutes and can be executed periodically to pick up new schedules.
choose the account to use as the credential. In addition Content Documenter can document failing history to a report.

Here’s an example failing schedules PDF report from Content Documenter.

Here’s an example failing schedules Excel report from Content Documenter.

Object Editor – Click to expand

 

Solution 2

Script Runner can be used to monitor for failing schedules and then email user’s to notify them that they need to renew their credentials.
Monitoring and emailing the user doesn’t correct the problem, but it does help minimize the downtime of broken schedules and removes the burden from IT to have to investigate the problem.
This solution can be automated as a nightly job by leveraging MetaManager’s™ Command Line processing.

c:>
c:> ControlPanel.exe “failing schedules monitor.js”

Below is a sample script that can be used to monitor failing schedules and email users.

Download the complete script here.

 
                
var smtpHost = "smtp.server.com";
var url = "http://localhost:9300/p2pd/servlet/dispatch";
var namespaceId = "AD";
var username = "admin";
var password = "cognos1234";
    
function run()
{
	// Log onto IBM Cognos
	var server = api.createServer(url);
	server.logon(namespaceId, username, password);
 
 
	// Get all of the objects that failed on their last run
	var cmobjects = server.getCMObjects("//*/history[last()]/*/..[@status='failed']/..");
	
    // Process each of the failed schedules
	for( var i = 0; i < cmobjects.length; i++ )
	{
		// Get the history information for this object.
		var cmobject = cmobjects[i];
		var array = cmobject.getHistory();
	
        // Process each of the failed history items
		for( var j = 0; j < array.length; j++ )
		{
			var history = array[j];
 
			// If the history failed for login then let's look deeper
			if(history.Status == "failed" && history.Details.indexOf("logon") != -1)
			{
				// Get the schedule's credential
				var credSearchPath = cmobject.scheduleFns.credential;
				if(credSearchPath == "" ) continue;
			
				// Get the user from the credential
				var user = server.getCMObject(credSearchPath + "/..");
				if(user == null ) continue;
			
				// Get the user's name and email
				var givenName = user.accountFns.givenName;
				var email = user.accountFns.email;
				console.log("Emailing: " + email + " about report " + cmobject.ancestors);
			
				// Send an email to the user.
				var subject = "Notice: Failing Schedule";
				var body = givenName + ",rnrn"
				body += "The following report schedule is failing ";
				body += "due to expired credentials.  Please log into IBM Cognos and renew ";
				body += "your stored credentials.rnrn";
				body += cmobject.ancestors;
				body += "rnrnThank you,";
				body += "rn-MetaManager";
				helpers.email.sendEmail(smtpHost, "MetaManagerScript@noreply.com", email, subject, body);
			
				return;
			
			}
		}
	}
}
run();