All Apps and Add-ons

df script in *nix for aix not always printing correct values

kkalmbach
Path Finder

I have some aix boxes and the fields being printed out by the df scipt are not correct. (the fields get off).
The problem is that the first call to df (/usr/sysv/bin/df -n), does not return every filesystem that the second call to df (/usr/bin/df -kP) returns.

So when this part of the format line runs:

$2=fsTypes[mountedOn]

$2 becomes empty (blank). Then when it's printed out there are fewer columns than the header states and the values are shifted.

Here is the my new FORMAT line (I just added in the if at the end):

FORMAT='{size=$2; used=$3; avail=$4; usePct=$5; mountedOn=$6; $2=fsTypes[mountedOn]; $3=size; $4=used; $5=avail;
 $6=usePct; $7=mountedOn; if ($2=="") {$2="?"}}'

Does that look good? If so, can you add it into the next version of *nix?

Thanks
-Kevin

1 Solution

araitz
Splunk Employee
Splunk Employee

Yes, I have added this bug to the queue for the next version of *nix.

View solution in original post

araitz
Splunk Employee
Splunk Employee

Yes, I have added this bug to the queue for the next version of *nix.

dwaddle
SplunkTrust
SplunkTrust

Araitz's blog post points out that the 4.5 version of this app will be published onto Splunk's github and released under the Apache license. Once it is out there, I would recommend that you pull the app from their git tree and provide patches on there. That would be one of the quickest ways to get your change integrated into the code base.

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...