<?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: disk usage script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482408#M556052</link>
    <description>Hi JRF,&lt;BR /&gt;&lt;BR /&gt;One more thing..&lt;BR /&gt;&lt;BR /&gt;I want to display total PVs present in VG also..&lt;BR /&gt;&lt;BR /&gt;how can we edit the same script to achieve thhat..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
    <pubDate>Wed, 19 Aug 2009 14:20:14 GMT</pubDate>
    <dc:creator>himacs</dc:creator>
    <dc:date>2009-08-19T14:20:14Z</dc:date>
    <item>
      <title>disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482402#M556046</link>
      <description>Hi Admins,&lt;BR /&gt;&lt;BR /&gt;I need a script which has to give following outputs..&lt;BR /&gt;1.number of VG presence with VG name&lt;BR /&gt;2.Total+used+free space per VG&lt;BR /&gt;&lt;BR /&gt;please help on this&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;himacs</description>
      <pubDate>Wed, 19 Aug 2009 12:20:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482402#M556046</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T12:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482403#M556047</link>
      <description># of VGs&lt;BR /&gt;&lt;BR /&gt;strings /etc/lvmtab | grep "^/dev" | /grep -v "/dev/dsk"| wc -l&lt;BR /&gt;&lt;BR /&gt;# usage&lt;BR /&gt;&lt;BR /&gt;for vg in `strings /etc/lvmtab | grep -v "/dev/dsk"`&lt;BR /&gt;do&lt;BR /&gt;pesize=`vgdisplay $vg | grep "^PE Size"|awk {'print $4'}&lt;BR /&gt;usedpe=`vgdisplay $vg | grep "^Alloc PE"|awk {'print $3'}&lt;BR /&gt;(( usedmb=${usedpe}*${pezise} ))&lt;BR /&gt;freepe=``vgdisplay $vg | grep "^Free PE"|awk {'print $3'}&lt;BR /&gt;(( freemb=${freepe}*${pezise} ))&lt;BR /&gt;&lt;BR /&gt;echo "${vg} has ${usedmb} MBs used and ${freemb} MBs free space"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;hope it helps</description>
      <pubDate>Wed, 19 Aug 2009 12:44:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482403#M556047</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-19T12:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482404#M556048</link>
      <description>Hi Admins,&lt;BR /&gt;Actually i have a script but it throws error while executing..&lt;BR /&gt;&lt;BR /&gt;#This pgm will display Total, Used and Free size(in MB) of all vgs in a system&lt;BR /&gt;&lt;BR /&gt;system("vgdisplay |grep -e 'Name' -e 'Total PE' -e'Alloc' -e'Free'|cut -b 29- &amp;gt;/tmp/bdf.out");&lt;BR /&gt;print("Name\t       Total MB\tUsed MB\tAvailable MB\n");&lt;BR /&gt;&lt;BR /&gt;open (BDF,"/tmp/bdf.out");&lt;BR /&gt;$line=&lt;BDF&gt;;&lt;BR /&gt;chop $line;&lt;BR /&gt;while ($line ne "")&lt;BR /&gt; {&lt;BR /&gt;  if ($line =~/vg/){&lt;BR /&gt;        $count=1;&lt;BR /&gt;        }&lt;BR /&gt;        while($count &amp;lt; 5){&lt;BR /&gt;         if($count &amp;gt; 1){&lt;BR /&gt;          $line=$line*$pe_size;&lt;BR /&gt;           }&lt;BR /&gt;         else {&lt;BR /&gt;         &amp;amp;get_pe_size;&lt;BR /&gt;         }&lt;BR /&gt;         print("$line \t");&lt;BR /&gt;         $line=&lt;BDF&gt;;&lt;BR /&gt;         chop $line;&lt;BR /&gt;         ++$count;&lt;BR /&gt;         }&lt;BR /&gt;  print("\n");&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;sub get_pe_size {&lt;BR /&gt;$vgname="vgdisplay $line";&lt;BR /&gt;open (WOUT,"$vgname |grep Mbyte|cut -b 28-30|");&lt;BR /&gt;$pe_size=&lt;WOUT&gt;;&lt;BR /&gt;chop $pe_size;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;eror is - free[3]: Syntax error at line 3 : `(' is not expected.&lt;BR /&gt;Plz let me know what causes this error..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs&lt;/WOUT&gt;&lt;/BDF&gt;&lt;/BDF&gt;</description>
      <pubDate>Wed, 19 Aug 2009 12:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482404#M556048</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T12:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482405#M556049</link>
      <description>Hi Himacs:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Actually i have a script but it throws error while executing..&lt;BR /&gt;&lt;BR /&gt;Then _SAY_SO_.&lt;BR /&gt;&lt;BR /&gt;Aside from your script being terribly un-Perlish it _IS_ a perl script and thus needs to be indentified as such.&lt;BR /&gt;&lt;BR /&gt;Every good script needs to declare the interpreter it wants to use in a "she-bang" line.  Failure to do so means that a shell is assumed.&lt;BR /&gt;&lt;BR /&gt;Add this as the first line of your script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;...or if that fails:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/env perl&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2009 13:14:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482405#M556049</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-19T13:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482406#M556050</link>
      <description>Hi JRF,&lt;BR /&gt;&lt;BR /&gt;Thanx for the guidance..its worked&lt;BR /&gt;i added #!/usr/bin/perl as interpreter.&lt;BR /&gt;&lt;BR /&gt;The same script i got from itrc after posting this thread..&lt;BR /&gt;&lt;BR /&gt;anyway thanx once again..&lt;BR /&gt;&lt;BR /&gt;Hi Mel ,&lt;BR /&gt;I executed the script suggested by u,but some errors..&lt;BR /&gt;./freetest[11]: /dev/vg00: Execute permission denied.&lt;BR /&gt;./freetest[12]:  usedmb=* : Syntax error&lt;BR /&gt;&lt;BR /&gt;anyhow i found ineterest ininformation in scripting with ur help.. thanx&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2009 13:26:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482406#M556050</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T13:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482407#M556051</link>
      <description>my script was untested and as expected from any caffeine-less morning, was riddled with typographic errors.&lt;BR /&gt;&lt;BR /&gt;here is a working copy:&lt;BR /&gt;&lt;BR /&gt;for vg in `strings /etc/lvmtab | grep -v "^/dev/dsk" | grep "^/dev"`&lt;BR /&gt;do&lt;BR /&gt;pesize=`vgdisplay $vg | grep "^PE Size"|awk {'print $4'}`&lt;BR /&gt;usedpe=`vgdisplay $vg | grep "^Alloc PE"|awk {'print $3'}`&lt;BR /&gt;usedmb=`echo "${usedpe}*${pesize}" | bc`&lt;BR /&gt;freepe=`vgdisplay $vg | grep "^Free PE"|awk {'print $3'}`&lt;BR /&gt;freemb=`echo "${freepe}*${pesize}" | bc`&lt;BR /&gt;&lt;BR /&gt;echo "${vg} has ${usedmb} MBs used and ${freemb} MBs free space"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Wed, 19 Aug 2009 13:56:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482407#M556051</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-19T13:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482408#M556052</link>
      <description>Hi JRF,&lt;BR /&gt;&lt;BR /&gt;One more thing..&lt;BR /&gt;&lt;BR /&gt;I want to display total PVs present in VG also..&lt;BR /&gt;&lt;BR /&gt;how can we edit the same script to achieve thhat..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
      <pubDate>Wed, 19 Aug 2009 14:20:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482408#M556052</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T14:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482409#M556053</link>
      <description>Hi Plz tell me why ~ and ^ used in script..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
      <pubDate>Wed, 19 Aug 2009 14:28:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482409#M556053</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T14:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482410#M556054</link>
      <description>pvcount=`vgdisplay -v $vg| grep "PV Name" | grep -v "Alternate Link" | wc -l`&lt;BR /&gt;&lt;BR /&gt;in my script you can put this line before the echo statement and on the echo line, incorporate the pvcount into printable variables as you desire.</description>
      <pubDate>Wed, 19 Aug 2009 14:28:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482410#M556054</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-19T14:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482411#M556055</link>
      <description>with my limited perl knowledge, ~ is used to suppress blan lines in the output. I can not see any ^ (carat) characters in the perl script but in regular expressions, ^ means the beginning of the line.</description>
      <pubDate>Wed, 19 Aug 2009 14:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482411#M556055</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-19T14:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482412#M556056</link>
      <description>Hi Mel,&lt;BR /&gt;&lt;BR /&gt;Thanx for the info..&lt;BR /&gt;&lt;BR /&gt;If i want to direct the output where should i add &amp;gt;/tmp/disk.out  &lt;BR /&gt;&lt;BR /&gt;I tried with adding in the end of echo line but ended up with directing ony VG00 info..&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
      <pubDate>Wed, 19 Aug 2009 15:41:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482412#M556056</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-19T15:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482413#M556057</link>
      <description>if you want to redirect at the end of echo, you need to use &amp;gt;&amp;gt; as this one will get executed as many times as the number of vg's you have.&lt;BR /&gt;&lt;BR /&gt;to use &amp;gt; (single redirect) do it after the word "done", for example:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;echo "blah-blah..."&lt;BR /&gt;done &amp;gt; /tmp/myreport.txt&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Wed, 19 Aug 2009 15:44:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482413#M556057</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-19T15:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482414#M556058</link>
      <description>Hi (again) Himacs:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; One more thing..I want to display total PVs present in VG also.&lt;BR /&gt;&lt;BR /&gt;One way is to add this section of Perl code to the end of what you have:&lt;BR /&gt;&lt;BR /&gt;my ( $fh, $vgname, $nbrpvs );&lt;BR /&gt;open( my $fh, '-|', '/sbin/vgdisplay' ) or die $!;&lt;BR /&gt;while (&amp;lt;$fh&amp;gt;) {&lt;BR /&gt;    $vgname = $1 if m{^VG Name\s+(.+)};&lt;BR /&gt;    $nbrpvs = $1 if m{^Act PV\s+(.+)};&lt;BR /&gt;    if ( defined $vgname and defined $nbrpvs ) {&lt;BR /&gt;        printf "%-12s = %02d PVs\n", $vgname, $nbrpvs;&lt;BR /&gt;        undef $vgname;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I would rewrite the whole script in this fashion...using an piped open() to read the output of 'vgdisplay'.  The caret (^) means match at the beginning of a line.  The '\s+' means one or more whitespaces (tabs, spaces, etc.).  The '.+' means one or more of any character and by enclosing it in parentheses we capture whatever is seen in the '$1' variable.&lt;BR /&gt;&lt;BR /&gt;As you can see, the whole script could be re-factored into a loop driven by the above.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2009 15:49:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482414#M556058</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-19T15:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: disk usage script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482415#M556059</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;If you're familiar with perl, there's an HPUX::LVM perl module on CPAN that automatically parses vgdisplay/lvdisplay/pvdisplay into a perl hash.  Once you get the data into a hash table, generating custom LVM reports should be trivial.  &lt;BR /&gt;&lt;BR /&gt;Caveats: I saw the module a while back but haven't actually tried it.  Also, it appears to be based on LVMv1, so may cause problems on 11i v3.&lt;BR /&gt;&lt;BR /&gt;Take a look at &lt;A href="http://search.cpan.org/~cwhite/HPUX-LVM_0.06/LVM.pm." target="_blank"&gt;http://search.cpan.org/~cwhite/HPUX-LVM_0.06/LVM.pm.&lt;/A&gt;  There's a complete sample script at the top of the page.&lt;BR /&gt;&lt;BR /&gt;Other related CPAN modules include:&lt;BR /&gt;HPUX::Ioscan.pm&lt;BR /&gt;HPUX::FS.pm&lt;BR /&gt;HPUX::LVM.pm&lt;BR /&gt;&lt;BR /&gt;If you have 11i v3 vith the latest version of LVM, there's a new option on vgdisplay that displays VG information in a format that's easier to parse with perl/awk/etc:&lt;BR /&gt;&lt;BR /&gt;vgdisplay -F&lt;BR /&gt;&lt;BR /&gt;Darren</description>
      <pubDate>Fri, 25 Sep 2009 14:31:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/disk-usage-script/m-p/4482415#M556059</guid>
      <dc:creator>d miller_2</dc:creator>
      <dc:date>2009-09-25T14:31:46Z</dc:date>
    </item>
  </channel>
</rss>

