0% found this document useful (0 votes)
247 views

Automating Cognos Server Reboot - V4.0

This document describes how to automate restarting Cognos services during monthly maintenance by scheduling batch files to stop services before patching and start services after patching. The batch files stop and start Cognos 8.3 and 10 services, send notification emails, and ensure content managers start before dispatchers. Scheduling the batch files reduces manual effort for restarting services across multiple servers during maintenance outages.

Uploaded by

clrhoades
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
247 views

Automating Cognos Server Reboot - V4.0

This document describes how to automate restarting Cognos services during monthly maintenance by scheduling batch files to stop services before patching and start services after patching. The batch files stop and start Cognos 8.3 and 10 services, send notification emails, and ensure content managers start before dispatchers. Scheduling the batch files reduces manual effort for restarting services across multiple servers during maintenance outages.

Uploaded by

clrhoades
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Automating Cognos Service Restart

Author: Arun Sekar (TCS), Ganapathy Srinivasan Ramanujam (TCS)


Introduction:
This document explains the process involved in automating a Cognos service
restart during monthly maintenance activities such as a Windows patch update.
The following instructions and scripts automatically stop the Cognos services
before any infrastructure patch update and automatically start the Cognos
services after the patch update.
Intended Audience:
This document is intended for Cognos administrators.
Versions considered:
Cognos 8.3 instance
Cognos 10 instance
Operating System:
Windows 2003 Platform
Workflow:
In most infrastructures, it is required to provide an outage window of Cognos
8.3 and 10 server instances to ensure the Windows servers are patched to the
latest level and the security patches are installed.
This outage window involves, stopping all the Cognos 8.3 and 10 services before
the infrastructure update and starting these once the update is completed.
In the case of a distributed multitier Cognos environment, this process can be
time consuming and requires manual intervention.
For this example, the Cognos 8.3 and Cognos 10 development instance, the
Windows team will be installing their patches between 2:00 PM EST to 5:00 PM
EST on first Sunday of every month.
Cognos 8.3 and Cognos 10 Services need to be stopped before 2:00 PM EST and
started after 5:00 PM EST.
We are going to schedule a batch file that will take care of shutting down the
Cognos 8.3 and Cognos 10 instance and notify us on the status of the services.

Figure 1: Stop and Start Sequence of Cognos instance

Schedules for Cognos stop and start:


1. Windows schedule needs to be installed on all the dispatcher and
content manager servers.

2. The timing of the schedule should be adjusted such that dispatchers


should be stopped before content managers and during starting, content
managers should be started before the dispatchers.
Before setting up the schedules, the following files should be present in the
D:\BATCH folder.
cog10stop.bat
StopTrigger.txt (empty file)
StartSuccessMail.vbs
SendErrorMail.vbs
cog10start.bat
StartTrigger.txt (empty file)
SendSuccessMail.vbs
SendErrorMail.vbs
The purpose of StopTrigger.txt and StartTrigger.txt:
1. In case you want to skip a monthly outage schedule due to business
reasons, the stopTrigger.txt and StartTrigger.txt files can be removed
from all the Windows servers. This will stop the schedule temporarily.
2. If you want to ensure that the content managers started before the
dispatchers are started, the startTrigger.txt file will be useful. The
script creates this file and puts in the dispatcher location after the
content manager is started (This is another check to ensure the services
are started appropriately. This is an optional setting and can be
commented out in the script if not applicable to your environment.)
The attached Visual Basic script, creates a text file called StartTrigger.txt and
moves it to the Standby Content Manager once the primary Content manager is
started and later subsequently to dispatchers to initiate the start process.

Navigate to your Control Panel and select Add scheduled Tasks as shown
below

Figure 2: Windows Scheduler status


Select the Cog10stop.bat in the Windows scheduler and select the appropriate
frequency. In this case the monthly schedule is used.

Step 1: Schedule Name and frequency

