<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: scripting help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052330#M304697</link>
    <description>hope that this will do all u need&lt;BR /&gt;cat filename|xargs -n10|grep -v vg00</description>
    <pubDate>Thu, 09 Aug 2007 02:11:21 GMT</pubDate>
    <dc:creator>AwadheshPandey</dc:creator>
    <dc:date>2007-08-09T02:11:21Z</dc:date>
    <item>
      <title>scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052326#M304693</link>
      <description>Hello Admins,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a script that will give me the Free PE and PE Sizeon all VG's except /dev/vg00 on close to 100 servers&lt;BR /&gt;&lt;BR /&gt;i have the ouput of #vgdisplay -v from all the servers copied up&lt;BR /&gt;&lt;BR /&gt;how can i grep/ sed or awk only the VG Name, PE Size and Free PE lines?&lt;BR /&gt;&lt;BR /&gt;eg &lt;BR /&gt;VG Name                     /dev/vg00&lt;BR /&gt;VG Write Access             read/write&lt;BR /&gt;VG Status                   available&lt;BR /&gt;Max LV                      255&lt;BR /&gt;Cur LV                      14&lt;BR /&gt;Open LV                     14&lt;BR /&gt;Max PV                      16&lt;BR /&gt;Cur PV                      2&lt;BR /&gt;Act PV                      2&lt;BR /&gt;Max PE per PV               4384&lt;BR /&gt;VGDA                        4&lt;BR /&gt;PE Size (Mbytes)            16&lt;BR /&gt;Total PE                    4340&lt;BR /&gt;Alloc PE                    4340&lt;BR /&gt;Free PE                     0&lt;BR /&gt;Total PVG                   0&lt;BR /&gt;Total Spare PVs             0&lt;BR /&gt;Total Spare PVs in use      0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;VG Name                     /dev/vgora&lt;BR /&gt;VG Write Access             read/write&lt;BR /&gt;VG Status                   available&lt;BR /&gt;Max LV                      255&lt;BR /&gt;Cur LV                      1&lt;BR /&gt;Open LV                     1&lt;BR /&gt;Max PV                      16&lt;BR /&gt;Cur PV                      2&lt;BR /&gt;Act PV                      2&lt;BR /&gt;Max PE per PV               2489&lt;BR /&gt;VGDA                        4&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Total PE                    4978&lt;BR /&gt;Alloc PE                    3250&lt;BR /&gt;Free PE                     1728&lt;BR /&gt;Total PVG                   0&lt;BR /&gt;Total Spare PVs             0&lt;BR /&gt;&lt;BR /&gt;I would like the output to look like &lt;BR /&gt;&lt;BR /&gt;VG Name                     /dev/vgora&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     1728&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;exlcude /dev/vg00 and get the 3 paremeters for other vgs.&lt;BR /&gt;&lt;BR /&gt;thanks in advance&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 00:11:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052326#M304693</guid>
      <dc:creator>George Chechakunnil</dc:creator>
      <dc:date>2007-08-09T00:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052327#M304694</link>
      <description>Try the command pipeline below:&lt;BR /&gt;&lt;BR /&gt;# ls -1d /dev/vg* | grep -v vg00 | xargs vgdisplay 2&amp;gt;&amp;amp;- | egrep '(^VG N|^PE|^Free)'</description>
      <pubDate>Thu, 09 Aug 2007 00:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052327#M304694</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-09T00:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052328#M304695</link>
      <description>you can use ssh/rsh for all servers at one script with Sandman! one liner.&lt;BR /&gt;ssh hostname ls -1d /dev/vg* | grep -v vg00 | xargs vgdisplay 2&amp;gt;&amp;amp;- | egrep '(^VG N|^PE|^Free)'</description>
      <pubDate>Thu, 09 Aug 2007 00:42:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052328#M304695</guid>
      <dc:creator>AwadheshPandey</dc:creator>
      <dc:date>2007-08-09T00:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052329#M304696</link>
      <description>Terrific.. It works&lt;BR /&gt;&lt;BR /&gt;Actually i am doing this on a file. Here is the output. how can i exclude the 3 lines for /dev/vg00?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat VGDISPLAY | egrep '(^VG N|^PE|^Free)'&lt;BR /&gt;VG Name                     /dev/vg00&lt;BR /&gt;PE Size (Mbytes)            16&lt;BR /&gt;Free PE                     0&lt;BR /&gt;VG Name                     /dev/vgora&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     1728&lt;BR /&gt;VG Name                     /dev/vgkctr8&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     685&lt;BR /&gt;VG Name                     /dev/vgkctr9&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     685&lt;BR /&gt;VG Name                     /dev/vgkdprd&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     3446&lt;BR /&gt;VG Name                     /dev/vgkct10&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     685&lt;BR /&gt;VG Name                     /dev/vgptprd&lt;BR /&gt;PE Size (Mbytes)            4&lt;BR /&gt;Free PE                     3446&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 01:06:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052329#M304696</guid>
      <dc:creator>George Chechakunnil</dc:creator>
      <dc:date>2007-08-09T01:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052330#M304697</link>
      <description>hope that this will do all u need&lt;BR /&gt;cat filename|xargs -n10|grep -v vg00</description>
      <pubDate>Thu, 09 Aug 2007 02:11:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052330#M304697</guid>
      <dc:creator>AwadheshPandey</dc:creator>
      <dc:date>2007-08-09T02:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052331#M304698</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Actually i am doing this on a file. Here is the output. how can i exclude the 3 lines for /dev/vg00?&lt;BR /&gt;&lt;BR /&gt;Either:&lt;BR /&gt;&lt;BR /&gt;# vgdisplay -v|awk '/^VG Name|^PE|^Free/ {if (i++&amp;lt;3) {next};print}'&lt;BR /&gt;&lt;BR /&gt;...or:&lt;BR /&gt;&lt;BR /&gt;# awk '/^VG Name|^PE|^Free/ {if (i++&amp;lt;3) {next};print}' VGDISPLAY&lt;BR /&gt;&lt;BR /&gt;...where (of course) "VGDISPLAY" in all uppercase letters is the name of your file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 09 Aug 2007 07:25:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052331#M304698</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-09T07:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052332#M304699</link>
      <description># cat VGDISPLAY | egrep '(^VG N|^PE|^Free)' | sed -n '/vgora/,$ p'</description>
      <pubDate>Thu, 09 Aug 2007 07:48:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052332#M304699</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-09T07:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052333#M304700</link>
      <description>I use a script for my vg reports&lt;BR /&gt;and I get the following outpupt:&lt;BR /&gt;+++&amp;lt; /dev/vg01 &amp;gt;+++&lt;BR /&gt;/dev/vg01         PE size 4    Total allocated :  83.977 GB     Available :   0.188 GB  &lt;BR /&gt;&lt;BR /&gt; LV Name           Mir        Size    Stripe Stripe size          Mount Point &lt;BR /&gt;/dev/vg01/lvol1   0       1000.000 MB      0           0        /usr/A             &lt;BR /&gt;/dev/vg01/lvol10  0        200.000 MB      0           0        /oracle/A/A &lt;BR /&gt;/dev/vg01/lvol11  0        200.000 MB      0           0        /oracle/A/B &lt;BR /&gt;/dev/vg01/lvol12  0       2000.000 MB      0           0        /oracle/A/org &lt;BR /&gt;/dev/vg01/lvol13  0      16500.000 MB      0           0        /oracle/A/data1 &lt;BR /&gt;/dev/vg01/lvol14  0      12000.000 MB      0           0        /oracle/A/data2 &lt;BR /&gt;/dev/vg01/lvol15  0      12000.000 MB      0           0        /oracle/A/data3 &lt;BR /&gt;/dev/vg01/lvol16  0      13500.000 MB      0           0        /oracle/A/data4 &lt;BR /&gt;/dev/vg01/lvol2   0       5000.000 MB      0           0        /mnt/A          &lt;BR /&gt;/dev/vg01/lvol3   0       5000.000 MB      0           0        /usr/a/A         &lt;BR /&gt;/dev/vg01/lvol4   0       5000.000 MB      0           0        /oracle              &lt;BR /&gt;/dev/vg01/lvol5   0       5000.000 MB      0           0        /oracle/age        &lt;BR /&gt;/dev/vg01/lvol6   0       2000.000 MB      0           0        /oracle/A          &lt;BR /&gt;/dev/vg01/lvol7   0       6000.000 MB      0           0        /oracle/A/64   &lt;BR /&gt;/dev/vg01/lvol8   0        2000000 MB      0           0        /oracle/A/logA &lt;BR /&gt;/dev/vg01/lvol9   0        200.000 MB      0           0        /oracle/A/logB &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As you see this report shows Lvol, Mirror if there is, # stripes, stripe size and mount point.&lt;BR /&gt;If you need to modify just to show  the vg with out the lvol info use the following&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;#  06/14/07  JML&lt;BR /&gt;&lt;BR /&gt;if [ `uname -s` != "HP-UX" ] ; then&lt;BR /&gt;   echo " This script was build to run on HPUX systems... Thank you ! "&lt;BR /&gt;   exit 99&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# List of VG&lt;BR /&gt;for VG in `ls -d /dev/vg* | grep -v vg00`&lt;BR /&gt;   do&lt;BR /&gt;    echo "+++&amp;lt; ${VG} &amp;gt;+++"&lt;BR /&gt;    vgdisplay $VG  &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;    if [ $? -ne 0 ] ; then&lt;BR /&gt;      echo "  Volume group \"$VG\" does not exist in the "/etc/lvmtab" file,   or is not active.  "&lt;BR /&gt;     else&lt;BR /&gt;      vgdisplay $VG | awk '/VG Name/ {printf "%-17s ",$NF}&lt;BR /&gt;                           /PE Size \(Mbytes\)/  {PESZ=$NF;printf "PE size %-4s ",$NF}&lt;BR /&gt;                           /Total PE/ {printf "Total allocated :%8.3f GB     ",((PESZ*$NF)/1024)}&lt;BR /&gt;                           /Free PE/ {printf "Available :%8.3f GB  \n\n",((PESZ*$NF)/1024)}'&lt;BR /&gt;                         &lt;BR /&gt;    &lt;BR /&gt;      fi&lt;BR /&gt;   done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if you need help</description>
      <pubDate>Thu, 09 Aug 2007 09:22:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052333#M304700</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-09T09:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052334#M304701</link>
      <description>oops forgot to include the other script with lvol information&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;#  06/14/07  JML&lt;BR /&gt;&lt;BR /&gt;if [ `uname -s` != "HP-UX" ] ; then&lt;BR /&gt;   echo " This script was build to run on HPUX systems... Thank you ! "&lt;BR /&gt;   exit 99&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# List of VG&lt;BR /&gt;for VG in `ls -d /dev/vg* | grep -v vg00`&lt;BR /&gt;   do&lt;BR /&gt;    echo "+++&amp;lt; ${VG} &amp;gt;+++"&lt;BR /&gt;    vgdisplay $VG  &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;    if [ $? -ne 0 ] ; then&lt;BR /&gt;      echo "  Volume group \"$VG\" does not exist in the "/etc/lvmtab" file,   or is not active.  "&lt;BR /&gt;     else&lt;BR /&gt;      vgdisplay $VG | awk '/VG Name/ {printf "%-17s ",$NF}&lt;BR /&gt;                           /PE Size \(Mbytes\)/  {PESZ=$NF;printf "PE size %-4s ",$NF}&lt;BR /&gt;                           /Total PE/ {printf "Total allocated :%8.3f GB     ",((PESZ*$NF)/1024)}&lt;BR /&gt;                           /Free PE/ {printf "Available :%8.3f GB  \n\n",((PESZ*$NF)/1024)}'&lt;BR /&gt;                         &lt;BR /&gt;      # List of lvol&lt;BR /&gt;&lt;BR /&gt;             printf " %-17s %-4s %10s    %6s %10s %20s \n" "LV Name" "Mir" "Size" "Stripe" "Stripe size" "Mount Point"&lt;BR /&gt;      for LVOL in `ls ${VG}/lvo*`&lt;BR /&gt;         do&lt;BR /&gt;            mount -p | egrep -e "$LVOL "  &amp;gt; /dev/null &lt;BR /&gt;            if [ $? -ne 0 ] ; then&lt;BR /&gt;                MOUNTPOINT="not_found" &lt;BR /&gt;              else&lt;BR /&gt;                MOUNTPOINT=`mount -p | egrep "$LVOL " | awk '{print $2}'`&lt;BR /&gt;            fi&lt;BR /&gt;            lvdisplay ${LVOL}  | awk '/LV Name/ {printf "%-17s ",$NF}&lt;BR /&gt;                                      /Mirror copies/  {printf "%-5s ",$NF}&lt;BR /&gt;                                      /LV Size \(Mbytes\)/  {printf "%10.3f MB ",$NF}&lt;BR /&gt;                                      /Stripes/ {printf "%6s ",$NF}&lt;BR /&gt;                                      /Stripe Size /  {printf " %10s ",$NF}'&lt;BR /&gt;                                      printf "       %-20s \n" $MOUNTPOINT&lt;BR /&gt;         done&lt;BR /&gt;                                      printf " \n"&lt;BR /&gt;      fi&lt;BR /&gt;   done&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 09:25:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052334#M304701</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-09T09:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052335#M304702</link>
      <description>&lt;!--!*#--&gt;George,&lt;BR /&gt;&lt;BR /&gt;Once you have those Name, Size and Free lines, don't you want to report them more nicely?&lt;BR /&gt;&lt;BR /&gt;Please consider a slightly more elaborate script, for example along the lines of the perl example below, to really parse the input data and add some more value.&lt;BR /&gt;&lt;BR /&gt;$ perl x.pl x.txt&lt;BR /&gt;                Name Size   Free Mbytes&lt;BR /&gt;                ---- ----   ---- ------&lt;BR /&gt;          /dev/vgora    4   1728   6912&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------ x.pl -------------------&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt; &lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ($name, $size, $free);&lt;BR /&gt;my $format = "%20s %4s %6s %6s\n";&lt;BR /&gt;printf $format, qw(Name Size Free Mbytes);&lt;BR /&gt;printf $format, qw(---- ---- ---- ------); &lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;  $name = $1 if /^VG Name\s+(.*)$/; &lt;BR /&gt;  $size = $1 if /^PE S.*\s(\d+)/;&lt;BR /&gt;  if (/^Free PE\s+(\d+)$/) {&lt;BR /&gt;    $free = $1;&lt;BR /&gt;    printf ("%20s %4d %6d %6d\n", $name, $size, $free, $free*$size) unless $name =~ /vg00/&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;---------------------------&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 10:14:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052335#M304702</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-09T10:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052336#M304703</link>
      <description>Hein,&lt;BR /&gt;&lt;BR /&gt;your perl script looks good.&lt;BR /&gt;If you don't mind I will modify and use on my servers. But I have a question, when I try to run the perl script I don't get any output on my server, I let it run for 2 mins and nothing showed up.&lt;BR /&gt;&lt;BR /&gt;I am a very beginner perl person. hope you dont mind this questions.&lt;BR /&gt;&lt;BR /&gt;1 - I am missing something&lt;BR /&gt;2 - who can I enable debug in perl (for ex in ksh i use set -x)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Aug 2007 11:15:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052336#M304703</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-09T11:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052337#M304704</link>
      <description>Hi Juan:&lt;BR /&gt;&lt;BR /&gt;Hein's script expects input from a pipe or from a file name(s) on the command line:&lt;BR /&gt;&lt;BR /&gt;# ./x.pl x.txt&lt;BR /&gt;&lt;BR /&gt;(or):&lt;BR /&gt;&lt;BR /&gt;# vgdisplay | ./x.pl&lt;BR /&gt;&lt;BR /&gt;You ran it without an argument, so it was expecting STDIN as input.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 09 Aug 2007 11:21:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052337#M304704</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-09T11:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052338#M304705</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Thanks for the clarification.&lt;BR /&gt;I should not call myself beginer anymore....&lt;BR /&gt;I should pay more attention when I read.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks again</description>
      <pubDate>Thu, 09 Aug 2007 11:50:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/4052338#M304705</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-09T11:50:05Z</dc:date>
    </item>
  </channel>
</rss>

