Fix docker script and props

* Fix output for docker script (handle lines that didn't have values)
* Fix props.conf LINE_BREAKER for docker
This commit is contained in:
Michael Erdely 2025-01-17 11:44:24 -05:00
parent 5551b8973d
commit e5e03ea464
Signed by: mike
SSH key fingerprint: SHA256:ukbnfrRMaRYlBZXENtBTyO2jLnql5AA5m+SzZCfYQe0
6 changed files with 41 additions and 10 deletions

View file

@ -1,2 +1,2 @@
9.2.0.5
9.2.0.5
9.2.0.6
9.2.0.6

View file

@ -29,7 +29,7 @@
"id": {
"group": null,
"name": "TA-nix",
"version": "9.2.0.5"
"version": "9.2.0.6"
},
"license": {
"name": "Splunk Software License Agreement",

View file

@ -62,8 +62,19 @@ for id in $docker_list; do
pids[$id]=$($docker_cmd inspect -f '{{ .State.Pid }}' $id)
read time_start[$id] _ < /proc/uptime
read _ cpu_start[$id] < /sys/fs/cgroup/system.slice/docker-$id.scope/cpu.stat
while read _if _rx _ _ _ _ _ _ _ _tx _ _ _ _ _ _ _ ; do if=$_if rx_start[$id]=$_rx tx_start[$id]=$_tx; done < /proc/${pids[$id]}/net/dev
br_start[$id]=0;bw_start[$id]=0;while read _ _br _bw _ _ _ _; do br_start[$id]=$((${br_start[$id]}+${_br:7}));bw_start[$id]=$((${bw_start[$id]}+${_bw:7})); done < /sys/fs/cgroup/system.slice/docker-$id.scope/io.stat
while read _if _rx _ _ _ _ _ _ _ _tx _ _ _ _ _ _ _ ; do
[ -z "$_if" ] && continue
[ -z "$_rx" ] && _rx=0
[ -z "$_tx" ] && _tx=0
if=$_if rx_start[$id]=$_rx tx_start[$id]=$_tx
done < /proc/${pids[$id]}/net/dev
br_start[$id]=0;bw_start[$id]=0
while read _ _br _bw _ _ _ _; do
[ -z "$_br" ] && _br=rbytes=0
[ -z "$_bw" ] && _bw=wbytes=0
br_start[$id]=$((${br_start[$id]}+${_br:7}))
bw_start[$id]=$((${bw_start[$id]}+${_bw:7}))
done < /sys/fs/cgroup/system.slice/docker-$id.scope/io.stat
done
sleep 2 # Sleep 2 seconds to give the script time to get CPU stats
@ -78,8 +89,19 @@ for id in $docker_list; do
fi
read cpu_stop _ < /proc/uptime
read _ proc_stop < /sys/fs/cgroup/system.slice/docker-$id.scope/cpu.stat
while read _if _rx _ _ _ _ _ _ _ _tx _ _ _ _ _ _ _ ; do if=$_if NetRX=$_rx NetTX=$_tx; done < /proc/${pids[$id]}/net/dev
BlockRead=0;BlockWrite=0;while read _ _br _bw _ _ _ _; do BlockRead=$((BlockRead+${_br:7}));BlockWrite=$((BlockWrite+${_bw:7})); done < /sys/fs/cgroup/system.slice/docker-$id.scope/io.stat
while read _if _rx _ _ _ _ _ _ _ _tx _ _ _ _ _ _ _ ; do
[ -z "$_if" ] && continue
[ -z "$_rx" ] && _rx=0
[ -z "$_tx" ] && _tx=0
if=$_if NetRX=$_rx NetTX=$_tx
done < /proc/${pids[$id]}/net/dev
BlockRead=0;BlockWrite=0
while read _ _br _bw _ _ _ _; do
[ -z "$_br" ] && _br=rbytes=0
[ -z "$_bw" ] && _bw=wbytes=0
BlockRead=$((BlockRead+${_br:7}))
BlockWrite=$((BlockWrite+${_bw:7}))
done < /sys/fs/cgroup/system.slice/docker-$id.scope/io.stat
read MemUsage < /sys/fs/cgroup/system.slice/docker-$id.scope/memory.current
read Pids < /sys/fs/cgroup/system.slice/docker-$id.scope/pids.current
read _ CPU < /sys/fs/cgroup/cpu.stat

View file

@ -17,7 +17,7 @@ docs_section_override = AddOns:released
[launcher]
author = Michael Erdely
version = 9.2.0.5
version = 9.2.0.6
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.5
version = 9.2.0.6

View file

@ -517,7 +517,7 @@ KV_MODE=multi
[docker]
SHOULD_LINEMERGE=false
LINE_BREAKER=(^$|[\r\n]+[\r\n]+)
LINE_BREAKER=(^$|[\r\n]+)
TRUNCATE=1000000
KV_MODE = json
FIELDALIAS-dest_for_docker = host as dest

View file

@ -1,5 +1,14 @@
# Technical Add-on for Unix and Linux
## Version 9.2.0.6 (2025-01-17)
Fix docker script and props
Changes:
* Fix output for docker script (handle lines that didn't have values)
* Fix props.conf LINE_BREAKER for docker
## Version 9.2.0.5 (2025-01-11)
Add script for docker events/metrics and support running TA outside of Splunk