Tip or Technique TM1 Useful Commands Product(s): TM1 Area of Interest: Development

TM1 Useful UNIX Commands 2

Copyright Copyright © 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC is an IBM Company. While every attempt has been made to ensure that the information in this document is accurate and complete, some typographical errors or technical inaccuracies may exist. Cognos does not accept responsibility for any kind of loss resulting from the use of information contained in this document. This document shows the publication date. The information contained in this document is subject to change without notice. Any improvements or changes to the information contained in this document will be documented in subsequent editions. This document contains proprietary information of Cognos. All rights are reserved. No part of this document may be copied, photocopied, reproduced, stored in a retrieval system, transmitted in any form or by any means, or translated into another language without the prior written consent of Cognos. Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. All other names are trademarks or registered trademarks of their respective companies. Information about Cognos products can be found www.cognos.com This document is maintained by the Best Practices, Product and Technology team. You can send comments, suggestions, and additions to [email protected] .

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 3

Contents 1 INTRODUCTION ...... 4

1.1 PURPOSE ...... 4 1.2 APPLICABILITY ...... 4 1.3 EXCLUSIONS AND EXCEPTIONS...... 4 2 USEFUL UNIX COMMANDS FOR TM1 ...... 4 3 SIMPLE COMMANDS ...... 4

3.1 - RETURN WORKING DIRECTORY NAME ...... 4 3.2 - LIST CONTENTS OF DIRECTORY ...... 4 3.3 HOW TO SET BACKSPACE KEY TO DELETE...... 5 3.4 - CONCATENATE AND DISPLAY FILES ...... 5 3.5 - DISPLAY STATUS OF DISK SPACE ON SYSTEMS ...... 6 3.6 - CHANGE WORKING DIRECTORY...... 7 4 DETAILED COMMANDS ...... 8

4.1 - REPORT PROCESS STATUS ...... 8 4.2 - A UTILITY THAT PROVIDES A ROLLING DISPLAY OF TOP CPU USING PROCESSES...... 8 4.3 - REPORT VIRTUAL MEMORY STATISTICS...... 9 4.4 MPSTAT - REPORT PER-PROCESSOR STATISTICS ...... 10 4.5 SAR -M (FOR HPUX) ...... 10 4.6 PSRINFO - DISPLAYS INFORMATION ABOUT PROCESSORS...... 11 4.7 SYSDEF - OUTPUT SYSTEM DEFINITION...... 12 4.8 TOP ...... 13 4.9 CHATR +Q3P ENABLE TM1S.EXE...... 14 4.10 –USR1 ...... 15 5 USING PSTACK AND SUM COMMANDS TO GATHER DUMPS DETAILS...... 15

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 4

1 Introduction

1.1 Purpose This document provides some information on using basic UNIX commands to help with the administration of TM1 when running in a UNIX environment.

1.2 Applicability TM1 version 9.1 and prior running on UNIX operating system

1.3 Exclusions and Exceptions This document is valid only for UNIX operating systems and is not applicable to Windows operating system implementations of TM1.

2 Useful UNIX Commands for TM1

The basis for this document is to give the TM1 user some valid UNIX commands that will help administer TM1 on a UNIX server.

These commands are based off of a Solaris 2.8 server. However, most of these commands are universal across the 3 platforms that IBM Cognos supports (AIX, Sun, and HP)

3 Simple Commands

3.1 pwd - return working directory name

#pwd

3.2 ls - list contents of directory

# ls

ls Options

# ls –la

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 5

Gives information on the files in the directory (ie. permissions, size, date last used)

3.3 How to set Backspace Key to delete

#stty erase [hit backspace key]

3.4 cat - concatenate and display files

#cat Tm1s.cfg

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 6

3.5 df - display status of disk space on file systems

df Options

#df -k

Displays in Kilobytes

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 7

3.6 cd - change working directory

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 8

4 Detailed Commands

4.1 ps - report process status

# ps –edf | Tm1

This command will search all the processes that are running on the UNIX server that have TM1 in the name. This is a great command to out how many TM1 servers are running and started them.

4.2 top - a utility that provides a rolling display of top cpu using processes # top

CPU usage

Physical RAM What RAM is being used

Top process using most of the system resource

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 9

4.3 vmstat - report virtual memory statistics

#vmstat

vmstat reports virtual memory statistics regarding process, virtual memory, disk, trap, and CPU activity

vmstat Options

#vmstat 1

reports a vmstat response every second

# vmstat 1 >vmstatlog

outputs the 1 second response to log file called vmstatlog

#vmstat -S

Report on swapping rather than paging activity. This option will change two fields in vmstat's ``paging'' display: rather than the ``re'' and ``mf'' fields, vmstat will report ``si'' (swap-ins) and ``so'' (swap-outs).

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 10

4.4 mpstat - report per-processor statistics

#mpstat

