Article ID: 122776, created on Sep 2, 2014, last review on Jun 17, 2016

  • Applies to:
  • Virtuozzo 6.0
  • Virtuozzo containers for Linux 4.7
  • Virtuozzo containers for Windows 6.0
  • Virtuozzo containers for Windows 4.6
  • Virtuozzo hypervisor
  • Virtual Automation 6.0

Question

Is it possible to gather all HWIDs from all nodes registered in PVA MN?

Answer

Yes, this is possible by using PVA API.

Important: To be able to send PVA API requests from PVA MN you should have working vzlcon on it. Please, check following article for instructions:

118197 vzlcon is not working on PVA management node

To check HWIDs from all nodes registered in PVA MN, login to PVA MN and issue the following command (in one line):

# for eid in $(echo '<packet version="4.0.0"><target>server_group</target><data><server_group><get_list><type>generic</type></get_list></server_group></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | awk -F '[<>]' '/ns2:eid/{print$3}'); do echo '<packet version="4.0.0"><target>licensem</target><dst><host>'$eid'</host></dst><data><licensem><get_hwid/></licensem></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | grep -a hwid || continue; echo '<packet version="4.0.0"><target>envm</target><dst><host>'$eid'</host></dst><data><envm><get_info><config/></get_info></envm></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | grep -a ':hostname'; echo; done

Real-life example:

# for eid in $(echo '<packet version="4.0.0"><target>server_group</target><data><server_group><get_list><type>generic</type></get_list></server_group></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | awk -F '[<>]' '/ns2:eid/{print$3}'); do echo '<packet version="4.0.0"><target>licensem</target><dst><host>'$eid'</host></dst><data><licensem><get_hwid/></licensem></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | grep -a hwid || continue; echo '<packet version="4.0.0"><target>envm</target><dst><host>'$eid'</host></dst><data><envm><get_info><config/></get_info></envm></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | grep -a ':hostname'; echo; done
<ns2:hwid>7D74.5003.DC21.F075.8738.C1E9.F607.493D</ns2:hwid>
<ns2:hwid>9BDC.6B71.E797.14D3.28E0.9FA6.57DE.2FD1</ns2:hwid>
<ns3:hostname>node1.local</ns3:hostname>

<ns2:hwid>9F03.4932.8711.8728.147B.2346.5969.A16B</ns2:hwid>
<ns2:hwid>FFB8.A9B3.CA6D.50FD.C5D1.9BD9.7DD1.A4DA</ns2:hwid>
<ns3:hostname>node2.local</ns3:hostname>

<ns2:hwid>905A.9BA1.F7A0.48C0.90E8.7E62.3B1A.AE9C</ns2:hwid>
<ns2:hwid>E94C.1070.C898.5716.7485.4E1B.88A4.963F</ns2:hwid>
<ns3:hostname>node3.local</ns3:hostname>

<ns2:hwid>88B8.3380.BCA3.C31E.6E9B.A8B7.BCED.9FD3</ns2:hwid>
<ns2:hwid>FD17.2D62.3F64.CF2D.F731.ADA6.B15E.E0A1</ns2:hwid>
<ns3:hostname>node4.local</ns3:hostname>

Based on this command you may create a script to be used in some monitoring purposes, e.g.:

    [root@pva ~]# cat ls-hwid
    #!/bin/bash

    EIDs=$(echo '<packet version="4.0.0"><target>server_group</target><data><server_group><get_list><type>generic</type></get_list></server_group></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | awk -F '[<>]' '/ns2:eid/{print$3}')

    [ -z "$EIDs" ] && { echo No hardware nodes in the group.; exit; }

    for eid in $EIDs
    do
            HWIDs=$(echo '<packet version="4.0.0"><target>licensem</target><dst><host>'$eid'</host></dst><data><licensem><get_hwid/></licensem></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | awk -F '[<>]' '/ns2:hwid/{print$3}')
            [ -z "$HWIDs" ] && continue

            HNAME=$(echo '<packet version="4.0.0"><target>envm</target><dst><host>'$eid'</host></dst><data><envm><get_info><config/></get_info></envm></data></packet>' | /opt/pva/mn/bin/sendRequestViaTCP.pl local - 2>/dev/null | awk -F '[<>]' '/:hostname/{print$3}')

            [ -z "$HNAME" ] && export HNAME=host-$eid

            echo -e "Hardware node '$HNAME' has HWIDs:\n$HWIDs\n"
    done
    [root@pva ~]#

Related topics

111220 How to send XML API request to PVA

Search Words

api

HWID

get hwid

pva

a26b38f94253cdfbf1028d72cf3a498b 2897d76d56d2010f4e3a28f864d69223 e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 319940068c5fa20655215d590b7be29b 0dd5b9380c7d4884d77587f3eb0fa8ef 0c05f0c76fec3dd785e9feafce1099a9 c62e8726973f80975db0531f1ed5c6a2 6f8e3eda12803cf88a9587e9782c9ed6 965b49118115a610e93635d21c5694a8 6c20476fe6c3408461ce38cbcab6d03b 0889ab60fa6494de107aa7338c3c38b6

Email subscription for changes to this article
Save as PDF