Proxmox VE 安裝及設定 LibreNMS-Agent
第一步:安裝 SNMP 套件
apt install snmpd -y
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
vim /etc/snmp/snmpd.conf
# this create a SNMPv1/SNMPv2c community named "my_servers"
# and restricts access to LAN adresses 192.168.0.0/16 (last two 0's are ranges)
rocommunity my_servers 192.168.0.0/16
# setup info
syslocation "rack 1, room 3, serverrroom"
syscontact "Svenn"
# open up
agentAddress udp:161
# run as
agentuser root
# dont log connection from UDP:
dontLogTCPWrappersConnects yes
# fix for disks larger then 2TB
realStorageUnits 0
disk / 10%
systemctl restart snmpd && systemctl enable snmpd
com2sec notConfigUser default public
com2sec local localhost public
com2sec my1network1 172.16.1.58/32 01
com2sec my2network2 172.16.2.10/32 02
com2sec my3network2 172.16.0.248/32 03
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyROGroup v1 my1network1
group MyROGroup v2c my1network1
group MyROGroup v1 my2network2
group MyROGroup v2c my2network2
group MyROGroup v1 my3network2
group MyROGroup v2c my3network2
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.2
view systemview included .1.3.6.1.2.1.25.1.1
access notConfigGroup "" any noauth exact systemview none none
view all included .1 80
access MyROGroup "" any noauth prefix all none none
access MyRWGroup "" any noauth prefix all all all
dontLogTCPWrappersConnects yes
syslocation "rack 1, room 3, serverrroom"
syscontact "Svenn"
第二步:安裝 LibreNMS-Agent
- 在 LibreNMS 服務上您要先在設定檔裡面新增一行
vim /opt/librenms/config.php
$config['enable_proxmox'] = 1;
apt update
- 再下載
libpve-apiclient-perl
及 sudo
套件
apt install libpve-apiclient-perl sudo -y
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox -O /usr/local/bin/proxmox
chmod +x /usr/local/bin/proxmox
- 編輯
vim /etc/sudoers
設定方式官方說明不一樣。因為 /etc/passwd
裡面設定的用戶名是 Debian-snmp
,而不是官網文件的 snmp,所以要依下面的設定,讓 Debian-snmp
可以不用密碼 sudo
跑 /usr/local/bin/proxmox
。
Debian-snmp ALL=(ALL) NOPASSWD: /usr/local/bin/proxmox
- 在
vim /etc/snmp/snmpd.conf
要加一行 extend 描述,官網沒有加上 sudo 執行,這會造成執行權限錯誤。
extend proxmox /usr/bin/sudo /usr/local/bin/proxmox
# 指令
echo "extend proxmox /usr/bin/sudo /usr/local/bin/proxmox" >> /etc/snmp/snmpd.conf
systemctl restart snmpd
參考相關網頁