SNMP installer
This commit is contained in:
39
snmp.sh
Normal file
39
snmp.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# install snmp monitoring and configures it
|
||||||
|
|
||||||
|
# make sure we are running as sudo
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "Please run as root"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# isntall curl and snmpd
|
||||||
|
apt install -y snmpd curl
|
||||||
|
|
||||||
|
# back the original config file
|
||||||
|
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
|
||||||
|
|
||||||
|
# create new config file
|
||||||
|
cat <<EOF >> /etc/snmp/snmpd.conf
|
||||||
|
# Change RANDOMSTRINGGOESHERE to your preferred SNMP community string
|
||||||
|
com2sec readonly default GauntSNMP
|
||||||
|
|
||||||
|
group MyROGroup v2c readonly
|
||||||
|
view all included .1 80
|
||||||
|
access MyROGroup "" any noauth exact all none none
|
||||||
|
|
||||||
|
syslocation Rack, Room, Building, City, Country [GPSX,Y]
|
||||||
|
syscontact Your Name <your@email.address>
|
||||||
|
|
||||||
|
#Distro Detection
|
||||||
|
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# download distro script
|
||||||
|
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
|
||||||
|
chmod +x /usr/bin/distro
|
||||||
|
|
||||||
|
systemctl restart snmpd
|
||||||
|
|
||||||
|
systemctl enable snmpd
|
||||||
Reference in New Issue
Block a user