This post contains short notes & step by step guide on open source network omonitoring system called LIBRENMS , it is based on Php/MySQL/Snmp
.
STEP BY STEP iNSTALLATION FOR LIBRENMS
OS: Ubuntu 16 (Server Edition/64bit)
First install required support packages
apt-get update # Now install all the required components in a single GO ... apt install -y apache2 composer fping git graphviz imagemagick libapache2-mod-php7.0 mariadb-client mariadb-server mtr-tiny nmap php7.0-cli php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois curl acl
Add local user for librenms
useradd librenms -d /opt/librenms -M -r usermod -a -G librenms www-data systemctl restart mysql
Create user & DB
mysql -uroot -pzaib1234 CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'zaib1234'; GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'; FLUSH PRIVILEGES; exit
Now edit maria-db config file
nano /etc/mysql/mariadb.conf.d/50-server.cnf
& add following
[Within the [mysqld] section please add]
innodb_file_per_table=1 sql-mode="" lower_case_table_names=0 systemctl restart mysql
Save & Exit.
Web Server Config
Edit PHP files & setup TIMEZONEs
nano /etc/php/7.0/apache2/php.ini nano /etc/php/7.0/cli/php.ini
Search for ‘date.timezone‘ & change it to
date.timezone = Asia/Karachi
Save & EXit.
Configure Apache
nano /etc/apache2/sites-available/librenms.conf
Add the following config,
DocumentRoot /opt/librenms/html/ ServerName librenms.localhost AllowEncodedSlashes NoDecode Require all granted AllowOverride All Options FollowSymLinks MultiViews
Save & Exit
a2dissite 000-default a2ensite librenms.conf a2enmod rewrite systemctl restart apache2
Configure snmpd
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
Now edit SNMPD config file and add our SNMP community string like public or other
nano /etc/snmp/snmpd.conf
Edit the text which says RANDOMSTRINGGOESHERE
and set your own community string.
save and exit.
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro chmod +x /usr/bin/distro systemctl restart snmpd
CRONJOBS for librenms
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms chown -R librenms:librenms /opt/librenms setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs
Install LIBRE-NMS via composer command
cd /opt composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master
Example:
Now access libre-nms via browser …
http://yourip/install.php
& follow onscreen steps…
Make sure to add id password which is authorized to change DB , as required …
AT one point, You have to create the config.php
manually as showed here.
nano /opt/librenms/config.php
& paste the data as showed in the config window of gui.
<?php ## Have a look in defaults.inc.php for examples of settings you can set here. DO NOT EDIT defaults.inc.php! ### Database config $config['db_host'] = 'localhost'; $config['db_port'] = '3306'; $config['db_user'] = 'librenms'; $config['db_pass'] = 'zaib1234'; $config['db_name'] = 'librenms'; $config['db_socket'] = ''; // This is the user LibreNMS will run as //Please ensure this user is created and has the correct permissions to your install $config['user'] = 'librenms'; ### Locations - it is recommended to keep the default #$config['install_dir'] = "/opt/librenms"; ### This should *only* be set if you want to *force* a particular hostname/port ### It will prevent the web interface being usable form any other hostname #$config['base_url'] = "http://librenms.company.com"; ### Enable this to use rrdcached. Be sure rrd_dir is within the rrdcached dir ### and that your web server has permission to talk to rrdcached. #$config['rrdcached'] = "unix:/var/run/rrdcached.sock"; ### Default community $config['snmp']['community'] = array("public"); ### Authentication Model $config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth #$config['http_auth_guest'] = "guest"; # remember to configure this user if you use http-auth ### List of RFC1918 networks to allow scanning-based discovery #$config['nets'][] = "10.0.0.0/8"; #$config['nets'][] = "172.16.0.0/12"; #$config['nets'][] = "192.168.0.0/16"; # Update configuration #$config['update_channel'] = 'release'; # uncomment to follow the monthly release channel #$config['update'] = 0; # uncomment to completely disable updates
Save & Exit.
and click on FINISH on GUI.
Make sure to remove COMPOSER
& set permissions when all is OK. Else it will give error in VALIDATION
part.
chown -R librenms:librenms /opt/librenms apt-get remove composer
Some more snaps
- Add Device