google-code-export / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
1 stars 0 forks source link

"nan" in Cacti - fine from command line #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to graph MySQL stats in Cacti
2. Everything returns as "nan"
3. From the command line it's all fine

What is the expected output? What do you see instead?
Expected output is valid values

What version of the product are you using? On what operating system?
mysql-cacti-templates 1.0.0
Cacti 0.8.6j
Centos 4.5

Please provide any additional information below.
In cacti everything returns "nan" but from the command line all is fine...

sh$ /usr/bin/php -q /var/www/cacti/scripts/ss_get_mysql_stats.php
host.domain.com username password
Key_read_requests:1618051935 Key_reads:13960793 Key_write_requests:37983702
Key_writes:37339538 history_list:0 innodb_transactions:0 read_views:0
current_transactions:0 locked_transactions:0 active_transactions:0
pool_size:0 free_pages:0 database_pages:0 modified_pages:0 pages_read:0
pages_created:0 pages_written:0 file_fsyncs:0 file_reads:0 file_writes:0
log_writes:0 pending_aio_log_ios:0 pending_aio_sync_ios:0
pending_buf_pool_flushes:0 pending_chkp_writes:0 pending_ibuf_aio_reads:0
pending_log_flushes:0 pending_log_writes:0 pending_normal_aio_reads:0
pending_normal_aio_writes:0 ibuf_inserts:0 ibuf_merged:0 ibuf_merges:0
spin_waits:0 spin_rounds:0 os_waits:0 rows_inserted:0 rows_updated:0
rows_deleted:0 rows_read:0 Table_locks_waited:2588760
Table_locks_immediate:78201304 Slow_queries:2394455 Open_files:504
Open_tables:275 Opened_tables:8254 innodb_open_files:0
open_files_limit:4010 table_cache:512 Aborted_clients:11704
Aborted_connects:38 Max_used_connections:467 Slow_launch_threads:0
Threads_cached:0 Threads_connected:330 Threads_created:6154624
Threads_running:22 max_connections:800 thread_cache_size:0
Connections:6154625 slave_running:0 slave_stopped:0
Slave_retried_transactions:0 slave_lag:0 Slave_open_temp_tables:0
Qcache_free_blocks:2142 Qcache_free_memory:56705256 Qcache_hits:146444273
Qcache_inserts:29819595 Qcache_lowmem_prunes:1061392
Qcache_not_cached:3366962 Qcache_queries_in_cache:7230
Qcache_total_blocks:16828 query_cache_size:67108864 Questions:251551490
Com_update:1522578 Com_insert:3568992 Com_select:33201547
Com_delete:3498013 Com_replace:24985314 Com_load:0 Com_update_multi:0
Com_insert_select:0 Com_delete_multi:0 Com_replace_select:0
Select_full_join:3687 Select_full_range_join:0 Select_range:81234
Select_range_check:364 Select_scan:2363751 Sort_merge_passes:2659
Sort_range:64815 Sort_rows:137949938 Sort_scan:1972270
Created_tmp_tables:307050 Created_tmp_disk_tables:7159
Created_tmp_files:5250 Bytes_sent:3948497184 Bytes_received:1330071296
innodb_log_buffer_size:0 unflushed_log:0 log_bytes_flushed:0
log_bytes_written:0 relay_log_space:0 binlog_cache_size:32768
Binlog_cache_disk_use:0 Binlog_cache_use:0 binary_log_space:0

Original issue reported on code.google.com by andyjohn...@gmail.com on 13 Jun 2008 at 6:06

GoogleCodeExporter commented 9 years ago
Are you using Cactid or Spine?  It's not compatible (yet).

Original comment by baron.schwartz on 13 Jun 2008 at 6:10

GoogleCodeExporter commented 9 years ago
The poller is cactid - is that OK?

Strangely the only graph which does work is MyISAM Indexes - but all the others 
show nan.

Original comment by andyjohn...@gmail.com on 13 Jun 2008 at 6:29

GoogleCodeExporter commented 9 years ago
I think you've been bitten by issue 14.

Original comment by baron.schwartz on 13 Jun 2008 at 6:31

GoogleCodeExporter commented 9 years ago
The file in /tmp seems to be complete, but does indeed contain > 1024 
characters (see
below). If it can graph MyISAM Indexes could this still be the issue? 

wc -m /tmp/host.domain.com-mysql_cacti_stats.txt 
2180 /tmp/host.domain.com-mysql_cacti_stats.txt

cat /tmp/host.domain.com-mysql_cacti_stats.txt
Key_read_requests:1620056878 Key_reads:13961026 Key_write_requests:37995478
Key_writes:37349529 history_list:0 innodb_transactions:0 read_views:0
current_transactions:0 locked_transactions:0 active_transactions:0 pool_size:0
free_pages:0 database_pages:0 modified_pages:0 pages_read:0 pages_created:0
pages_written:0 file_fsyncs:0 file_reads:0 file_writes:0 log_writes:0
pending_aio_log_ios:0 pending_aio_sync_ios:0 pending_buf_pool_flushes:0
pending_chkp_writes:0 pending_ibuf_aio_reads:0 pending_log_flushes:0
pending_log_writes:0 pending_normal_aio_reads:0 pending_normal_aio_writes:0
ibuf_inserts:0 ibuf_merged:0 ibuf_merges:0 spin_waits:0 spin_rounds:0 os_waits:0
rows_inserted:0 rows_updated:0 rows_deleted:0 rows_read:0 
Table_locks_waited:2593759
Table_locks_immediate:78345702 Slow_queries:2397786 Open_files:536 
Open_tables:291
Opened_tables:8270 innodb_open_files:0 open_files_limit:4010 table_cache:512
Aborted_clients:12214 Aborted_connects:38 Max_used_connections:467
Slow_launch_threads:0 Threads_cached:0 Threads_connected:326 
Threads_created:6160206
Threads_running:24 max_connections:800 thread_cache_size:0 Connections:6160207
slave_running:0 slave_stopped:0 Slave_retried_transactions:0 slave_lag:0
Slave_open_temp_tables:0 Qcache_free_blocks:2696 Qcache_free_memory:58042736
Qcache_hits:146496811 Qcache_inserts:29881526 Qcache_lowmem_prunes:1061392
Qcache_not_cached:3372187 Qcache_queries_in_cache:4756 Qcache_total_blocks:12534
query_cache_size:67108864 Questions:251817315 Com_update:1533348 
Com_insert:3572488
Com_select:33268720 Com_delete:3499083 Com_replace:25037349 Com_load:0
Com_update_multi:0 Com_insert_select:0 Com_delete_multi:0 Com_replace_select:0
Select_full_join:3687 Select_full_range_join:0 Select_range:81245
Select_range_check:364 Select_scan:2367075 Sort_merge_passes:2659 
Sort_range:64829
Sort_rows:137955994 Sort_scan:1974185 Created_tmp_tables:307063
Created_tmp_disk_tables:7159 Created_tmp_files:5250 Bytes_sent:50409634
Bytes_received:1370186915 innodb_log_buffer_size:0 unflushed_log:0
log_bytes_flushed:0 log_bytes_written:0 relay_log_space:0 
binlog_cache_size:32768
Binlog_cache_disk_use:0 Binlog_cache_use:0 binary_log_space:0

Original comment by andyjohn...@gmail.com on 13 Jun 2008 at 6:40

