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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...