phpipam-agent icon indicating copy to clipboard operation
phpipam-agent copied to clipboard

IPs nos added to phpipam DB when running update

Open celya44 opened this issue 6 years ago • 4 comments

phpipam-agent is trying to UPDATE new IP addresses instead of INSERTing it :

/opt/phpipam-agent# php /opt/phpipam-agent/index.php update ... x.x.103.250 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 11.4/11.4/11.4

on mysql server, I see :

            503127 Query    SELECT * FROM `ipaddresses` where `subnetId` = '744' order by `ip_addr` asc
            503128 Query    update `ipaddresses` set `lastSeen` = '2018-10-11 09:52:01' where `subnetId` = '744' and `ip_addr` = '3111806913' limit 1

As the IP does not exist (it's part of a DHCP pool), shouldn't it be an INSERT instead of an UPDATE ?

celya44 avatar Oct 11 '18 07:10 celya44

Update only updates existing IP addresses, so the behavior is correct. If you want to add IP addresses that were previously unseen, you need to run the command with "discover" instead of "update" and you need to be sure that discovery is enabled for the subnet.

KenK73 avatar Oct 22 '18 07:10 KenK73

discovery is enabled fur this subnet in phpipam. When I run it :

root#:/opt/phpipam-agent# php /opt/phpipam-agent/index.php discover
--------------------
Error: Didn't find any address to scan!
--------------------

Rico29 avatar Oct 22 '18 08:10 Rico29

in database : phpipam.subnets, for the subnet I want to discover, I have :+1:

                   id: 744
               subnet: 31xxxxxx12
                 mask: 26
            sectionId: 1
          description:  FTTH AT
firewallAddressObject: NULL
                vrfId: 0
       masterSubnetId: 31
        allowRequests: NULL
               vlanId: 114
             showName: 1
               device: 0
          permissions: {"3":"1","2":"3"}
           pingSubnet: 1
       discoverSubnet: 1
         DNSrecursive: 0
         nameserverId: 0
           DNSrecords: 0
            scanAgent: 3
             isFolder: 0
               isFull: 0
                state: 2
            threshold: 0
             editDate: 2018-10-22 10:30:13
        linked_subnet: NULL
             location: 0
             lastScan: 2018-10-22 10:30:01
        lastDiscovery: NULL
           resolveDNS: 1
          customer_id: NULL

Rico29 avatar Oct 22 '18 08:10 Rico29

discovery is enabled fur this subnet in phpipam. When I run it :

root#:/opt/phpipam-agent# php /opt/phpipam-agent/index.php discover
--------------------
Error: Didn't find any address to scan!
--------------------

Rico29, I think you are seeing what we are seeing in Issue #40. This issue #46 appears to be celya44 running the agent with "update" instead of "discover". You might want to add to the #40 thread. In short, I havent found a fix for the "Didn't finad any to scan" problem yet.

KenK73 avatar Oct 22 '18 23:10 KenK73