AIX Filesystem inspectors

AIX 7.2, BESClient 9.2.9.36, Console version 9.2.9.36.
names of filesystems returns incorrect results:
reports /opt/local exists, when it does not, and reporting details for /opt/ when actually checking for /opt/local.

Q: names of filesystems
A: /
A: /usr
A: /var
A: /tmp
A: /home
A: /data
A: /www
A: /proc
A: /tempfs
A: /www-DR
A: /admin
A: /opt
A: /opt/samgr/systemlogs
A: /chbuxu05/optprods
A: /EP2

Q: (exists names of filesystems “/opt/local/”)
A: True
T: 326
This is evaluating as True, but is actually False as seen above.

Also finding the documentation and examples are minimal for AIX filesystem related inspectors any hints, tips or links are appreciated.
Any suggestions

I would suggest to open a PMR for this topic .

It seems that the relevance names of filesystems "/opt/local/" is returning the name of the FS itself, in this case /opt.

What if you try:

exists filesystems whose(name of it = "/opt/local/")
1 Like

Hello, this not working either, but half way.

Now it returns correctly false when “/opt/local” does not exist. But does not report True when the filesystem exists.

Q: names of filesystems
A: /
A: /usr
A: /var
A: /tmp
A: /home
A: /data
A: /www
A: /proc
A: /tempfs
A: /www-DR
A: /admin
A: /opt
A: /opt/samgr/systemlogs
A: /chbuxu05/optprods

Incorrect result.
Q: (exists names of filesystems “/opt/local/”)
A: True
T: 290

Correct result for not found…
Q: exists filesystems whose(name of it = “/opt/local/”)
A: False
T: 2710

Example where “/opt/local” exists.

Q: names of filesystems
A: /
A: /usr
A: /var
A: /tmp
A: /home
A: /proc
A: /opt
A: /opt/local
T: 749

*Incorrect results, when “/opt/local” filesystem exists.
Q: (exists filesystems whose(name of it = “/opt/local/”))
A: False
T: 441

*Correct results, when “/opt/local” filesystem exists.
Q: (exists names of filesystems “/opt/local/”)
A: True

One syntax works correctly for the “True” condition but is incorrect for the “False” condition.
The other syntax is correct for the “False” condition but incorrect for the “True” condition.

Thanks very much for the suggestion Fermt but still looking for any recommendations. It seems like a syntax bug? The inspector should be using the lsfs aix command to gather the correct info.

John

Where to open a PMR?

You may find references in this link
http://www-01.ibm.com/support/docview.wss?uid=swg21624185

*Incorrect results, when “/opt/local” filesystem exists.
Q: (exists filesystems whose(name of it = “/opt/local/”))
A: False
T: 441

it is enough logical.
name of filesystems - returns filesystem name without last “/”
"/opt/local" is not equal to “/opt/local/”

Q: name of filesystems "/proc/"
A: /proc
T: 210

Q: name of filesystems "/proc"
A: /proc
T: 207

Q: (exists filesystems whose(name of it = “/proc/”))
A: False
T: 970

Q: (exists filesystems whose(name of it = “/proc”))
A: True
T: 696

1 Like

Hello Vitali, I think this solved it. I tried with and without the trailing “/” but not in the final syntax you figured out with the absolute logic. Thanks very much.

This was part of a bigger analysis to report info for a specific filesystem:

if (exists filesystems whose(name of it = “/opt/local”)) then (size of filesystem “/opt/local” / 1024 /1024) as string & " MB" else (“does not exist”)

if (exists filesystems whose(name of it = “/opt/local”)) then (used space of filesystem “/opt/local” / 1024 /1024) as string & " MB" else (“does not exist”)

if (exists filesystems whose(name of it = “/opt/local”)) then (free space of filesystem “/opt/local” / 1024 / 1024) as string & " MB" else (“does not exist”)

if (exists filesystems whose(name of it = “/opt/local”)) then (used percent of filesystem “/opt/local”) as string & ("%25") else (“does not exist”)

if (exists filesystems whose(name of it = “/opt/local”)) then (name of filesystem “/opt/local”) else (“does not exist”)

if (exists filesystems whose(name of it = “/opt/local”)) then (mode of folder “/opt/local” as string) else (“filesytem not found”)

if (exists filesystems whose(name of it = “/opt/local”)) then (user name of folder “/opt/local”) & (":") & (group name of folder “/opt/local”) as string else (“file not found”)

Anyone care to take a crack at simplfying this one? The basic if/then/else for AIX, Linux or Solaris works fine, then you can add any other test within the sub if…

if (name of operating system contains “AIX”) then (if ((exists file “/var/spool/cron/crontabs/root”) and (exists lines whose (it as string contains “/usr/bin/nmon”) of file “/var/spool/cron/crontabs/root”)) then (lines whose (it as string contains “/usr/bin/nmon”) of file “/var/spool/cron/crontabs/root”) else (“nmon not found crontab”)) else if (name of operating system contains “Linux”) then (if ((exists file “/var/spool/cron/tabs/root”) and (exists lines whose (it as string contains “nmon”) of file “/var/spool/cron/tabs/root”)) then (lines whose (it as string contains “/bin/nmon”) of file “/var/spool/cron/tabs/root”) else (“nmon not found crontab”)) else if (name of operating system contains “SunOS”) then ("nmon not found on: "& name of operating system) else (“unknown OS”)

Thanks again Vitali.
John

Here is a simplified version of your last relevance statement:

(if it starts with “nmon not found” or it starts with “unkown OS” then it else if exist file it and exist lines whose (it as string contains “/usr/bin/nmon”) of file it then lines whose (it as string contain “/usr/bin/nmon”) of file it else “nmon not found crontab”) of (if it contains “AIX” then “/var/spool/cron/crontabs/root” else if it contains “Linux” then “/var/spool/cron/tabs/root” else if it contains “SunOS” then "nmon not found on: "& it else “unknown OS”) of (name of operating system)

Thanks Matt, will give it a shot.
I had spent some time previously on a generic if/then/else loop to be able to then add any specific command based on the OS type.
My original if/then/else is lacking in that it only checks 3 conditions, when OS could be many more.
In shell script or Rexx I would have used a case or select statement. Thanks again for passing a simplified version.
John