GoogleCodeExporter commented 9 years ago
Also, I see no errors in the cacti log file which seem to relate to this.
Unfortunately the Cacti log file seems to truncate lines itself - which is 
entirely
useless for troubleshooting issues :-(

Original comment by andyjohn...@gmail.com on 13 Jun 2008 at 6:49

GoogleCodeExporter commented 9 years ago
I have just switched to cmd.php instead of cactid for testing purposes, but I 
still
get nan on the graphs.

I'll try and ask in the Cacti forums how I can get a complete cacti.log rather 
than a
useless truncated one to troubleshoot this further.

Original comment by andyjohn...@gmail.com on 13 Jun 2008 at 7:02

GoogleCodeExporter commented 9 years ago
Right, what's happening is the MyISAM metrics are first in line, so they come 
through
in the 1024-byte buffer cactid uses.

You know, I wonder if a decent solution to this problem is to just compress the
variable names.  It's stupid and will make things harder to debug, but why not 
have
the output look like 

v1:123 v2:234

This will fit in about 900 bytes right now (using your sample from above as a 
test
case).  In the worst case it will still overflow, but hopefully average cases 
won't.
 Let me work on this.

Original comment by baron.schwartz on 13 Jun 2008 at 7:05

GoogleCodeExporter commented 9 years ago
Thanks very much for your help on this issue. However, please note that I am now
running cmd.php as the poller as still see this problem.

Original comment by andyjohn...@gmail.com on 13 Jun 2008 at 7:14

GoogleCodeExporter commented 9 years ago
I can now confirm the buffer issue from debug output in the cacti.log..

06/14/2008 05:44:02 PM - CACTID: Poller[0] Host[25] DS[2783] SCRIPT: 
/usr/bin/php -q
/var/www/cacti/scripts/ss_get_mysql_stats.php host.domain.com  , output:
Key_read_requests:1725822859 Key_reads:14078469 Key_write_requests:39899106
Key_writes:39224313 history_list:0 innodb_transactions:0 read_views:0
current_transactions:0 locked_transactions:0 active_transactions:0 pool_size:0
free_pages:0 database_pages:0 modified_pages:0 pages_read:0 pages_created:0
pages_written:0 file_fsyncs:0 file_reads:0 file_writes:0 log_writes:0
pending_aio_log_ios:0 pending_aio_sync_ios:0 pending_buf_pool_flushes:0
pending_chkp_writes:0 pending_ibuf_aio_reads:0 pending_log_flushes:

06/14/2008 05:54:04 PM - CACTID: Poller[0] Host[25] DEBUG: The POPEN returned 
the
following File Descriptor 10

...unless the logfile itself is truncating the output? There does only seem to 
be 511
bytes of output there.

Original comment by andyjohn...@gmail.com on 14 Jun 2008 at 5:08

GoogleCodeExporter commented 9 years ago
No, it's definitely cactid that truncates the output.  See the notes in issue 
14. 
There are links to forum discussions about it.  The log files aren't going to 
have
full output because it's truncated before it gets there.

I doubt your nan issue is related to the templates.  There's a whole thread 
about
this on the forums.

Original comment by baron.schwartz on 14 Jun 2008 at 6:09

GoogleCodeExporter commented 9 years ago
OK. Are you going to compress variable names as you note in comment 7, as I'd 
very
much like to test this.

I cannot switch to cmd.php as it takes _way_ too long to run, but I'd really 
like to
get results from your templates :-)

Thanks.

Original comment by andyjohn...@gmail.com on 14 Jun 2008 at 6:44

GoogleCodeExporter commented 9 years ago
Try the script and template currently in Subversion (r53).  This is not
backwards-compatible.  I suggest a fresh Cacti install, unless you already have 
a lot
of data you want to keep.  (By fresh install, I mean delete all the RRA files 
and
reinstall the database by doing "mysql cacti < cacti.sql")

Original comment by baron.schwartz on 15 Jun 2008 at 2:45

GoogleCodeExporter commented 9 years ago
Sadly this is in production and graphing hundreds of things - I cannot start 
afresh
unfortunately. So this template cannot be imported over the top of the existing 
one?
Can I not just delete any graphs / rra's / rrd's etc relating to this template 
and
load in this new one? The only other solution would be to run a second instance 
of
Cacti - but that's far from ideal.

Original comment by andyjohn...@gmail.com on 15 Jun 2008 at 5:17

GoogleCodeExporter commented 9 years ago
You know what, I can't think of why you'll have to drop your RRAs etc.  The only
"compression" here happened between Cacti and the PHP file, which was kind of 
the
minimal change possible.  The names of the values going into the RRAs should 
not have
changed at all.  Give it a try.

Original comment by baron.schwartz on 15 Jun 2008 at 6:06

GoogleCodeExporter commented 9 years ago
Great, thanks. So to clarify - I just need to import the new xml template in 
revision
53 which will overwrite the existing template? Cheers.

Original comment by andyjohn...@gmail.com on 15 Jun 2008 at 6:25

GoogleCodeExporter commented 9 years ago
Ah, I'm wrong there - I need all the changes in r51 too, right? So I do a 
complete
checkout of the latest code and work with that, yes? We have a 120 second poll
interval so I will need to rebuild the template, which requires the files in 
r51 I
believe.

Original comment by andyjohn...@gmail.com on 15 Jun 2008 at 6:30

GoogleCodeExporter commented 9 years ago
You need the new template and new PHP script both.

Original comment by baron.schwartz on 15 Jun 2008 at 6:37

