[SOLVED] COUNTER function not working

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

Moderators: Developers, Moderators

Post Reply
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

[SOLVED] COUNTER function not working

Post by proohu01 »

Until now, everything I did in Cacti went just fine. Cacti is making graphs so there is nothing wrong with the installation in general.

However, I keep getting NAN's in wat is supposed to be a simple COUNTER graph that I am creating from scratch.
I want to graph my Gas, Water and Energy usage in Cacti. I created a data source and a data template. Both seem to be oke but ones I start making graphs...NAN's all the time :cry:

Poller Cache:

Code: Select all

Script: php /srv/www/htdocs/cacti/scripts/xpl-rfxcom-sql-query.php 00f0 01f1 02f2  
RRD: /srv/www/htdocs/cacti/rra/rfxmeter1_gas_121.rrd
Cacti Log:

Code: Select all

SPINE: Poller[0] Host[22] DS[121] SCRIPT: php /srv/www/htdocs/cacti/scripts/xpl-rfxcom-sql-query.php 00f0 01f1 02f2, output: gas:55.00 water:49.0 energy:49.0 
Graph Source:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1236164928 \
--end=1236172128 \
--title="Gas Usage" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
COMMENT:"From 2009/03/04 12\:08\:48 To 2009/03/04 14\:08\:48\c" \
COMMENT:"  \n" \
--vertical-label="M³" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/srv/www/htdocs/cacti/rra/rfxmeter1_gas_121.rrd":gas:AVERAGE \
CDEF:cdefa=a,100,* \
AREA:cdefa#9FA4EEFF:"Gas Usage"  \
GPRINT:cdefa:AVERAGE:"Last\:%8.0lf"  \
GPRINT:cdefa:AVERAGE:"Avg\:%8.0lf" 
I followed the Debug NaN's in your graphs - http://docs.cacti.net/node/283 to the letter and everything seems to be right except for the output of

Code: Select all

rrdtool fetch rfxmeter1_gas_121.rrd AVERAGE

1236168900: nan nan nan
1236169200: nan nan nan
1236169500: nan nan nan
1236169800: nan nan nan
1236170100: nan nan nan
1236170400: nan nan nan
1236170700: nan nan nan
1236171000: nan nan nan
.......now what? Please help. :roll:
Last edited by proohu01 on Sat Mar 14, 2009 7:26 am, edited 2 times in total.
Cacti Version - 0.8.8b
CentOS 6.4
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

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

Post by gandalf »

When running in debug mode, do you see the rrdtool update statements?
Reinhard
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

I created a second device (rfxcom2) and changed the data source type to gauge for this host (The rest of the settings are unchanged). After a couple of minutes, a succesful graph is created for that host. (See images below) However, gauge is not correct and I realy need it as a counter.

The rrdtool update debug output for both devices seem oke to me....

Code: Select all

03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom2_gas_125.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0  
03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom2_gas_124.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0  
03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom123_gas_127.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0  
03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom2_gas_126.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0  
03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom123_gas_129.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0  
03/08/2009 11:20:16 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom123_gas_128.rrd --template gas:water:energy 1236507615:99.00:105.0:115.0
Attachments
Data Source Type: Gauge
Data Source Type: Gauge
water_gauge.png (19.23 KiB) Viewed 2852 times
Data Source Type: Counter
Data Source Type: Counter
water_counter.png (17.32 KiB) Viewed 2852 times
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

- I installed a new VM with a different OS (Fedora 10)
- Installed a new (fresh, empty) version of Cacti 0.8.7d
- Installed Spine 0.8.7c
- Impoted my own RFXcom host template with all dependancies
- Added just one host (rfxcom)

.......NAN's !!

Could it be a bugg in the "counter" routine?

Would it help if I post the entire DEBUG log for this single device ?? (single pol)
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

Log File [Total Lines: 96 - All Items Shown]

