Graphing in a different SNMP port

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

Moderators: Developers, Moderators

shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Graphing in a different SNMP port

Post by shingouki »

hi,

just installed my Cacti and I would say it rocks.... but having problem
graphing from a different SNMP port. Actually I would like to graph a
program or an SNMP agent that our developer created to monitor no. of
calls in our iPBX . This uses a different port and OID so as not to
conflict with the net-snmp installed on the same system. I've used the
SNMP - Generic OID Template but it does not tell what new port to use.
Kindly let me know if this is possible. Thanks.



Shingouki
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

In the UI and in cmd.php, yes. Today in Cactid, no. I am just about to release that update.

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?
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

hi,

thanks for the reply. kindly let me know as soon as its released, or perhaps there is another quick workaround. again many thanks. :)
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

shingouki wrote:hi,

thanks for the reply. kindly let me know as soon as its released, or perhaps there is another quick workaround. again many thanks. :)

hi,

just read that its possible to do it via Data Input Methods, just created my simple scripts but was confused on how I can invoke it and then graph the data that was run by the scripts. Would appreciate any enlightment. Many thanks.


Shingouki
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

shingouki wrote:just read that its possible to do it via Data Input Methods, just created my simple scripts but was confused on how I can invoke it and then graph the data that was run by the scripts. Would appreciate any enlightment. Many thanks.
Shingouki,
there is a documentation on this: http://www.cacti.net/downloads/docs/htm ... PUT_METHOD
In your case, I'd say a single shell script should to the trick. You may provide hostname/IP address, community string and OID to it (perhaps you'll like to provide the SNMP port, timeout, version as well etc.) Your script should do a "snmpget -c <community> .... <hostname/IP> OID" and return solely the value.

Reinhard
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

lvm wrote:
shingouki wrote:just read that its possible to do it via Data Input Methods, just created my simple scripts but was confused on how I can invoke it and then graph the data that was run by the scripts. Would appreciate any enlightment. Many thanks.
Shingouki,
there is a documentation on this: http://www.cacti.net/downloads/docs/htm ... PUT_METHOD
In your case, I'd say a single shell script should to the trick. You may provide hostname/IP address, community string and OID to it (perhaps you'll like to provide the SNMP port, timeout, version as well etc.) Your script should do a "snmpget -c <community> .... <hostname/IP> OID" and return solely the value.

Reinhard

yup it worked! just recently make sense to me on how to add it finally. many thanks

What I did are;

1. Create Data Input Method using the scripts
2. Create a Graph Template
3. Add a Data Source
4. then Add the Graph

Cacti Rocks And Rules!!!


Shingouki
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

its quite lame but anyone knows how to remove a double quotes in an output using awk. cacti seems not to recognize output within quotes like for example "45". thanks.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Cacti should. What poller are you using?

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?
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

TheWitness wrote:Cacti should. What poller are you using?

TheWitness

hi

im still using cmd.php. just a suspicion of mine since I can poll and graph 3 box without qoutes in snmpget while another box that outputs with qoutes does not.


Shingouki
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Interesting. I will have to investigate since I believe, repeat "believe", we are stripping off the nva characters. What does your DEBUG log state?

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?
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

TheWitness wrote:Interesting. I will have to investigate since I believe, repeat "believe", we are stripping off the nva characters. What does your DEBUG log state?

TheWitness

my log shows these errors;

08/31/2005 04:50:44 PM - CMDPHP: Poller[0] Host[5] DS[126] WARNING: Result from CMD not valid. Partial Result: "22
...
08/31/2005 04:46:13 PM - CMDPHP: Poller[0] Host[5] DS[126] WARNING: Result from CMD not valid. Partial Result: "28
...
08/31/2005 04:40:40 PM - CMDPHP: Poller[0] Host[5] DS[126] WARNING: Result from CMD not valid. Partial Result: "30
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Please make sure the following exists in your functions.php:

Code: Select all

/* strip_quotes - Strip single and double quotes from a string
	in addition remove non-numeric data from strings.
	@arg $result - (string) the result from the poll
	@returns - (string) the string with quotes stripped */
function strip_quotes($result) {
  	/* first strip all single and double quotes from the string */
	$result = strtr($result,"'","");
	$result = strtr($result,'"','');

	/* clean off ugly non-numeric data */
	if ((!is_numeric($result)) && ($result != "U")) {
		$len = strlen($result);
		for($a=$len-1; $a>=0; $a--){
			$p = ord($result[$a]);
			if (($p > 47) && ($p < 58)) {
				$result = substr($result,0,$a+1);
				break;
			}
		}
	}

	return($result);
}
And that you are running 0.8.6f with patches.

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?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Oh, now know the issue. Change to the following:

Code: Select all

/* strip_quotes - Strip single and double quotes from a string
	in addition remove non-numeric data from strings.
	@arg $result - (string) the result from the poll
	@returns - (string) the string with quotes stripped */
function strip_quotes($result) {
  	/* first strip all single and double quotes from the string */
	$result = strtr($result,"'"," ");
	$result = strtr($result,'"',' ');

	/* clean off ugly non-numeric data */
	if ((!is_numeric($result)) && ($result != "U")) {
		$len = strlen($result);
		for($a=$len-1; $a>=0; $a--){
			$p = ord($result[$a]);
			if (($p > 47) && ($p < 58)) {
				$result = substr($result,0,$a+1);
				break;
			}
		}
	}

	return(trim($result));
}
Discovered this today while writing code. Nasty changes in PHP behavior.
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
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

What version of php does the behavor change in?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
shingouki
Posts: 24
Joined: Sat Aug 27, 2005 2:54 pm
Location: Manila, Philippines
Contact:

Post by shingouki »

only difference on the code entry under functions.php is below;

from: return($result);

to: return(trim($result));

made the modification but same...

Have tried running patches but looking a specific file to patch. So Im not sure which is which.

..........

sh# pwd
/opt/cacti-0.8.6f

sh# patch -p1 -N < multi_field_output_script_server.patch

Looks like a unified context diff.
File to patch:

No file found -- skip this patch? [no]
File to patch: ^C

sh#

sh# patch -p1 -N < multi_field_output_script_server.patch
Looks like a unified context diff.
File to patch: data_input.php

Hunk #2 failed at line 515.
1 out of 2 hunks failed: saving rejects to data_input.php.rej
I can't seem to find a patch in there anywhere.

sh#

.....................

My system install btw is a Solaris 8(SPARC) with packages version below.

cacti-0.8.6f
httpd-2.0.54
mysql-4.1.14
php-5.0.2
rrdtool-1.0.49
libxml2-2.6.16


Shingouki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest