This is a known issue.

This is Network Discovery, not normal Autodiscovery.

Try using this patch.

Javier

Laurentiu Drob wrote:
Hi all,

OS:              Slackware 10.1
Database:       Postgresql 8.0.3

I have a problem getting JFFNMS to work in this configuration. Nothing is
discovered, even manually running autoconfig
_networks script:
jffnms/engine$ php -q autodiscovery_network.php master 5
display this:

.....

17:16:12 Launcher Starting. Parameters: childs: 5, Timeout: 240, item
Retries: 2, Rest Time: 3 secs, Read Timeout: 3,
Child Hearbeat every 5 secs.
[EMAIL PROTECTED]:/opt/jffnms-0.8.2/engine$ 17:16:15 Number Network Deep/Max Status Changed
       IDs
17:16:15
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
17:16:15 ITEMS     Added 0 items
17:16:18 Number Network Deep/Max Status Changed IDs
17:16:18
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
17:16:18 Launcher Ended. Parameters: childs: 5, Timeout: 240, item Retries:
2, Rest Time: 3 secs, Read Timeout: 3, chi
ld Hearbeat every 5 secs. Total Time: 6 sec
All Items were processed correctly.

.....

I added a zone with IP 10.141.0.0/24 then run the autodescovery_network
script... nothing  was discovered. I added a host from this zone, manually
discovered it, added the interfaces of this host, run the
autodescovery_network script again but still nothing was discovered.
All above steps using mysql database give a positive result (hosts are
discovered by the script).
And one more thing, maybe two:

- I replaced $id=NULL with $id=0 in engine/autodescovery_network.php at line
315 because postgres 8.x dislike '' value for a numeric field
- I replaced the shell /bin/false with /bin/sh in /etc/password for user
jffnms  to make nmap or fping to work for user jffnms (su jffnms -c
".../fping t.x.y.z" doesn't work for me).

Maybe somebody have some ideas to get this work on postgres 8.x

  Best regards,
   lwd.


                
__________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jffnms-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Javier Szyszlican, Project Leader, JFFNMS
[EMAIL PROTECTED]

I hope JFFNMS or I were helpful to you, if you
can, please donate at http://jffnms.org/donate

diff -x'*png' -x'*.ini*' -x'*rrd' -x'*log' -x'*sql' -x'jffnms.conf*' -x'*dot' 
-x'*map' -x'*tftpd*' -Nru 
jffnms-0.8.2/engine/autodiscovery_network.php 
jffnms/engine/autodiscovery_network.php
--- jffnms-0.8.2/engine/autodiscovery_network.php       2005-05-09 
21:04:25.000000000 -0300
+++ jffnms/engine/autodiscovery_network.php     2005-09-20 10:04:50.000000000 
-0300
@@ -85,7 +85,8 @@
            
            if  (
                (ip_same_network($net, $private_net, 
bitsmask_to_mask($private_mask))) ||       // base net is the same network as a 
private net
-               (ip_same_network($net, "0.0.0.0", bitsmask_to_mask($net_mask))) 
                // base net is 0.0.0.0
+               (ip_same_network($net, "0.0.0.0", bitsmask_to_mask($net_mask))) 
||              // base net is 0.0.0.0
+               (ip_same_network($net, "0.0.0.0", bitsmask_to_mask(24)))        
                // base net is 0.0.0.0
                )
                return true;
        }
@@ -138,7 +139,6 @@
                
                $host_ip_parts = explode(".",$host_ip);
                