GoogleCodeExporter commented 9 years ago
OK - we're looking better...

sh$ /usr/bin/php -q /var/www/cacti/scripts/ss_get_mysql_stats.php 
host.domain.com
username password
PHP Notice:  Undefined variable:  innodb_txn in
/var/www/cacti/scripts/ss_get_mysql_stats.php on line 350
a0:1871856020 a1:14250170 a2:41920888 a3:41191915 a4:0 a5:0 a6:0 a7:0 a8:0 a9:0 
aa:0
ab:0 ac:0 ad:0 ae:0 af:0 ag:0 ah:0 ai:0 aj:0 ak:0 al:0 am:0 an:0 ao:0 ap:0 aq:0 
ar:0
as:0 at:0 au:0 av:0 aw:0 ax:0 ay:0 az:0 b0:0 b1:0 b2:0 b3:0 b4:2923762 
b5:92724929
b6:2684068 b7:516 b8:286 b9:9004 ba:0 bb:4010 bc:512 bd:53567 be:59 bf:467 bg:0 
bh:0
bi:305 bj:6806001 bk:21 bl:800 bm:0 bn:6806002 bo:0 bp:0 bq:0 br:0 bs:0 bt:1450
bu:55795264 bv:160415902 bw:36121843 bx:1087139 by:3756155 bz:8067 c0:17748
c1:67108864 c2:283331635 c3:1798809 c4:3951626 c5:39894502 c6:3857338 
c7:30829157
c8:0 c9:0 ca:0 cb:0 cc:0 cd:3875 ce:0 cf:91313 cg:383 ch:2651356 ci:2659 
cj:70953
ck:138642510 cl:2169208 cm:319951 cn:7391 co:5250 cp:3522092697 cq:2753735628 
cr:0
cs:0 ct:0 cu:0 cv:0 cw:32768 cx:0 cy:0 cz:0

Because we use MyISAM and are not concerned about innodb I just commented out 
the "if
( $innodb_txn )" section from the file to stop that initial PHP notice. Might be
worth looking at, though?

I can already see some values being graphed - which is great news! There's still
quite a few nan's about, but I'll report back tomorrow with details on those.

Perhaps I may need to recreate and/or reset a few things? I'll have a play and 
see.

Either way I'd like to thank you for the quick turnaround on this issue. 
Getting it
to work with cactid is a great step forward as it's so much faster than cmd.php
there's no way we could work with the latter. We poll (probably too) many 
things!

Original comment by andyjohn...@gmail.com on 15 Jun 2008 at 9:22

GoogleCodeExporter commented 9 years ago
You can set $debug = FALSE to stop that notice.  Oddly, I can't reproduce it.  
Maybe
you have your php.ini set differently or you have different PHP version.  I'm 
using
5.1.6 and can't get the error to happen even when I set skip-innodb in my.cnf.

Original comment by baron.schwartz on 15 Jun 2008 at 11:59

GoogleCodeExporter commented 9 years ago
Well, still lots of "nan"'s, which is proving tricky to resolve. I'm going to 
setup
an entirely separate instance of Cacti and configure this from scratch to find 
out
what's going wrong. In the meantime this is the best I can get from the Cacti 
log....

06/16/2008 02:54:08 PM - CACTID: Poller[0] Host[116] DS[2800] WARNING: Result 
from
SCRIPT not valid. Partial Result: a0:171719879 a1:3712...
06/16/2008 02:54:08 PM - CACTID: Poller[0] Host[116] DS[2800] SCRIPT: 
/usr/bin/php -q
/var/www/cacti/scripts/ss_get_mysql_stats.php host.domain.com  , output: U
06/16/2008 02:54:08 PM - CACTID: Poller[0] Host[116] DEBUG: The POPEN returned 
the
following File Descriptor 20

