use temysql and graph instance with port different to 3306

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

Moderators: Developers, Moderators

Post Reply
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

use temysql and graph instance with port different to 3306

Post by driden91 »

hello

i want graph many instance mysql using a different port.
I use temysql.

in the Data Input Methods section, i have add a input field called port and had the option <port> in the section Input sting

see the screen :

Image

and i have modified the script php :

Code: Select all

function ss_mysql_stats($section = "", $host = "", $user = "", $passwd = "", $port = "", $status_var = "") {
        /* perform initial error checking */
        if (empty($section) || empty($host) || empty($user) || empty($passwd)) {
                cacti_log("ERROR: MySQL Stats - Parameters Missing, can not continue");
        }

=====>        if (!isset($port))  { $port=3306;  }
        /* collect [show status], [show variables], [slave status], [show innodb status]
         * into
         * $status, $variables, $slavestatus, $innodb_status
         */
=====>         $connection = @mysql_connect($host.":".$port, $user, $passwd);

i have just add : if (!isset($port)) { $port=3306; }
and just modified : @mysql_connect ( modified $host, for $host.":".$port,


after i have modified "Temysql index Data template" and just checked "Use Per-Data Source Value" for the custom data port
and on a console it's work perfectly !

Code: Select all

# php ss_mysql_statsV2.php teindexusage 192.XXX.XXXX.XXX test test 3306
Key_read_requests:3579654846707 Key_reads:496856704 Key_write_requests:13225240269 Key_writes:5313532527
# php ss_mysql_statsV2.php teindexusage 192.XXX.XXXX.XXX test test 3308
Key_read_requests:116018993470 Key_reads:2070526551 Key_write_requests:13225258515 Key_writes:5313739400
# php ss_mysql_statsV2.php teindexusage 192.XXX.XXXX.XXX test test
but with cacti, the script don't use the port what i specified :
(cacti log in debug mode )
SPINE: Poller[0] Host[109] DS[18408] SS[0] SERVER: /var/www/cacti/scripts/ss_mysql_statsV2.php ss_mysql_stats teindexusage 192.168.1.155 cacti cacti 3308, output: Key_read_requests:116019151505 Key_reads:2070526779 Key_write_requests:13225268850 Key_writes:5313747074

SPINE: Poller[0] Host[109] DS[18409] SS[1] SERVER: /var/www/cacti/scripts/ss_mysql_statsV2.php ss_mysql_stats teindexusage 192.168.1.155 cacti cacti 5050, output: Key_read_requests:3579657321301 Key_reads:496857184 Key_write_requests:13225251348 Key_writes:5313540887
it's not good, the port 5050 is not use for my mysql instance and i can use any port i have alway the result for the port 3306 ...

where is the problem ? i don't understand
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Quite possibly, the $port variable is not being passed.

Check the top of the script, where it assigns the variables:

Code: Select all

 $host     = $_SERVER["argv"][2];
 $username = $_SERVER["argv"][3];
 $password = $_SERVER["argv"][4];
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

hello

i use the script server written by the witness not mysql_stat.php

this is this script ss_mysql_stat.php :
http://forums.cacti.net/about16618.html
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

The links no longer work. Attach the script and I'll take a look (and then beat TheWitness over the head with it :) )
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

thank for you help

a link for the script :

http://forums.cacti.net/download.php?id=7910

regards
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Thats weird.

The script appears fine, and your enhancements seem fine.

What is the output of:

Code: Select all

# php ss_mysql_statsV2.php teindexusage 192.XXX.XXXX.XXX test test 5050
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

php ss_mysql_statsV2.php teindexusage 192.168.xxx.xxx test test 3306
Key_read_requests:3581415577929 Key_reads:497029539 Key_write_requests:13228891991 Key_writes:5316543301

# php ss_mysql_statsV2.php teindexusage 192.168.xxx.xxx test test 3308
Key_read_requests:116062616262 Key_reads:2070560766 Key_write_requests:13228910395 Key_writes:5316749981

# php ss_mysql_statsV2.php teindexusage 192.168.xxx.xxx test test 5050
#
in console the script work but in cacti, i have the same result with different port ... i have a result with the port 5050 in example and it's impossible.

i think cacti use alway the port 3306 but i don't know why ...

in cacti log :
07/07/2009 11:55:09 PM - PHPSVR: Poller[0] DEBUG: INC: '/var/www/cacti/scripts/ss_mysql_statsV2.php' FUNC: 'ss_mysql_stats' PARMS: 'teindexusage 192.168.xxx.xxx test test'
07/07/2009 11:55:09 PM - SPINE: Poller[0] Host[109] DS[2018] SS[4] SERVER: /var/www/cacti/scripts/ss_mysql_statsV2.php ss_mysql_stats teindexusage 192.168.xxx.xxx test test , output: Key_read_requests:3581452093124 Key_reads:497031901 Key_write_requests:13228925345 Key_writes:5316567317
07/07/2009 11:55:09 PM - PHPSVR: Poller[0] DEBUG: INC: '/var/www/cacti/scripts/ss_mysql_statsV2.php' FUNC: 'ss_mysql_stats' PARMS: 'teindexusage 192.168.xxx.xxx test test 3308'
07/07/2009 11:55:09 PM - SPINE: Poller[0] Host[109] DS[18408] SS[1] SERVER: /var/www/cacti/scripts/ss_mysql_statsV2.php ss_mysql_stats teindexusage 192.168.xxx.xxx test test 3308, output: Key_read_requests:3581452093124 Key_reads:497031901 Key_write_requests:13228925345 Key_writes:5316567317
07/07/2009 11:55:09 PM - PHPSVR: Poller[0] DEBUG: INC: '/var/www/cacti/scripts/ss_mysql_statsV2.php' FUNC: 'ss_mysql_stats' PARMS: 'teindexusage 192.168.xxx.xxx test test 5050'
07/07/2009 11:55:09 PM - SPINE: Poller[0] Host[109] DS[18409] SS[2] SERVER: /var/www/cacti/scripts/ss_mysql_statsV2.php ss_mysql_stats teindexusage 192.168.xxx.xxx test test 5050, output: Key_read_requests:3581452093124 Key_reads:497031901 Key_write_requests:13228925345 Key_writes:5316567317
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

OK. I'll have to load this into my test instance and take a look. Might take a while...
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

hello

have you the same problem with your test ?

Regards
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

Same issue. I'm not going to have a real chance to dig into it until tomorrow.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

hello

have you find a solution for this bug ?

Regards
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

hello

any news ?

regards
driden91
Cacti User
Posts: 52
Joined: Fri Jan 20, 2006 10:38 am

Post by driden91 »

hello

any update ?

my company waiting for use the template ...

regards
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests