Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Jul 28, 2017 12:12 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Discovery Plugin - Patch for hostnames and availability
PostPosted: Wed Jul 18, 2012 12:59 am 
Offline

Joined: Thu Jul 07, 2005 5:14 pm
Posts: 16
Location: Melb, Australia
Hi All,

Another modification I thought I'd share I just made to the Discovery plugin, this one uses the hostname in place of the IP if it can resolve it, and also uses the actual availability method configured, I found it was setting it to Ping and SNMP.


Code:
--- /plugins/discovery/findhosts.php   Thu Dec 22 08:27:32 2011
+++ /plugins/discovery/findhosts.php   Wed Jul 18 15:48:20 2012
@@ -357,6 +357,7 @@
                  $dnsname = discover_get_dns_from_ip($host, $dns, 300);
                  if ($dnsname != $host && $dnsname != 'timed_out') {
                     $device['dnsname'] = $dnsname;
+                     $device['hostname'] = $dnsname;
                  }
                  $device['dnsname_short'] = preg_split('/[\.]+/', strtolower($dnsname), -1, PREG_SPLIT_NO_EMPTY);
               }else{
@@ -438,6 +439,7 @@
                  $dnsname = discover_get_dns_from_ip($host, $dns, 300);
                  if ($dnsname != $host && $dnsname != 'timed_out') {
                     $device['dnsname'] = $dnsname;
+                     $device['hostname'] = $dnsname;
                  }
                  $device['dnsname_short'] = preg_split('/[\.]+/', strtolower($dnsname), -1, PREG_SPLIT_NO_EMPTY);
               }else{
@@ -493,7 +495,7 @@
   $snmp_timeout         = read_config_option('snmp_timeout');
   $disable              = false;
   $tree                 = $device['tree'];
-   $availability_method  = read_config_option("ping_method");
+   $availability_method  = read_config_option("availability_method");
   $ping_method          = read_config_option("ping_method");
   $ping_port            = read_config_option("ping_port");
   $ping_timeout         = read_config_option("ping_timeout");


Top
 Profile  
 
 Post subject: Re: Discovery Plugin - Patch for hostnames and availability
PostPosted: Sun Jul 22, 2012 3:11 am 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Thx, added
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group