netstat does not exist in all systems

Add ss (replacement of netstat) to output equivalent data
---
/home/zuul/src/git.openstack.org/openstack/openstack-ansible/scripts/scripts-library.sh: line 398: netstat: command not found

Change-Id: I14b97037c3b69d60b6a26dda69840ee3de66354c
This commit is contained in:
Jonathan Herlin 2018-12-10 00:04:46 +01:00
parent ed3691fd05
commit cf69f701eb
1 changed files with 8 additions and 1 deletions

View File

@ -395,7 +395,14 @@ function get_instance_info {
free -m > "/openstack/log/instance-info/free_${TS}.log" || true
cat /proc/cpuinfo > "/openstack/log/instance-info/cpuinfo_${TS}.log" || true
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > "/openstack/log/instance-info/ps_${TS}.log" || true
netstat -tulpn > "/openstack/log/instance-info/netstat_${TS}.log" || true
# Check if system has netstat or iproute2
if command -v ss >/dev/null; then
ss -tulpn > "/openstack/log/instance-info/ss_${TS}.log" || true
fi
if command -v netstat >/dev/null; then
netstat -tulpn > "/openstack/log/instance-info/netstat_${TS}.log" || true
fi
}
## Signal traps --------------------------------------------------------------