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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...