git://git.iain.cx/iain
/
pstop.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6befaee
)
Show only short hostname to save a bit of space
author
Simon J Mudd
<sjmudd@pobox.com>
Fri, 21 Nov 2014 23:21:11 +0000
(
00:21
+0100)
committer
Simon J Mudd
<sjmudd@pobox.com>
Fri, 21 Nov 2014 23:21:11 +0000
(
00:21
+0100)
state/state.go
patch
|
blob
|
history
diff --git
a/state/state.go
b/state/state.go
index
90c3f7d
..
0bacb2e
100644
(file)
--- a/
state/state.go
+++ b/
state/state.go
@@
-6,6
+6,7
@@
package state
import (
"database/sql"
"fmt"
import (
"database/sql"
"fmt"
+ "strings"
"time"
"github.com/sjmudd/pstop/lib"
"time"
"github.com/sjmudd/pstop/lib"
@@
-65,7
+66,11
@@
func (state *State) Setup(dbh *sql.DB) {
state.show = showLatency
state.tiwsbt.SetWantsLatency(true)
state.show = showLatency
state.tiwsbt.SetWantsLatency(true)
+ // get short name (to save space)
_, hostname := lib.SelectGlobalVariableByVariableName(state.dbh, "HOSTNAME")
_, hostname := lib.SelectGlobalVariableByVariableName(state.dbh, "HOSTNAME")
+ if index := strings.Index(hostname, "."); index >= 0 {
+ hostname = hostname[0:index]
+ }
_, mysql_version := lib.SelectGlobalVariableByVariableName(state.dbh, "VERSION")
_, datadir := lib.SelectGlobalVariableByVariableName(state.dbh, "DATADIR")
state.SetHostname(hostname)
_, mysql_version := lib.SelectGlobalVariableByVariableName(state.dbh, "VERSION")
_, datadir := lib.SelectGlobalVariableByVariableName(state.dbh, "DATADIR")
state.SetHostname(hostname)