Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jun 25, 2019 11:07 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Anomaly with Percona MySQL Poller
PostPosted: Wed Nov 28, 2018 5:54 pm 
Offline
Cacti User

Joined: Mon Apr 09, 2018 1:37 pm
Posts: 86
I am playing with the Percona MySQL template and having a perplexing issue I am having trouble fixing (Fixing the right way anyhow)

I have defined the MySQL Username and Password in the script file.

And note if I manually execute the script as below I get valid results back (As noted)

/usr/bin/php -q /var/www/html/cacti-1.1.36/scripts/ss_get_mysql_stats.php --host '10.<redacted>' --items kx,ky

kx:46745279089 ky:14653778591

When executed by Cacti however here is what is being sent :

2018/11/28 22:25:10 - POLLER: Poller[1] Device[281] DS[5260] CMD: /usr/bin/php -q /var/www/html/cacti-1.1.36/scripts/ss_get_mysql_stats.php --host '10.<redacted>' --items ku,kv,kw --user '' --pass '' --port '' --server-id '', output: ku:-1 kv:-1 kw:-1

From my old 0.8.8 server (Running an older version of the template) I see below in my logs.
11/28/2018 10:21:19 PM - CMDPHP: Poller[0] Host[549] DS[10044] CMD: /usr/bin/php -q /srv/share/sites/web/httpdocs/cacti-0.8.7g/scripts/ss_get_mysql_stats.php --host <redacted> --items im,in,io --user --pass --port , output: im:2702941 in:14927 io:37405

I have confirmed on the new server if I pass the flags as shown on the old version (Minus the single quotes) it DOES work.

/usr/bin/php -q /var/www/html/cacti-1.1.36/scripts/ss_get_mysql_stats.php --host '10.<redacted>' --items ku,kv,kw --user --pass --port --server-id

ku:37161327 kv:146538 kw:56

So the conundrum here is 'where' do I fix this? I can look at the ss_get_mysql_stats.php and try to fix it not handling the blank vs null values passed (I assume this is the difference anyway), or am I missing something in the data input method (I have been looking at it side by side for hours and can see nothing) that would instruct cacti to pass the null value when executing this method versus the single quotes?

Running Cacti Version is 1.1.36

I believe I could fix this in the Percona script, but if there is a better place to correct this I would much prefer that to changing a script (And having to remember that change in the event of a future update that re-breaks my change)


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Wed Nov 28, 2018 7:54 pm 
Offline
Cacti User

Joined: Mon Apr 09, 2018 1:37 pm
Posts: 86
OK Temp solution I have tested and am deploying for now.

A normal data input method looks like this.
Code:
<path_php_binary> -q <path_cacti>/scripts/ss_get_mysql_stats.php --host <hostname> --items gu,gv,gw --user <username> --pass <password> --port <port> --server-id <serverid>


What I have done is removed the variable tags completely as show below.
Code:
<path_php_binary> -q <path_cacti>/scripts/ss_get_mysql_stats.php --host <hostname> --items nj,nk --user --pass --port --server-id


Now the obvious down side here is that after this change I CANNOT dynamically sent unique values to these queries, and they will always use what is defined in my config file. But for me I do not think this will be a problem, at least not in the immediate term.

Trying to walk through the code I believe poller.php (Or rather an included component) is what constructs the actual php call to ss_get_mysql_stats.php so either there is a difference there causing the single quotes to be passed, or my php config has a problem, but as everything EXCEPT this script works I really don't want to go screwing with those components, when IMO the percona script really should properly interpret the blank variable and still load the static values defined in the file.

If others look at this and concur, my approach is going to be to fix the percona php file as soon as I have the free time, so it properly handles what cacti sends, but for now this solution gets me working so I can at least evaluate the graphs.


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Thu Nov 29, 2018 3:15 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2523
Wait, this is a percona script? Check this out:
https://github.com/percona/percona-moni ... ns/pull/98

That was for one of the other scripts I think.

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Thu Nov 29, 2018 10:23 am 
Offline
Cacti User

Joined: Mon Apr 09, 2018 1:37 pm
Posts: 86
netniV wrote:
Wait, this is a percona script? Check this out:
https://github.com/percona/percona-moni ... ns/pull/98

That was for one of the other scripts I think.


Son of ...

I SWEAR I combed through the Cacti Git page for issues, I didn't even think to check the Percona repo too (Though I did check their forums which are DEAD)!! Looks like you fixed the exact thing I was going to fix (As soon as I found it) though, and would concur the fault here is with the Percona script and non Cacti :)

Thanks sir! I am going to make the same fix to my code, and re-test with the original unmodified templates but I'm confident this is going to work from reading your code!


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Thu Nov 29, 2018 1:47 pm 
Offline
Cacti User

Joined: Mon Apr 09, 2018 1:37 pm
Posts: 86
Quote:
/usr/bin/php -q /var/www/html/cacti-1.1.36/scripts/ss_get_mysql_stats.php --host '10.<redacted>' --items it,iu,iv,iw,iy --user --pass --port --server-id
it:17 iu:70 iv:286 iw:1 iy:151


Code:
         ##Changed 11-29-2019 by MJM Deploying codefix for cacti command line issue
         ##Codefix by netniV under Git commit ba4cb8b ro percona:master
         ##if ($nextparam !== false && strpos($nextparam, '--') !==0) {
         if (!empty($nextparam) && strpos($nextparam, '--') !==0) {
            list($tmp, $value) = each($args);
         }


Quote:
/usr/bin/php -q /var/www/html/cacti-1.1.36/scripts/ss_get_mysql_stats.php --host '10.<redacted>' --items it,iu,iv,iw,iy --user '' --pass '' --port '' --server-id ''
it:17 iu:70 iv:286 iw:1 iy:151


Confirming your code fix perfectly resolves the issue!

It may be worth updating the package at https://docs.cacti.net/template:package ... sql_server with the fix, as that is the "1.x.x" compatible template, and as far as I can tell it won't actually work for anyone without your fix.

Unless you're defining auth credentials in the methods, (but that just sounds awful).

Tremendous thanks as usual sir!


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Fri Nov 30, 2018 3:56 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2523
Yeah they haven't responded since I submitted that fix. Unfortunately, when I tried to find some way of contacting them to get some traction as an official member of the Cacti group, I struggled to find who what or how I should contact them. Makes me wonder if whomever was supporting it has maybe left the company or moved onto other projects and is no longer actively monitoring the situation.

It's just lucky that it was the fix I submitted so I was fully aware of it :)

_________________
Official Cacti Developer

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Anomaly with Percona MySQL Poller
PostPosted: Fri Jan 04, 2019 6:47 am 
Offline
Cacti Pro User
User avatar

Joined: Mon Jan 05, 2015 10:10 am
Posts: 753
I think a fork is required and a new templates repo that is not read only.

_________________
Before history, there was a paradise, now dust.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group