пятница, 26 февраля 2016 г.

ibm hmc lpar report csv

Что необходимо:
1.nix машина которая имеет passwordless доступ к HMC (мою HMC звать hmc2, пользователь hmcreporter с правами VIEW)
2.
 #!/usr/bin/bash  
 workdir=/home/hmcrepo  
 echo Fetching list of systems  
 /usr/bin/ssh hmcreporter@hmc2 lssyscfg -r sys -F name | sort -u > $workdir/sys.list  
 echo Done  
 echo "sys,name,lpar_id,lpar_env,state,os_version,logical_serial_num,curr_profile,curr_proc_mode,run_proc_units,run_mem" > $workdir/hmcLPAR.csv  
 echo "name,type_model,serial_num,lpar_proc_compat_modes,installed_sys_proc_units,configurable_sys_proc_units,curr_avail_sys_proc_units,installed_sys_mem,configurable_sys_mem,curr_avail_sys_mem" > $workdir/hmcSYS.csv  
 for i in `cat $workdir/sys.list`;do  
     echo Fetching system info for server $i  
     SYS_PROF=`/usr/bin/ssh hmcreporter@hmc2 lssyscfg -m $i -r sys -F name,type_model,serial_num,lpar_proc_compat_modes`  
     SYS_EC=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r proc --level sys -F installed_sys_proc_units,configurable_sys_proc_units,curr_avail_sys_proc_units`  
     SYS_MEM=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r mem --level sys -F installed_sys_mem,configurable_sys_mem,curr_avail_sys_mem`  
     echo $SYS_PROF,$SYS_EC,$SYS_MEM >> $workdir/hmcSYS.csv  
     echo Fetching lpar info for $i system  
     /usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r proc --level lpar -F lpar_name > $workdir/lpar.list  
         for LPAR in `cat $workdir/lpar.list`;do  
             echo Fetching PROF,EC,MEM for $LPAR lpar  
             LPAR_PROF=`/usr/bin/ssh hmcreporter@hmc2 lssyscfg -r lpar -m $i -F name,lpar_id,lpar_env,state,os_version,logical_serial_num,curr_profile --filter lpar_names=$LPAR`  
             LPAR_EC=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r proc --level lpar -F curr_proc_mode,run_proc_units --filter lpar_names=$LPAR`  
             LPAR_MEM=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r mem --level lpar -F run_mem --filter lpar_names=$LPAR`  
                 echo $i,$LPAR_PROF,$LPAR_EC,$LPAR_MEM >> $workdir/hmcLPAR.csv  
         done  
 done  
 echo Done  

на выходе 2 файла
hmcSYS.csv Отчёт по железным серверам
hmcLPAR.csv Отчёт по LPAR в разрезе ресурсов

старая версия под катом



 #!/usr/bin/bash  
 workdir=/home/hmcrepo  
 echo Fetching list of systems  
 /usr/bin/ssh hmcreporter@hmc2 lssyscfg -r sys -F --header > $workdir/hmcSYS.csv  
 echo Done  
 cat $workdir/hmcSYS.csv | cut -d, -f1 | grep -v name | sort -u > $workdir/sys.list  
 echo Fetching header for LPAR list  
 echo "name,lpar_id,lpar_env,state,os_version,logical_serial_num,curr_profile,curr_proc_mode,run_proc_units,run_mem" > $workdir/hmcLPAR.csv  
 for i in `cat $workdir/sys.list`;do  
     echo Fetching lpar info for $i system  
     /usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r proc --level lpar -F lpar_name > $workdir/lpar.list  
         for LPAR in `cat $workdir/lpar.list`;do  
             echo Fetching PROF,EC,MEM for $LPAR lpar  
             LPAR_PROF=`/usr/bin/ssh hmcreporter@hmc2 lssyscfg -r lpar -m $i -F name,lpar_id,lpar_env,state,os_version,logical_serial_num,curr_profile --filter lpar_names=$LPAR`  
             LPAR_EC=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r proc --level lpar -F curr_proc_mode,run_proc_units --filter lpar_names=$LPAR`  
             LPAR_MEM=`/usr/bin/ssh hmcreporter@hmc2 lshwres -m $i -r mem --level lpar -F run_mem --filter lpar_names=$LPAR`  
                 echo $LPAR_PROF,$LPAR_EC,$LPAR_MEM >> $workdir/hmcLPAR.csv  
         done  
 done  
 echo Done  

Комментариев нет: