2019年3月25日 星期一

CentOS 7 加入 Librenms

yum update
yum -y install net-snmp net-snmp-utils wget

wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro;chmod +x /etc/snmp/distro

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.$(date +%s)
cat <<EOF>/etc/snmp/snmpd.conf
rocommunity public localhost
rocommunity public 192.168.0.0/16
extend hardware "/bin/cat /sys/devices/virtual/dmi/id/product_name"
extend manufacturer "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor"
extend distro "/etc/snmp/distro"

sysName hostname
syslocation 5FG
syscontact email@email
EOF
systemctl start snmpd;systemctl enable snmpd;sleep 3;systemctl restart snmpd

測試
snmpwalk -v 2c -c public localhost

2019年3月22日 星期五

Proxmox 加入 Librenms

apt-get install snmp snmpd
apt-get install libpve-apiclient-perl sudo
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox -O /etc/snmp/proxmox
chmod +x /etc/snmp/proxmox

wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /etc/snmp/distro

#修改 /etc/sudoers
echo "Debian-snmp     ALL=(ALL) NOPASSWD: /etc/snmp/proxmox">> /etc/sudoers

#修改 /etc/snmp/snmpd.conf
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

cat <<EOF $gt;/etc/snmp/snmpd.conf
rocommunity public localhost
rocommunity public 192.168.0.0/16

#sysName hostname
syslocation 5FG
syscontact email@email
extend hardware "/bin/cat /sys/devices/virtual/dmi/id/product_name"
extend manufacturer "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor"
extend distro "/etc/snmp/distro"
extend proxmox  "/usr/bin/sudo /etc/snmp/proxmox"
EOF

systemctl enable snmpd
systemctl start snmpd

2019年3月11日 星期一

LEAF 設定 SNMP

安裝相關套件 apkg -i netsnmpd libsnmp libsens libnl3
 

修改 snmpd 設定檔 /etc/snmp/snmpd.conf 加入
rocommunity public localhost
rocommunity public 192.168.0.0/16
sysName leaf-fw
syslocation GRoom
syscontact email@email
extend hardware "/bin/cat /sys/devices/virtual/dmi/id/product_name"
extend manufacturer "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor"
extend distro "/bin/echo LEAF Bering-uClibc" 

修改
/etc/shorewall/rule
/etc/hosts.allow
/etc/hosts.deny

QNAP TAS-268 更換硬碟加大容量

mdadm --grow /dev/md1 --size=[$size]
pvresize /dev/md1
lvresize -l +[$size] /dev/vg1/lv1
reboot
resize2fs /dev/mapper/cachedev1

Proxmox 修正 no subscription 錯誤

echo "deb http://download.proxmox.com/debian/pve stretch pve-no-subscription">/etc/apt/sources.list.d/pve-no-subscription.list

mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak

Extend ZFS partition

parted /dev/sda
resizepart NUMBER END

zpool online -e rpool sda3
zpool online -e rpool sdb3
zpool online -e rpool sdc3

Cisco PIX515 設定 SNMP

snmp-server host inside 192.168.1.1 poll 
snmp-server location Room 
no snmp-server contact 
snmp-server community public 
no snmp-server enable traps