beego: admin support link
Showing
1 changed file
with
29 additions
and
23 deletions
| ... | @@ -9,6 +9,7 @@ package beego | ... | @@ -9,6 +9,7 @@ package beego |
| 9 | import ( | 9 | import ( |
| 10 | "fmt" | 10 | "fmt" |
| 11 | "net/http" | 11 | "net/http" |
| 12 | "strconv" | ||
| 12 | "time" | 13 | "time" |
| 13 | 14 | ||
| 14 | "github.com/astaxie/beego/toolbox" | 15 | "github.com/astaxie/beego/toolbox" |
| ... | @@ -53,15 +54,16 @@ func init() { | ... | @@ -53,15 +54,16 @@ func init() { |
| 53 | // AdminIndex is the default http.Handler for admin module. | 54 | // AdminIndex is the default http.Handler for admin module. |
| 54 | // it matches url pattern "/". | 55 | // it matches url pattern "/". |
| 55 | func adminIndex(rw http.ResponseWriter, r *http.Request) { | 56 | func adminIndex(rw http.ResponseWriter, r *http.Request) { |
| 56 | rw.Write([]byte("Welcome to Admin Dashboard\n")) | 57 | rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>")) |
| 57 | rw.Write([]byte("There are servral functions:\n")) | 58 | rw.Write([]byte("Welcome to Admin Dashboard<br>\n")) |
| 58 | rw.Write([]byte("1. Record all request and request time, <a href='/qps'>http://localhost:8088/qps</a>\n")) | 59 | rw.Write([]byte("There are servral functions:<br>\n")) |
| 59 | rw.Write([]byte("2. Get runtime profiling data by the pprof, <a href='/prof'>http://localhost:8088/prof</a>\n")) | 60 | rw.Write([]byte("1. Record all request and request time, <a href='/qps'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/qps</a><br>\n")) |
| 60 | rw.Write([]byte("3. Get healthcheck result from <a href='/healthcheck'>http://localhost:8088/healthcheck</a>\n")) | 61 | rw.Write([]byte("2. Get runtime profiling data by the pprof, <a href='/prof'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/prof</a><br>\n")) |
| 61 | rw.Write([]byte("4. Get current task infomation from task <a href='/task'>http://localhost:8088/task</a> \n")) | 62 | rw.Write([]byte("3. Get healthcheck result from <a href='/healthcheck'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/healthcheck</a><br>\n")) |
| 62 | rw.Write([]byte("5. To run a task passed a param <a href='/runtask'>http://localhost:8088/runtask</a>\n")) | 63 | rw.Write([]byte("4. Get current task infomation from task <a href='/task'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/task</a><br> \n")) |
| 63 | rw.Write([]byte("6. Get all confige & router infomation <a href='/listconf'>http://localhost:8088/listconf</a>\n")) | 64 | rw.Write([]byte("5. To run a task passed a param <a href='/runtask'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/runtask</a><br>\n")) |
| 64 | 65 | rw.Write([]byte("6. Get all confige & router infomation <a href='/listconf'>http://localhost:" + strconv.Itoa(AdminHttpPort) + "/listconf</a><br>\n")) | |
| 66 | rw.Write([]byte("</body></html>")) | ||
| 65 | } | 67 | } |
| 66 | 68 | ||
| 67 | // QpsIndex is the http.Handler for writing qbs statistics map result info in http.ResponseWriter. | 69 | // QpsIndex is the http.Handler for writing qbs statistics map result info in http.ResponseWriter. |
| ... | @@ -180,10 +182,12 @@ func listConf(rw http.ResponseWriter, r *http.Request) { | ... | @@ -180,10 +182,12 @@ func listConf(rw http.ResponseWriter, r *http.Request) { |
| 180 | rw.Write([]byte("command not support")) | 182 | rw.Write([]byte("command not support")) |
| 181 | } | 183 | } |
| 182 | } else { | 184 | } else { |
| 183 | rw.Write([]byte("ListConf support this command:\n")) | 185 | rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>")) |
| 184 | rw.Write([]byte("1. command=conf\n")) | 186 | rw.Write([]byte("ListConf support this command:<br>\n")) |
| 185 | rw.Write([]byte("2. command=router\n")) | 187 | rw.Write([]byte("1. <a href='?command=conf'>command=conf</a><br>\n")) |
| 186 | rw.Write([]byte("3. command=filter\n")) | 188 | rw.Write([]byte("2. <a href='?command=router'>command=router</a><br>\n")) |
| 189 | rw.Write([]byte("3. <a href='?command=filter'>command=filter</a><br>\n")) | ||
| 190 | rw.Write([]byte("</body></html>")) | ||
| 187 | } | 191 | } |
| 188 | } | 192 | } |
| 189 | 193 | ||
| ... | @@ -195,16 +199,18 @@ func profIndex(rw http.ResponseWriter, r *http.Request) { | ... | @@ -195,16 +199,18 @@ func profIndex(rw http.ResponseWriter, r *http.Request) { |
| 195 | if command != "" { | 199 | if command != "" { |
| 196 | toolbox.ProcessInput(command, rw) | 200 | toolbox.ProcessInput(command, rw) |
| 197 | } else { | 201 | } else { |
| 198 | rw.Write([]byte("request url like '/prof?command=lookup goroutine'\n")) | 202 | rw.Write([]byte("<html><head><title>beego admin dashboard</title></head><body>")) |
| 199 | rw.Write([]byte("the command have below types:\n")) | 203 | rw.Write([]byte("request url like '/prof?command=lookup goroutine'<br>\n")) |
| 200 | rw.Write([]byte("1. lookup goroutine\n")) | 204 | rw.Write([]byte("the command have below types:<br>\n")) |
| 201 | rw.Write([]byte("2. lookup heap\n")) | 205 | rw.Write([]byte("1. <a href='?command=lookup goroutine'>lookup goroutine</a><br>\n")) |
| 202 | rw.Write([]byte("3. lookup threadcreate\n")) | 206 | rw.Write([]byte("2. <a href='?command=lookup heap'>lookup heap</a><br>\n")) |
| 203 | rw.Write([]byte("4. lookup block\n")) | 207 | rw.Write([]byte("3. <a href='?command=lookup threadcreate'>lookup threadcreate</a><br>\n")) |
| 204 | rw.Write([]byte("5. start cpuprof\n")) | 208 | rw.Write([]byte("4. <a href='?command=lookup block'>lookup block</a><br>\n")) |
| 205 | rw.Write([]byte("6. stop cpuprof\n")) | 209 | rw.Write([]byte("5. <a href='?command=start cpuprof'>start cpuprof</a><br>\n")) |
| 206 | rw.Write([]byte("7. get memprof\n")) | 210 | rw.Write([]byte("6. <a href='?command=stop cpuprof'>stop cpuprof</a><br>\n")) |
| 207 | rw.Write([]byte("8. gc summary\n")) | 211 | rw.Write([]byte("7. <a href='?command=get memprof'>get memprof</a><br>\n")) |
| 212 | rw.Write([]byte("8. <a href='?command=gc summary'>gc summary</a><br>\n")) | ||
| 213 | rw.Write([]byte("</body></html>")) | ||
| 208 | } | 214 | } |
| 209 | } | 215 | } |
| 210 | 216 | ... | ... |
-
Please register or sign in to post a comment