2013-05-07 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Tools.pm: Added a function to resolve hostnames. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8111 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
506ef27913
commit
2f31062b25
|
@ -1,3 +1,7 @@
|
||||||
|
2013-05-07 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Tools.pm: Added a function to resolve hostnames.
|
||||||
|
|
||||||
2013-05-07 Ramon Novoa <rnovoa@artica.es>
|
2013-05-07 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/DB.pm,
|
* lib/PandoraFMS/DB.pm,
|
||||||
|
|
|
@ -24,6 +24,7 @@ use POSIX;
|
||||||
use PandoraFMS::Sendmail;
|
use PandoraFMS::Sendmail;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
use Encode;
|
use Encode;
|
||||||
|
use Socket qw(inet_ntoa inet_aton);
|
||||||
|
|
||||||
# New in 3.2. Used to sendmail internally, without external scripts
|
# New in 3.2. Used to sendmail internally, without external scripts
|
||||||
# use Module::Loaded;
|
# use Module::Loaded;
|
||||||
|
@ -65,6 +66,7 @@ our @EXPORT = qw(
|
||||||
md5_init
|
md5_init
|
||||||
pandora_ping
|
pandora_ping
|
||||||
pandora_ping_latency
|
pandora_ping_latency
|
||||||
|
resolve_hostname
|
||||||
ticks_totime
|
ticks_totime
|
||||||
safe_input
|
safe_input
|
||||||
safe_output
|
safe_output
|
||||||
|
@ -1163,6 +1165,15 @@ sub cron_get_closest_in_range ($$) {
|
||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Attempt to resolve the given hostname.
|
||||||
|
###############################################################################
|
||||||
|
sub resolve_hostname ($) {
|
||||||
|
my ($hostname) = @_;
|
||||||
|
|
||||||
|
return inet_ntoa(inet_aton($hostname));
|
||||||
|
}
|
||||||
|
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
# End of defined Code
|
# End of defined Code
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue