From 676d3cb6c5a28d042b4c43e903096ded2e99f645 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 21 Oct 2014 11:28:36 +0200 Subject: [PATCH] Get the agent IP using ip addr if ifconfig fails. --- pandora_agents/unix/pandora_agent | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index ac2df78f76..b1e57b087c 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -2167,6 +2167,10 @@ while (1) { if ($Conf{'address'} eq 'auto') { # Tested on Ubuntu, debian, Suse, Solaris 10 and AIX 5.1 my @address_list = `ifconfig -a | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{ print \$2 }' | awk -F':' '{ print \$2 }'`; + if ($#address_list < 0) { + # Tested on Red Hat 7 + @address_list = `ip addr show | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{print \$2}' | cut -d/ -f1`; + } for (my $i = 0; $i <= $#address_list; $i++) { chomp($address_list[$i]); if ($i > 0) {