Step 2: Schedule Frequency through Windows scheduler

Step 3: Authentication for running the schedule

Repeat the steps above for all the other Dispatcher and Content Manager
servers.
If you are running Cognos 8.3 and Cognos 10 in parallel, you can use a separate
schedule for Cognos 8.3 as well.

Two separate batch files are required one for Cognos 8.3 and another for
Cognos 10. There is no change in the batch file except the path of the
installation should be changed appropriately.
File Name: Cog8Stop.bat and Cog10stop.bat (D:\BATCH)
Note: This needs to be scheduled through the service account with which the
Cognos 8.3 and Cognos 10 services are running.
SL:NO
1
2
3
4

Machine
A
B
C
D

Cognos 8.3
1:30 PM EST
1:35 PM EST
1:40 PM EST
1:45 PM EST

Cognos 10
1:35 PM EST
1:30 PM EST
1:45 PM EST
1:40 PM EST

After 5:00 PM EST, we will proceed with starting the Cognos services on 8.3 and
10 instances through a custom batch file.
File Name: Cog8Start.bat and Cog10Start.bat (D:\BATCH)
SL:NO
1
2
3
4

Machine
A
B
C
D

Cognos 8.3
5:20 PM EST
5:15 PM EST
5:10 PM EST
5:05 PM EST

Cognos 10
5:15 PM EST
5:20 PM EST
5:05 PM EST
5:10 PM EST

The order of the start sequence is critical, the start sequence should be
Primary CM, Standby CM, Dispatcher 1, Dispatcher 2
A notification mail is sent after stopping the Cognos server and also after
starting the Cognos servers along with the log files.
Based on the log file description, ROS (Return of service) communication can
be sent to the application teams. Return of service communication is a
notification to the application teams stating that the outage is completed and
the Cognos servers are up and running.

Figure 3: Execution Status

Figure 4: Email Notification

Benefits:
This technique reduces the manual effort required to bring down the Cognos
instance and bring up the same in case of a multi-tiered environment.
Batch File Specifications:
To stop cognos instance: (cog10stop.bat)
Rem batch file to stop the Cognos 10 Sandbox instance
IF EXIST D:\BATCH\StopTrigger.txt GOTO YES
GOTO NO
:YES
(
D:
cd D:\Cognos10.1.0\bin
CALL cogconfig.bat -stop
sc config "IBM Cognos:9301" start= disabled
CALL D:\BATCH\SendSuccessMail.vbs
GOTO END
)
:NO
(
CALL D:\BATCH\SendErrorMail.vbs
)
:END
SendSuccessMail.vbs:
'**********************************************************************
****************************************************************
'* CDOSYS object to send mail related to Cognos Server status
'* This script is created for Cognos 10 Sandbox instance
'* Cogserver.log file path needs to be Specified for different Cognos
8.3 and Cognos 10 Environments to ensure the Latest Logs are sent
'**********************************************************************
****************************************************************
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Cognos Sandbox 10 instance Stopped"
myMail.From="Enter the From Address"
myMail.To="User 1; User 2"
myMail.TextBody="Cognos 10 Sandbox Instance Stopped, Attached are the
log files. Please review the cogconfig_repsponse.csv file for further
details. You can reach the Global Platform Solutions - BI Service
Delivery team for any questions."
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_stop.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_isrunning.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cogconfig_response.csv"

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="SMTP
Server Name"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

SendErrorMail:
'**********************************************************************
****************************************************************
'* CDOSYS object to send mail related to Cognos Server status
'* This script is created for Cognos 10 Sandbox instance
'* Cogserver.log file path needs to be Specified for different Cognos
8.3 and Cognos 10 Environments to ensure the Latest Logs are sent
'**********************************************************************
****************************************************************
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Cognos Sandbox 10 instance is running AS IS"
myMail.From="From Address"
myMail.To="User 1;User 2"
myMail.TextBody="Cognos 10 Sandbox Instance is running AS IS. No
trigger file found"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_stop.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_isrunning.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cogconfig_response.csv"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<Enter
the SMTP Server>"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
Set myMail=nothing

