From e3d80ba745a9466e90cd5a9eacf8e31eeeb03dc2 Mon Sep 17 00:00:00 2001 From: "Gaunt, John" Date: Wed, 12 Dec 2018 19:39:50 -0500 Subject: [PATCH] Update snmp.sh --- snmp.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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