diff --git a/snmp.sh b/snmp.sh index af09b10..f35785b 100644 --- a/snmp.sh +++ b/snmp.sh @@ -8,8 +8,21 @@ if [ "$EUID" -ne 0 ]; then exit fi -# isntall curl and snmpd -apt install -y snmpd curl +if [ "$EUID" -ne 0 ]; then + 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 mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak