xslim / php-snmp Goto Github PK
View Code? Open in Web Editor NEWsending SNMP v2c traps from directly PHP, without using any command-line utilites or modules. Just socket_open and socket_sendto
sending SNMP v2c traps from directly PHP, without using any command-line utilites or modules. Just socket_open and socket_sendto
When I have provided '1.3.6.1.4.1.28319.10.2.2' in oid then it is converted to '1.3.6.1.4.1.11935.10.2.2' while sending to the snmp trap.
Example variable:
$vars[] = packVarBind(array('oid' => '1.3.6.1.4.1.28319.10.2.2',
'value' => 'sample',
'type' => 'o'
));
While debugging, I found that if the value in oid is greater than 16384 then it is being reset from 0 so I am unable to receive the actual oid on the snmp trap.
So the oid value should be the same while sending from php and on receiving on snmp trap end.
Please let me know if I need to set any configuration while sending the snmp trap.
What steps will reproduce the problem?
1. php SNMP.php
2. use PHP/4.3.11
3.
What is the expected output? What do you see instead?
back to prompt ( I think ) when it works properly. I am currently
recieving this error:
PHP Parse error: parse error, unexpected T_STRING, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in
/var/www/html/snmp_monitor/SNMP4.php on line 30
Line 30:
public static function trap($ip, $varBinds=null, $community='public')
Can this code not be used on this old of a version of PHP?
What version of the product are you using? On what operating system?
Centos 4
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 4 Oct 2009 at 8:42
Hi all,
Can anyone confirm that the code in this repo is working? I know it is not maintained but is the packing correct? If not, are there any alternatives?
Cheers
What steps will reproduce the problem?
1. Calling SNMP::trap() is not working
What version of the product are you using? On what operating system?
Debian, Lenny
Please provide any additional information below.
Bugs in SNMP.php
Line: 80
$trap is not exists, should be $pSnmp
Line: 91
$trapPacket is not exists, should be $snmpPacket
Proposals:
All functions shoul be part od class.
SNMPTrap is better name for class.
Impreved hexlen:
public static function hexlen( $s )
{
$len = strlen( $s );
$hexlen = self::dec2hex( $len );
$keyByte = "";
if( $len > 127 ){
$lenBytes = strlen( $hexlen ) / 2;
$keyByte = self::dec2hex( 0x80 + $lenBytes );
}
return $keyByte . $hexlen;
}
Original issue reported on code.google.com by [email protected]
on 2 Oct 2009 at 5:07
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.