Step 1: integrate prometheus
for let prometheus get metrics from go program, we need prometheus/client_golang to collect some informations
import (
"github.com/prometheus/client_golang/prometheus/promhttp"
"net/http"
)
func main() {
// ...
http.Handle("/metrics", promhttp.Handler())
http.ListenAndServe(":9200", nil)
}
Step 2: Set up Prometheus Server
- configuration for Prometheus Server
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
scrape_configs:
- job_name: 'yourprogramname'
metrics_path: "/metrics"
static_configs:
- targets: ['[yourhostaddress]:9200']
- Start up Prometheus docker container(otherwise you can deploy on your host side, just make sure configurations are all good, up to you)
> docker run \
-p 9090:9090 \
-v [your prometheus config file location]:/etc/prometheus/prometheus.yml \
-d prom/prometheus
Step 3: Set up Grafana
- start up Grafana docker container
> docker run -d --name=grafana -p 3000:3000 grafana/grafana
- access your grafana web ui, localhost:3000
- Configuration -> Add data source -> prometheus -> set url to
http://localhost:9090
-> setaccess
tobrowser
-> save & test - Dashboard -> import -> id: 240 -> set
prometheus
to the data source you just set
Enjoy!
Hmm is anyone else encountering problems with the images on this blog loading? I’m trying to determine if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.
ohio state michigan game betting line
Hi, I wanted to know your price.
What do you mean by price?
大佬依然研究这些…
很久没上了
专制是腐败的土壤。没有政党竞争、没有真正的选举、没有三权分立与制衡、没有独立的司法、没有独立的媒体、没有独立的民间社会,这必然导致全局性、制度性腐败。就是说,只能我反腐败,不能你、民间或者是其他的别人做。大家都是一条线上的蚂蚱——中南海这座政治大庙已经没有谁干净了。如果真的宪政民主了,不但没机会腐败,已经腐败的还要受审判和清算,人财两空、身败名裂。反腐败往往是跟权力斗争有关。老百姓不应该对中共反腐报有任何希望,跟老百姓无关。抛弃其党退出其组织,才是走向宪政民主的前提。
非技术的路过。