Number of CPUs per system

4.5 sar -M (for HPUX)

A command that may help gain some more detail on the CPU usage. This command is similar to mpstat on Solaris.

The sar command with -M will segregate CPU usage per CPU. If you in sar -M 1 10 this will give a CPU response every second for 10 seconds. What I would do is the following sar -M 5 100 >/tmp/sar.log

What this will do is every 5 second report CPU usage 100 times and output the stats to a log file. Run this command when you kick off 7 TI processes again

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 11

4.6 psrinfo - displays information about processors.

#psrinfo

Without the processor_id operand, psrinfo displays one line for each configured processor, displaying whether it is on-line, non-interruptible (designated by no-intr), off-line, or powered off, and when that status last changed. Use the processor_id operand to display information about a specific processor.

psrinfo Options

# psrinfo –v

Verbose mode. Displays additional information about the specified processors, including: processor type, floating point unit type and clock speed. If any of this information cannot be determined, psrinfo displays unknown.

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 12

4.7 sysdef - output system definition

Note: Best to output this to a log file because a lot of information is returned

#sysdef >syslog

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 13

4.8 TOP

Top is scripted command that needs to placed in the /usr/local directory. This command gives valuable details on processes running and how much CPU and physical RAM is being used

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 14

4.9 chatr +q3p enable Tm1s.exe

Brings back some useful information on the Tm1s.exe

$ chatr +q3p enable Tm1s.exe Ignoring options "+q3penable" for files: Tm1s.exe chatr(warning): file "Tm1s.exe" appears to be corrupted and does not have a DT_FLAGS dynamic table entr y. Therefore, the -B options will not function properly. Tm1s.exe: 64-bit ELF executable shared library dynamic path search: LD_LIBRARY_PATH enabled first SHLIB_PATH enabled second embedded path enabled third /usr/lib/pa20_64:/opt/langtools/lib/pa20_64 shared library list: libpthread.1 libstd.2 libstream.2 libCsup.2 libm.2 libcl.2 libc.2 libdl.1 shared library binding: deferred global hash table disabled shared library mapped private disabled shared library segment merging disabled shared vtable support disabled segments: index type address flags size 5 text 4000000000000000 z---c D (default) 6 data 8000000100000000 ---m- D (default) executable from stack: D (default) static branch prediction disabled kernel assisted branch prediction enabled lazy swap allocation for dynamic segments disabled nulptr references disabled

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 15

4.10 Kill –USR1

Kill –USR1

• USR1 has to be placed in capital letters • being that of the TM1 server running on unix

* allows admin to shutdown TM1 server and perform a save data

5 Using PSTACK and SUM commands to gather dumps details

The strictly accurate statement about running ‘pstack’ is that the path to the TM1 server executable must be exactly the same when pstack is run as it was when the server was started for ‘pstack’ to be able to resolve the symbols out of the executable. The startup command for the process is written into the core file, and that is what ‘pstack’ uses to find the executable, and thereby the symbols.

If the user does not get this correct one gets a ‘pstack’ output full of question marks like:

00000001001cb26c ???????? (1006f071a, ffffffff7fffc998, 10079fa8f, 2e36222c223022, 22, 0) 00000001001cb400 ???????? (1006f071a, ffffffff7fffc93e, 0, 22000000, 0, 1006cfa12) 00000001001ccab8 ???????? (1006f071a, 1006eebc4, 1006eec45, 10070c5e0, 30db, 5b4) 0000000100146148 ???????? (1006f0f54, fff, 100141e58, 0, 7000, 74) 0000000100145814 ???????? (ffffffff7fffe9c7, 50, ffffffff7e0b6f60, ffffffff7e0c3928, ffffffff7fffe9c7, 1006d2ea0) 00000001002d5cbc ???????? (3, ffffffff7ffffac8, ffffffff7ffffae8, 0, 0, 100000000) 000000010013a3fc ???????? (0, 0, 0, 0, 0, 0)

Examples: 1) User is in the directory “/appl/Applix” and start the server with the command “bin/tm1s.exe –z …” In the core file is the executable path “bin/tm1s.exe” so user must be in the directory “/appl/Applix” when pstack is run so that “bin/tm1s.exe” find the executable. Core file can be anywhere.

2) User starts the TM1 server with a full pathname, “/appl/Applix/bin/tm1s.exe –z …” In the core file is the full path “/appl/Applix/bin/tm1s.exe” so ‘pstack’ can be run from anywhere.

IBM Cognos Proprietary Information

TM1 Useful UNIX Commands 16

We should, as part of the standard instructions for Solaris and HP, have customers:

1) Do a “sum” on the core file and submit the produced values with any inquiry report. Run “sum path-to-core-file” This produces something like: 34216 7584 core.13307

2) Do not use “zip” on Unix. Use “compress”

IBM Cognos Proprietary Information