2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

hostname -I returns all values on one line.

This commit is contained in:
Phil! Gold 2016-10-17 10:04:03 -04:00
parent 24ffbb8c29
commit 5355c24b49

View File

@ -16,9 +16,11 @@ track their current reputation score.
=head1 CONFIGURATION =head1 CONFIGURATION
By default, the script will use the first IP address returned by C<hostname -I>. By default, the script will use the first IP address returned by
If that's not the right address to use, set the C<ip_address> environment C<hostname -I>. If that's not the right address to use, set the
variable to the appropriate value. C<ip_address> environment variable to the appropriate value. (Note that
if a host has multiple IP addresses, there's no guaranteed ordering for
C<hostname -I>, so you should set the address explicitly in that case.)
[senderbase] [senderbase]
env.ip_address 8.8.8.8 env.ip_address 8.8.8.8
@ -40,7 +42,7 @@ This plugin is made available under a CC0 waiver:
=cut =cut
real_ip_address=${ip_address:-$(hostname -I | head -1)} real_ip_address=${ip_address:-$(hostname -I | awk '{print $1}')}
ip_reversed=$(echo $real_ip_address | sed -re 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/\4.\3.\2.\1/') ip_reversed=$(echo $real_ip_address | sed -re 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/\4.\3.\2.\1/')
query_host=${ip_reversed}.rf.senderbase.org query_host=${ip_reversed}.rf.senderbase.org