前言:
LibreNMS 是个以 PHP/MySQL 为基底的自动探索网络监控系统
LibreNMS 官网
版本 | 23.8.2-52-g7bbe0a2 - Thu Sep 14 2023 22:33:23 GMT+0700 |
数据库纲要 | 2023_09_01_084057_application_new_defaults (259) |
Web 服务器 | nginx/1.20.1 |
PHP | 8.1.23 |
Python | 3.6.8 |
Database | MariaDB 10.5.22-MariaDB |
Laravel | 10.16.1 |
RRDtool | 1.4.8 |
LibreNMS 是建基于社群开发的项目
您随时都可以加入社群贡献您的程序代码、文件以及问题回报:
官方网站 | 文件 | GitHub | 问题追踪 | Merch Shop | 社群论坛 | Twitter | LinkedIn | 变更记录 | 本机 Git 记录
贡献者
See the list of contributors on GitHub.
特别感谢
Bruno Pramont Collectd code.
Dennis de Houx Application monitors for PowerDNS, Shoutcast, NTPD (Client, Server).
Erik Bosrup Overlib Library.
Jonathan De Graeve SNMP code improvements.
Observium Codebase for fork.
第一步、安装准备
1.1.1 准备 一键安装脚本 librenms_install.sh librenms_configfile.tar remi-release-7
#!/bin/bash
yum localinstall -y remi-release-7.rpm
yum install -y epel-release yum-utils
yum-config-manager --enable remi-php81
cat > /etc/yum.repos.d/MariaDB.repo << \EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=0
EOF
yum -y install gcc 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
cd /opt
git clone https://github.com/librenms/librenms.git
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms nginx
chown -R librenms:librenms /opt/librenms
chmod 775 /opt/librenms
chgrp apache /var/lib/php/session/
su - librenms -c "/opt/librenms/scripts/composer_wrapper.php install --no-dev"
systemctl start mariadb
mysqladmin -u root password "Root@2023"
mysql -u root -pRoot@2023 << EOF
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'librenms@2023';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
EOF
mkdir /opt/configfile_backup
mkdir /opt/librenms_temp
cd /root/
tar -zxvf librenms_configfile.tar.gz -C /opt/librenms_temp
mv /etc/my.cnf.d/server.cnf /opt/configfile_backup
mv /opt/librenms_temp/server.cnf /etc/my.cnf.d/
systemctl enable mariadb
systemctl restart mariadb
mv /etc/php.ini /opt/configfile_backup
cp -rf /opt/librenms_temp/php.ini /etc/php.ini
mv /etc/php-fpm.d/www.conf /opt/configfile_backup
cp -rf /opt/librenms_temp/www.conf /etc/php-fpm.d/www.conf
systemctl enable php-fpm
systemctl restart php-fpm
cp -rf /opt/librenms_temp/librenms.conf /etc/nginx/conf.d/librenms.conf
systemctl enable nginx
systemctl restart nginx
firewall-cmd --permanent --zone public --add-service http
firewall-cmd --reload
cp -rf /opt/librenms_temp/snmpd.conf /etc/snmp/snmpd.conf
cp -rf /opt/librenms_temp/distro /usr/bin/distro
chmod +x /usr/bin/distro
systemctl enable snmpd
systemctl restart snmpd
cp -rf /opt/librenms/dist/librenms.cron /etc/cron.d/librenms
cp -rf /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
1.1.2 将 remi-release-7.rpm、librenms_configfile.tar.gz和librenms_install.sh 到 /root/ 根目录下:
1.1.3 先别着急执行安装,先关闭 selinux 注意---需要重启机器才能生效
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #永久关闭 selinux(需要重启机器才能生效):
getenforce #查看是否成功关闭:
cat /etc/selinux/config #查看是否成功关闭:
第二步、安装阶段
2.2.1 需要在服务器连接外网的情况下进行安装 :
2.2.2 执行 sh librenms_install.sh 执行过程不用管理,可以去喝杯茶:
第三步、初始化 LibreNMS
3.3.1 安装完成之后不要着急、肯能需要等几到十几分钟左右后台跑完就可以 web 访问了:
3.3.2 访问直接输入主机 IP http://192.168.108.128/install/checks
3.3.3 密码为 librenms@2023 “”一键安装脚本一键设置好了“”
mysql root Root@2023"
librenms librenms librenms@2023';
3.3.4 新建一个管理员账号 admin
3.3.5 登录系统
第四步、 LibreNMS 设置
4.4.1 设置语言
4.4.2 添加主机 linux win huaw cisco 添加过程略 需要 IP 团体名称和 端口号 对了就可以:
第五步、 LibreNMS 查看状态: