Repository navigation
Discovery
discovery.php is compatible with Collate:Network version 1.5.2 and later. This script works by pinging all addresses in the subnet ranges in the database except for those that have been already reserved or those that fall within an ACL. If a host is found, and the "numeric" option is not set, a name is looked for in reverse DNS. If a name isn't found, the IP is reserved with an empty string for a name. Beginning with Collate:Network version 2.1, these reserved IPs with empty names are re-checked on future runs for names as long as the "numeric" option is not set.
This script accepts three options:
-h (or --help): Outputs the help message
-v (or --verbose): Outputs detail about the progress of the script as it executes
-n (or --numeric): Skip name resolution when adding hosts
This script should be setup to execute via cron on a POSIX system. The schedule will depend on the amount of IP space you manage - generally, the more space, the less frequently you can run the script. This script should augment the ping command on the static IP reservation page, not replace it.
NOTE: You may be able to run this script on a Windows system if you modify the $command variable at the top of the script but this script was not written with Windows in mind and future versions will likely not be written with Windows in mind either.
By default, each address is pinged three times and considered active if any pings are ponged. (I'm allowed to make up words, it's my documentation :-) You can change the number of times each host is pinged by modifying the $command variable at the top of the script to -c # where # is the number of times you'd like a host to be pinged.
NOTE: Most networks are full of hosts that often go more than four hours between sending/receiving traffic. Because of this, it is common to see the first or first two packets get dropped while an ARP lookup occurs. It is best not to set this value below 3.
Successful pings will be executed very quickly. Expect up to 4 seconds per address.See the manual page for the ping command for ways that you might fine-tune this script for better performance. Never use -f or -l options for ping in this script!
It could certainly be possible to re-write this script to execute with child processes doing the time-intensive portion of the work but this script finishes in 12-24 hours in our environment which is fine for the once-per-week schedule we run it on.