mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Get the agent IP using ip addr if ifconfig fails.
This commit is contained in:
parent
6b3a8a93f0
commit
676d3cb6c5
@ -2167,6 +2167,10 @@ while (1) {
|
|||||||
if ($Conf{'address'} eq 'auto') {
|
if ($Conf{'address'} eq 'auto') {
|
||||||
# Tested on Ubuntu, debian, Suse, Solaris 10 and AIX 5.1
|
# 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 }'`;
|
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++) {
|
for (my $i = 0; $i <= $#address_list; $i++) {
|
||||||
chomp($address_list[$i]);
|
chomp($address_list[$i]);
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user