Problem/Solution Data Source w/ more than 1 output value

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
gilson
Posts: 27
Joined: Wed Jan 23, 2002 7:00 pm
Contact:

Problem/Solution Data Source w/ more than 1 output value

Post by gilson »

This is the problem:

I needed to graph memory values from a Linux box, via SNMP.
I created a script/Data Input with two input values <ip> <community> and four output values <user> <nice> <sys> <idle>.
Created the DS and the Graph
All in my development version of Cacti.
-Works like a charm. :D

So....
I asked my co-worker to REPLICATE the Data Input/Data Source/Graph and the script to the production installation of Cacti. :-?

He made it using two browser instances: each one pointing to development/production instalations.

When he was creating the Data Input, although the CORRECT order is <user> <nice> <sys> <idle>, the DI screen was showing Idle, Nice, Sys and User. So... he created the input source fields in this order (Idle, Nice, Sys and User).

Ie, this the alphabetical order (by Name). It's not the SEQUENCE you input the DS fields (user nice sys idle)

When you do this, cacti generates a new-line after the last DS name, in this case IDLE. The execution line becomes: :(

(note that there are TWO lines)
/usr/bin/rrdtool update /var/www/html/peg/rra/peg_lnx_cpu.rrd --template idle:nice:sys:user N:38667
:5:43977:70972030
instead of (note that there is ONE line)
/usr/bin/rrdtool update /var/www/html/peg/rra/peg_lnx_cpu.rrd --template user:nice:sys:idle N:38667:5:43977:70972030
Crontab's email:
ERROR: expected 4 data source readings (got 1) from N:38667:...
sh: :5:43977:70972030: command not found
The Solution:

Add the data source fields IN THE SAME ORDER of the script's output.
After I've done this, the DS/Graph worked fine, in the production installation.

-Gilson

PS: This script is posted in Message Board "Scripts and Other Addons for cacti"
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Interesting problem... and fix I might add :D

After taking a look, the problem stems from line 203 in 'include/rrd_functions.php':

Code: Select all

order by d.id
Like you said, it is ordering the fields by the order you add them (ie. the ID field).

I still do not understand why it is adding a newline after the "last ds name" though. The rrdtool_function_update() function does not add new lines anywhere in the string (that I can see).

Perhaps this will take further investigation.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests