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 :
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);
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
(cacti log in debug mode )
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 ...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
where is the problem ? i don't understand