LibreNMS - Ọpa Ifihan Nẹtiwọọki Ifihan Ifihan ni kikun fun Lainos


LibreNMS jẹ orisun ṣiṣi, alagbara ati awari ẹya-ara ọlọrọ adaṣe PHP eto ibojuwo nẹtiwọọki eyiti o nlo ilana SNMP. O ṣe atilẹyin ibiti o gbooro ti awọn ọna ṣiṣe pẹlu Linux, FreeBSD, ati awọn ẹrọ nẹtiwọọki pẹlu Cisco, Juniper, Brocade, Foundry, HP ati ọpọlọpọ diẹ sii.

  1. O ṣe iwari gbogbo nẹtiwọọki nipa lilo awọn ilana wọnyi: CDP, FDP, LLDP, OSPF, BGP, SNMP ati ARP.
  2. O ni UI wẹẹbu ọrẹ ọrẹ kan, pẹlu awọn dasibodu isọdi.
  3. Ṣe atilẹyin oluranlowo Unix.
  4. Ṣe atilẹyin igbelewọn petele lati faagun pẹlu nẹtiwọọki rẹ.
  5. Ṣe atilẹyin ọna itaniji gíga ati asefara asefara; firanṣẹ awọn iwifunni nipasẹ imeeli, irc, slack ati diẹ sii.
  6. Ṣe atilẹyin API kan fun iṣakoso, aworan ati gbigba data lati inu eto rẹ.
  7. Nfun eto isanwo-owo ijabọ kan.
  8. Tun ṣe atilẹyin awọn ohun elo Android ati iOS eyiti o funni ni awọn iṣẹ ṣiṣe pataki.
  9. Ṣe atilẹyin isopọmọ pẹlu NfSen, akojopo, SmokePing, RANCID ati Oxidized.
  10. Ṣe atilẹyin ọpọlọpọ awọn ọna ijẹrisi bii MySQL, HTTP, LDAP, Radius ati Itọsọna Iroyin.
  11. Gba awọn laaye lati ṣe imudojuiwọn adaṣe ati ọpọlọpọ awọn ẹya miiran.

Demo kan lori ayelujara wa fun ọ lati gbiyanju ṣaaju fifi LibreNMS sori awọn ọna ṣiṣe Linux.

Demo URL: https://demo.librenms.org/
Username: demo
Password: demo

  1. Ubuntu 16.04 pẹlu LEMP Stack
  2. CentOS 7 pẹlu LEMP Stack

Ninu ẹkọ yii a yoo kọ bi a ṣe le fi sori ẹrọ Ọpa Abojuto Nẹtiwọọki LibreNMS lori Ubuntu ti a fi sori ẹrọ tuntun tabi Linux Linux (awọn itọnisọna kanna tun ṣiṣẹ lori awọn pinpin kaakiri Debian ati RHEL).

AKIYESI: Gbogbo awọn itọnisọna wọnyi ni nkan yii yẹ ki o ṣiṣe bi olumulo gbongbo, ti o ko ba ṣe bẹ, lo aṣẹ sudo lati ni awọn anfani olumulo gbongbo.

Igbesẹ 1: Fi Awọn idii ti a beere sii

1. Ibẹrẹ akọkọ nipa fifi sori ẹrọ gbogbo awọn idii ti a beere nipa lilo oluṣakoso package aiyipada bi o ti han.

$ sudo apt install composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php7.0-cli php7.0-curl php7.0-fpm php7.0-gd php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois
# yum install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# yum install composer cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php72w php72w-cli php72w-common php72w-curl php72w-fpm php72w-gd php72w-mysql php72w-process php72w-snmp php72w-xml php72w-zip python-memcached rrdtool

2. Lọgan ti a ba fi gbogbo awọn idii sii, nginx, php-fpm, mariadb ati awọn iṣẹ snmp yoo bẹrẹ ati mu ṣiṣẹ lati bẹrẹ ni adaṣe ni akoko bata (eyi jẹ deede ọran pẹlu Ubuntu), bibẹkọ, o le ṣiṣe awọn aṣẹ ni isalẹ si bẹrẹ ati mu wọn ṣiṣẹ.

------------ On Debian/Ubuntu ------------ 
$ sudo systemctl nginx start php7.0-fpm mysql snmp 
$ sudo systemctl enable nginx php7.0-fpm mysql snmp

------------ On CentOS/RHEL ------------ 
# systemctl nginx start php-fpm mariadb snmpd 
# systemctl enable nginx php-fpm mariadb snmpd

Igbesẹ 2: Fi sori ẹrọ Ọpa Abojuto LibreNMS

3. Nigbamii, ṣẹda olumulo eto ti a pe ni librenms, pẹlu aṣẹ useradd; nibiti Flag -M mu ṣiṣẹda ẹda ti itọsọna ile olumulo, ati -r n jẹ ki ṣiṣẹda akọọlẹ eto kan. Lẹhinna ṣafikun olumulo librenms si ẹgbẹ www-data (lori Ubuntu) tabi nginx (lori CentOS) bi atẹle.

------------ On Debian/Ubuntu ------------ 
$ sudo useradd librenms -d /opt/librenms -M -r
$ sudo usermod -a -G librenms www-data   

------------ On CentOS/RHEL ------------ 
# useradd librenms -d /opt/librenms -M -r
# usermod -a -G librenms nginx           

4. Lẹhinna fi LibreNMS sori ẹrọ nipasẹ aṣẹ olupilẹṣẹ bi o ṣe han.

------------ On Debian/Ubuntu ------------ 
$ cd /opt
$ sudo composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master

------------ On CentOS/RHEL ------------ 
# cd /opt
# composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master

Igbesẹ 3: Ṣẹda aaye data LibreNMS

5. Ṣaaju ki o to bẹrẹ lilo olupin MariaDB, o nilo lati ni aabo fifi sori ẹrọ rẹ, ṣiṣe awọn iwe afọwọkọ aabo ti a pese ni package alakomeji. Yoo beere lọwọ rẹ ṣeto ọrọigbaniwọle gbongbo kan, yọ awọn olumulo alailorukọ kuro, mu wiwọle root kuro latọna jijin ki o yọ ibi ipamọ data idanwo kuro.

O le ṣe ifilọlẹ akosile nipasẹ ipinfunni aṣẹ isalẹ ki o dahun gbogbo awọn ibeere pẹlu bẹẹni/y .

$ sudo mysql_secure_installation   [On Debian/Ubuntu]
# mysql_secure_installation        [On CentOS/RHEL]

6. Lẹhinna buwolu wọle si ibi ipamọ data MariaDB lati ṣẹda iwe data fun LibreNMS (ranti lati lo ọrọigbaniwọle to lagbara/aabo ni agbegbe iṣelọpọ).

$ sudo mysql -u root -p
MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY '[email !#@%$libre';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

7. Lẹhinna, mu ipo muna MySQL mu fun bayi (ibaramu pẹlu ipo MySQL ti o muna jẹ sibẹsibẹ lati ṣafikun).

$ sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf    [On Debian/Ubuntu]
# vi /etc/my.cnf        [On CentOS/RHEL]

Laarin apakan [mysqld] jọwọ ṣafikun.

innodb_file_per_table=1
sql-mode=""
lower_case_table_names=0

Lẹhinna tun bẹrẹ olupin data lati ni ipa awọn ayipada.

$ sudo systemctl restart mysql     [On Debian/Ubuntu]
# systemctl restart mariadb        [On CentOS/RHEL]

Igbesẹ 4: Tunto ati Ibẹrẹ PHP-FPM

8. Nigbamii, ṣeto ọjọ rẹ.oko agbegbe ni php.ini si agbegbe aago rẹ lọwọlọwọ, fun apẹẹrẹ\"Africa/Kampala", bi a ṣe han ninu sikirinifoto atẹle.

