[20180810]gpnptool.txt

lfree發表於2018-08-10

[20180810]gpnptool.txt


--//gpnptool用於檢視GPnP Profile的內容.我以前一直認為輸出格式不好看.使用xmllint格式化.

--//連結:http://blog.itpub.net/267265/viewspace-2117702/

--//實際上gpnptool支援一些引數,可以顯示輸出更加清晰.

--//例子如下:

$ gpnptool get -o- | xmllint --format - | grep SPFile


Success.

  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm-disk*" SPFile="+OCR/fyhis-cluster/asmparameterfile/registry.253.931436169"/>


--//注:gpnptool get -o-不過濾,顯示很難看.透過xmllint格式化在grep過濾顯示比較清晰.檢視gpnptool幫助:


$ gpnptool


Oracle GPnP Tool


Usage:

 "gpnptool <verb> <switches>", where verbs are:


     create   Create a new GPnP Profile

     edit     Edit existing GPnP Profile

     getpval  Get value(s) from GPnP Profile

     get      Get profile in effect on local node

     rget     Get profile in effect on remote GPnP node

     put      Put profile as a current best

     find     Find all RD-discoverable resources of given type

     lfind    Find local gpnpd server

     check    Perform basic profile sanity checks

     c14n     Canonicalize, format profile text (XML C14N)

     sign     Sign/re-sign profile with wallet's private key

     unsign   Remove profile signature, if any

     verify   Verify profile signature against wallet certificate

     help     Print detailed tool help

     ver      Show tool version


--//提供取值getpval引數.

$ gpnptool getpval -p=profile.xml -?


Oracle GPnP Tool

     getpval  Get value(s) from GPnP Profile

Usage:

 "gpnptool getpval <switches>", where switches are:

    -prf                  Profile Tag: <GPnP-Profile>, optional

    -[id:]prf_cn          Profile Tag: <GPnP-Profile [Id="id"]  ClusterName="<val>">, optional

    -[id:]prf_pa          Profile Tag: <GPnP-Profile [Id="id"]  PALocation="<uri>">, optional

    -[id:]prf_sq          Profile Tag: <GPnP-Profile [Id="id"]  ProfileSequence="<num>">, optional

    -[id:]prf_cid         Profile Tag: <GPnP-Profile [Id="id"]  ClusterUId="<val>">, optional

    -[pid:]nets           Profile Tag: <Network-Profile> children of <GPnP-Profile Id="pid">, optional

    -[pid:]haip           Profile Tag: <HAIP> children of <Network-Profile Id="pid">, optional

    -[id:]haip_ma         Profile Tag: <HAIP [Id="id"]  MulticastAddress="<val>">, optional

    -[id:]haip_bm         Profile Tag: <HAIP [Id="id"]  BootMode="<val>">, optional

    -[id:]haip_s          Profile Tag: <HAIP [Id="id"]  Subnet="<val>">, optional

    -[pid:]hnet           Profile Tag: <HostNetwork> children of <Network-Profile Id="pid">, optional

    -[id:]hnet_nm         Profile Tag: <HostNetwork [Id="id"]  HostName="<val>">, optional

    -[pid:]net            Profile Tag: <Network> children of <HostNetwork Id="pid">, optional

    -[id:]net_ip          Profile Tag: <Network [Id="id"]  IP="<val>">, optional

    -[id:]net_use         Profile Tag: <Network [Id="id"]  Use="<val>">, optional

    -[id:]net_nt          Profile Tag: <Network [Id="id"]  NameTempl="<val>">, optional

    -[id:]net_aip         Profile Tag: <Network [Id="id"]  AutoIP="<val>">, optional

    -[id:]net_ada         Profile Tag: <Network [Id="id"]  Adapter="<val>">, optional

    -[pid:]asm            Profile Tag: <ASM-Profile> children of <GPnP-Profile Id="pid">, optional

    -[id:]asm_dis         Profile Tag: <ASM-Profile [Id="id"]  DiscoveryString="<val>">, optional

    -[id:]asm_spf         Profile Tag: <ASM-Profile [Id="id"]  SPFile="<val>">, optional

    -[id:]asm_uid         Profile Tag: <ASM-Profile [Id="id"]  UniverseId="<hexnum>">, optional

    -[pid:]css            Profile Tag: <CSS-Profile> children of <GPnP-Profile Id="pid">, optional

    -[id:]css_dis         Profile Tag: <CSS-Profile [Id="id"]  DiscoveryString="<val>">, optional

    -[id:]css_ld          Profile Tag: <CSS-Profile [Id="id"]  LeaseDuration="<num>">, optional

    -[id:]css_cin         Profile Tag: <CSS-Profile [Id="id"]  ProfileCIN="<num>">, optional

    -[id:]css_cuv         Profile Tag: <CSS-Profile [Id="id"]  CUV="<val>">, optional

    -[pid:]ocr            Profile Tag: <OCR-Profile> children of <GPnP-Profile Id="pid">, optional

    -[id:]ocr_oid         Profile Tag: <OCR-Profile [Id="id"]  OCRId="<num>">, optional

    -rmws                 Remove whitespace from xml, optional

    -fmt[=0,2]            Format profile. Value is ident level,step, optional

    -p[=profile.xml]      GPnP profile name

    -o[=gpnptool.out]     Output result to a file, optional

    -o-                   Output result to stdout

    -ovr                  Overwrite output file, if exists, optional

    -t[=3]                Trace level (min..max=0..7), optional

    -f=<val>              Command file name, optional

    -?                    Print verb help and exit


--//透過這個引數getpval可以更好取值.例子如下:


1.定位profile.xml

# find / -name profile.xml

/u01/app/11.2.0/grid/gpnp/fyhis1/profiles/peer/profile.xml

/u01/app/11.2.0/grid/gpnp/profiles/peer/profile.xml


--//或者使用locate:

$ locate profile.xml

/u01/app/11.2.0/grid/gpnp/fyhis1/profiles/peer/profile.xml

/u01/app/11.2.0/grid/gpnp/profiles/peer/profile.xml



2.查詢:

$ cd /u01/app/11.2.0/grid/gpnp/fyhis1/profiles/peer/


$ gpnptool getpval -p=profile.xml -asm_spf  -o-

+OCR/fyhis-cluster/asmparameterfile/registry.253.931436169


$ gpnptool getpval -p=profile.xml -asm_dis -o-

/dev/asm-disk*



--//也可以使用如下:

$ gpnptool get -o- | xmllint --format - | grep SPFile


Success.

  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm-disk*" SPFile="+OCR/fyhis-cluster/asmparameterfile/registry.253.931436169"/>


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2199606/,如需轉載,請註明出處,否則將追究法律責任。