二、安裝 LibreNMS


2-2.LibreNMS VMs virtualBOX

2-3.Image download

3.How to Install LibreNMS on CentOS 8

1 dnf -y update 2 systemctl set-default 3 systemctl get-default 4 yum install ibus-libzhuyin -y 5 yum install ibus ibus-table-chinese-array -y 6 dnf install epel-release -y 7 dnf install xrdp -y 8 systemctl enable xrdp --now 9 firewall-cmd --add-port=3389/tcp --permanent
10 firewall-cmd --reload
11 dnf update
12 vi /etc/yum.repos.d/webmin.repo
13 wget
14 rpm --import jcameron-key.asc
15 dnf install webmin
16 firewall-cmd --add-port=10000/tcp --permanent
17 firewall-cmd --reload
18 reboot -n
19 dnf update
20 dnf upgrade
21 clear
22 shutdown -h now
23 dnf -y install
24 dnf -y install
25 vi /etc/selinux/config
26 reboot -n
27 dnf install bash-completion cronie fping git ImageMagick mariadb-server mtr net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-json php-mbstring php-process php-snmp php-xml php-zip php-mysqlnd python3 python3-PyMySQL python3-redis python3-memcached python3-pip rrdtool unzip
28 useradd librenms -d /opt/librenms -M -r -s /usr/bin/bash
29 cd /opt && git clone
30 chown -R librenms:librenms /opt/librenms
31 chmod 771 /opt/librenms
32 setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
33 setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
34 su - librenms
35 systemctl start mariadb
36 systemctl enable mariadb
37 mysql_secure_installation
38 myqll -u root -p
39 mysql -u root -p
40 vi /etc/my.cnf.d/mariadb-server.cnf
41 systemctl restart mariadb
42 cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/librenms.conf
43 vi /etc/php-fpm.d/librenms.conf
44 vi /etc/nginx/conf.d/librenms.conf
45 cd /etc/nginx/conf.d/
46 ls
47 ls -al
48 vi /etc/nginx/conf.d/librenms.conf
49 vi /etc/nginx/nginx.conf
50 systemctl start nginx
51 systemctl enable nginx
52 firewall-cmd --zone public --add-service http
53 firewall-cmd --permanent --zone public --add-service http
54 firewall-cmd --zone public --add-service https
55 firewall-cmd --permanent --zone public --add-service https
56 cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
57 vi /etc/snmp/snmpd.conf
58 curl -o /usr/bin/distro
59 chmod +x /usr/bin/distro
60 systemctl enable snmpd
61 systemctl restart snmpd
62 cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
63 cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
64 timedatectl
65 nano /etc/php.ini
66 vi /etc/php.ini
67 systemctl restart php-fpm
68 dnf module list php
69 sudo dnf module enable php:remi-7.4
70 dnf module list php
71 dnf module enable php:remi-7.4
72 dnf module reset php
73 dnf module enable php:remi-7.4
74 dnf install php
75 php --version
76 dnf install php
77 systemctl restart php-fpm
78 php --version
79 cd /etc/snmp/
80 ls
81 ls -al
82 vi snmpd.conf
83 cp snmpd.conf snmpd.conf.bak
84 vi snmpd.conf
85 systemctl restart snmpd
86 ip a
87 /bin/cat /sys/devices/virtual/dmi/id/product_name
88 clear
89 extend . distro /usr/bin/distro
90 /bin/cat /sys/devices/virtual/dmi/id/product_name
91 /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
92 extend distro /usr/bin/distro
93 /usr/bin/distro
94 reboot -n
95 update
96 yum update
97 yum upgrade
98 exit
99 ls
100 ls -al
101 cd /etc/cron.daily/
102 ls
103 ls -al
104 find / -name
105 cd /opt/librenms/
106 ls
107 ./
108 yum update
109 exit
110 history
111 clear
112 history
113 history > history.txt

三、FortiGate 啟動 SNMP

1.How to Configure FortiGate SNMP Agent for Monitoring

1-1.To configure SNMP access – GUI:

1) Go to Network -> Interfaces
2) Choose an interface that an SNMP manager connects to and select ‘Edit’
3) In Administrative Access, select ‘SNMP’
4) Select ‘OK’

1-2.To configure the SNMP agent – GUI:

1) Go to System -> SNMP
2) Select ‘Enable’ for the SNMP Agent
3) Enter a descriptive name for the agent
4) Enter the location of the FortiGate unit
5) Enter a contact or administrator for the SNMP Agent or FortiGate unit
6) Select ‘Apply’

1-3.To add an SNMP v1/v2c community – GUI:

1) Go to System -> SNMP
2) In the SNMP v1/v2c area, select ‘Create New’
3) Enter a Community Name
4) Enter the IP address and Identify the SNMP
5) Select the interface if the SNMP manager is not on the same subnet as the FortiGate unit
6) Enter the Port number that the SNMP managers in this community use for SNMP v1 and SNMP v2c queries to receive configuration information from the FortiGate unit.
    Select the Enable check box to activate queries for each SNMP version
7) Enter the Local and Remote port numbers that the FortiGate unit uses to send SNMP v1 and SNMP v2c traps to the SNMP managers in this community
8) Select the Enable check box to activate traps for each SNMP version
9) Select ‘OK’

四、Librenms Add Device


vi /etc/snmp/snmpd.conf

rocommunity public
syslocation LIB3F-CCenter

#Distro Detection
extend . distro /usr/bin/distro

#Hardware Detection (uncomment to enable)
extend . hardware '/bin/cat /sys/devices/virtual/dmi/id/product_name'
extend . manufacturer '/bin/cat /sys/devices/virtual/dmi/id/sys_vendor'
extend . serial '/bin/cat /sys/devices/virtual/dmi/id/product_serial'

systemctl restart snmpd.service
systemctl enable snmpd.service
snmpwalk -c public -v 2c

六、下載 Distro 指令碼

curl -o /usr/bin/distro
chmod +x /usr/bin/distro

在 SNMP 中 Distro 回應值 (/etc/snmp/snmpd.conf)
extend . distro /usr/bin/distro

systemctl restart snmpd
firewall-cmd --add-service snmp --permanent
firewall-cmd --reload
firewall-cmd --list-all