LibreNMS - jonatello/lab-musing GitHub Wiki
LibreNMS is an open source Network Monitoring Solution, you can read more about it here - https://www.librenms.org/. I am still running into some issues with PHP or RRD where I get errors within the WebGUI. Not quite sure why. I will continue to add notes to the Troubleshooting section. I also noticed due to some sort of Zlib version it was necessary to deploy this via iocage instead of Warden.
Update all packages
pkg update
pkg upgrade
Install the LibreNMS package
pkg install librenms
Install the MySQL package
pkg install mysql56-server-5.6.41
Enable MySQL via rc.conf
sysrc mysql_enable=yes
Start MySQL
service mysql-server start
Run the Secure Installation (fill out prompts appropriately)
mysql_secure_installation
Log into MySQL via root
mysql -u root -p
Create the librenms database and configure the librenms user with privileges
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
Create my.cnf using "librenms.my.cnf"
vi /var/db/mysql/my.cnf
Restart the MySQL service
service mysql-server restart
Edit crontab and append the following line
vi /etc/crontab
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
Copy the default production config to php.ini and set the timezone appropriately
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
sed -i '' 's/;date.timezone =/date.timezone = "%My%\/%Timezone%/g' /usr/local/etc/php.ini
Copy the default LibreNMS config to config.php and configure appropriately
cp /usr/local/www/librenms/config.php.default /usr/local/www/librenms/config.php
Or use "librenms.config.php" and update %Password% appropriately with the MySQL password of the librenms user created
vi /usr/local/www/librenms/config.php
Enable PHP via rc.conf
sysrc php_fpm_enable=yes
Start PHP
service php-fpm start
Create httpd.conf
vi /usr/local/etc/apache24/httpd.conf
Or use "librenms.httpd.conf" and update the ServerName appropriately
Enable Apache via rc.conf
sysrc apache24_enable=yes
Start Apache
service apache24 start
Copy the example SNMP config to snmpd.conf
cp /usr/local/share/examples/librenms/snmpd.conf.example /usr/local/share/snmp/snmpd.conf
Create snmpd.conf and configure appropriately
vi /usr/local/share/snmp/snmpd.conf
Or use librenms.snmpd.conf and update appropriately
Download the OS detection via SNMP script via Curl
curl -o /usr/local/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
Add execute permissions
chmod +x /usr/local/bin/distro
Enable SNMPD and set the "-r" flag (?) via rc.conf
sysrc snmpd_enable=yes
sysrc snmpd_flags="-r"
Start the SNMP Daemon
service snmpd start
Copy the example Logrotate config to the logrotate config directory
cp /usr/local/www/librenms/misc/librenms.logrotate /usr/local/etc/logrotate.d/librenms
Copy the example Cron config to the cron config directory
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
Or use librenms.cron
Create the librenms user
adduser librenms
Add librenms to the apache group...not actually sure if this is necessary
pw usermod librenms -G www
Modify the librenms file permissions recursively...not actually sure if this is necessary. Last I actually changed them back to root:wheel
chown -R librenms:librenms /usr/local/www/librenms
Not sure if these directory permissions are necessary. I actually copied these commands from a different guide which may have been for a different OS...
setfacl -d -m g::rwx /usr/local/www/librenms/rrd /usr/local/www/librenms/logs /usr/local/www/librenms/bootstrap/cache/ /usr/local/www/librenms/storage/
setfacl -R -m g::rwx /usr/local/www/librenms/rrd /usr/local/www/librenms/logs /usr/local/www/librenms/bootstrap/cache/ /usr/local/www/librenms/storage/
Add a new user called "jonatello" with password %Password% and example email
php adduser.php jonatello %Password% 10 [email protected]
Validate the configuration
/usr/local/www/librenms/validate.php
I've played with the following within config.php but it didn't seem to help. I think I need to fix something with the RRD paths but I'm not really sure.
vi /usr/local/www/librenms/config.php
$config['installed_from_package'] = true;
$config['log_dir'] = '/var/log/librenms';
$config['rrd_dir'] = '/var/db/librenms/rrd';
I've tried running the daily.sh script, which requires the Git package to be additionally installed, but there were issues. I think it also would seem to go against the principle of striving for stability rather than features, but I might be wrong there.
pkg install git
/usr/local/www/librenms/daily.sh