Monday, October 22, 2018

IBM Tivoli Netcool Omnibus multiple choice Question and Answer

Multiple Choice Q & A

1.A company is deploying a multi-tiered architecture with collection, aggregation, and display layers. Which stepsare required to create the primary and backup aggregation ObjectServers? 

A) Configure the omni.dat or Server Editor and generate the interfaces file for NCOMS_P, NCOMS_B and NCOMS_V.Run nco_dbinit with the -customconfigfile option to load the aggregation.sql and initialize the ObjectServer.Start the ObjectServers NCOMS_P and NCOMS_B.
 

B) Configure the omni.dat or Server Editor and generate the interfaces file for AGG_P, AGG_B and AGG_V.Run nco_dbinit with the -customconfigfile option to load the primary.sql or backup.sql and initialize the ObjectServerStart the ObjectServers AGG_P and AGG_B.
 

C) Configure the omni.dat or Server Editor and generate the interfaces file for AGG_P, AGG_B and AGG_V.Run nco_dbinit with the -customconfigfile option to load the aggregation.sql and initialize the ObjectServer.Start the ObjectServers AGG_P and AGG_B.
 

D) Configure the omni.dat or Server Editor and generate the interfaces file for NCOMS_P, NCOMS_B and NCOMS_V.Run nc o_dbinit with the -customconfigfile option to load the primary.sql or backup.sql and initialize theObjectServer.Start the ObjectServers AGG_P and AGG_B

2.The command nco_store_resize -newhardlimit 500mb changes which hard limit to 500MB? 

A) the memstoreoftheNCOMS ObjectServer
B) the amount of disk space available for the IBM Tivoli Netcool/OMNIbus installation
C) the memory footprint of any OMNIbus process
D) the amount of memory available to probe buffering

3.When configuring a Backup ObjectServer, what are the default property values for ActingPrimary andBackupObjectServer?


A) ActingPrimary is TRUE and BackupObjectServer TRUE
B) ActingPrimary is FALSE and BackupObjectServer FALSE
C) ActingPrimary is TRUE and BackupObjectServer FALSE
D) ActingPrimary is FALSE and BackupObjectServer TRUE
 

4.When upgrading probes, what does the UPGRADE.SH script do? 
A) It overwrites the probe older versions with the latest versions.
B) It reinstalls the probes and migrates data to the $NCHOME/omni bus/probes/mi grated directory
C) It migrates probes data to the $NCHOME/omni bus/probes/mi grated directory.
D) It configures the probe files (rules and props) with the latest available information
 

5.Which combination of properties can be used to enable an ObjectServer to serve files to a HTTP client? 
A) NHttpd.EnableHTTP, NHttpd.ListeningPort, NHttpd.SSLEnable, NHttpd.SSLListeningPort
B) NHttpd.AuthenticationDomain, NHttpd.SSLCertificate, NHttpd.DocumentRoot, NHttpd.EnableFileServing
C) NHttpd.DocumentRoot, NHttpd.EnableFileServing, NHttpd.AccessLog, NHttpd.EnableHTTP
D) NHttpd.EnableHTTP, NHttpd.ListeningPort, NHttpd.DocumentRoot, NHttpd.EnableFileServing

6.Which command line tool does the WebGUI administrator use to export and import portal data? 

A) export.sh
B) webportal.bin
C) tipcli.sh
D) run_waapi

7.What are wires used for when developing a custom set of pages in the WebGUI portal? 

A) to link portlets in different workspaces
B) to allow the communication of information between two different users using the same custom portal page
C) to create a link to publish content from one page to another
D) to route or connect client-side events between source and target portlets

8.In the multi-tiered architecture, when an event is reinserted from the collection to the aggregation layer, what is the default deduplication behavior for severity? 

A) The severity is changed only if the incoming severity is higher than the existing severity.
B) Only closed events are reawakened on deduplication. The severity is changed only if the old severity is 0 (clear) and thenew severity is greater than 0 (not clear).
C) The Severity field is always updated on deduplication. The severity from the collection layer will overwrite the severity atthe aggregation layer.
D) The Severity field is never updated on deduplication. The severity from the collection layer is dropped and the severity atthe aggregation layer is kept unchanged.
 

