首頁>技術>

一、LibreNMS簡單介紹

LibreNMS是一款開源的,功能強大且功能豐富的自動發現的網路監控系統,基於PHP,使用SNMP協議。它支援廣泛的作業系統,包括Linux,FreeBSD以及思科,Juniper,Brocade,Foundry,HP等網路裝置。

(圖片可放大檢視)

二、CentOS7下部署LibreNMS

參考官方配置文件完成

(圖片可放大檢視)

https://docs.librenms.org/Installation/Installation-CentOS-7-Nginx/
1、關閉SELINUX,配置yum源
setenforce 0sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/configwget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.reposed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repowget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2、配置remi-php73源,安裝LibreNMS所需的元件
yum install -y yum-utilsyum localinstall http://rpms.remirepo.net/enterprise/remi-release-7.rpmyum-config-manager --enable remi-php73yum 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 python3-devel
3.git下載lirenms最新版本
cd /optgit clone https://github.com/librenms/librenms.git
useradd librenms -d /opt/librenms -M -rusermod -a -G librenms nginxchown -R librenms:librenms /opt/librenmschmod 770 /opt/librenmschgrp apache /var/lib/php/session/
4、切換到librenms使用者,配置php環境
su - librenms./scripts/composer_wrapper.php install --no-devexit
5、配置資料庫
systemctl start mariadbmysqladmin -u root password 'MySQL@2021'mysql -u root -pMySQL@2021登入資料庫並建立如下資料庫表CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'librenms@2021';GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';FLUSH PRIVILEGES;exit
vi /etc/my.cnf[mysqld]下加入如下兩行datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socksystemctl enable mariadbsystemctl restart mariadb
6、配置php環境
vi /etc/php.ini修改時區配置如下date.timezone = Asia/Shanghai
vi /etc/php-fpm.d/www.conf修改成如下行;user = apacheuser = nginxgroup = apache   ;keep group as apache;listen = 127.0.0.1:9000listen = /run/php-fpm/php-fpm.socklisten.owner = nginxlisten.group = nginxlisten.mode = 0660systemctl enable php-fpmsystemctl restart php-fpm
7、配置nginx
vi /etc/nginx/conf.d/librenms.confserver { 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:/run/php-fpm/php-fpm.sock; } location ~ /\.ht {  deny all; }}並刪掉/etc/nginx/nginx.conf中server段預設配置systemctl enable nginxsystemctl restart nginx
8、snmpd配置
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.confvi /etc/snmp/snmpd.conf中團體名,例如librenmscom2sec readonly  default      librenmscurl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distrochmod +x /usr/bin/distrosystemctl enable snmpdsystemctl restart snmpd
9、crond配置與logrotated配置
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenmscp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

(圖片可放大檢視)

10、登入web介面,新增監控裝置,功能介面體驗

監控裝置的snmpd可以參考之前文章

(圖片可放大檢視)

(圖片可放大檢視)

(圖片可放大檢視)

(圖片可放大檢視)

(圖片可放大檢視)

(圖片可放大檢視)

(圖片可放大檢視)

41
最新評論
  • BSA-TRITC(10mg/ml) TRITC-BSA 牛血清白蛋白改性標記羅丹明
  • ClickHouse億點抽樣展示