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