9.The WAAPI host, port, username, password is configured in which file? 
A) $NCHOME/omnibus_webgui/etc/waapi.init
B) $NCHOME/omnibus_webgui/waapi/etc/server.init
C) $NCHOME/omnibus_webgui/etc/server.init
D) $NCHOME/omnibus_webgui/waapi/etc/waapi.init

10.The optional nco_security section of a ProcessAgent config file is used for what? 

A) to list commands/binaries that the ProcessAgent will run from a remote request
B) to configure how username/passwords are authenticated for incoming connections to that ProcessAgent
C) to configure a whitelist of all hosts that the ProcessAgent will accept incoming connections from
D) to list usernames/passwords that are required for authentication connections to other Process Agents

11.Review the output from a rules file syntaxcheck:What is the cause of this error? 

A) CustomerD is not a valid parameter.
B) A call to an undefined variable CustomerD was made on line 39 in the rules file.
C) CustomerD was not set properly in the rulesfile.
D) The CustomerD field does not exist in the ObjectServer NCOMS_P.
 

12.An ObjectServer has been set up to create checkpoint files, and a utility is available to check the validity of the checkpoint files. Which command checks the files? 
A) nco_storepoint
B) nco check_store
C) nco_check_file
D) nco_checkpoint

13.A consultant is working on an IBM Tivoli Netcool/OMNIbus V7.2.1 ObjectServer upgrade to V7.4.Which high level steps migrate the key database? 

A) move the omni.kdb file to a temporary location, create a new key database with nc_gskcmd, import the certificates
B) move the omni.kdb file to a temporary location /nc_gskcmd withthe-load //omni.kbd
C) export the omni.kdb file to a flat file with nco_g_crypt -d, create a new key database with nc_gskcmd, import thecertificates
D) move the omni.kdb to a temporary location, perform the upgrade, move the omni.kdb into the$NCHOME/ etc/security/keys directory

14.A company is deploying a multi-tiered architecture with a collection, aggregation, and display layers. Which steps are required to create a pair of collection layer ObjectServers? 

A) Configure the omni.dat or Server Editor and generate the interfaces file for COL_P_1, COL_B_1 and COL_V_1Edit the properties file for COL_P_1 and COL_B_1 to specify the ObjectServers as collection ObjectServers.Start the ObjectServers COL_P_1 and COL_B_1.
 

B) Configure the omni.dat or Server Editor and generate the interfaces file for COL_P_1, COL_B_1 and COL_V_1Run nco_dbinit with the -customconfigfile option to load the collection.sql to initialize the ObjectServers.Start the ObjectServers COL_P_1 and COL_B_1.
 

C) Configure the omni.dat or Server Editor and generate the interfaces file for COL_P_1, COL_B_1 and COL_V_1Run nco_dbinit with the -customconfigfile option to load the collection.sql.Start the ObjectServers COL_P_1, COL_B_1 and COL_V_1.
 

D) Configure the omni.dat or Server Editor and generate the interfaces file for COL_P_1, COL_B_1 and COL_V_1Start the ObjectServers COL_P_1 and COL_B_1.
 

15.What is the default location of the ObjectServer, probe, and gateway log files? 
A) $NCHOME/log
B) $OMNIHOME/omnibus/log
C) $NCHOME/probes/log
D) $NCHOME/omnibus/log


Answers :-

 
1-C    2-D    3-C    4-C    5-D    6-C    7-D    8-C    9-D    10-C    11-D
12-B    13-A    14-B    15-D


Wednesday, October 3, 2018

Sed Examples for Append, Insert and Replace a line in file

Sed For Append, Insert and Replace a line in a file
Append a Line :-
Syntax :-
sed 'ADDRESS a\
    Line which you want to append' filename

    (OR)

sed '/PATTERN/ a\
    Line which you want to append' filename


Example1 :-Append a line after the 2nd line of the file

