Search My Techie Guy

Monday, November 24, 2014

snmpwalk -v bash: snmpwalk: command not found yet Net-Snmp is successfully installed

I already have Net-Snmp installed on my server but couldn't run any snmp commands!

Problem:

# snmpwalk -v
bash: snmpwalk: command not found


Solution:

The problem is that the snmp binaries are not listed in my system's environment PATH!

# find / -name snmpwalk
/usr/sfw/bin/snmpwalk
/usr/local/bin/snmpwalk
/tmp/net-snmp-5.4.4/apps/.libs/snmpwalk
/tmp/net-snmp-5.4.4/apps/snmpwalk
/tmp/net-snmp-5.4.4/win32/snmpwalk


#echo $PATH
/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Netra-240/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin

So i added the PATH "/usr/local/bin" to my system's environment PATH:

export PATH=$PATH:/usr/local/bin

#echo $PATH
/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Netra-240/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin:/usr/local/bin

#snmpwalk -V
NET-SNMP version: 5.4.4


To make the environment PATH persistent through system restarts, follow these steps:

  • vi /etc/profile
Add this line at the bottom, depending on your system's suitable environment PATH:
  • PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/dt/bin:/usr/platform/SUNW,Netra-240/sbin:/opt/sun/bin:/opt/SUNWexplo/bin:/opt/SUNWsneep/bin:/opt/CTEact/bin:/usr/local/bin
Run this command to update the system environment PATH:
  • source /etc/profile 
Test:
  •  #echo $PATH
Post a Comment