------------ On Debian/Ubuntu ------------ 
$ sudo vim /etc/php/7.0/fpm/php.ini
$ sudo vim /etc/php/7.0/cli/php.ini

------------ On CentOS/RHEL ------------ 
# vi /etc/php.ini

9. Nigbamii jẹ ki module mrypt PHP ni Ubuntu ki o tun bẹrẹ php-fpm bi o ṣe han.

------------ On Debian/Ubuntu ------------ 
$ sudo phpenmod mcrypt
$ sudo systemctl restart php7.0-fpm

10. Lori CentOS/RHEL o nilo lati ṣe awọn ayipada atẹle ni faili iṣeto php-fpm.

# vi /etc/php-fpm.d/www.conf

Ṣe awọn ayipada wọnyi.

;user = apache
user = nginx

group = apache   ; keep group as apache

;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php7.2-fpm.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

11. Tun bẹrẹ iṣẹ php-fpm bi o ṣe han.

# systemctl restart php-fpm

Igbesẹ 5: Tunto Nginx fun LibreNMS

12. Ni igbesẹ yii, o nilo lati tunto bulọọki olupin Nginx fun awọn librenms lati le wọle si UI wẹẹbu naa. Ṣẹda faili .conf fun fun bi o ti han.

$ sudo vim /etc/nginx/conf.d/librenms.conf     [On Debian/Ubuntu]
# vi /etc/nginx/conf.d/librenms.conf           [On CentOS/RHEL]         

Ṣafikun atunto atẹle, satunkọ server_name bi o ti nilo.

server {
 listen      80;
 server_name librenms.example.com;
 root        /opt/librenms/html;
 index       index.php;

 charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
  try_files $uri $uri/ /index.php?$query_string;
 }
 location /api/v0 {
  try_files $uri $uri/ /api_v0.php?$query_string;
 }
 location ~ \.php {
  include fastcgi.conf;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
 }
 location ~ /\.ht {
  deny all;
 }
}

13. Lẹhinna fipamọ ati jade kuro ni faili naa. Tun yọ iṣeto aiyipada olupin kuro ki o tun bẹrẹ olupin Nginx.

------------ On Debian/Ubuntu ------------ 
$ sudo rm /etc/nginx/sites-enabled/default
$ sudo systemctl restart nginx

------------ On CentOS/RHEL ------------ 
# systemctl restart nginx

AKIYESI: Lori CentOS/RHEL, iwọ yoo nilo lati mu apakan aaye aiyipada, ti eyi ba jẹ aaye kan nikan ti o n gbalejo. Paarẹ apakan olupin lati faili /etc/nginx/nginx.conf.

14. Pẹlupẹlu lori CentOS/RHEL, o nilo lati fi sori ẹrọ ọpa eto imulo fun SELinux ati Tunto awọn ipo ti o nilo nipasẹ LibreNMS nipa lilo awọn ofin atẹle.

------------ On CentOS/RHEL ------------ 
# yum install policycoreutils-python
# semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/logs(/.*)?'
# semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/logs(/.*)?'
# restorecon -RFvv /opt/librenms/logs/
# semanage fcontext -a -t httpd_sys_content_t '/opt/librenms/rrd(/.*)?'
# semanage fcontext -a -t httpd_sys_rw_content_t '/opt/librenms/rrd(/.*)?'
# restorecon -RFvv /opt/librenms/rrd/
# setsebool -P httpd_can_sendmail=1
# setsebool -P httpd_execmem 1

15. Gba laaye fping nipa ṣiṣẹda faili http_fping.tt pẹlu awọn akoonu wọnyi.

module http_fping 1.0;

require {
type httpd_t;
class capability net_raw;
class rawip_socket { getopt create setopt write read };
}