sed '2 a\
Add H/W - Mouse, Headphone' config_details.txt


Example2 :-Append a line after the matching word in a line of the file


sed '/Window/ a\
Add H/W - Mouse, Headphone' config_details.txt


Example3 :- Append a line at the end of the file

sed '$ a\
Add H/W - Mouse, Headphone' config_details.txt

Insert a Line :-

Syntax :-
sed 'ADDRESS i\
    Line which you want to append' filename

    (OR)

sed '/PATTERN/ i\
    Line which you want to append' filename


Example1 :-Append a line before the 2nd line of the file

sed '2 i\
Add H/W - Mouse, Headphone' config_details.txt


Example2 :-Append a line before the matching word in a line of the file


sed '/Window/ i\
Add H/W - Mouse, Headphone' config_details.txt


Example3 :- Append a line before last line of the file

sed '$ i\
Add H/W - Mouse, Headphone' config_details.txt


Replace a Line :-

Syntax :-

sed 'ADDRESS c\
    Line which you want to append' filename

    (OR)

sed '/PATTERN/ c\
    Line which you want to append' filename


Example1 :-Replace 2nd line of the file

sed '2 c\
Add H/W - Mouse, Headphone' config_details.txt


Example2 :-Replace matching word line of the file


sed '/Window/ c\
Add H/W - Mouse, Headphone' config_details.txt


Example3 :- Replace last line of the file

sed '$ c\
Add H/W - Mouse, Headphone' config_details.txt

Server To Server Password less connectivity setup

Server To Server Password less connectivity setup
Here I have below two server

First Server :-192.168.2.100
Second Server :-192.168.2.101

I need password less connectivity from "First Server" to "Second Server".

Login to First Server (192.168.2.100) and perform below steps

Step 1: Create Authentication SSH-Kegen Keys on First Server

ssh-keygen -t rsa


Step 2: Create .ssh Directory on Second Server from First server

ssh user@192.168.2.101 mkdir -p .ssh

Step 3: Upload Generated Public Keys on Second Server from First Server

cat .ssh/id_rsa.pub | ssh user@192.168.2.101 'cat >> .ssh/authorized_keys'

Step 4: Set Permissions on Key File on Second Server from First Server

ssh user@192.168.2.101 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

Tuesday, October 2, 2018

crontab command examples

crontab (Job Scheduler) 

Crontab :- Crontab is a job scheduler in Linux.

Crontab Options:-
crontab -l :- Listing all scheduled jobs
crontab -r :- Remove all scheduled job
crontab -e :- Editing the scheduled job
crontab -l -u username :- Listing of all scheduled jon for User


Syntax:-


1) How can we take a backup of all scheduled jobs ?
crontab -l>jobs.txt

2) How we can install jobs in cron by text file ?
crontab jobs.txt

3) How can we schedule a monitoring.sh script for every 10 minutes ?
*/10 * * * * sh /path/monitoring.sh

Note:- path is the path where monitoring.sh script is placed

4) How can we schedule a dailyreport.sh for daily early morning at 3:00 AM ?
00 03 * * * sh /path/dailyreport.sh

5) How can we schedule report.sh for every Monday morning 10.15 AM ?
15 10 * * 1 sh /path/report.sh



6) How can we schedule a job.sh for First Friday of every month at 8:20 AM ?
20 08 01-07 * 5 sh /path/job.sh

7) How can we schedule a.sh for 2:15 PM, 4:15 PM and 6:15 PM ?   
15 02,04,06 * * * sh /path/a.sh

8) How can we schedule fullbackup.sh for 15th Apr 08:30 AM ?
30 08 15 04 * sh /path/fullbackup.sh

9) How can we schedule a cronjob for weekdays during working hours (9:00AM to 6:00PM) ?

00 09-18 * * 1-5 sh /path/os_monitoring.sh

10) How can we scheduled a command for daily ? 
@daily command

Note:- Same way, we can schedule any command/job for below as well

@monthly
@yearly
@reboot

11) How can we disable a scheduled cronjob ?
By adding "#" at the begining of scheduled jon line

