Managing configuration settings of the Cognos Analytics service instance

Change configuration settings of the Cognos Analytics service instance to values that optimize your work with the service.

You can use the set_config_property.sh script file to set your preferred values to configuration properties of the Cognos Analytics service instance, such as the connection lifetime or server persist timeout. For example, you can lengthen the time for which data endures in your instance to work with the data more comfortably.

Synopsis

set_config_property.sh [-h] -t tethered_namespace -p config_property_name -P config_property_value

Options

-t tethered_namespace
Tethered namespace or project in which you want to change connection times.
-p config_property_name
The name of the connection property that you intend to change. The name might be one of the following:
  • connectionLifetime
  • cognosServerPersistTimeoutSeconds
-P config_property_value
The value for the time parameter that you want to set.

When you set the connection lifetime, the value must be in [ms].

When you set the persist.timeout parameter, the value must be in [s].

-h
Prints help to the console and exits.

Examples

The following example sets the data connection lifetime of your Cognos Analytics service instance to 5500000 ms:

./set_config_property.sh -t NAMESPACE -p connectionLifetime -P 5500000

The following example sets the persist.timeout parameter for the web container transport chains of to 60 s:

./set_config_property.sh -t NAMESPACE -p cognosServerPersistTimeoutSeconds -P 60

Script file

The set_config_property.sh script is a file with the following contents:

#!/usr/bin/env bash
#
# -----------------------------------------------------------------------------
#         Licensed Materials - Property of IBM
#
#         IBM Cognos Products: ca
#
#         (C) Copyright IBM Corp. 2025
#
#         US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
# -----------------------------------------------------------------------------
#
#

set -e
#set -x

_config_properties=("connectionLifetime" "cognosServerPersistTimeoutSeconds")
_property_name_msg="Check the list below for available property names."
_property_val_msg="Check the list below for respective property values."
_property_msg="Check the table below for more details."
_cr_name=""

function usage {
    echo $0: usage: $0 [-h] -t tethered namespace -p config property name -P config property value
}

function help {
    usage
    echo "-h                        prints help to the console"
    echo "-t tethered namespace     namespace where cognos analytics instance is provisioned e.g. cpd-instance (required)"
    echo "-p config property name   property name to set under cogConfigProperties. ${_property_msg} (required)"
    echo "-P config property value  property value to set under cogConfigProperties. ${_property_msg} (required)"
    echo ""
    # Additional information
    echo "Property Name                        Property Value Type          example"
    echo "------------------------------------------------------------------------------------------------------------"
    echo "connectionLifetime                   Number in milliseconds      -p connectionLifetime -P 5500000"
    echo "cognosServerPersistTimeoutSeconds    Number in seconds           -p cognosServerPersistTimeoutSeconds -P 60"

    exit 0
}

while getopts ":ht:p:P:" opt; do
     case ${opt} in
     h)
        help
        ;;
     t)
        _tethered_ns=$OPTARG
        ;;
     p) 
        _config_property=$OPTARG
        ;;
     P)
        _config_property_value=$OPTARG
        ;;
     \?)
        usage
        exit 0
        ;;
     esac
done

function output_info {
    echo $1
}

function output_warn {
    echo $1
}

function output_error {
    echo $1
    exit 1
}

function verifyParameters() {
    if [[ -z ${_tethered_ns} ]]; then
        output_error "A tethered namespace must be provided"
    fi

    if [[ -z ${_config_property} || ${_config_property} == "" ]]; then
        output_error "Please use -p <config_property_name> to specify the CA config property you want to add (ex. connectionLifetime)"
    fi

    validate_property

    if [[ -z ${_config_property_value} || ${_config_property_value} == "" ]]; then
        output_error "Please use -P <config_property_value> to specify the CA config property value you want to add (ex. 55000)"
    fi
}

function validate_property() {
    for _property in "${_config_properties[@]}"; do
        if [[ "${_property}" == "${_config_property}" ]]; then
            return  # Valid property found, exit the function
        fi
    done
    output_error "${_config_property} is invalid. Only these values are supported: ${_config_properties[*]}"
}

function checkForDependencies () {
    # Check if oc is installed
    if ! command -v oc &> /dev/null; then
        echo "oc is not installed."
        echo -e "Install oc using following steps....\n\
            \twget https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz -O oc.tar.gz\n\
            \ttar -xvf oc.tar.gz\n\
            \tmv oc /usr/local/bin\n\
            \tchmod +x /usr/local/bin/oc\n\
            \trm oc.tar.gz"

        output_error need to install oc
    else
        echo "oc is installed."
    fi

    set -e
}

function patchCr() {
    _cr_name=$(oc -n ${_tethered_ns} get caserviceinstance --no-headers -o custom-columns=NAME:.metadata.name)

    if [[ -z ${_cr_name} ]]; then
        output_info "Unable to find CAServiceInstance CR for namespace: ${_tethered_ns}"
        help
    fi

    echo "Setting cognos caConfig property for: ${_cr_name} ..."
    oc patch caserviceinstance ${_cr_name} --type merge -p "{\"spec\":{\"cogConfigProperties\":{\"${_config_property}\": \"${_config_property_value}\"}}}" -n ${_tethered_ns}
    sleep 20
}

function checkCrStatus() {
    # Checking status of ca
    for i in {1..240};do
        local _caStatus=$(oc get caserviceinstance ${_cr_name} -o jsonpath="{.status.caStatus}" -n ${_tethered_ns})
        local _failMessage=$(oc get caserviceinstance ${_cr_name} -o jsonpath="{.status.failMessage}" -n ${_tethered_ns})
        local _ansibleMessage=$(oc get caserviceinstance ${_cr_name} -o jsonpath='{.status.conditions[*].message}{"\n"}' -n ${_tethered_ns})
        local _progress=$(oc get caserviceinstance ${_cr_name} -o jsonpath="{.status.progress}" -n ${_tethered_ns})
        local _progressMessage=$(oc get caserviceinstance ${_cr_name} -o jsonpath="{.status.progressMessage}" -n ${_tethered_ns})

        if [[ ${_caStatus} == "Completed" ]];then
            echo "ca instance cr Install Completed Successfully"
            break
        elif [[ ${_caStatus} == "Failed" ]];then
            echo "ca instance cr Install ${_caStatus} [${_failMessage}]!"
            echo $_ansibleMessage
            exit 1
        fi
        echo "ca instance cr Status: ${_caStatus} [${_progressMessage}] (${_progress})"
        sleep 30
    done
}

checkForDependencies
verifyParameters
patchCr
checkCrStatus