#============= httpd_t ==============
allow httpd_t self:capability net_raw;
allow httpd_t self:rawip_socket { getopt create setopt write read };

16. Lẹhinna ṣiṣe awọn ofin wọnyi.

------------ On CentOS/RHEL ------------ 
# checkmodule -M -m -o http_fping.mod http_fping.tt
# semodule_package -o http_fping.pp -m http_fping.mod
# semodule -i http_fping.pp

17. Ti o ba nlo Ogiriina lori CentOS/RHEL, jẹ ki iraye HTTP/HTTPS ṣiṣẹ nipasẹ ogiriina.

------------ On CentOS/RHEL ------------ 
# firewall-cmd --zone public --add-service http
# firewall-cmd --permanent --zone public --add-service http
# firewall-cmd --zone public --add-service https
# firewall-cmd --permanent --zone public --add-service https

Igbesẹ 6: Tunto SNMPD fun LibreNMS

18. Bayi lo iṣeto ni snmp apẹẹrẹ lati ṣẹda faili iṣeto rẹ ki o ṣi i fun ṣiṣatunkọ, bi atẹle.

------------ On Debian/Ubuntu ------------ 
$ sudo cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
$ sudo vim /etc/snmp/snmpd.conf

------------ On CentOS/RHEL ------------ 
# cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
# vi /etc/snmp/snmpd.conf

Wa okun RANDOMSTRINGGOESHERE ki o yipada si okun agbegbe tirẹ bi o ṣe han ni sikirinifoto.

19. Nigbamii, ṣe igbasilẹ akọọlẹ ikarahun lori ẹrọ rẹ, eyiti o ṣe iranlọwọ lati ṣawari iru OS ati ti o ba jẹ Lainos lẹhinna o yoo rii iru pinpin Linux, ti o nlo:

------------ On Debian/Ubuntu ------------ 
$ sudo curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
$ sudo chmod +x /usr/bin/distro
$ sudo systemctl restart snmpd

------------ On CentOS/RHEL ------------ 
# curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
# chmod +x /usr/bin/distro
# systemctl restart snmpd

Igbesẹ 7: Ṣẹda Cron ati Tunto Logrotate

20. Bayi ṣiṣe aṣẹ ni isalẹ lati ṣeto iṣẹ cron kan fun LibreNMS.

# cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms

21. Itele, gbogbo awọn iwe-aṣẹ LibreNMS ni a gbasilẹ ni/opt/librenms/log, o le nilo lati tunto awọn akọọlẹ wọnyi lati wa ni iyipo-laifọwọyi, ni lilo faili atunto logrotate ti a pese, bii eleyi.

# cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

Lẹhinna ṣeto awọn igbanilaaye ti o yẹ lori itọsọna gbongbo LibreNMS fifi sori ẹrọ ati awọn faili log.

------------ On Debian/Ubuntu ------------
$ sudo chown -R librenms:librenms  /opt/librenms
$ sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
$ sudo setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs

------------ On CentOS/RHEL ------------ 
# 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

Igbesẹ 8: Iwọle si insitola Wẹẹbu LibreNMS

22. Itele, lo URL atẹle lati wọle si olupilẹṣẹ wẹẹbu ki o tẹle awọn itọnisọna loju iboju.

http://librenms.tecmint.lan/install.php

Fun adirẹsi yii lati ṣiṣẹ lori ẹrọ agbegbe, o nilo lati ṣeto DNS agbegbe kan nipa lilo faili awọn ọmọ-ogun (/ati be be lo/awọn ogun ), fun ipinnu agbegbe agbegbe tabi awọn idi idanwo ṣaaju gbigbe.

192.168.43.31 tecmint.lan
192.168.43.31 librenms.tecmint.lan

23. Iwọ yoo wo oju-iwe itẹwọgba fifi sori ẹrọ bi o ṣe han ninu sikirinifoto atẹle, tẹ Ipele Itele lati tẹsiwaju.

