# $Header: emagent/sysman/admin/scripts/Ptdpm12.pm /stpl_db_11.2.0.2.0_aix.ppc64/1 2010/04/15 01:15:34 nparaddi Exp $ # # Package : Ptdpm12.pm # # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. # # NAME # Ptdpm12.pm # # DESCRIPTION # Collects Mounted File System Details # # NOTES # # MODIFIED (MM/DD/YY) # nparaddi 04/12/10 - use full path for mount # mgoodric 09/27/04 - code cleanup # mgoodric 09/23/04 - ignore autofs files systems # skumar 05/14/04 - bug/3579828: exclude /tmp_mnt: add nfs3, mmfs # skumar 01/09/04 - AIX changes for mounted filesystems # mgoodric 05/11/03 - added -debug tracing # mgoodric 04/08/03 - fix finding MAC address # goramamo 10/23/02 - removed mount time # goramamo 08/16/02 - Mount option fix # xxu 06/25/02 - remove /usr/local/bin/perl # vkhizder 06/20/02 - vkhizder_compare_fix_2420795_collection_script_changes # goramamo 06/11/02 - Creation (GIT5) # ##************************************************************* use strict; package Ptdpm12; use Carp; require 5.005; #require 5.6.1; require Exporter; use Ptdpm0; use Ptdpm2; use Ptdpm3; use Ptdpm11; #****************************************** # Global Variables #****************************************** use constant NIL => ''; @Ptdpm12::FS = ('nfs', 'ufs', 'vxfs', 'jfs', 'nfs3', 'mmfs'); #****************************************** # Export Subroutines #****************************************** @Ptdpm12::ISA = ('Exporter'); @Ptdpm12::EXPORT = qw( &getMountedFileSystemDetails ); #****************************************** # Exported Subroutines #****************************************** sub getMountedFileSystemDetails { debugTrace('Calling... getMountedFileSystemDetails()'); return getAIXMountedFileSystemDetails(); my @fsdata = (); my $file = getEtcMnttabLocation(); if ($file eq NIL) { return @fsdata; } my @att = (); my @autofs = (); my $automount = NIL; my $flag = 'false'; my $rest = ''; my $i = 0; my $j = 0; debugTrace('Opening... ' . $file); open(MNT, $file); LOOP:while () { @att = split (' ', $_); $flag = doesContain($att[2]); if ($flag eq 'true') { foreach $automount (@autofs) { next LOOP if ($att[1] =~ m~^$automount/~); } $fsdata[$i][0] = joinValue($Ptdpm2::RESOURCE_NAME_TAG, $att[0]); $fsdata[$i][1] = joinValue($Ptdpm2::MOUNT_LOCATION_TAG, $att[1]); $fsdata[$i][2] = joinValue($Ptdpm2::TYPE_TAG, $att[2]); $fsdata[$i][3] = joinValue($Ptdpm2::MOUNT_OPTIONS_TAG, NIL); ($att[3], $rest) = split (",dev=", $att[3], 2); if (!(index($att[3], "dev=") > -1)) { $fsdata[$i][3] = joinValue($Ptdpm2::MOUNT_OPTIONS_TAG, $att[3]); } #$att[4] = convEpochTime($att[4]); #$fsdata[$i][4] = joinValue($Ptdpm2::MOUNT_TIME_TAG,$att[4]); $i++; } elsif ($att[2] eq 'autofs') { $autofs[$j++] = $att[1]; } } close(MNT); return @fsdata; } #****************************************** # Non Exported Subroutines #****************************************** sub doesContain { my $str = $_[0]; my $i = 0; my $flag = 'false'; my $noOfFS = scalar(@Ptdpm12::FS); for ($i = 0 ; $i < $noOfFS ; $i++) { if ($str eq $Ptdpm12::FS[$i]) { $flag = 'true'; last; } } return $flag; } sub getAIXMountedFileSystemDetails { debugTrace('Calling... getAIXMountedFileSystemDetails()'); my @fsdata = (); my @att = (); my @mountdata = `$Ptdpm0::MOUNT | $Ptdpm0::TAIL -n +3`; my $line = ''; my $i = 0; my $size = 0; my $flag = 'false'; foreach $line (@mountdata) { @att = split(' ', $line); $size = scalar(@att); if ($size == 8) { $flag = doesContain($att[3]); if (($flag eq 'true') && !($att[2] =~ m~^/tmp_mnt/~)) { $fsdata[$i][0] = joinValue($Ptdpm2::RESOURCE_NAME_TAG, $att[0] . $att[1]); $fsdata[$i][1] = joinValue($Ptdpm2::MOUNT_LOCATION_TAG, $att[2]); $fsdata[$i][2] = joinValue($Ptdpm2::TYPE_TAG, $att[3]); $fsdata[$i][3] = joinValue($Ptdpm2::MOUNT_OPTIONS_TAG, $att[7]); } } else { $flag = doesContain($att[2]); if (($flag eq 'true') && !($att[1] =~ m~^/tmp_mnt/~)) { $fsdata[$i][0] = joinValue($Ptdpm2::RESOURCE_NAME_TAG, $att[0]); $fsdata[$i][1] = joinValue($Ptdpm2::MOUNT_LOCATION_TAG, $att[1]); $fsdata[$i][2] = joinValue($Ptdpm2::TYPE_TAG, $att[2]); $fsdata[$i][3] = joinValue($Ptdpm2::MOUNT_OPTIONS_TAG, $att[6]); } } $i++; } return @fsdata; } 1; # End of the Program