顯示具有 ITM Agent 標籤的文章。 顯示所有文章
顯示具有 ITM Agent 標籤的文章。 顯示所有文章

2014-01-12

ITM CEC Base agent issue

ITM CEC Base agent重啟後,ITM無法顯示CEC的數據,解決步驟如下:

STEPS TO RECYCLE THE SHARED MEMORY:
1.
Stop all the processes which use the SPMI shared library
(xmservd,filtd, xmperf, 3dmon, ptxrlog, harmd, topas, any PSSP process)
if they are currently running your AIX LPAR. 


2.
Stop the ITM system P agents (PX, PK, PH) that you have running on
this system. 


3.
To find if any zombie processes are running on your machine.
a. Run
# ps -ef | grep Provider
Kill each one of them "kill <pid> 


b. Run
ps -ef | grep kpkagent
ps -ef | grep kpxagent
ps -ef | grep kphagent
Kill each one of them "kill <pid>" 


c.
Check if there are any defunct processes
"ps -ef | grep defunct" 


4. Kill the processes that are using the shared memory. 
genld -l | grep -p Spmi 

5.
Run "ipcs -m" command and check for any segment "KEY" that begins
with '0x78'
, as listed below:
T ID KEY
m 0 0xc76283cc
m 1 0x78002323
If there are any such segments starting with 0x78, make sure the process
which uses those shared segments is stopped (or terminate it with kill
command) 


6. Then run: "ipcrm -m <ID #>" to
clear the shared memory segments

7.
Run "slibclean"

8. Restart system P agents - PH PX PK 


2013-08-06

ITM Agent change hostname

在TEP上,遇到Agent端的hostname有重複的時候,TEP管理的介面上會一直出現更新的訊息(圖1)。因此需要在Agent端做一些調整,方能解決問題。
(圖1)

On Linux/UNIX agent systems, these parameters can be added to the xx.ini file, where xx is the product code of the agent.

Example: edit the xx.ini file and add the following lines, where <your hostname> = the name you chose
to have displayed in the TEP navigator tree.
CTIRA_HOSTNAME=<your hostname>
CTIRA_SYSTEM_NAME=<your hostname>

After making the changes to the file and saving it, a restart of the agent is required.


For the Windows agents, you need to perform the following steps:

1) Stop the agent
2) In the TEP Managed System Status workspace, clear the offline entry for the agent
3) Ensure the corresponding navigator item has been removed
4) In the Manage Tivoli Enterprise Monitoring Services (MTEMS) GUI, right-click on the agent and select Advanced->Edit Variables...
5) Click on Add
6) For CTIRA_HOSTNAME, choose the variable from the list of selected variables
7) For the value, replace "%computername%" with the desired hostname, making sure to leave the remaining part of the value (typically .TYPE=REG_EXPAND_SZ) unchanged
8) For CTIRA_SYSTEM_NAME, type in the variable name and also the desired value
9) Select OK and start the Windows OS agent.

Alternative method: The following may be used to manually change the hostname on the Windows system:

1) Stop the agent
2) Clear the offline entry from Managed System Status workspace
3) Ensure the corresponding navigator item has been removed
4) Edit the <ITMHOME>\TMAITM6\kxxcma.ini file to include:
[Override Local Settings]
CTIRA_HOSTNAME=<hostname> .TYPE=REG_EXPAND_SZ
CTIRA_SYSTEM_NAME=<hostname>
where xx is the product code and <hostname> is the desired name to appear in the TEP
5) Reconfigure the agent through the MTEMS
6) Start the agent

Note that all agents running on a system must use the same values for both the CTIRA_HOSTNAME and CTIRA_SYSTEM_NAME parameters. If this construct is not followed, unpredictable results can occur. This applies to agents on all operating systems.

2013-03-26

透過背景模式進行ITM Agent安裝

先前安裝ITM Agent至90台LPAR時,若沒有善加運用背景執行程序的方法,當安裝1台需花費10分鐘的話,90台至少就要花費900分鐘!所以透過ssh中提供的f參數時,則可將程序丟到背景執行以達到同一時間並行運行安裝程序。


#!/usr/bin/ksh

for HOST in `cat /tmp/host.lst`;
do
   echo "$HOST start....."
   ssh -p 2222 -f $HOST '/tmp/agent_silent_install.pl'
 
   ExecStatus=$?
   if [ $ExecStatus -eq 0 ]; then
      echo "$HOST finish..." >> /tmp/itm.log
   else
      echo "$HOST fail..." >> /tmp/itm.log
   fi
done

2012-10-23

ITM Agent Owner由ROOT轉換為Normal User

