SNMP Agent...

#1
I keep getting the error message below when i try and snmpwalk:

SNMPv2-SMI::enterprises.8888.101 = No Such Instance currently exists at this OID

When i use V1 i get no message at all. I know my config is ok b/c i can access anything else:

snmpwalk -c hhpv2 -v 2c localhost .1.3.6.1.4.1

Returns a whole bunch of info. All i added to my config was the line:

pass .1.3.6.1.4.1.8888 /etc/snmp/litespeed/sample.php

and i replaced the first 2 lines of sample.php to the following:

#!/usr/local/bin/php
<?php

Since my php does not use short tags, am i missing something here? Is there a way for me to test it via the command line and no SNMP?
 

xing

LiteSpeed Staff
#2
Test:

Code:
/usr/bin/php /etc/snmp/litespeed/sample.php
.1.3.6.1.4.1.8888.101.1
string
LiteSpeed Web Server
Excecute the sample.php with no args should give you the litespeed product name and let you know the script is working. Note you need PHP 5.

Another problem would be your snmpd.conf

Use only the following 2 lines for your snmpd.conf and restart snmpd.

Code:
rocommunity  public
pass .1.3.6.1.4.1.8888 /usr/bin/php /etc/snmp/litespeed/sample.php
If above snmpd.conf works then there is some conflict or misconfig in existing snmpd.conf.
 
#3
I tried just running the script and i get no output, are there settings in php.ini that need to be changed?

PHP 5.1.2 (cli) (built: Feb 28 2006 12:12:16)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

/usr/local/bin/php sample.php

Produces no output for me :(
 

ts77

Well-Known Member
#5
I'm using it and without problems ;).
running the script manually gives no output for me too, that can't be the cause of your error.
 

xing

LiteSpeed Staff
#7
The php that executes the litespeed snmp bridge sample script, i.e. sample.php, must have read access to the /tmp/lshttpd/ folder. Perhaps safemode is responsible for your problems, but then again maybe now.

I made an error saying that executing the sample.php script without input parameters would output a value. I was using a customize version.

For the default sample.php, execute this command:

Code:
php sample.php '-g' .1.3.6.1.4.1.8888.101.1
and you should get the following output:

Code:
.1.3.6.1.4.1.8888.101.1
string
LiteSpeed Web Server
if you don't get the above output, there is someting wrong with your php and/or php.ini.
 
Last edited:
#8
Warning: file_get_contents(): SAFE MODE Restriction in effect. The script whose uid is 0 is not allowed to access /tmp/lshttpd/.rtreport owned by uid 99 in /etc/snmp/litespeed/class.litespeed_stats.php on line 87

Warning: file_get_contents(/tmp/lshttpd/.rtreport): failed to open stream: Success in /etc/snmp/litespeed/class.litespeed_stats.php on line 87
.1.3.6.1.4.1.8888.101.1
string


Looks like safe mode is the issue...

I'll change it in a bit and get back to you
 
#9
php -d safe_mode=Off sample.php '-g' .1.3.6.1.4.1.8888.101.1

.1.3.6.1.4.1.8888.101.1
string
LiteSpeed Web Server

:) Looks like you should mention that safe mode must be turned Off or that the .rtreport file should be owned by the same user executing the script.
 
Top