by looking at the pattern defined in the server. Currently I'm using
hard-coded stuff which matches personal usage.
-2. Latency issues over slow connections. Perhaps should use compressed
-connection to speed things up?
+2. Latency issues over slow connections. Perhaps I should use
+compressed connection to speed things up, but that is not possible
+at the moment. See https://github.com/go-sql-driver/mysql/issues/24
+for more details.
3. Sometimes I see this:
have options to pstop to present the info in that sort of format
too.
-4. add some replication metrics to pstop as most of my servers are
+4. Add some replication metrics to pstop as most of my servers are
slaves and we want to know where the server is busy. I've seen a
way to do that and need to incorporate it into pstop.
-5. _if_ ps statistics get truncated it would be good to be able
-to remember the latest state and add those metrics back again, _if_
-looking at absolute rather than statistics. I currently truncate
-info after 15-minutes, so this might happen while watching a server
-with pstop.
+5. _if_ ps statistics get truncated it would be good to be able to
+remember the latest state and add those metrics back again, _if_
+looking at absolute rather than relative statistics. On servers I
+manage I currently truncate info as it is collected after 15-minutes,
+so this might happen while watching a server with pstop.
6. Improve the options for sorting the data. Total latency is good,
but it would be good to see the write based metrics ordered by total
write latency. So look to improve the display and sort options here.
7. Add command line options for providing access to the MySQL server.
-Currently uses ~/.my.cnf and that's all.
-
-8. shift-tab to go back a screen.
-
-Issue 3 - termbox - SHIFT + TAB with go - termbox library ...
-code.google.com/p/termbox/issues/detail?id=3
-14 Sep 2010 - If I press Shift + Tab the Poll function will send
-me 3 things successively: 1: Key 27 2: Ch 91 3: Ch 90 It's the only
-Key I know that do that.
-https://github.com/peco/peco/issues/161
+--defaults-file=/path/to/.my.cnf now works, but missing an explicit
+--host=xx --port=99 --user=xx --password=xx or --socket=/path/to/mysql.sock
+options.
+
+8. I/O Latency by File shows read/write bytes and operations but
+none of these values is converted into B/s or ops/sec which might
+be better given we want to see the rate values. MB/s or ops/s are
+easier to understand and the values don't change depending on the
+period being viewed. That said unless we have the times the metrics
+were collected we can't calculate these rates so the ABS values
+can't show the rate information but would need to show only the
+counters.
### Configuration
Access to MySQL is currently via a defaults-file which is assumed
-to be `~/.my.cnf`. This should probably be made more configurable.
-If you see a need for this please let me know.
+to be `~/.my.cnf`. Alternatively you can now provide
+-defaults-file=/path/to/.my.cnf if needed.
### Grants
)
var (
- flag_version = flag.Bool("version", false, "Show the version of "+lib.MyName())
- flag_debug = flag.Bool("debug", false, "Enabling debug logging")
- flag_help = flag.Bool("help", false, "Provide some help for "+lib.MyName())
- cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
+ flag_debug = flag.Bool("debug", false, "Enabling debug logging")
+ flag_defaults_file = flag.String("defaults-file", "", "Provide a defaults-file to use to connect to MySQL")
+ flag_help = flag.Bool("help", false, "Provide some help for "+lib.MyName())
+ flag_version = flag.Bool("version", false, "Show the version of "+lib.MyName())
+ cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
re_valid_version = regexp.MustCompile(`^(5\.[67]\.|10\.[01])`)
)
-func get_db_handle() *sql.DB {
+// Connect to the database with the given defaults-file, or ~/.my.cnf if not provided.
+func get_db_handle( defaults_file string ) *sql.DB {
var err error
var dbh *sql.DB
lib.Logger.Println("get_db_handle() connecting to database")
- dbh, err = mysql_defaults_file.OpenUsingDefaultsFile(sql_driver, "", "performance_schema")
+ dbh, err = mysql_defaults_file.OpenUsingDefaultsFile(sql_driver, defaults_file, "performance_schema")
if err != nil {
log.Fatal(err)
}
fmt.Println("Usage: " + lib.MyName() + " <options>")
fmt.Println("")
fmt.Println("Options:")
- fmt.Println("-help show this help message")
- fmt.Println("-version show the version")
+ fmt.Println("-defaults-file=/path/to/defaults.file Connect to MySQL using given defaults-file" )
+ fmt.Println("-help show this help message")
+ fmt.Println("-version show the version")
}
// pstop requires MySQL 5.6+ or MariaDB 10.0+. Check the version
}
func main() {
+ var defaults_file string = ""
flag.Parse()
// clean me up
lib.Logger.Println("Starting " + lib.MyName())
- dbh := get_db_handle()
+ if flag_defaults_file != nil && *flag_defaults_file != "" {
+ defaults_file = *flag_defaults_file
+ }
+
+ dbh := get_db_handle( defaults_file )
if err := validate_mysql_version(dbh); err != nil {
log.Fatal(err)
}
package version
const (
- version = "0.1.2"
+ version = "0.1.3"
)
// return the current application version