This is a quick how-to (updated) on getting the latest version (v2.39.27, May of 2018) of Netdisco up and running on FreeBSD 11 p9. It’s assumed you have your base system installed, have set your shell and installed sudo or given your account wheel access. To start, we need the following prerequisites installed:
- p5-DBD-Pg (this will install Perl)
Note this version of the PostgreSQL client above, we will want to install the matching -server version
Once PostgreSQL server is installed, we will receive the following:
We need to note the above information and come back to it a little bit later after net-snmp is installed and configured.
If we want to add the full snmpd and snmpdtrapd stuff, we’d follow the brief example at the end of the installation. If not, we add just the pertinent information to /etc/rc.conf:
We DO copy the example snmpd.conf file to our /etc/ directory:
Then edit the /etc/snmpd.conf file for our snmp environment setting the rocommunity string in the ACCESS CONTROL section (where we define read and/or write configuration).
Last but not least, we install the curl package:
Next, we will need to add the netdisco user. This is important as the entire netdisco installation and perl based micro web server (dancer) runs in the context of the netdisco user.
Now we initialize the PostgreSQL server:
This won’t take long to complete but we do need to note what it says here; It is important as we will need to revisit the pgsql pseudo-user later in the installation:
Next, we test the PostgreSQL server:
We should receive the following:
Now we are finally ready to begin the netdisco installation:
Here is where we can go get a cup of coffee or some other favorite beverage…this will take awhile especially depending on our specific hardware or virtual config 🙂
Staying in the user context of the netdisco user, we create the /bin and /environments folder:
Now we copy the critical files into ~/environments, chmod the file and then edit the deployment.yml file:
We edit the database section, domain suffix and the SNMP community string(s) sections:
In order to run the netdisco-deploy script, we need to link it and the envpath:
We can now test the daemon. We see the Netdisco Daemon [Not Running], this is normal behavior.
So, remember when we noted previously the pgsql pseudo-user information? This is where we will create the netdisco database and the netdisco database user:
We exit out of the netdisco user context, login to the pgsql user context, and create the db and user:
Note the following as this will be the user we create that will be the initial admin account that we login to the netdisco web interface with:
We finalize by downloading the MAC prefixes and MIB files. IMPORTANT: Both of these processes will appear to do nothing as no user notification is given. We should not be alarmed and definitely not try to break out of the script completion. It will feel like it’s locked up, but assuredly it is not.
Oddly, for this how-to, a failed MIB download occurred. Improvising, exit out of the netdisco user context, do a “pkg install wget”, go back into netdisco user context and grab the files manually:
We log back into the netdisco user context and start the web and daemon:
We can now open a web browser and browse to the host’s IP address (or DNS name if added to local DNS server) on port 5000
Now, we can either add the initial network discovery IP address on the next screen or launch it separately from the terminal:
Congratulations! We now have a fully operational FreeBSD/Netdisco server ready to poll our SNMP environment.
Please note: This micro-web server runs in the context of an unprivileged user. When rebooting the server, we will need to manually run the netdisco-web and netdisco-daemon start processes (there are also several ways to start the web and daemon at boot [non-root], but this tutorial doesn’t cover that process). It is highly recommended to run netdisco behind an SSL Apache proxy. Please read the section on metacpan.org’s website about running Netdisco in reverse proxy
That’s it. Happy Net Disco’ing!