啟用ITM Agent的Owner預設會是由root所持有,但使用者不希望當Agent發生異常時,需要透過root才能重新啟動Agent的服務,因此經由IBM工程師給的建議和執行程序,我將它簡單的編譯成Script,主要還是方便透過這支Script來修改多台系統的配置,程序如下:


#!/usr/bin/perl -w
use strict;
##################################################
## Target:                                         ##
## transfer itm agent owner to normal user          ##
## ##
## 1.chown -R seadm:se /opt/IBM/ITM/ ##
## 2.chmod -R o-rwx /opt/IBM/ITM/ ##
## 3./opt/IBM/ITM/bin/SetPerm.sh ##
## 4./opt/IBM/ITM/bin/UpdateAutoRun.sh ##
## 5./opt/IBM/ITM/bin/itmcmd agent stop all ##
## 6.Disable ux agent under /etc/rc.itm1 ##
## 7./etc/rc.itm1 ##
## ##
## Date:   2012/10/22 ##
## Ver:    1.2 ##
## Author: Jammy Yu ##
##################################################

## Initial setup
my $command;
my $source_dir = '/tmp';
my $env_dir = '/etc';
my $itm_dir = '/opt/IBM/ITM';
my $user = 'seadm';
my $group = 'se';
my $time = `date +%Y-%m-%d_%H:%M:%S`;

##################################################
## 0. Initial test ##
##################################################
print"Transfer agent owner from root to $user has Step0~7:\n";
print"-" x 52,"\n";
print"step0...Initial check\t\t\t";
if (!-e "$itm_dir") {
   print "Please check itm has been installed first!\n";
   exit 1;
}
if (!-e "$source_dir/agent_owner_transfer_SetPerm") {
   print "Please check agent_owner_transfer_SetPerm file has been under $source_dir dir!\n";
   exit 1;
}
print"OK!\n";

##################################################
## 1.chown -R seadm:se /opt/IBM/ITM/ ##
##################################################
print"step1...Chown -R $user:$group /opt/IBM/ITM/\t";
$command = "/usr/bin/chown -R $user:$group $itm_dir";
`$command`;
print"OK!\n";

##################################################
## 2.chmod -R o-rwx /opt/IBM/ITM/ ##
##################################################
print"step2...Chmod -R o-rwx /opt/IBM/ITM/\t";
$command = "/usr/bin/chmod -R o-rwx $itm_dir";
`$command`;
print"OK!\n";

##################################################
## 3./opt/IBM/ITM/bin/SetPerm ##
##################################################
print"step3...Running SetPerm.sh\t\t";
if (-e "$itm_dir/bin/SetPerm")
{
   $command = "/usr/bin/cp -f $itm_dir/bin/SetPerm $itm_dir/bin/SetPerm.bak_$time";
   `$command`;
   $command = "/usr/bin/cp -f $source_dir/agent_owner_transfer_SetPerm $itm_dir/bin/";
   `$command`;
   $command = "$itm_dir/bin/agent_owner_transfer_SetPerm";
   `$command`;
}
else
{
   $command = "/usr/bin/cp -f $source_dir/agent_owner_transfer_SetPerm $itm_dir/bin/";
   `$command`;
   $command = "$itm_dir/bin/agent_owner_transfer_SetPerm";
   `$command`;
}
print"OK!\n";

##################################################
## 4./opt/IBM/ITM/bin/UpdateAutoRun.sh ##
##################################################
print"step4...Running UpdateAutoRun.sh\t";
$command = "$itm_dir/bin/UpdateAutoRun.sh";
`$command`;
print"OK!\n";

##################################################
## 5./opt/IBM/ITM/bin/itmcmd agent stop all ##
##################################################
print"step5...Stop itm agent\t\t\t";
$command = "$itm_dir/bin/itmcmd agent stop all >/dev/null 2>&1";
`$command`;
print"OK!\n";

##################################################
## 6.Disable ux agent under /etc/rc.itm1 ##
##################################################
print"step6...Disable ux agent line\t\t";
if (-e "$env_dir/rc.itm1")
{
   $command = "/usr/bin/cp -f $env_dir/rc.itm1 $env_dir/rc.itm1.bak_$time";
   `$command`;
}

open(TMP, "$env_dir/rc.itm1.bak_$time") || die "$!\n";
open(FHD, "> $env_dir/rc.itm1") || die "$!\n";

while ( <TMP> )
{
   chomp;
   if ( /ux/ )
   {
      $_ =~ s/$_/#$_/;
      print FHD "$_\n";
   }
   else
   {
      print FHD "$_\n";
   }
}

close(FHD);
close(TMP);

print"OK!\n";

##################################################
## 7.re-execute /etc/rc.itm1 ##
##################################################
print"step7...Running /etc/rc.itm1\t\t";
$command = "$env_dir/rc.itm1";
`$command`;
print"OK!\n";
print"-" x 52,"\n";

