How can I get data if containing string with number?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
araregodji
Posts: 2
Joined: Thu Sep 24, 2009 3:36 am

How can I get data if containing string with number?

Post by araregodji »

I'm newbie here :o.

When I use snmpwalk at solaris and get lotus domino data, but data contains string with number. Here's is the example.

snmpwalk -v2c -c ... localhost 1.3.6.1.4.1.334.72.1.1.1.1.2.603

SNMPv2-SMI::enterprises.334.72.1.1.1.1.2.603 = STRING: "Server.Users.Peak = 6"

Number 6 is useful for cacti to plot graph. How can I get this number in order that cacti get it to plot graph?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I would write a script to do this. Something like:

In PHP of course...

Code: Select all

<?php
/* parse the calling parameters hostname, community, oid */
$hostname = $_ARGV[1];
$community = $_ARGV[2];
$oid = $_ARGV[3];

/* get the value */
$value = snmpget(blah blah blah);

/* break it apart */
$parts = explode("=", $value);

/*  return the goods */
print trim($parts[1]);?>
TheWitness

ps. Whoever wrote the agent should be shot.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

If it where me, I would create a 'SNMP Generic OID' Data Source with '.1.3.6.1.4.1.334.72.1.1.1.1.2.603' in it, then create a graph based on that OID.

http://docs.cacti.net/manual_old:087:ad ... data_input
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Wait, timeout. Do we strip on both sides. How embarrassing ;)

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
araregodji
Posts: 2
Joined: Thu Sep 24, 2009 3:36 am

Post by araregodji »

Still dizzy? :o

Any example and URL to write script would be help much.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

See the docs site. There are examples there. There are also examples if you simply review the default install.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests