You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
465 B
26 lines
465 B
package common
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
"log"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
/*
|
|
@Auth:ShenZ
|
|
@Description:
|
|
*/
|
|
func PrometheusBoot(port int) {
|
|
http.Handle("/metrics", promhttp.Handler())
|
|
//启动web服务
|
|
go func() {
|
|
err := http.ListenAndServe("0.0.0.0"+strconv.Itoa(port), nil)
|
|
if err != nil {
|
|
log.Fatal("启动普罗米修斯失败!")
|
|
}
|
|
log.Println("监控启动,端口为:" + strconv.Itoa(port))
|
|
}()
|
|
|
|
}
|