LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-31-2013, 10:32 AM   #1
czezz
Member
 
Registered: Nov 2004
Location: Poland/Warsaw
Distribution: Slackware/Solaris
Posts: 563

Rep: Reputation: 30
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 ?

Last edited by czezz; 01-31-2013 at 10:33 AM.
 
Old 02-02-2013, 11:38 AM   #2
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,159
Blog Entries: 4

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
Quote:
Originally Posted by czezz View Post
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."
 
Old 02-04-2013, 08:16 AM   #3
czezz
Member
 
Registered: Nov 2004
Location: Poland/Warsaw
Distribution: Slackware/Solaris
Posts: 563

Original Poster
Rep: Reputation: 30
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.
 
Old 02-04-2013, 09:39 AM   #4
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,159
Blog Entries: 4

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
Yeah, I'm stuck.
no answer on Net-snmp-users@lists.sourceforge.net ?
 
Old 02-04-2013, 09:47 AM   #5
czezz
Member
 
Registered: Nov 2004
Location: Poland/Warsaw
Distribution: Slackware/Solaris
Posts: 563

Original Poster
Rep: Reputation: 30
Nope :/
I posted there too.
 
Old 02-04-2013, 09:52 AM   #6
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,159
Blog Entries: 4

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php and snmp rojoblandino Linux - Networking 4 06-30-2010 12:41 PM
Snmp mib file definition :: Syntax for time narendra1310 Linux - Software 0 05-31-2010 02:47 AM
perl: Context or Syntax merana Programming 4 12-08-2009 12:17 AM
need snmp syntax to change a community string RedhatES4_user Linux - Software 1 02-12-2007 06:47 AM
snmp / php BaerRS Linux - Networking 2 04-21-2003 08:31 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration