Update snmp.sh
This commit is contained in:
17
snmp.sh
17
snmp.sh
@@ -8,8 +8,21 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# isntall curl and snmpd
|
if [ "$EUID" -ne 0 ]; then
|
||||||
apt install -y snmpd curl
|
echo "Please run as root"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/debian_version ]; then
|
||||||
|
apt update
|
||||||
|
apt install -y snmpd curl
|
||||||
|
elif [ -f /etc/redhat-release ]; then
|
||||||
|
yum install -y net-snmp net-snmp-utils
|
||||||
|
else
|
||||||
|
echo "Unable to determine linux distro"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# back the original config file
|
# back the original config file
|
||||||
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
|
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
|
||||||
|
|||||||
Reference in New Issue
Block a user