Search code examples
phpcentossnmpnet-snmp

PHP snmpwalk(): No response, working via putty


I am trying to get values from a device. It worked well & gave the results when I was running the snmp via putty. The command goes like this.

snmpwalk -v 2c -c public 1.2.3.4 1.5.2.33.1.4.2.2.1.1

But when put in php & ran it, it gave this:

Warning: snmpwalk(): No response from 1.2.3.4

I've read some articles and said to update the snmp in the server (Centos). I did that, but the result still same.
I also tried to change snmpwalk with snmp2_walk and snmpwalkoid. Still not work.

Anyone can help? Thanks for all your kind.


Solution

  • You have to mention the device IP address which you are going to make SNMP query.

    Warning: snmpwalk(): No response from 1.2.3.4
    

    The above error says , SNMP tries to query the host 1.2.3.4 and it fails. The correct syntax is

    snmpwalk -v 2c localhost -c public 1.2.3.4 1.5.2.33.1.4.2.2.1.1