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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...