Hi Karl,
Can you try this patch, instead of your changes?
Javier
[EMAIL PROTECTED] wrote:
> Javier,
>
> Here is the change I made to get SNMPv2c internal, rather than an
> external call. I pulled this from the PHP bugs
> list basically. It is my understanding that SNMPv2c will be in
> the next releases of PHP v5. At least it was submitted
> to the PHP developers and one responded.
>
>
>
> After apply'ng this patch and re-compiling PHP 5.0.3. I then
> modified api.network.inc.php.
>
> Im being simplistic, but I essentially took snmp1 and copied and
> changed the function call.
>
> function jffnms_snmp2 ($p) {
>
> $params = array_merge(
> array($p["ip"], $p["community"], $p["oid"]),
> (($p["action"]=="set")
> ?array($p["set_type"], $p["set_value"])
> :array()),
> array($p["timeout"]*1000000,$p["retries"]));
>
> return
> @call_user_func_array("snmp2_".$p["action"].((($p["action"]=="walk") &&
> ($p["include_oid"]))?"oid":""), $params);
> }
>
> So far it appears to be working. The discovery functions appear
> to work correctly. The poller has only been running a short while
> so Im still checking.
>
> --
> Karl S. Hagen, CISSP [EMAIL PROTECTED]
> Vice President, JPMorganChase & Company
> GTI End User Technology, Enterprise Network
> 1111 Polaris Pkwy, MS OH1-1287 (614) 213-8758 Office
> Columbus, OH 43240 (614) 264-8539 Cell
>
> This transmission may contain information that is privileged, confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including any
> reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
> in error, please immediately contact the sender and destroy the material in
> its entirety, whether in electronic or hard copy format. Thank you.
>
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Javier Szyszlican, Project Leader, JFFNMS
[EMAIL PROTECTED]
I hope JFFNMS or I were helpful to you, if you
can, please donate at http://jffnms.org/donate
--- jffnms-0.8.1/lib/api.network.inc.php 2005-03-07 16:14:54.000000000
-0300
+++ jffnms-devel-2005-03-28/lib/api.network.inc.php 2005-03-28
22:00:46.290334112 -0300
@@ -71,7 +71,7 @@
// Real SNMP Functions
- function jffnms_snmp1 ($p) {
+ function jffnms_snmp1 ($p, $base_function_name = "snmp") {
$params = array_merge(
array($p["ip"], $p["community"], $p["oid"]),
@@ -80,18 +80,21 @@
:array()),
array($p["timeout"]*1000000,$p["retries"]));
- return
@call_user_func_array("snmp".$p["action"].((($p["action"]=="walk") &&
($p["include_oid"]))?"oid":""), $params);
+ return
@call_user_func_array($base_function_name.$p["action"].((($p["action"]=="walk")
&& ($p["include_oid"]))?"oid":""), $params);
}
function jffnms_snmp2 ($p) {
+ if (function_exists("snmp2_get")) //if we have native SNMPv2
functions
+ return jffnms_snmp1 ($p, "snmp2_"); //call them like SNMPv1
functions but with different name
+
$func = "snmp".$p["action"]." -v2c ".(!$p["include_oid"]?"-Oqv":"")."
-c '".$p["community"]."' -t ".$p["timeout"]." -r ".$p["retries"]." ".
$p["ip"]." ".$p["oid"].
(($p["action"]=="set")?" ".$p["set_type"]."
".$p["set_value"]:"");
//logger ("Command ".$func."\n");
@exec($func, $result, $aux);
-
+
if ((count($result)==1) &&
(preg_match("/No Such (Object|Instance)/i", current($result)) ||
preg_match("/No more variables left/i", current($result))))