LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   SNMP v3 with CONTEXT syntax for PHP ? (https://www.linuxquestions.org/questions/programming-9/snmp-v3-with-context-syntax-for-php-4175448009/)

czezz 01-31-2013 10:32 AM

SNMP v3 with CONTEXT syntax for PHP ?
 
Hello,
I am looking for a correct PHP syntax of SNMP v3 with CONTEXT in it.
On the command line I simply execute this:
Code:

snmpget -v 3 -a MD5 -A MD5UserAuth -u MD5 -l authNoPriv -n unit-11 192.168.1.55 1.3.6.1.4.1.21696.4.1.1.1.1.0
where CONTEXT = unit-11 (option -n).

However, I have no idea how can I do that with PHP.
Does anyone can help please ?

Habitual 02-02-2013 11:38 AM

Quote:

Originally Posted by czezz (Post 4881448)
Hello,
I am looking for a correct PHP syntax of SNMP v3 with CONTEXT in it.
On the command line I simply execute this:
Code:

snmpget -v 3 -a MD5 -A MD5UserAuth -u MD5 -l authNoPriv -n unit-11 192.168.1.55 1.3.6.1.4.1.21696.4.1.1.1.1.0
where CONTEXT = unit-11 (option -n).

However, I have no idea how can I do that with PHP.
Does anyone can help please ?

Why the bold emphasis?
Do "what with php" exactly? Hook snmp with php code? replicate snmpget? duplicate snmpget? Parse it? Tickle it until it screams?

Are you looking to populate an .html document via some snmp-enabled .php script? I think that's do-able. :)

Please clarify "do that with PHP."

czezz 02-04-2013 08:16 AM

Hello Habitual,

Quote:

Why the bold emphasis?
Indicates that "unit-11" stands for CONTEXT option (of snmp v3). With command line, it is option -n.

Quote:

Do "what with php" exactly? Hook snmp with php code? replicate snmpget? duplicate snmpget? Parse it? Tickle it until it screams?
Well... I was sure it can not be more clear: I am looking for correct PHP syntax of SNMP v3 with CONTEXT option in it.
Let me put this in other words:
I need to execute SNMP v3 request(get) with PHP code with option CONTEXT in it. MIND: SNMP v3 with option CONTEXT.
And I can execute this request with CLI but because of CONTEXT option I am not able to execute it with PHP.

Quote:

Please clarify "do that with PHP."
Does above makes clear my question ?
Note, it is not about how to insert SNMP request in the PHP code or how to print it out. It is question about syntax of SNMP v3 with option CONTEXT for PHP.

Habitual 02-04-2013 09:39 AM

Yeah, I'm stuck.
no answer on Net-snmp-users@lists.sourceforge.net ?

czezz 02-04-2013 09:47 AM

Nope :/
I posted there too.

Habitual 02-04-2013 09:52 AM

I'd use "shell_exec(" like so:

Code:

<?php
$output = shell_exec("snmpget -v 3 -a MD5 -A MD5UserAuth -u MD5 -l authNoPriv -n unit-11 192.168.1.55 1.3.6.1.4.1.21696.4.1.1.1.1.0")
echo $output ;
?>

but .php scripting isn't my strong suit.

It may not be "clean",
it may not be "pretty",
but it may just work. :)


All times are GMT -5. The time now is 02:49 PM.