diff --git a/VERSION b/VERSION index 57399a7..5d998c4 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -9.2.0.7 -9.2.0.7 +9.2.0.8 +9.2.0.8 diff --git a/app.manifest b/app.manifest index 8777a00..88ce30d 100644 --- a/app.manifest +++ b/app.manifest @@ -29,7 +29,7 @@ "id": { "group": null, "name": "TA-nix", - "version": "9.2.0.7" + "version": "9.2.0.8" }, "license": { "name": "Splunk Software License Agreement", diff --git a/bin/df.sh b/bin/df.sh index be0a901..6664ff4 100755 --- a/bin/df.sh +++ b/bin/df.sh @@ -15,7 +15,7 @@ if [ "$KERNEL" = "Linux" ] ; then # shellcheck disable=SC2016 FILTER_PRE='$2=="btrfs"&&btrfs[$1]==1{next}$2=="btrfs"{btrfs[$1]=1}' # shellcheck disable=SC2016 - FILTER_POST='/(devtmpfs|tmpfs)/ {next}' + FILTER_POST='/(devtmpfs|tmpfs|efivars)/ {next}' # shellcheck disable=SC2016 PRINTF=' { @@ -217,50 +217,19 @@ elif [ "$KERNEL" = "Darwin" ] ; then #Maps fsType # shellcheck disable=SC2016 MAP_FS_TO_TYPE='/ on / { - for(i=1;i<=NF;i++){ - if($i=="on" && $(i+1) ~ /^\/.*/) - { + for (i = 1; i <= NF; i++) { + if ($i == "on" && $(i + 1) ~ /^\/.*/) key=$(i+1); - } if($i ~ /^\(/) - value=substr($i,2,length($i)-2); + value = substr($i, 2, length($i) - 2); } - fsTypes[key]=value; + fsTypes[key] = value; }' - # Append Type and Inode headers to the main header and print respective fields from values stored in MAP_FS_TO_TYPE variables - # shellcheck disable=SC2016 - PRINTF=' - { - if($0 ~ /^Filesystem.*/){ - sub("%iused","IUsePct",$0); - - for(i=1;i<=NF;i++){ - if($i=="iused") iusedCol=i; - if($i=="ifree") ifreeCol=i; - - if($i=="Mounted" && $(i+1)=="on"){ - mountedCol=i; - sub("Mounted on","MountedOn",$0); - } - } - $(NF+1)="Type"; - $(NF+1)="INodes"; - print $0; - } + PRINTF='/^Filesystem/ { + printf "Filesystem\tType\tSize\tUsed\tAvail\tUse%%\tInodes\tIUsed\tIFree\tIUse%%\tMountedOn\n"; } - { - for(i=1;i<=NF;i++) - { - if($i ~ /^\/dev\/.*s[0-9]+$/){ - sub("^/dev/", "", $i); - sub("s[0-9]+$", "", $i); - } - if($i ~ /^\/\S*/ && i==mountedCol){ - $(NF+1)=fsTypes[$mountedCol]; - $(NF+1)=$iusedCol+$ifreeCol; - print $0; - } - } + $0 !~ /^Filesystem/ && $0 !~ / on / { + printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $1, fsTypes[$NF], $2, $3, $4, $5, $6+$7, $6, $7, $8, $9; }' elif [ "$KERNEL" = "FreeBSD" ] ; then diff --git a/bin/df_metric.sh b/bin/df_metric.sh index 4888ea0..5d5c4f1 100755 --- a/bin/df_metric.sh +++ b/bin/df_metric.sh @@ -23,7 +23,7 @@ if [ "$KERNEL" = "Linux" ] ; then # shellcheck disable=SC2016 FILTER_PRE='$2=="btrfs"&&btrfs[$1]==1{next}$2=="btrfs"{btrfs[$1]=1}' # shellcheck disable=SC2016 - FILTER_POST='/(devtmpfs|tmpfs)/ {next}' + FILTER_POST='/(devtmpfs|tmpfs|efivars)/ {next}' # shellcheck disable=SC2016 PRINTF=' function rem_pcent(val) @@ -32,20 +32,19 @@ if [ "$KERNEL" = "Linux" ] ; then {val=substr(val, 1, length(val)-1); return val} } { - if($0 ~ /^Filesystem.*/){ + if ($0 ~ /^Filesystem.*/) { sub("Mounted on","MountedOn",$0); $(NF+1)="OSName"; $(NF+1)="OS_version"; $(NF+1)="IP_address"; $(NF+1)="IPv6_Address"; print $0; + } else { + + if ($10 == "-") $10 = "0%"; + printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $1, $2, $3, $4, $5, rem_pcent($6), $7, $8, $9, rem_pcent($10), $11, OSName, OS_version, IP_address, IPv6_Address; } - match($0,/^(.*[^ ]) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+%|-) +(.*)$/,a); - - if (length(a) != 0) - { printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", a[1], a[2], a[3], a[4], a[5], rem_pcent(a[6]), a[7], a[8], a[9], rem_pcent(a[10]), a[11], OSName, OS_version, IP_address, IPv6_Address} - }' elif [ "$KERNEL" = "SunOS" ] ; then @@ -236,63 +235,21 @@ elif [ "$KERNEL" = "Darwin" ] ; then #Maps fsType # shellcheck disable=SC2016 MAP_FS_TO_TYPE='/ on / { - for(i=1;i<=NF;i++){ - if($i=="on" && $(i+1) ~ /^\/.*/) - { + for (i = 1; i <= NF; i++) { + if ($i == "on" && $(i + 1) ~ /^\/.*/) key=$(i+1); - } if($i ~ /^\(/) - value=substr($i,2,length($i)-2); + value = substr($i, 2, length($i) - 2); } - fsTypes[key]=value; + fsTypes[key] = value; }' # Append Type and Inode headers to the main header and print respective fields from values stored in MAP_FS_TO_TYPE variables # shellcheck disable=SC2016 - PRINTF=' - { - if($0 ~ /^Filesystem.*/){ - sub("%iused","IUsePct",$0); - - for(i=1;i<=NF;i++){ - if($i=="iused") iusedCol=i; - if($i=="ifree") ifreeCol=i; - if($i=="Mounted" && $(i+1)=="on"){ - mountedCol=i; - sub("Mounted on","MountedOn",$0); - } - } - $(NF+1)="Type"; - $(NF+1)="INodes"; - $(NF+1)="OSName"; - $(NF+1)="OS_version"; - $(NF+1)="IP_address"; - $(NF+1)="IPv6_Address"; - - - print $0; - } + PRINTF='/^Filesystem/ { + printf "Filesystem\tType\t1K-blocks\tUsed\tAvail\tUse%%\tInodes\tIUsed\tIFree\tIUse%%\tMountedOn\tOSName\tOS_version\tIP_address\tIPv6_Address\n"; } - { - for(i=1;i<=NF;i++) - { - if($i ~ /.*\%$/) - $i=substr($i, 1, length($i)-1); - - if($i ~ /^\/dev\/.*s[0-9]+$/){ - sub("^/dev/", "", $i); - sub("s[0-9]+$", "", $i); - } - - if($i ~ /^\/\S*/ && i==mountedCol){ - $(NF+1)=fsTypes[$mountedCol]; - $(NF+1)=$iusedCol+$ifreeCol; - $(NF+1)=OSName; - $(NF+1)=OS_version; - $(NF+1)=IP_address; - $(NF+1)=IPv6_Address; - print $0; - } - } + $0 !~ /^Filesystem/ && $0 !~ / on / { + printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $1, fsTypes[$NF], $2, $3, $4, substr($5, 1, length($5) - 1), $6+$7, $6, $7, substr($8, 1, length($8) - 1), $9, OSName, OS_version, IP_address, IPv6_Address; }' elif [ "$KERNEL" = "FreeBSD" ] ; then diff --git a/default/app.conf b/default/app.conf index 3e4130c..cbf2275 100644 --- a/default/app.conf +++ b/default/app.conf @@ -17,7 +17,7 @@ docs_section_override = AddOns:released [launcher] author = Michael Erdely -version = 9.2.0.7 +version = 9.2.0.8 description = Technical Add-on for Unix and Linux #[package] @@ -26,5 +26,5 @@ description = Technical Add-on for Unix and Linux [id] name = TA-unix -version = 9.2.0.7 +version = 9.2.0.8 diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 8eab784..9a31062 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -1,5 +1,15 @@ # Technical Add-on for Unix and Linux +## Version 9.2.0.8 (2025-01-23) + +Fix df.sh and df_metric.sh + +Changes: + +* Fix Linux when df outputs a "-" +* Exclude efivars partitions for Linux +* Fix the output on Darwin to match Linux output + ## Version 9.2.0.7 (2025-01-20) Fix run_nix_ta_commands script