03/12/2009 09:10:03 AM - SYSTEM STATS: Time:1.3487 Method:spine Processes:1 Threads:1 Hosts:2 HostsPerProcess:2 DataSources:3 RRDsProcessed:3
03/12/2009 09:10:03 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom_counter_power_15.rrd --template gas 1236845402:1.80
03/12/2009 09:10:03 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom_counter_power_16.rrd --template gas:water:power 1236845402:1.80:15.92:299.36
03/12/2009 09:10:03 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom_counter_power_14.rrd --template gas 1236845402:1.80
03/12/2009 09:10:03 AM - POLLER: Poller[0] Parsed MULTI output field 'gas:1.80' [map gas->gas]
03/12/2009 09:10:03 AM - POLLER: Poller[0] Parsed MULTI output field 'power:299.36' [map power->power]
03/12/2009 09:10:03 AM - POLLER: Poller[0] Parsed MULTI output field 'water:15.92' [map water->water]
03/12/2009 09:10:03 AM - POLLER: Poller[0] Parsed MULTI output field 'gas:1.80' [map gas->gas]
03/12/2009 09:10:03 AM - POLLER: Poller[0] Parsed MULTI output field 'gas:1.80' [map gas->gas]
03/12/2009 09:10:02 AM - SPINE: Poller[0] Time: 0.5077 s, Threads: 1, Hosts: 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: MYSQL Free & Close Completed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Allocated Variable Memory Freed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: PHP Script Server Pipes Closed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Thread Cleanup Complete
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 0
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DS[14] SCRIPT: php /srv/www/htdocs/cacti/scripts/xpl_rfxcom/xpl-rfxcom-sql-query.php 00f0 01f1 02f2, output: gas:1.80
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DEBUG: The POPEN returned the following File Descriptor 9
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DS[16] SCRIPT: php /srv/www/htdocs/cacti/scripts/xpl_rfxcom/xpl-rfxcom-sql-query.php 00f0 01f1 02f2, output: gas:1.80 water:15.92 power:299.36
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DEBUG: The POPEN returned the following File Descriptor 9
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DS[15] SCRIPT: php /srv/www/htdocs/cacti/scripts/xpl_rfxcom/xpl-rfxcom-sql-query.php 00f0 01f1 02f2, output: gas:1.80
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] DEBUG: The POPEN returned the following File Descriptor 9
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] RECACHE: Processing 1 items in the auto reindex cache for '192.168.123.21'
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[4] SNMP Result: Host responded to SNMP
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Valid Thread to be Created
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: In Poller, About to Start Polling of Host
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 0
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[0] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Valid Thread to be Created
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: In Poller, About to Start Polling of Host
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Initial Value of Active Threads is 0
03/12/2009 09:10:02 AM - SPINE: Poller[0] SPINE: Initializing PHP Script Server(s)
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: SNMP Library Version is 5.4.2.1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: SNMP Header Version is 5.4.2.1
03/12/2009 09:10:02 AM - SPINE: Poller[0] SPINE: Initializing Net-SNMP API
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: MySQL is Thread Safe!
03/12/2009 09:10:02 AM - SPINE: Poller[0] Version 0.8.7c starting
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Maximum SNMP OID Get Size is 10
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The PHP Script Server is Not Required
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: StartHost='4', EndHost='4', TotalPHPScripts='0'
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The number of php script servers to run is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The script timeout is 25
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The number of concurrent processes is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The polling interval is 300 seconds
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The threads variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_pstats variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_pwarn variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_perror variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_timeout variable is 400
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_retries variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_method variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_failure_count variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_recovery_count variable is 3
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The availability_method variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The path_php variable is /usr/bin/php
03/12/2009 09:10:02 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/spinetest/spine, ARGS: 4 4]
03/12/2009 09:10:02 AM - SPINE: Poller[0] Time: 0.0713 s, Threads: 1, Hosts: 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: MYSQL Free & Close Completed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Allocated Variable Memory Freed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: PHP Script Server Pipes Closed
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Thread Cleanup Complete
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 0
03/12/2009 09:10:02 AM - SPINE: Poller[0] Host[0] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: In Poller, About to Start Polling of Host
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Value of Active Threads is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Valid Thread to be Created
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: Initial Value of Active Threads is 0
03/12/2009 09:10:02 AM - SPINE: Poller[0] SPINE: Initializing PHP Script Server(s)
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: SNMP Library Version is 5.4.2.1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: SNMP Header Version is 5.4.2.1
03/12/2009 09:10:02 AM - SPINE: Poller[0] SPINE: Initializing Net-SNMP API
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: MySQL is Thread Safe!
03/12/2009 09:10:02 AM - SPINE: Poller[0] Version 0.8.7c starting
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The Maximum SNMP OID Get Size is 10
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The PHP Script Server is Not Required
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: StartHost='0', EndHost='0', TotalPHPScripts='0'
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The number of php script servers to run is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The script timeout is 25
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The number of concurrent processes is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The polling interval is 300 seconds
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The threads variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_pstats variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_pwarn variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The log_perror variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_timeout variable is 400
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_retries variable is 1
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_method variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_failure_count variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The ping_recovery_count variable is 3
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The availability_method variable is 2
03/12/2009 09:10:02 AM - SPINE: Poller[0] DEBUG: The path_php variable is /usr/bin/php
03/12/2009 09:10:02 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/spinetest/spine, ARGS: 0 0]
03/12/2009 09:10:02 AM - POLLER: Poller[0] NOTE: Poller Int: '300', Cron Int: '300', Time Since Last: '294', Max Runtime '298', Poller Runs: '1'
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Please apply the patches from the web site. Also, make sure the Max in the data template is not 0, or too low. Then, if the RRDfiles are being created and the max is too low, then you will either need to tune your RRDfiles, or delete them and allow them to be created again using the revised template.

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
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

- Applied all (4) patches
- Changed max from 10000 to 1000000 even though the value will probably never be higher than 1000.
- Removed device including .rrd files
- Recreated device. Waited at least 30 minutes. (new .rrd files get created oke)
- :cry:
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ok, if there are no warnings in the log, and you have the entry in the poller cache, then you need to dump the RRDfile and see if there are entries there. If the RRD is all empty, then there is a problem and I'm a bit clueless at this point.

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
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Post by proohu01 »

Code: Select all

/usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/rfxcom_counter_rfxmeter_20.rrd --template rfxmeter 1236927940:541,2

ERROR: /srv/www/htdocs/cacti/rra/rfxcom_counter_rfxmeter_20.rrd: not a simple integer: '541,2'
It seems that the RRDTOOL doesn't accept integer when using COUNTER. It is too bad that this error doesn't show up in the Cacti log :-? .

I must oppoligize, as I did read step 5 of the "Debug NaN's in your graphs" document, and I did see the update entries in the log, but I failed to execute them in the shell myself. It would have saved time.

Solution: Instead of using a CDEF to multiply by 100, I now do the multiplying in the data imput script. Works just fine for me!!
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Glad to see you figured it out.

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 0 guests