To Start Cognos instance (cog10start.bat)


Rem batch file to start the Cognos 10 Sandbox instance
IF EXIST D:\BATCH\StartTrigger.txt GOTO YES
GOTO NO
:YES
(
D:
cd D:\Cognos10.1.0\bin
sc config "IBM Cognos:9301" start= auto
CALL cogconfig.bat -s
d:
cd d:\batch
CALL D:\BATCH\StartSuccessMail.vbs
GOTO END
)
:NO
(
CALL D:\BATCH\SendErrorMail.vbs
)
:END
StartSuccessMail.vbs:
Const ForReading = 1
Dim i
Set objRegEx = CreateObject("VBScript.RegExp")

objRegEx.IgnoreCase = True
objRegEx.Pattern = "ERROR|Failed|Unable"

Set objFSO = CreateObject("Scripting.FileSystemObject")


Set objFile = objFSO.OpenTextFile("D:\Cognos10.1.0\logs\cbs_start.log",
ForReading)
i = 0
Do Until objFile.AtEndOfStream
strSearchString = objFile.ReadLine
Set colMatches = objRegEx.Execute(strSearchString)
If colMatches.Count > 0 Then
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Cognos Sandbox 10.1 instance could NOT be
Started, Please review the logs for further information"

myMail.From="From Address"
myMail.To="User 1;User 2"
myMail.TextBody="Cognos Sandbox Instance could NOT be
Started, Attached are the log files"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_start.log"
myMail.AddAttachment
"D:\Cognos10.1.0\logs\cbs_isrunning.log"
myMail.AddAttachment
"D:\Cognos10.1.0\logs\cogconfig_response.csv"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<SMTP
Server>"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
i = 1
End If
Loop
If i = 0 then
Dim fso, f1,f2
Set fso = CreateObject("Scripting.FileSystemObject")
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Cognos Sandbox 10.1 instance is started
successfully, Please review the Logs for further information"
myMail.From="From Address"
myMail.To="User 1;User 2"
myMail.TextBody="Cognos Sandbox Instance started
Successfully, Attached are the log files"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_start.log"
myMail.AddAttachment
"D:\Cognos10.1.0\logs\cbs_isrunning.log"
myMail.AddAttachment
"D:\Cognos10.1.0\logs\cogconfig_response.csv"
myMail.CreateMHTMLBody "http://<CM
HOST>:<PORT>/p2pd/servlet"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<SMTP
Server>"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
Const DeleteReadOnly = True

Set f1 = fso.CreateTextFile("\\<Dispatcher or Standby


CM>\D$\BATCH\StartTrigger.txt", True)
'The below line is an optional one and can be removed if not applicable
to your environment
fso.DeleteFile ("D:\BATCH\StartTrigger.txt"),DeleteReadOnly
End If
objFile.Close

SendErrorMail:
'**********************************************************************
****************************************************************
'* CDOSYS object to send mail related to Cognos Server status
'* This script is created for Cognos 10 Sandbox instance
'* Cogserver.log file path needs to be Specified for different Cognos
8.3 and Cognos 10 Environments to ensure the Latest Logs are sent
'**********************************************************************
****************************************************************
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Cognos Sandbox 10 instance is running AS IS"
myMail.From="From Address"
myMail.To="User 1;User 2"
myMail.TextBody="Cognos 10 Sandbox Instance is running AS IS. No
trigger file found"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_stop.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cbs_isrunning.log"
myMail.AddAttachment "D:\Cognos10.1.0\logs\cogconfig_response.csv"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="<SMTP
Server>"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

Conclusion:

This approach avoids manual interruption for any scheduled outages. This is
tested and implemented for Cognos 8.3 and Cognos 10 instances running on
Windows 2003 Server.

You might also like