FreeDSx / SNMP

A Pure PHP SNMP Library.
MIT License
57 stars 13 forks source link

No message received from host. #12

Open dnl4 opened 2 years ago

dnl4 commented 2 years ago

Hello, I constantly get the error of the first attached image. Is this is caused by CPU usage of the device, connection, or what? And how to avoid that? Is there any change on the device that I should do?

More details:

image

screely-1639269036958

ChadSikorra commented 2 years ago

If you tell the walk to not use getBulk, does it still have the same issue? ie.: $walk->useGetBulk(false) before starting the loop.

decadence commented 2 years ago

Had the same issue and $walk->useGetBulk(false) helped. Maybe device doesn't fully support bulk requests. I don't know exactly how it works.

jozefrebjak commented 2 years ago

@dnl4 are you solved problem ? For me it seems that SnmpWalk function not work at all

Guyverix commented 2 years ago

I have seen that happen before on some devices when retrieving a large number of OID's. If you have access to syslog on the servers/ hosts that are timing out take a look and see if it is making snmpd on the machine restart, or give a buffer error of some kind.

You could test putting in a speedbump such as a sleep(1) between each bulkGet and perhaps that will allow it to complete. If you hammer some devices, like cheaper Ausus AP routers, I have seen that happen, and had OK luck by slowing things down a little.

ChadSikorra commented 2 years ago

I think part of the issue is that some devices respond to bulkGet requests quite differently, whether because of memory constraints or other issues. It's probably possible to handle this in a more sophisticated way in the walk to account for some of these cases. I imagine that's what the snmpwalk cli utility must do. Though haven't dug through it to see what specifically it is doing.

decadence commented 2 years ago

At least we can add more info about useGetBulk in Exception message because it took some time before I realised that this issue exists due to bulk requests which is default behaviour.

ChadSikorra commented 2 years ago

At least we can add more info about useGetBulk in Exception message because it took some time before I realised that this issue exists due to bulk requests which is default behaviour.

The problem there is that the error is very generic and the exception thrown is a network based exception that the SNMP host did not respond when it was supposed to. That could happen for all sorts of reasons. The best that could possibly be done is to catch the specific exception and re-throw it with an additional appended message suggesting the need to set useGetBulk to false.