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:
Ramon Novoa 2013-05-07 17:02:02 +00:00
parent 506ef27913
commit 2f31062b25
2 changed files with 15 additions and 0 deletions

View File

@ -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>
* lib/PandoraFMS/DB.pm,

View File

@ -24,6 +24,7 @@ use POSIX;
use PandoraFMS::Sendmail;
use HTML::Entities;
use Encode;
use Socket qw(inet_ntoa inet_aton);
# New in 3.2. Used to sendmail internally, without external scripts
# use Module::Loaded;
@ -65,6 +66,7 @@ our @EXPORT = qw(
md5_init
pandora_ping
pandora_ping_latency
resolve_hostname
ticks_totime
safe_input
safe_output
@ -1163,6 +1165,15 @@ sub cron_get_closest_in_range ($$) {
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 defined Code