#00 09-18 * * 1-5 sh /path/os_monitoring.sh


Problem :- "You are not allowed to use this program"
When we tried to access the cron, we got an error.

$ crontab -l
You  are not allowed to use this program (crontab)
See crontab(1) for more information

Solution :-This error is due to user don’t have access to crontab.

There are two files on server, to allow & deny access to crontab, Files are named as

/etc/cron.allow & /etc/cron.deny

check that if user is present in cron.deny file. if it is present remove user from cron.deny file & add user to cron.allow file.

If user is not present in any file then add user in /etc/cron.allow file.

# cat /etc/cron.allow
root

so, i haved added oracle user to cron.allow file, file will look as follows:

# cat /etc/cron.allow
root
myuser

Now user will be able to access the crontab.

$ crontab -l
no crontab for oracle

NOTE – If the files“/etc/cron.allow” and “/etc/cron.deny” files are not present on server / system, we can create both files manually.

# touch /etc/cron.allow /etc/cron.deny

xargs command examples

xargs Command

1) How can we limit output per line for any command like ls command output ?
ls |xargs -n 3

2) How can we ask for prompt from xargs command before execution ?
ls |xargs -p -n 3

3) How can we remove all html files older than 30 days by help of xargs ?

find / -name "*.html" -type f -mtime +30 |xargs rm -f 

4) How can we remove all files those have white-space " " in it's name and extension is csv ?

find / -name "*.csv" -print0 | xargs -0 rm -f 

Note:- "print0" option search files those have whitespace in it's name with regular file name as well.

5) How can we find all txt files those have "string" word in it's content ?

find / -name "*.txt" -type f |xargs grep string

6)  Find all mp3 files and copy all to directory by xargs 

find / -name "*.mp3" -type f |xargs cp {} /path/

7) Find all mp3 files and archived those 

find / -name "*.mp3" -type f |xargs tar -cvfz songs.tar.gz

scp command examples

scp Command

1) Transfer single file to remote host 
scp abc.txt username@remote_ip:/remote_path/

2) Transfer multiple files to remote host 
scp *.txt username@remote_ip:/remote_path/
                OR