2012-10-13

透過Silent Install的模式進行ITM Agent的安裝和配置

當需要安裝ITM Agent數量變多的時候,我們可能會希望讓系統自行安裝和配置,甚至於順便啟動服務。

下列提供的作法共分為七個步驟,分別是:

1.安裝Unix OS Agent、AIX Premium Agent和Unix LOG Agent
2.將原先kul_config檔案備份並將定義好的kul_config檔案拷貝至/opt/IBM/ITM/config目錄下
3.檢查Unix LOG Agent欲檢查的目錄及檔案是否存在
4.將原先syslog.conf檔案備份並將定義好的syslog.config檔案拷貝至/etc目錄底下
5.重新啟動syslog daemon
6.將ITM Agent安裝檔刪除
7.僅啟動AIX Premium和Unix LOG Agent,故必須把Unix OS Agent自動帶起服務的項目先Disable




#!/usr/bin/perl -w
use strict;
##################################################
## Target                                                                                 ##
## 1.Install & Config ul,ux,px agent                                        ##
## 2.Replace ITM config file:kul_configfile                              ##
## 3.Check directory and files for ul agent                          ##
## 4.Replace syslog entry to /etc/syslog.conf                            ##
## 5.Start syslogd but ITM agent                                          ##
## 6.Delete temp ul ux px agent directory                               ##
## 7.Disable ux agent from /etc/rc.itm1 file                              ##
## ##
## Date:   2012/10/12         ##
## Ver:    1.7         ##
## Author: Jammy Yu ##
##################################################

## Initial setup
my $source_dir = '/TWSE';
my $install_dir = '/opt/IBM/ITM';
my $env_dir = '/etc';

## Package source
my %agent_relation = (
"ux" => "$source_dir/ITM_V6.2.3_Agent_Multiplatform",
"ul" => "$source_dir/ITM_V6.2.3_Agent_Multiplatform",
"px" => "$source_dir/ITM_Agents_SystemP_V6.2.2",
);

## LOG record
open(LOG, ">$source_dir/agent_install.log") || die "$!\n";

## Start Program
my $start_time = `date +%Y-%m-%d_%H:%M:%S`;

print LOG "Program start time:$start_time\n";

##################################################
## 1.Install & Config ul,ux,px agent                                 ##
##################################################
while (my ($agent_name, $agent_source_dir) = each (%agent_relation))
{
   ## Check source agent directory
   if (!-e "$agent_source_dir")
   {
      print"ERROR: Please check source agent directories are aready under the $source_dir directory\n";
      exit 1;
   }
   ## Chmod agent Directory
   `chmod -R 777 $agent_source_dir`;
   print LOG "Chmod agent Directory:$agent_source_dir to 777\n";
   ## Install agent
   `$agent_source_dir/install.sh -q -h $install_dir -p $agent_source_dir/$agent_name\_silent_install.txt`;
   print LOG "Install agent name:$agent_name,\t Source agent dir:$agent_source_dir\n";

   ## Config agent
   `$install_dir/bin/itmcmd config -A -p $agent_source_dir/silent_config.txt $agent_name`;
   print LOG "Config agent name:$agent_name\n";
}
print LOG "-" x 80,"\n";

##################################################
## 2.Replace /opt/IBM/ITM/config/kul_configfile                 ##
##################################################
my $itmconfig_dir = '/opt/IBM/ITM/config';
my $command;
if (-e "$itmconfig_dir/kul_configfile")
{
   $command = "/usr/bin/mv $itmconfig_dir/kul_configfile $itmconfig_dir/kul_configfile.bak_$start_time";
   `$command`;
   $command = "/usr/bin/cp -f $source_dir/kul_configfile $itmconfig_dir/kul_configfile";
   `$command`;
   $command = "/usr/bin/chmod 777 $itmconfig_dir/kul_configfile";
   `$command`;
}
else
{
   $command = "/usr/bin/cp -f $source_dir/kul_configfile $itmconfig_dir/kul_configfile";
   `$command`;
   $command = "/usr/bin/chmod 777 $itmconfig_dir/kul_configfile";
   `$command`;
}

##################################################
## 3.check directory and files for ul agent                                 ##
##################################################
my %file_relation = (
        "/var/log/syslog/critical_files" => "D",
        "/var/log/syslog/auth_files" => "D",
        "/var/log/syslog/user_files" => "D",
        "/var/log/syslog/sftp_files" => "D",
        "/var/log/syslog/critical" => "F",
        "/var/log/syslog/auth" => "F",
        "/var/log/syslog/user" => "F",
        "/var/log/syslog/sftp" => "F",
);

