No output from SNMP

#1
Hi all,

I recently tried getting SNMP working with my Litespeed server but for some reason no data is presented when quering it with SNMP.

I followed this guide:
http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:snmp_cacti_monitoring

Code:
# apt-get install php5-cli php5-common php5-snmp
Added the following to /etc/snmp/snmpd.conf (There's preexisting configuration for other MIBs which works)
Code:
pass .1.3.6.1.4.1.22253 /usr/bin/php /usr/local/lsws/add-ons/snmp_monitoring/sample.php
Running it locally returns:
Code:
# php -q ./sample.php -n .1.3.6.1.4.1.22253.101
.1.3.6.1.4.1.22253.101.1
string
LiteSpeed Web Server
The SNMP log only shows that a SNMP query has been requested but not output was provided.

Please advice.
 

mistwang

LiteSpeed Staff
#2
Maybe it is because snmp agent call an external application to serve the request.
You got the result from sample.php, right? it is working.
 

mistwang

LiteSpeed Staff
#4
I think it is just the way it works.
You should ask net-snmp developers about this, it is not something develop by LiteSpeed.
 
#5
Quering the script with extend rather than pass gave this output:
SNMPv2-SMI::enterprises.22253.1.0 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "/usr/local/lsws/add-ons/snmp_monitoring/sample.php"
SNMPv2-SMI::enterprises.22253.2.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.5.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 5
SNMPv2-SMI::enterprises.22253.2.1.6.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.7.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.20.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 4
SNMPv2-SMI::enterprises.22253.2.1.21.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.1.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "/usr/local/lsws/add-ons/snmp_monitoring/sample.php: Permission denied"
SNMPv2-SMI::enterprises.22253.3.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "/usr/local/lsws/add-ons/snmp_monitoring/sample.php: Permission denied"
SNMPv2-SMI::enterprises.22253.3.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.4.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112.1 = STRING: "/usr/local/lsws/add-ons/snmp_monitoring/sample.php: Permission denied"

Gives you a bit more to work on.
 

mistwang

LiteSpeed Staff
#6
chmod a+x /usr/local/lsws/add-ons/snmp_monitoring/sample.php

add
#!/usr/local/bin/php

at the beginning of sample.php if it is not there.
 
#7
Ok getting a bit closer however I'm still not getting the full output:

root@mon:~# snmpwalk -c public -v 1 10.254.11.101 .1.3.6.1.4.1.22253
SNMPv2-SMI::enterprises.22253.1.0 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "/var/lib/snmp/snmp_monitoring/sample.php"
SNMPv2-SMI::enterprises.22253.2.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.5.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 5
SNMPv2-SMI::enterprises.22253.2.1.6.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.7.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.20.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 4
SNMPv2-SMI::enterprises.22253.2.1.21.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.1.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.3.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.3.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 0
SNMPv2-SMI::enterprises.22253.4.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112.1 = ""
 
#9
Hm, did seam to help, however as the file is executeble I configured snmpd to query the script directly instead extend .1.3.6.1.4.1.22253 /var/lib/snmp/snmp_monitoring/sample.php

Which gives me this:
root@mon:~# snmpwalk -c public -v 1 10.254.11.101 .1.3.6.1.4.1.22253
SNMPv2-SMI::enterprises.22253.1.0 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.2.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = STRING: "
"
SNMPv2-SMI::enterprises.22253.2.1.3.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.4.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.5.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 5
SNMPv2-SMI::enterprises.22253.2.1.6.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.7.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.20.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 4
SNMPv2-SMI::enterprises.22253.2.1.21.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.1.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = STRING: "No such file or directory"
SNMPv2-SMI::enterprises.22253.3.1.2.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = STRING: "No such file or directory"
SNMPv2-SMI::enterprises.22253.3.1.3.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.4.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.4.1.2.40.47.118.97.114.47.108.105.98.47.115.110.109.112.47.115.110.109.112.95.109.111.110.105.116.111.114.105.110.103.47.115.97.109.112.108.101.46.112.104.112.1 = STRING: "No such file or directory"

Any idea what file that could be missing?
 
#11
Back on square one using pass, with extend I get:

root@mon:~# snmpwalk -c public -v 1 10.254.11.101 .1.3.6.1.4.1.22253
SNMPv2-SMI::enterprises.22253.1.0 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "-q"
SNMPv2-SMI::enterprises.22253.2.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "/var/lib/snmp/snmp_monitoring/sample.php"
SNMPv2-SMI::enterprises.22253.2.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = ""
SNMPv2-SMI::enterprises.22253.2.1.5.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 5
SNMPv2-SMI::enterprises.22253.2.1.6.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.7.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.2.1.20.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 4
SNMPv2-SMI::enterprises.22253.2.1.21.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.1.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "-q: No such file or directory"
SNMPv2-SMI::enterprises.22253.3.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112 = STRING: "-q: No such file or directory"
SNMPv2-SMI::enterprises.22253.3.1.3.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.3.1.4.12.47.117.115.114.47.98.105.110.47.112.104.112 = INTEGER: 1
SNMPv2-SMI::enterprises.22253.4.1.2.12.47.117.115.114.47.98.105.110.47.112.104.112.1 = STRING: "-q: No such file or directory"
 
Top