scp /path/*.txt username@remote_ip:/remote_path/               
                OR
scp /path/* username@remote_ip:/remote_path/
                OR
scp abc.txt abc1.txt abc2.txt username@remote_ip:/remote_path/               

3) Copy single file from remote to local 
scp username@remote_ip:/remote_path/abc.txt .
                
4) Copy multiple files from remote to local 
scp username@remote_ip:/remote_path/*.txt .

5) Copy a directory to remote host 
scp -r abc username@remote_ip:/remote_path/

6) Transfer single file to remote host in silent mode 
scp -q /abc/xyz.txt username@remote_ip:/remote_path/

Note:- "-q" option is for silent mode and progress of command and error will not be displayed on monitor

7) Transfer single file to remote host via specific port 
scp -P 922 /abc/xyz.txt username@remote_ip:/remote_path/

Note:- If port is not default then Port Number need to mentioned by "-P" option

8) Transfer faster by "-C" option for big file to remote host
scp -C -P 922 /abc/xyz.txt username@remote_ip:/remote_path/

Note:-"-C" option will compress files on the go. Compression is happen in the network only.
      When the file is arrived to the destination server, it will return into the original size.
     
9) Transfer files from one remote host to another remote host
scp username@remote_host1:/remote1_path/ username@remote_host2:/remote2_path/

10) Transfer a file with preserve file attributes
scp -p test.txt username@remote_ip:/remote_path/

touch command examples

touch Command

1) Create a blank file
touch abc.txt

2) Creating multiple blank file
touch abc.txt abc1.txt abc2.txt abc3.txt

3) Creating multiple blank files with Regular Expression
touch {A..Z}.txt
touch {0..9}.csv

4) Changing the file access time
touch -a abc.txt

5) Changing the file modification time
touch -a abc.txt

6) Changing modification time of multiple files using RE
touch -m *.txt

7) Changing the file access and modification time of a file
touch -am abc.txt

8) Changing the file access and modification time of a file with reference of another file
touch -r xyz.txt abc.txt

grep command examples

grep Command

grep command :- grep command is used to search files and print lines that have the matched string .
  
1) Print all lines that have the "error" word in file
grep error file.txt

2) Print all lines of files that have the "error" word
grep error file1.txt file2.txt file3.txt

3) Print all lines that have unix word in any capital and small letter
grep -i unix file.txt

Note:- "i" option for case insensitive search.

4) Print all lines those starts with digit
grep "^[0-9]*" file.txt

Note:-"^" denote start of line 

5) Print all lines those does not start with digit
grep "^[^0-9]*" file.txt

Note:-"^" sign inside [ ] denote negation of given range 

6) Print all lines those end with digit
grep "*[0-9]$" file.txt

7) Print all lines those does not end with digit
grep "*[^0-9]$" file.txt

8) Print all matched lines with 2 lines before matched line that have the "error" word in file 
grep -B 2 error file.txt

9) Print all matched lines with 3 lines after matched line that have the "error" word in file 
grep -A 3 error file.txt

10) Print all lines that does not contain "error" word in file
grep -v error file.txt

Note:- "v" option invert the selection

11) Print all non-empty lines
grep -v "^$" file.txt

12) Print line count that have matched pattern in file
grep -c error file.txt

13) Print all matched line with line number
grep -n error file.txt

14) Print the file name that contain matched pattern
grep -l error *.txt

find command examples

Find Command

Find Command:-The Linux find command is very powerful. It can search the entire Filesystem to find files and directories according to the search criteria you specify.

Basic Syntax :- find path option
 

Values for "path" :-
       1)  (.) denote current directory
       2)  (/) denote root directory or full system
       3)  (/path/) denote the path where you want to search 


"Options" for Find command :-
1) time    a) mtime
                 b) ctime
                 c) atime
 

2) min        a) amin
                    b) cmin
                    c) mmin
 

3) name       a) name
                     b) iname
4) size
5) perm
6) type
7) user
8) group

9) empty 
 

Examples:-
1) Find all empty files in /tmp directory
find /tmp -type f -empty

2) Find all empty directories in /tmp directory
find /tmp -type d -empty

3) Find all hidden files in /tmp directory
find /tmp -type f -name ".*"

4) Fill all files of User "oracle" in /tmp directory 
find /tmp -user oracle -type f

5) Fill all files of Group "developer" in /tmp directory
find /tmp -group developer -type f

6) Find all files whose modification times is 50-100 days older from today
find / -mtime +50 –mtime -100 -type f

7) Find all files those modified in last 1 hour
find / -mmin -60 -type f

8) Find all files those size is between 50MB - 100MB
find / -size +50M -size -100M -type f

9) Find all mp3 extension files those size is greater than 10MB 
find / -type f -name *.mp3 -size +10M

10) Find all mp3 extention files and copy to /tmp/Music directory
find / -type f -name "*.mp3" -exec cp {} /tmp/Music \;


11) Find files that don't have a pattern (.html)
find / -type f -not -name "*.html"
           (OR)
find / -type f ! -name "*.html"

12) Find all files in multiple directories (/opt /usr /var) with extension txt
find /opt /usr /var -type f -name "*.txt"

13) Find all files with different extensions 
find / -type f \( -name "*.c" -o -name "*.sh" \)

find / -type f \( -name "*.log" -o -name "*.xml" -o -name "*.html" \) 


Find with "exec" command :- 



14) Find all files having 777 permission and change it to 644
find / -perm 777 -type f -exec chmod 644 {} \;

15) Find all directories having 777 permission and change it to 755
find / -perm 777 -type d -exec chmod 755 {} \;

16) Find all files with extension java and having the "string" in its content
find / -type f -name "*.java" -exec grep -l string {} \;
                    (OR)
find / -type f -name "*.java" -exec grep -il string {} \;    

Note:-i option with grep search case insensitive

17) copy one file to many directories by find command
find dir1 dir2 dir3 dir4 -type d -exec cp header.html {} \;

18) Find all .err files older than 60 days and remove those files
find / -type f -name "*.err" -mtime +60 -exec rm -f {} \;

19) Find all directories older than 90 days and remove those   
find . -type d -mtime +90 -exec rm -rf {} \;


Find with "xargs" command :-  

20) Find all files older than 90 days and with extension mp3 and size is greater than 5MB, tar all those files
find / -type f -name "*.mp3" -mtime +90 | xargs tar cvf myfile.tar
                    (OR)
find . -type f -name '*.mp3' -mtime +90 -print0 | xargs -0 tar rvf music.tar

Note:-print0 helps handle spaces in filenames

ps command examples

ps Command

ps command:- ps command is used to see current running processes.

1) Display currently running processes 
ps -ef

Note:-"-e" option is for displaying all the processes and "-f" option is for displaying full format listing.
                     (OR)
ps -aux
     
2) Display all running processes of a User
ps -f -u username

3) Display the processes based on PIDs or PPIDs   
ps -f --ppid 2359

ps -f  -p 4389,5268,9421

4) Display processes in Hierarchy
ps -f --forest

ps with grep and more for displaying selected data:-
5) Display processes which have a "string" word in its name
ps -eaf|grep string

6) Display the "ps -eaf" result pagewise
ps -ef|more
OR
ps -ef|less




ps with --sort option for sorting data:-
7) Display the "ps -eaf" result in sorted order of column
ps -eaf --sort pcpu
ps -eaf --sort pid
ps -eaf --sort ppid

Below following values can be put in "--sort" option
cmd     - Executable name
pcpu    - CPU utilisation
flags   - Flags
pgrp    - Process group id
cutime  - Cumulative user time
cstime  - Cumulative system time
utime   - User time
pid     - Process ID
ppid    - Parent process ID
size    - Size
uid     - User ID
user    - User Name

OR

ps aux --sort=-pcpu,+pmem

Note:- Here "+" denotaing increasing order and "-" denotaing decreasing order

8) Display the top 10 processes consuming most of the cpups aux sort=-pcpu |head -10

9) Display selected column 
ps -e -o pid,uname,pcpu,pmem,comm

Note:- "-o" option is used to display selected columns

10) Display "ps" result in realtime process viewer
watch -n 1 'ps -e -o pid,uname,cmd,pmem,pcpu --sort=-pmem,-pcpu | head -15'

Note:-Output would be updated every 1 second to refresh the stats.

mv command examples

mv Command

1) Rename a file in same directory by mv command
mv abc.txt abc1.txt

2) Move a file in a directory 
mv abc.txt /home/unix/

3) Rename a file and Move to in a directory 
mv abc.txt /home/unix/abc1.txt

4) Move multiple files with same extension in a directory 
mv *.txt /home/unix/

5) Move multiple files in a directory 
mv abc.txt abc1.txt abc2.txt /home/unix/

6) Move a directory in a another directory 
mv xyz /home/unix/

cp command examples

cp Command

1) Copy single file on same directory 
cp abc.txt  abc1.txt

2) Copy single file on different directory
cp abc.txt  /home/unix/abc1.txt

3) Copy multiple files with same extension in different directory
cp *.txt  /home/unix/

4) Copy multiple files in different directory
cp abc.txt abc1.txt abc2.txt /home/unix/

5) Copy a directory to different directory 
cp -R xyz/ /home/unix/

6) Copy multiple directory to different directory
cp -R xyz/ abc/ abc1/ /home/unix/

7) Copy a file with preserve file attributes (permissions, group and user owernship)
cp --preserve abc.txt  abc1.txt

8) Creating a hard link with cp command
cp -l abc.txt abc1.txt

9) Creating a soft link with cp command
cp -s abc.txt /home/unix/abc1.txt

10) Showing progress of cp command
cp -v *.txt /home/unix/

Remove CTRL-M characters from a file in UNIX

 We can remove ^M by below methods 1st Method - Using sed command Type below command:    sed -e "s/^M//" filename > newfilena...