Any thoughts on how I can stop this fundamentally useless logfile to stop 
truncating
the entries? How on earth am I meant to troubleshoot this further? Bah, this is
frustrating :-(

Original comment by andyjohn...@gmail.com on 16 Jun 2008 at 2:00

GoogleCodeExporter commented 9 years ago
I am experiencing same issue and I am using cmd.php as poller.

What steps will reproduce the problem?
1. Attempt to graph MySQL stats in Cacti
2. Everything returns as "nan"
3. From the command line it's all fine

What is the expected output? What do you see instead?
Expected output is valid values

What version of the product are you using? On what operating system?
mysql-cacti-templates 1.0.0 with updates from r57
Cacti 0.8.7
RHEL ES 3.2

# /usr/local/php/bin/php -q
/usr/local/apache2/htdocs/cacti/scripts/ss_get_mysql_stats.php 10.200.10.11
a0:2465248388 a1:6072615 a2:18362401 a3:2172956 a4:18 a5:1050672298 a6:0 a7:43 
a8:0
a9:0 aa:4480 ab:0 ac:4389 ad:368 ae:2127261661 af:2536558 ag:105237719 
ah:89367975
ai:772184792 aj:166220157 ak:85198831 al:0 am:0 an:0 ao:0 ap:0 aq:0 ar:0 as:0 
at:0
au:10838741 av:10838741 aw:3727789 ax:2652422745 ay:4169309641 az:281672334
b0:50895958 b1:467740598 b2:16716304 b3:2718602892 b4:2 b5:3377864224 b6:13995 
b7:26
b8:64 b9:597613295 ba:300 bb:1024 bc:64 bd:1339 be:176 bf:126 bg:28 bh:0 bi:43
bj:44705993 bk:1 bl:500 bm:0 bn:44705994 bo:0 bp:0 bq:0 br:0 bs:0 bt:0 bu:0 
bv:0 bw:0
bx:0 by:0 bz:0 c0:0 c1:0 c2:847525699 c3:1069548366 c4:24243418 c5:2245359995
c6:5648140 c7:0 c8:0 c9:215 ca:62797 cb:58220 cc:0 cd:99020 ce:0 cf:1339902 
cg:24290
ch:663880822 ci:46245 cj:18496815 ck:3721545697 cl:10837076 cm:4461832 
cn:4294916
co:6277750 cp:570037608 cq:4154596246 cr:1048576 cs:1048576 ct:73640994054
cu:73640994054 cv:0 cw:32768 cx:736028 cy:112738091 cz:0

-- cacti.log
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] Host[57] DS[909] WARNING: Result 
from CMD
not valid.  Partial Result: 
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] Host[57] DS[909] CMD:
/usr/local/php/bin/php -q
/usr/local/apache2/htdocs/cacti/scripts/ss_get_mysql_stats.php 10.200.10.11  , 
output: U
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into
poller_output (local_data_id, rrd_name, time, output) values (9
09, '', '2008-09-12 11:20:04', 'U')"
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] Host[57] DS[910] WARNING: Result 
from CMD
not valid.  Partial Result: 
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] Host[57] DS[910] CMD:
/usr/local/php/bin/php -q /usr/local/apache2/htdocs/cacti/scripts/ss_ge
t_mysql_stats.php 10.200.10.11  , output: U
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into
poller_output (local_data_id, rrd_name, time, output) values (9
10, '', '2008-09-12 11:20:04', 'U')"
09/12/2008 11:20:08 AM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown 
request
received, exiting
09/12/2008 11:20:08 AM - CMDPHP: Poller[0] Time: 8.1948 s, Theads: N/A, Hosts: 
53

I also noticed that when I am importing the template, the input string of "X Get
MySQL Stats" from Data Input Methods doesn't contain "<" and ">" in references 
to
paths. I had to add those.

What else can I check?

Original comment by drakul...@gmail.com on 12 Sep 2008 at 3:59

GoogleCodeExporter commented 9 years ago
Disregard the previous message. I ran the script manually using root privileges.
Cacti user couldn't overwrite the tmp file. 
I deleted the output files from tmp. Now all the graphs are ok.

Original comment by drakul...@gmail.com on 12 Sep 2008 at 4:52

GoogleCodeExporter commented 9 years ago

Original comment by baron.schwartz on 15 Sep 2008 at 5:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I am seeing a very similar issue using Cacti 0.8.7d and the 1.1.1 mysql 
templates.

It is discussed here:

http://groups.google.com/group/better-cacti-templates/browse_thread/thread/162a5
531e335f64d/33cd4f949f110486#33cd4f949f110486

Original comment by spkan...@gmail.com on 6 Apr 2009 at 5:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
If you've arrived here from a Google search, please read and follow the 
instructions
here:
http://www.cacti.net/downloads/docs/html/debugging.html

Original comment by baron.schwartz on 23 Jan 2010 at 4:17