一文学会LirbeNMS安装~优秀开源的SNMP设备监控软件

开源
这篇主要讲安装的过程,大家在使用开源软件的时候不要抱有免费的软件,商业的体验的心态,那是不可能的,该款软件一样存在很多问题,只不过在网络领域还是比其他开源软件要强大不少,至少在易用性、可扩展性还是不错的。

[[391522]]

写在前面

前面简单介绍了该款软件,这篇主要讲安装的过程,大家在使用开源软件的时候不要抱有免费的软件,商业的体验的心态,那是不可能的,该款软件一样存在很多问题,只不过在网络领域还是比其他开源软件要强大不少,至少在易用性、可扩展性还是不错的。

正文

环境

  • 系统版本:CentOS 7.8
  • web:Nginx
  • PHP版本:7.3(最低7.3)
  • 数据库:Mariadb

安装前准备

  1. yum install epel-release yum-utils -y 
  2. yum localinstall http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y 
  3. yum-config-manager --enable remi-php74  
  4. yum install composer cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-mbstring php-process php-snmp php-xml php-zip php-memcached php-mysqlnd python-memcached rrdtool python3 python3-pip -y 

创建LibreNMS用户

  1. useradd librenms -d /opt/librenms -M -r  
  2. usermod -a -G librenms nginx 

下载LibreNMS文件

  1. cd /opt  
  2. git clone https://github.com/librenms/librenms.git 

如果大家出现这个问题,将上文地址由https改为git,但是非常慢

设置权限

  1. chown -R librenms:librenms /opt/librenms  
  2. chmod 770 /opt/librenms  
  3. setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/  
  4. setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/  
  5. chgrp apache /var/lib/php/session/ 

安装PHP依赖组件

  1. su - librenms 
  2. ./scripts/composer_wrapper.php install --no-dev 
  3. exit 

安装、配置DB

  1. yum -y install mariadb-server 
  2. systemctl start mariadb && systemctl enable mariadb 
  3. mysql -uroot -p 
  4. CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci; 
  5. CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'xiaoyu123'
  6. GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'
  7. FLUSH PRIVILEGES
  8. quit 
  9. ####修改mariadb配置文件#### 
  10. vi /etc/my.cnf 
  11. innodb_file_per_table=1 
  12. lower_case_table_names=0 
  13. ####wr保存退出#### 
  14. systemctl restart mariadb 

添加配置

PHP-FPM配置

1.修改时区

  1. vi /etc/php.ini 

修改时区

2.修改php-fpm配置文件

  1. vi /etc/php-fpm.d/www.conf 
  2. ####改为如下#### 
  3. ;user = apache 
  4. user = nginx 
  5. group = apache 
  6. ;listen = 127.0.0.1:9000 
  7. listen = /run/php-fpm/php-fpm.sock 
  8. listen.owner = nginx 
  9. listen.group = nginx 
  10. listen.mode = 0660 

3.重启php-fpm服务

  1. systemctl enable php-fpm  
  2. systemctl restart php-fpm 

配置Nginx

  1. vi /etc/nginx/conf.d/librenms.conf 
  2. ####添加如下内容#### 
  3. server { 
  4.  listen      80; 
  5.  server_name librenms.example.com; 
  6.  root        /opt/librenms/html; 
  7.  index       index.php; 
  8.  
  9.  charset utf-8; 
  10.  gzip on
  11.  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; 
  12.  location / { 
  13.   try_files $uri $uri/ /index.php?$query_string; 
  14.  } 
  15.  location /api/v0 { 
  16.   try_files $uri $uri/ /api_v0.php?$query_string; 
  17.  } 
  18.  location ~ \.php { 
  19.   include fastcgi.conf; 
  20.   fastcgi_split_path_info ^(.+\.php)(/.+)$; 
  21.   fastcgi_pass unix:/run/php-fpm/php-fpm.sock; 
  22.  } 
  23.  location ~ /\.ht { 
  24.   deny all
  25.  } 

启动Nginx

  1. systemctl enable nginx 
  2. systemctl restart nginx 

SNMP配置

  1. cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf 
  2. curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro  
  3. chmod +x /usr/bin/distro  
  4. systemctl enable snmpd &&systemctl restart snmpd 

计划任务

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

复制LibreNMS配置文件

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

访问前端

此时会发现访问还是Nginx的界面,这里需要调整一些参数

  1. vi /etc/nginx/nginx.conf  
  2. systemctl restart nginx 

将端口改为8080

前端配置

点击图标进行下一步

检查通过

填写数据库信息

通过之后点击build

点击红框才能下一步

正常是空的dashboard

设置中文

简单使用

新增设备

最终效果

总结

该软件部署较为复杂,如果仅仅想体验可以试试容器版本,目前官方提供apache和nginx两种版本,容器版本使用起来设备如果不多还是可以的,当然如果有一定基础的可以自行安装,但该软件的特点主要使用简单,监控项细致,但目前该软件还是存在一定的问题,例如华为WLAN部分access user显示有一定问题,预测是后台的mib逻辑调用存在异常导致,另外负载也有相对应的问题,所以大家如果想用,不妨先测试,最终决定是否使用。

 

责任编辑:姜华 来源: 今日头条
相关推荐

2021-03-26 08:07:25

LibreNMS开源监控软件

2020-08-03 08:01:50

爬虫技巧

2021-04-30 07:33:35

效率提升技巧

2021-04-28 07:22:13

HiveJson数组

2021-03-29 08:24:18

KubeadmKubernetes1运维

2021-08-04 07:47:18

IDEJTAGSWD

2020-08-31 06:54:37

注解脱敏ELK

2020-04-20 10:47:57

Redis数据开发

2021-06-28 14:13:34

OOM内存事故

2021-06-26 09:26:01

Jupyter主题目录

2019-03-21 09:45:11

TypeScript编程语言Javascript

2020-04-19 21:41:13

Python数据可视化

2023-09-26 12:22:37

队列Python

2023-11-01 10:49:50

Python面向对象

2023-07-31 08:18:50

Docker参数容器

2021-07-30 06:51:28

Nginx运维web

2022-09-28 09:32:29

自动驾驶算法

2019-11-12 09:15:18

MySQL复制拓扑Orchestrato

2020-08-05 08:27:38

CSS Firefox浏览器

2019-07-26 06:29:22

MySQL数据库SQL
点赞
收藏

51CTO技术栈公众号