Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SNMPget and quotes

423 views
Skip to first unread message

Ben Tshin

unread,
Jul 2, 2002, 3:58:26 PM7/2/02
to
I'm using ucd-snmp 4.2.5 and I'm performing snmpget on a MIB. However, when
output the result has quotations around it. I tried the exact same command
in 4.2.3 and the output did NOT have quotations around it. I'm using snmpget
in part of a script and the script REQUIRES that the output not have
quotations, so how can i get around this problem.

Ben

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

tony bourke

unread,
Jul 2, 2002, 4:08:51 PM7/2/02
to
Hi Ben,

What kind of script are you using?

Tony

--
-------------- -- ---- ---- --- - - - - - -- - - - - - -
Tony Bourke to...@vegan.net

Ben Tshin

unread,
Jul 2, 2002, 4:28:06 PM7/2/02
to
It's a simple shell script that runs a snmpget. The problem is that the
value of extTable.extNames comes out with quotation marks around it. But I
only want the extName result, not the quotation marks because when I put the
result into a variable the quotation marks are in the variable as well.

Ben

tony bourke

unread,
Jul 2, 2002, 4:33:21 PM7/2/02
to
Hi Ben,

If you can make it into a perl script, you could do this:

$value =~ s/\"//g;

This would remove all the quotation marks.

Ben Tshin

unread,
Jul 2, 2002, 4:52:07 PM7/2/02
to
My script works fine for 4.2.3 so I don't want to totally revamp the script
for 4.2.5. Alternatively, I might just use 4.2.3 instead of 4.2.5.

Ben

-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/

Robert Story

unread,
Jul 2, 2002, 4:58:26 PM7/2/02
to
On Tue, 2 Jul 2002 15:42:37 -0400 "Ben Tshin" <b...@foundmoney.com> wrote:
BT> I'm using ucd-snmp 4.2.5 and I'm performing snmpget on a MIB. However, when
BT> output the result has quotations around it. I tried the exact same command
BT> in 4.2.3 and the output did NOT have quotations around it. I'm using
BT> snmpget in part of a script and the script REQUIRES that the output not
BT> have quotations, so how can i get around this problem.

Have you tried the various -O options? See the snmpcmd man page for options,
and see if one of them does the trick.

--
Robert Story, NET-SNMP Junkie
<irc://irc.openprojects.net/#net-snmp> <http://www.net-snmp.org/>

You are lost in a twisty maze of little standards, all different.

Ben Tshin

unread,
Jul 2, 2002, 5:07:29 PM7/2/02
to
I've tried everything with 4.2.5 and it doesn't work.
With 4.2.3 I just use: VAR=`snmpget -Ov localhost public
1.3.6.1.4.1.2021.8.1.2.1 (extTable.extNames.1)`
and then echo $VAR gives:
192.168.0.1

but with 4.2.5 i get:
"192.168.0.1"

and I can't use the quotes.

Ben


----- Original Message -----
From: "Robert Story" <rst...@freesnmp.com>
To: <net-snm...@lists.sourceforge.net>
Cc: <b...@foundmoney.com>
Sent: Tuesday, July 02, 2002 4:46 PM
Subject: Re: SNMPget and quotes

Ben Tshin

unread,
Jul 2, 2002, 5:51:47 PM7/2/02
to
So I've given up on ucd-snmp 4.2.5 and I'm building 4.2.3.

Is there any way to get all the settings and file directories like it is in
redhat 6.2? basically I want it to be identical to the RHL6.2 update RPM
except for the lack of openssl. (ie: install the files into /usr/bin instead
of /usr/local/bin)

If it's too hard then I'll just create links into /usr/bin and /usr/sbin for
the executables

Ben

----- Original Message -----
From: "Robert Story" <rst...@freesnmp.com>
To: <net-snm...@lists.sourceforge.net>
Cc: <b...@foundmoney.com>
Sent: Tuesday, July 02, 2002 4:46 PM
Subject: Re: SNMPget and quotes


> On Tue, 2 Jul 2002 15:42:37 -0400 "Ben Tshin" <b...@foundmoney.com> wrote:
> BT> I'm using ucd-snmp 4.2.5 and I'm performing snmpget on a MIB. However,
when
> BT> output the result has quotations around it. I tried the exact same
command
> BT> in 4.2.3 and the output did NOT have quotations around it. I'm using
> BT> snmpget in part of a script and the script REQUIRES that the output
not
> BT> have quotations, so how can i get around this problem.
>
> Have you tried the various -O options? See the snmpcmd man page for
options,
> and see if one of them does the trick.
>
> --
> Robert Story, NET-SNMP Junkie
> <irc://irc.openprojects.net/#net-snmp> <http://www.net-snmp.org/>
>
> You are lost in a twisty maze of little standards, all different.

-------------------------------------------------------


This sf.net email is sponsored by:ThinkGeek

No, I will not fix your computer.
http://thinkgeek.com/sf

Robert Story

unread,
Jul 2, 2002, 6:28:45 PM7/2/02
to
On Tue, 2 Jul 2002 17:41:03 -0400 "Ben Tshin" <b...@foundmoney.com> wrote:
BT> Is there any way to get all the settings and file directories like it is in
BT> redhat 6.2? basically I want it to be identical to the RHL6.2 update RPM
BT> except for the lack of openssl. (ie: install the files into /usr/bin
BT> instead of /usr/local/bin)

I believe "configure --prefix=/usr" should do the trick...

Dave Shield

unread,
Jul 3, 2002, 4:33:35 AM7/3/02
to
> I've tried everything with 4.2.5 and it doesn't work.
> With 4.2.3 I just use: VAR=`snmpget -Ov localhost public
> 1.3.6.1.4.1.2021.8.1.2.1 (extTable.extNames.1)`
> and then echo $VAR gives:
> 192.168.0.1
>
> but with 4.2.5 i get:
> "192.168.0.1"


Hmmm.... I've just tried this with the 4.2.3, 4.2.5 and 5.0.1 agents,
and I don't see the quotes round the name in any of these three cases.


One thought springs to mind.
I note that the output of the 'name' common is a numeric-looking string.
How have you got this set up in the snmpd.conf file?

If I try something like:

exec 192.128.0.1 /some/command with args

the agent tries to interpet this field as the root OID of the MIB subtree
to use for the output (instead of the default 1.3.6.1.4.1.2021.8.1.2)
I need to put this string in quotes to get it interpreted correctly.

But even then, the output I get back doesn't have these quotes.

What happens if you try with an alphabetic name, instead of an IP address
string?

Dave

0 new messages