Table of Contents

SNMP configuration

ESXi host

# esxcli system snmp set --communities public
# esxcli system snmp set --enable true
# /etc/init.d/snmpd restart

firewall rules:

# esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
# esxcli network firewall ruleset set --ruleset-id snmp --enabled true

rescue

LibreNMS installation:

# apt update && apt upgrade
# apt install apache2 curl acl zip unzip
# systemctl enable apache2
# a2dismod mpm_event
# a2enmod mpm_prefork
# vi /etc/apache2/sites-available/librenms.conf

Add the following config, edit ServerName as required:

<VirtualHost *:80>
  DocumentRoot /opt/librenms/html/
  ServerName  10.1.2.1

  AllowEncodedSlashes NoDecode
  <Directory "/opt/librenms/html/">
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
  </Directory>
</VirtualHost>
# a2ensite librenms.conf
# a2enmod rewrite
# systemctl restart apache2

php 7.1.3 installation:

# apt install apt-transport-https lsb-release ca-certificates
# wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
# sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
# apt update
# apt install php7.1-cli php7.1-curl php7.1-mbstring php7.1-gd libapache2-mod-php7.1 php7.1-snmp php7.1-xml php7.1-mysql php7.1-zip php7.1-json

Add date.timezone = Europe/Athens in

/etc/php/7.1/apache2/php.ini
/etc/php/7.1/cli/php.ini
# a2enmod php7.1

mariadb installation:

# apt install mariadb-server
# systemctl enable mariadb
# systemctl start mariadb
# mysql_secure_installation
# mysql -u root -p
CREATE DATABASE librenms;
USE librenms;
GRANT ALL PRIVILEGES ON librenms.* TO 'librenmsuser'@'localhost' IDENTIFIED BY 'librenmspss';
FLUSH PRIVILEGES;
exit;

# vi /etc/mysql/mariadb.conf.d/50-server.cnf
add the following in mysqld section
innodb_file_per_table=1
sql-mode=""
lower_case_table_names=0

# systemctl restart mariadb
# apt install composer fping git graphviz imagemagick mtr-tiny nmap python-memcache python-mysqldb rrdtool snmp snmpd whois

# useradd librenms -d /opt/librenms -M -r
# usermod -a -G librenms www-data
# cd /opt/
# git clone https://github.com/librenms/librenms.git librenms
# chown -R librenms:librenms /opt/librenms
# cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
# vi /etc/snmp/snmpd.conf
Replace RANDOMSTRINGGOESHERE with community name

# curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
# chmod +x /usr/bin/distro
# systemctl restart snmpd
# cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
# cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

# cd /opt/librenms
# ./scripts/composer_wrapper.php install --no-dev

Disable updates

uncomment $config['update'] = 0; in config.php

Enable discovery

$config['nets'][] = "10.1.2.0/24"; in config.php

Manual discovery

python3 ./snmp-scan.py <IP or range>

Installation validation:

cd /opt/librenms
./validate.php