写在前面
前面简单介绍了该款软件,这篇主要讲安装的过程,大家在使用开源软件的时候不要抱有免费的软件,商业的体验的心态,那是不可能的,该款软件一样存在很多问题,只不过在网络领域还是比其他开源软件要强大不少,至少在易用性、可扩展性还是不错的。
正文
环境
- 系统版本:CentOS 7.8
- web:Nginx
- PHP版本:7.3(最低7.3)
- 数据库:Mariadb
安装前准备
- yuminstallepel-releaseyum-utils-y
- yumlocalinstallhttp://rpms.remirepo.net/enterprise/remi-release-7.rpm-y
- yum-config-manager–enableremi-php74
- yuminstallcomposercroniefpinggitImageMagickjwhoismariadbmariadb-servermtrMySQL-pythonnet-snmpnet-snmp-utilsnginxnmapphp-fpmphp-cliphp-commonphp-curlphp-gdphp-mbstringphp-processphp-snmpphp-xmlphp-zipphp-memcachedphp-mysqlndpython-memcachedrrdtoolpython3python3-pip-y
创建LibreNMS用户
- useraddlibrenms-d/opt/librenms-M-r
- usermod-a-Glibrenmsnginx
下载LibreNMS文件
- cd/opt
- gitclonehttps://github.com/librenms/librenms.git
如果大家出现这个问题,将上文地址由https改为git,但是非常慢
设置权限
- chown-Rlibrenms:librenms/opt/librenms
- chmod770/opt/librenms
- setfacl-d-mg::rwx/opt/librenms/rrd/opt/librenms/logs/opt/librenms/bootstrap/cache//opt/librenms/storage/
- setfacl-R-mg::rwx/opt/librenms/rrd/opt/librenms/logs/opt/librenms/bootstrap/cache//opt/librenms/storage/
- chgrpapache/var/lib/php/session/
安装PHP依赖组件
- su-librenms
- ./scripts/composer_wrapper.phpinstall–no-dev
- exit
安装、配置DB
- yum-yinstallmariadb-server
- systemctlstartmariadb&&systemctlenablemariadb
- mysql-uroot-p
- CREATEDATABASElibrenmsCHARACTERSETutf8COLLATEutf8_unicode_ci;
- CREATEUSER'librenms'@'localhost'IDENTIFIEDBY'xiaoyu123';
- GRANTALLPRIVILEGESONlibrenms.*TO'librenms'@'localhost';
- FLUSHPRIVILEGES;
- quit
- ####修改mariadb配置文件####
- vi/etc/my.cnf
- innodb_file_per_table=1
- lower_case_table_names=0
- ####wr保存退出####
- systemctlrestartmariadb
添加配置
PHP-FPM配置
1.修改时区
- vi/etc/php.ini
修改时区
2.修改php-fpm配置文件
- vi/etc/php-fpm.d/www.conf
- ####改为如下####
- ;user=apache
- user=nginx
- group=apache
- ;listen=127.0.0.1:9000
- listen=/run/php-fpm/php-fpm.sock
- listen.owner=nginx
- listen.group=nginx
- listen.mode=0660
3.重启php-fpm服务
- systemctlenablephp-fpm
- systemctlrestartphp-fpm
配置Nginx
- vi/etc/nginx/conf.d/librenms.conf
- ####添加如下内容####
- server{
- listen80;
- server_namelibrenms.example.com;
- root/opt/librenms/html;
- indexindex.php;
- charsetutf-8;
- gzipon;
- gzip_typestext/cssapplication/javascripttext/javascriptapplication/x-javascriptimage/svg+xmltext/plaintext/xsdtext/xsltext/xmlimage/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{
- includefastcgi.conf;
- fastcgi_split_path_info^(.+\\.php)(/.+)$;
- fastcgi_passunix:/run/php-fpm/php-fpm.sock;
- }
- location~/\\.ht{
- denyall;
- }
- }
启动Nginx
- systemctlenablenginx
- systemctlrestartnginx
SNMP配置
- cp/opt/librenms/snmpd.conf.example/etc/snmp/snmpd.conf
- y
- curl-o/usr/bin/distrohttps://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
- chmod+x/usr/bin/distro
- systemctlenablesnmpd&&systemctlrestartsnmpd
计划任务
- cp/opt/librenms/librenms.nonroot.cron/etc/cron.d/librenms
复制LibreNMS配置文件
- cp/opt/librenms/misc/librenms.logrotate/etc/logrotate.d/librenms
访问前端
此时会发现访问还是Nginx的界面,这里需要调整一些参数
- vi/etc/nginx/nginx.conf
- systemctlrestartnginx
将端口改为8080
前端配置
点击图标进行下一步
检查通过
填写数据库信息
通过之后点击build
点击红框才能下一步
正常是空的dashboard
设置中文
简单使用
新增设备
最终效果
总结
该软件部署较为复杂,如果仅仅想体验可以试试容器版本,目前官方提供apache和nginx两种版本,容器版本使用起来设备如果不多还是可以的,当然如果有一定基础的可以自行安装,但该软件的特点主要使用简单,监控项细致,但目前该软件还是存在一定的问题,例如华为WLAN部分access user显示有一定问题,预测是后台的mib逻辑调用存在异常导致,另外负载也有相对应的问题,所以大家如果想用,不妨先测试,最终决定是否使用。
原文地址:https://www.toutiao.com/i6943253500189016583/