24. Lẹhinna tẹ awọn eto sii (olupin data, ibudo, orukọ olumulo ati ọrọ igbaniwọle olumulo) fun ibi ipamọ data LibreNMS ki o tẹ Ipele Itele lati tẹsiwaju.

25. Olupese wẹẹbu yoo bẹrẹ bayi ni akowọle ibi ipamọ data MySQL, eyi yoo gba akoko diẹ. Akiyesi pe ilana naa yoo gbiyanju lati da duro ni awọn aaye kan, tẹ rọrun lori Tun gbiyanju lati tẹsiwaju pẹlu ilana gbigbe wọle.

26. Ni kete ti gbigbe wọle data wọle ti pari, o yẹ ki o wo ifiranṣẹ naa\"Database ti wa ni imudojuiwọn!", Bi o ṣe han ninu sikirinifoto ni isalẹ. Lẹhinna tẹ lori Goto Add User lati tẹsiwaju.

27. Nigbamii ti, ṣafikun olumulo LibreNMS kan, ṣafihan orukọ olumulo, ọrọ igbaniwọle ati imeeli, lẹhinna tẹ lori Ṣafikun Olumulo lati ṣe awọn ayipada naa.

28. Bayi tẹ lori ṣẹda iṣeto ni LibreNMS fun eto rẹ, nipa tite Generate Config.

29. Lọgan ti a ti ipilẹṣẹ iṣeto naa, bi o ṣe han ninu sikirinifoto ti tẹlẹ, daakọ ki o fi pamọ sinu itọsọna gbongbo ti fifi sori ẹrọ rẹ, ninu faili kan ti a pe ni /opt/librenms/config.php.

# vi /opt/librenms/config.php
<?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'] = '[email !#@%$libre';
$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

30. Fipamọ ki o pa faili naa. Lẹhinna pada si olupilẹṣẹ wẹẹbu lati tẹsiwaju pẹlu ilana fifi sori ẹrọ, nipa tite Pari Fi sori ẹrọ.

31. Nisisiyi fifi sori ẹrọ LibreNMS rẹ ti pari, o le tẹ lori\"jẹrisi fifi sori ẹrọ rẹ ki o ṣatunṣe eyikeyi awọn ọran", oju-iwe iwọle wọle yẹ ki o han.

32. Nigbamii ti, tẹ awọn iwe eri olumulo rẹ lati wọle si oju-iwe afọwọsi.

33. Lati ilana imudaniloju fifi sori ẹrọ, LibreNMS ti ṣe awari awọn ọran meji, ọkan ni pe a ko fi kun awọn ẹrọ (eyi jẹ ikilọ fun bayi), ati keji, a ko ṣeto igbanilaaye ti o yẹ lori faili atunto (/ opt/librenms) /config.php) eyiti a fi kun pẹlu ọwọ, bi o ṣe han ninu iboju iboju ni isalẹ.

Bayi ṣiṣe aṣẹ atẹle lati ṣeto igbanilaaye ti o tọ lori faili atunto.

$ sudo chown -R librenms:librenms /opt/librenms/config.php 

34. Lati ṣafikun awọn ẹrọ, lọ si: http://librenms.tecmint.lan/addhost. Lẹhin fifi awọn ẹrọ kun, o le lọ si oju-ile ki o ṣafikun ọpọlọpọ awọn dasibodu.

O n niyen! O le wa alaye diẹ sii, pẹlu fifi sori ẹrọ ati iṣeto lori Iwe-ipamọ LibreNMS ni https://docs.librenms.org/.

LibreNMS jẹ ẹya ibojuwo nẹtiwọọki ti ẹya ti o ni kikun ti o ṣe atilẹyin fun ọpọlọpọ ohun elo nẹtiwọọki. A nireti pe eyi jẹ itọsọna fifi sori ẹrọ lucid, ti o ba ni ibeere eyikeyi, de ọdọ wa nipasẹ fọọmu esi ni isalẹ.