1、安裝go環(huán)境,并且配置好GOPATH
2、$ mkdir -p $GOPATH/src/github.com/prometheus
? ? ?$ cd $GOPATH/src/github.com/prometheus
? ? $ git clone https://github.com/prometheus/prometheus.git
3、修改代碼,由于go源碼在mips架構(gòu)不支持unix.Infotiy*(),而prometheus的file service discovery是基于這個(gè)實(shí)現(xiàn)的,所以需要修改prometheus源碼,就是去掉/prometheus/prometheus/discovery/file包以及相關(guān)的代碼,代碼修改如下:
--第一步:注釋掉prometheus/CHANGELOG.md里的282行:
* [BUGFIX] discovery/file: fix logging #4178
--第二步:注釋掉prometheus/config/config_test.go36行
--第三:注釋掉prometheus/prometheus/discovery/config/config.go里的23行、40行、85-89行
--第四:注釋掉prometheus/prometheus/discovery/manager.go里的34行,354-358行
--第五:注釋掉prometheus/prometheus/cmd/promtool/main.go里的229-242行
4、$ cd prometheus
5、$ make build
6、$ ./prometheus --config.file=prometheus.yml