-                               
                if (($host_ip_parts[3]!=0) && ($host_ip_parts[3]!=255)) {
                    if ($parts[3]=="Up") {
                        $hosts_up++;
@@ -192,7 +192,7 @@
        while ((list (, $comm) = each ($communities)) && (!$snmp_name))
            
            if (($snmp_name = snmp_get($host_ip, $comm, $system_name_oid, 
1))!==false) {
-
+               
                $log =  "N ".str_pad($net["id"], 4)." : H 
".str_pad($host_id,3)." : ";
                logger ($log." Has SNMP $comm - $snmp_name\n");
 
@@ -204,8 +204,11 @@
 
                    // Create IPs Table
                    foreach ($snmp_ips_data as $key=>$aux_ip) {
-                       list(,$aux_ip) = explode (" ",$aux_ip);
-
+                       $aux_ip = trim($aux_ip);
+                       
+                       if (strpos(" ", $aux_ip)!==false)
+                           list(,$aux_ip) = explode (" ",$aux_ip);
+                       
                        if (!in_array($aux_ip,$invalid_ips)) {
 
                            if ($aux_ip!=$host_ip)                              
        // If IP is different than the host IP
@@ -225,7 +228,11 @@
                    // Populate the IPs table with Mask and Type data
                    foreach ($host_ips as $aux_ip=>$ipd) {
        
-                       list(,$aux_mask) = explode (" 
",$snmp_mask_data[$ipd["pos"]]);
+                       if (strpos(" ", $aux_mask)!==false)
+                           list(,$aux_mask) = explode (" 
",$snmp_mask_data[$ipd["pos"]]);
+                       else
+                           $aux_mask = $snmp_mask_data[$ipd["pos"]];
+                           
                        if (empty($aux_mask)) $aux_mask = "255.255.255.0"; // 
Fix for broken IP-MIB implementations
                                        
                        $if_index = $snmp_int_data[$ipd["pos"]];
@@ -326,7 +333,7 @@
            $net_bit = $ip_bit & $mask_bit;
            $net = ip_to_str2 ($net_bit);
 
-           if ($net != "127.0.0.0") {
+           if (($net != "127.0.0.0") && ($net!="0.0.0.0")) {
                $oper_status = 0;
 
                $mask_prefix = ip_to_bitsmask ($mask_bit);
@@ -347,10 +354,15 @@
                    "via NET_ID $parent_net, Deep $deep\n");
                */
                
-               if (!isset($networks[$aux]))
-                   return db_insert("nad_networks",array("network"=>$aux, 
"deep"=>$deep, "parent"=>$parent_net, 
-                       "oper_status"=>$oper_status, "seed"=>$seed_id, 
"oper_status_changed"=>time(), "id"=>$id));
-               else
+               if (!isset($networks[$aux])) {
+               
+                   $fields = array("network"=>$aux, "deep"=>$deep, 
"parent"=>$parent_net, 
+                       "oper_status"=>$oper_status, "seed"=>$seed_id, 
"oper_status_changed"=>time());
+
+                   if ($id!==NULL) $fields["id"] = $id;
+       
+                   return db_insert("nad_networks",$fields);
+               } else
                    return $networks[$aux]["id"];       // return the network id
            }
     }
@@ -554,7 +566,7 @@
                if (($net_data["oper_status"] == 2) &&                          
        // if its Running
                    !isset($pending_items[$network])) {                         
        // and its not in the pending list
                
-                   nad_network_status ($net_data["id"], 5);                    
        // mark it as error
+                   //nad_network_status ($net_data["id"], 5);                  
        // mark it as error
                    logger("Changed Network $network to Error, because it was 
hanged running\n");
                }

diff -x'*png' -x'*.ini*' -x'*rrd' -x'*log' -x'*sql' -x'jffnms.conf*' -x'*dot' 
-x'*map' -x'*tftpd*' -Nru jffnms-0.8.2/lib/api.nad.inc.php 
jffnms/lib/api.nad.inc.php
--- jffnms-0.8.2/lib/api.nad.inc.php    2005-05-09 21:04:25.000000000 -0300
+++ jffnms/lib/api.nad.inc.php  2005-05-18 11:38:57.000000000 -0300
@@ -19,7 +19,9 @@
        $result_nad = db_query($query_nad);
     
        while ($rnad = db_fetch_array($result_nad))
-           if (strpos($rnad["network"],"/32")==false) {
+           //if (strpos($rnad["network"],"/32")==false) 
+           if (1==1)
+           {
     
                if (!isset($hosts[$rnad["host_id"]]))
                    $hosts[$rnad["host_id"]] = 
array("ips"=>array(),"snmp_name"=>$rnad["snmp_name"], 
@@ -122,16 +124,15 @@
     }
 
     function nad_graph_by_host ($hosts, $ips, $networks, $host_id="", 
$show_all = 0) {
-
        $hosts_ids = array();
 
        if (isset($host_id))
            $hosts1 = array($host_id=>$hosts[$host_id]);
        else
            $hosts1 = $hosts;
-           
+
        if (is_array($hosts1))
-       while (list ($host_id, $host_data) = each ($hosts1)) 
+       while (list ($host_id, $host_data) = each ($hosts1))
            if (($host_data["no_more"] < 1) && (count($host_data["ips"]) > 1))
                    foreach ($host_data["ips"] as $net=>$net_data)
                        if (nad_get_bitmask($net) < 30)
@@ -147,8 +148,8 @@
                                    
$host_cnx[$host_id]["hosts"][$other_host_id]=$net;
                                
                                    if (!isset($hosts1[$other_host_id]) || 
($show_all==1)) {
-                                       
$hosts1[$other_host_id]=$hosts[$other_host_id];
-                                       $hosts1[$other_host_id]["no_more"]=1;
+                                       $hosts1[$other_host_id] = 
$hosts[$other_host_id];
+                                       $hosts1[$other_host_id]["no_more"] = 1;
                                        $host_cnx[$other_host_id]=array();
                                    }
                                }
@@ -250,7 +251,6 @@
        if (count($graph_core)!=0) {
 
            $graph = array_merge($graph_init, $graph_core, $graph_finish);
-       
            $output = nad_graph_data($graph);
 
            if ($params["get_data"]==true) $output[]=$params["data"];

Reply via email to