while (my ($path, $type) = each (%file_relation))
{
=cut
   ## Build directory and files
   if ( $type eq 'D' )
   {
      build_dir($path);
   }
   elsif ( $type eq 'F' )
   {
      build_file($path);
   }
=cut
   ## Check directory and files
   if (-e "$path" )
   {
      print LOG "Type:$type,PATH:$path\t check: Exist!\n";
   }
   else
   {
      print LOG "Type:$type,PATH:$path\t check: Doesn't Exist!\n";
   }
}
print LOG "-" x 80,"\n";

##################################################
## 4.Replace syslog entry to /etc/syslog.conf                         ##
##################################################
if (-e "$env_dir/syslog.conf")
{
   $command = "/usr/bin/cp -f $env_dir/syslog.conf $env_dir/syslog.conf.bak_$start_time";
   `$command`;
   $command = "/usr/bin/cat $source_dir/syslog_build.config > $env_dir/syslog.conf";
   `$command`;
}
else
{
   $command = "/usr/bin/touch $env_dir/syslog.conf";
   `$command`;
   $command = "/usr/bin/cat $source_dir/syslog_build.config > $env_dir/syslog.conf";
   `$command`;
}


##################################################
## 5.Start syslogd but ITM agent                                 ##
##################################################
=cut
`$install_dir/bin/itmcmd agent start px`;
`$install_dir/bin/itmcmd agent start ul`;
=cut

`/usr/bin/stopsrc -s syslogd`;
`/usr/bin/startsrc -s syslogd`;


## Agent status
my $agent_status = `$install_dir/bin/cinfo -r`;
print LOG "ITM install agent status:$agent_status\n";
print LOG "-" x 80,"\n";
my $agent_status = `$install_dir/bin/cinfo -i`;
print LOG "ITM install package:$agent_status\n";
print LOG "-" x 80,"\n";
my $agent_status = `ps -ef | grep syslogd | grep -v grep`;
print LOG "Syslog daemon status:$agent_status\n";
print LOG "-" x 80,"\n";

##################################################
## 6.Delete temp ul ux px agent directory                           ##
##################################################
my $host = `hostname`;
chomp($host);

if ($host ne "WKLPAR")
{
   opendir(DIR, "$source_dir") || die "Can't open dir\n";
   while( defined(my $filename = readdir(DIR)) )
   {
      next if ($filename eq '.' || $filename eq '..');
 
      if (-d "$source_dir/$filename")
      {
         `rm -rf "$source_dir/$filename"`;
         print LOG "Delete directory:$source_dir/$filename\n";
      }
   }
   close(DIR);
}

## End Program
my $end_time = `date +%Y-%m-%d_%H:%M:%S`;
print LOG "Program end time:$end_time\n";

close(LOG);

##################################################
## 7.Disable ux agent from /etc/rc.itm1 file                         ##
##################################################
if (-e "$env_dir/rc.itm1")
{
   $command = "/usr/bin/cp -f $env_dir/rc.itm1 $env_dir/rc.itm1.bak_$start_time";
   `$command`;
}

open(TMP, "$env_dir/rc.itm1.bak_$start_time") || die "$!\n";

open(FHD, "> $env_dir/rc.itm1") || die "$!\n";

while ( <TMP> )
{
   chomp;
   if ( /ux/ )
   {
      $_ =~ s/$_/#$_/;
      print FHD "$_\n";
   }
   else
   {
      print FHD "$_\n";
   }
}

close(FHD);

close(TMP);

##################################################
## Subroutine                                            ##
##################################################
sub build_dir
{
   my $directory = shift;
   my $command;

   if (-e $directory)
   {
      $command = "/usr/bin/mv $directory $directory.bak_$start_time";
      `$command`;
      $command = "/usr/bin/mkdir -p $directory";
      `$command`;
   }
   else
   {
      $command = "/usr/bin/mkdir -p $directory";
      `$command`;
   }

   return;
}

sub build_file
{
   my $file = shift;
   my $command;
   if (-e $file)
   {
      $command = "/usr/bin/mv $file $file.bak_$start_time";
      `$command`;
      $command = "/usr/bin/touch $file";
      `$command`;
   }
   else
   {
      $command = "/usr/bin/touch $file";
      `$command`;
   }

   return;
}

2012-09-25

ITM System P Agent中的key.pl bug fix

ITM System P Agent有提供HMC Base Agent和CEC Base Agent交換key的perl檔案,進行交換key的程序一般是會透過normal user去執行,但原先的key.pl檔案中已預設使用者的家目錄位於/home底下,所以若使用者的家目錄並非位於/home時,就有可能發生無法交換key,因此須注意下列的key point:

●原先的key.pl內容






















●修改後的key.pl
方法有兩種:
1.修改原先定義$file和$key的所在目錄
2.增加自行判斷使用者的家目錄