Skip to content

Commit

Permalink
netstat command is deprecated, switch to ss command instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemens Schwaighofer committed Sep 3, 2024
1 parent c89a750 commit 49882fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zabbix-dump
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ if [[ "${READ_ZBX_CONFIG}" == "yes" && -f "${ZBX_CONFIG}" && -r "${ZBX_CONFIG}"
if [[ ( "$DBTYPE" == "mysql" && "$DBHOST" == "localhost" ) || ( "$DBTYPE" == "psql" && "$DBHOST" == "" ) ]]; then
[ "$DBTYPE" == "mysql" ] && searchstr="mysqld.sock"
[ "$DBTYPE" == "psql" ] && searchstr="postgres"
sock=$(netstat -lxn | grep -m1 "$searchstr" | sed -r 's/^.*\s+([^ ]+)$/\1/')
sock=$(ss -lax | grep -m1 "$searchstr" | column -t -o "#" | cut -d "#" -f 5)
if [[ -n "$sock" && -S $sock ]]; then DBSOCKET="$sock"; DBHOST=""; fi
else
DBSOCKET="$(/usr/bin/awk -F'=' '/^DBSocket/{ print $2 }' "${ZBX_CONFIG}")"
Expand Down

0 comments on commit 49882fb

Please sign in to comment.