物理ディスク一覧を作成する際、単純に「storage disk show」で取得すると、2ノードの表示が入り交じり、どちらに所属している物理ディスクなのか判別が面倒。
なので、「storage disk show -nodelist ノード名」という形で出力を分けたいのだが、NetAppに対して「system node show -fields node」で取得したノード一覧からノード名を抜き出して、それぞれに対してコマンドを実行するためには、TeraTermマクロで実装できるのかを調査した。
調査
まず、NetAppのノード名一覧の出力を確認
netapp01::> system node show -fields node
node
-------------
netapp01-01
netapp01-02
2 entries were displayed.
netapp01::>
ノードとして「netapp01-01」と「netapp01-02」があることを確認。
また、system node showコマンドの出力のうち最初の2行はヘッダ、そして、ノード名出力後に「~ entries were displayed.」と出力がある。これらは使わないので除外が必要。
スクリプト
サンプルとして、ノード一覧を表示して、各ノードに対して「system node run -node ノード名 hostname」を実行する、というものを作成した。
setsync 1
timeout=60
strdim nodenames 20
I=0
sendln 'system node show -fields node'
recvln ; コマンド入力 のecho出力 をスキップ
recvln ; ヘッダ部分 をスキップ
recvln ; --- 部分 をスキップ
endflag=1
while endflag=1
recvln
strscan inputstr 'displayed.'
if result>0 then
endflag=0
else
nodenames[I] = inputstr
I=I+1
endif
endwhile
wait '::> '
J=0
while I > J
sendln 'system node run -node ' nodenames[J] ' hostname'
wait '::> '
J=J+1
endwhile
setsync 0
「2 entries were displayed.」というエントリ以降の行は不要なので、whileを終了する処理を入れるが、1台だったりすると1 entry wasとかになったりしそうなのでdisplayed.だけで終了検出。
whileを抜けたあとは、コマンドプロンプトの「::> 」が来るまで待ちを入れる。
スクリプト実行例
netapp01::> system node show -fields node
node
-------------
netapp01-01
netapp01-02
2 entries were displayed.
netapp01::> system node run -node netapp01-01 hostname
netapp01-01
netapp01::> system node run -node netapp01-02 hostname
netapp01-02
netapp01::>
Oracle Cloud上のOracle Linux 7インスタンスでyum check-updateを実行したところ、下記の様なメッセージが出力された。
[osakanataro@ocilinux ~]$ sudo yum check-update
読み込んだプラグイン:langpacks, ulninfo
Update notice ELBA-2021-9629 (ol7_developer から) is broken, or a bad duplicate, skipping.
You should report this problem to the owner of the ol7_developer repository.
To help pinpoint the issue, please attach the output of "yum updateinfo --verbose" to the report.
Update notice ELBA-2021-9631 (ol7_developer から) is broken, or a bad duplicate, skipping.
Security: kernel-uek-4.14.35-2047.510.5.2.el7uek.x86_64 is an installed security update
Security: kernel-uek-4.14.35-2047.504.2.el7uek.x86_64 is the currently running version
[osakanataro@ocilinux ~]$
とりあえず、出力にかいてある「yum updateinfo –verbose」を実行してみる。
[osakanataro@ocilinux ~]$ sudo yum updateinfo --verbose
無効になっているため、プラグイン「osmsplugin」は読み込みません
無効になっているため、プラグイン「rhnplugin」は読み込みません
プラグイン「ulninfo」を読み込んでいます
プラグイン「langpacks」を読み込んでいます
Adding en_US.UTF-8 to language list
Config time: 0.091
Yum version: 3.4.3
rpmdb time: 0.000
Setting up Package Sacks
pkgsack time: 0.255
Duplicate of ELBA-2021-9629 differs in some fields:
<<<<<<< ol7_developer:description
'[2.53.1-1]\n- Update to version 2.53.1\n\n[2.53.0-1]\n- Update to version 2.53.0\n\n[2.52.1-1]\n- Update to version 2.52.1\n\n[2.52.0-1]\n- Update to version 2.52.0\n\n[2.51.0-1]\n- Update to version 2.51.0\n\n[2.50.0-1]'
=======
'[2.53.1-1]\n- Update to version 2.53.1'
>>>>>>> ol7_addons:description
Update notice ELBA-2021-9629 (ol7_developer から) is broken, or a bad duplicate, skipping.
You should report this problem to the owner of the ol7_developer repository.
To help pinpoint the issue, please attach the output of "yum updateinfo --verbose" to the report.
Duplicate of ELBA-2021-9631 differs in some fields:
<<<<<<< ol7_developer:description
'[3.4.1-1]\n- Update to version 3.4.1\n\n[3.4.0-1]\n- Update to version 3.4.0\n\n[3.3.3-1]\n- Update to version 3.3.3\n\n[3.3.2-1]\n- Update to version 3.3.2\n\n[3.3.1-1]\n- Update to version 3.3.1\n\n[3.3.0-1]\n- Update to version 3.3.0\n\n[3.2.2-1]\n- Update to version 3.2.2\n\n[3.2.1-1]\n- Update to version 3.2.1\n\n[3.2.0-1]\n- Update to version 3.2.0\n\n[3.1.2-1]\n- Update to version 3.1.2\n\n[3.1.1-1]\n- Update to version 3.1.1\n\n[3.1.0-1]\n- Update to version 3.1.0\n\n[3.0.5-1]\n- Update to version 3.0.5\n\n[3.0.4-1]\n- Update to version 3.0.4\n\n[3.0.3-1]\n- Update to version 3.0.3\n\n[3.0.2-1]\n- Update to version 3.0.2\n\n[3.0.1-1]\n- Update to version 3.0.1\n\n[3.0.0-1]'
=======
'[3.4.1-1]\n- Update to version 3.4.1'
>>>>>>> ol7_addons:description
Update notice ELBA-2021-9631 (ol7_developer から) is broken, or a bad duplicate, skipping.
updateinfo time: 5.586
オブジェクトの更新を構築しています
up:Obs Init time: 4.605
up:simple updates time: 0.024
up:obs time: 0.008
up:condense time: 0.000
updates time: 10.097
Security: kernel-uek-4.14.35-2047.510.5.2.el7uek.x86_64 is an installed security update
Security: kernel-uek-4.14.35-2047.504.2.el7uek.x86_64 is the currently running version
updateinfo summary done
[osakanataro@ocilinux ~]$