Dstat Mysql5-conn

Source: Internet
Author: User

Part of the source code in dstat_mysql5_conn.py under the/usr/shared/dstat directory
 c = Self.db.cursor () C.execute (  show global variables like ' max_connections ';   ) Max  = C.fetchone () C.execute (  "" " show global status Like ' threads_connected ';   ) thread  = C.fetchone ()  if  thread[0]  self.vars:self.set2[ Thread[0]]  = float (thread[1]) self.set2[   threads   ] = Float (thread[1]/float (max[1]) 1.0 *) 

Print type (max[1]), type (thread[1])

<type ' str ' > <type ' str ' >

Debug, the data retrieved from the database (number) is STR so

self.set2[' Threads ' = float (thread[1]/float (max[1]) 1.0 * 100)--yes Str[thread[1]]/float[float (max[1])

Modify this code to

self.set2[' Threads ' = float (float (thread[1])/float (max[1]) * 100)
#!/bin/bash#file: Mysql5conn. SH export Dstat_mysql_user='USER'export dstat_mysql_pwd='  PWD'--mysql5-conn [email protected]
[Email protected] ~]#./mysql5io.SH  1 TenMYSQL5-Cothco%Con0.00 0.001.00 0.661.00 0.661.00 0.661.00 0.661.00 0.661.00 0.661.00 0.661.00 0.661.00 0.661.00 0.66

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.