2013-10-03

Allocate memory by Perl

仿效Java先allocate memory的作法可試著用Perl來做實驗, 作法如下:

#!/usr/bin/perl -w

for (0..10){
   my $buf = "A" x (1024 * 1024 * 100);
   print "Allocated " . length($buf) . " byte buffer\n";

}
print "Finished\n";
sleep(1000);

2013-09-16

透過HMC指令列出LPAR的資訊

hscroot@localhost:~> lssyscfg -r sys -F name
Server-9179-MHC-SN06394FR

hscroot@localhost:~> lssyscfg -m Server-9179-MHC-SN06394FR -r lpar -F name,lpar_id,state,rmc_ipaddr
TS1-1,16,Running,10.199.130.158
FGW2-1,15,Running,10.199.130.157
FGW1-1,14,Running,10.199.130.156
DEV1,13,Running,10.199.130.155
WORKING_LPAR,12,Running,10.199.130.154
NIM_Server,11,Running,10.199.130.153
DAP2-1,10,Running,10.199.130.51
DAP1-1,9,Running,10.199.130.1
DAR2-1,8,Running,10.199.130.136
DAR1-1,7,Running,10.199.130.131
LOG2,6,Running,10.199.130.122
LOG1,5,Running,10.199.130.121
MDS2,4,Running,10.199.130.112
MDS1,3,Running,10.199.130.111
VIOS2,2,Running,10.199.130.152

VIOS1,1,Running,10.199.130.151


Reference
1. http://www.aixhealthcheck.com/blog.php?id=227
2. http://santosh-aix.blogspot.tw/2008/06/creating-lpar-from-hmc-command-line.html

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-08-01

AIX上壓縮檔處理方式

在AIX上最常見的壓縮檔就是.tar檔了順手整理了一些常見的壓縮檔格式:

.tar.Z file format
   壓縮
      # compress filename.tar
   解壓
      # zcat filename.tar.Z | tar -xvf -

.tar.gz file format
   壓縮
      # tar cvf - folder | gzip > filename.tar.gz
   解壓
      # gunzip -c filename.tar.gz | tar -xvf -

.gz file format (註1)
   解壓
      # gzip -d filename.gz
   壓縮
      # gzip -v filename

.tgz file format
   解壓
      # gzip -d filename.tgz | tar -xvf -

.zip file format (註2)
   解壓
      # unzip filename.zip


註1 : gzip 在壓縮完後,會建立一個 .gz 的檔,並清除原始未壓縮的檔。反之,解壓縮的時候,則是把 .gz 檔清除,只留解開後的檔。

註2 : 請注意,AIX預設並沒有裝unzip的程式。

2013-07-31

AIX增加Paging Space失敗時的檢查及處理流程

root@NIM_SERVER:/#lsps -a
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type Chksum
hd6             hdisk0


root@NIM_SERVER:/#lslv hd6
LOGICAL VOLUME:     hd6                    VOLUME GROUP:   rootvg
LV IDENTIFIER:      00f7394f00004c000000013ae4b1d3cb.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               paging                 WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        128 megabyte(s)
COPIES:             2                      SCHED POLICY:   parallel
LPs:                44                     PPs:            90
STALE PPs:          0                      BB POLICY:      non-relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: off                                  
EACH LP COPY ON A SEPARATE PV ?: yes                                  
Serialize IO ?:     NO                                  
INFINITE RETRY:     no

root@NIM_SERVER:/#chps -s 1 hd6
0516-404 allocp: This system cannot fulfill the allocation request.
        There are not enough free partitions or not enough physical volumes 
        to keep strictness and satisfy allocation requests.  The command
        should be retried with different allocation characteristics.


root@NIM_SERVER:/#lspv
hdisk0          00f7394fe4b1d24f                    rootvg          active    
hdisk1          00f7394fe4b1d2e0                    rootvg          active


root@NIM_SERVER:/#lspv hdisk0
PHYSICAL VOLUME:    hdisk0                   VOLUME GROUP:     rootvg
PV IDENTIFIER:      00f7394fe4b1d24f VG IDENTIFIER     00f7394f00004c000000013ae4b1d3cb
PV STATE:           active                                  
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)          LOGICAL VOLUMES:  17
TOTAL PPs:          799 (102272 megabytes)   VG DESCRIPTORS:   2
FREE PPs:           0 (0 megabytes)          HOT SPARE:        no
USED PPs:           799 (102272 megabytes)   MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  00..00..00..00..00                      
USED DISTRIBUTION:  160..160..159..160..160                  
MIRROR POOL:        None                                    
root@NIM_SERVER:/#r 0=1
lspv hdisk1
PHYSICAL VOLUME:    hdisk1                   VOLUME GROUP:     rootvg
PV IDENTIFIER:      00f7394fe4b1d2e0 VG IDENTIFIER     00f7394f00004c000000013ae4b1d3cb
PV STATE:           active                                  
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)          LOGICAL VOLUMES:  17
TOTAL PPs:          799 (102272 megabytes)   VG DESCRIPTORS:   1
FREE PPs:           228 (29184 megabytes)    HOT SPARE:        no
USED PPs:           571 (73088 megabytes)    MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  00..00..00..68..160                      
USED DISTRIBUTION:  160..160..159..92..00                    
MIRROR POOL:        None


root@NIM_SERVER:/#smitty jfs2
調整hd6的空間, 將其空間縮小。


root@NIM_SERVER:/#lspv hdisk0
PHYSICAL VOLUME:    hdisk0                   VOLUME GROUP:     rootvg
PV IDENTIFIER:      00f7394fe4b1d24f VG IDENTIFIER     00f7394f00004c000000013ae4b1d3cb
PV STATE:           active                                  
STALE PARTITIONS:   0                        ALLOCATABLE:      yes
PP SIZE:            128 megabyte(s)          LOGICAL VOLUMES:  17
TOTAL PPs:          799 (102272 megabytes)   VG DESCRIPTORS:   2
FREE PPs:           34 (4352 megabytes)      HOT SPARE:        no
USED PPs:           765 (97920 megabytes)    MAX REQUEST:      256 kilobytes
FREE DISTRIBUTION:  00..00..00..00..34                      
USED DISTRIBUTION:  160..160..159..160..126                  
MIRROR POOL:        None


root@NIM_SERVER:/#chps -s 1 hd6


root@NIM_SERVER:/#lsps -a
Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type Chksum
hd6             hdisk0            rootvg        5760MB     1   yes   yes    lv     0


root@NIM_SERVER:/#lslv hd6
LOGICAL VOLUME:     hd6                    VOLUME GROUP:   rootvg
LV IDENTIFIER:      00f7394f00004c000000013ae4b1d3cb.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       opened/syncd
TYPE:               paging                 WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        128 megabyte(s)
COPIES:             2                      SCHED POLICY:   parallel
LPs:                45                     PPs:            90
STALE PPs:          0                      BB POLICY:      non-relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: off                                  
EACH LP COPY ON A SEPARATE PV ?: yes                                  
Serialize IO ?:     NO                                  
INFINITE RETRY:     no