mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-09 23:24:09 -08:00
Log version at startup
This commit is contained in:
parent
a814d7f8da
commit
626900fe21
1
Makefile
1
Makefile
|
@ -13,5 +13,6 @@
|
||||||
|
|
||||||
VERSION := 0.8.0
|
VERSION := 0.8.0
|
||||||
TARGET := node_exporter
|
TARGET := node_exporter
|
||||||
|
GOFLAGS := -ldflags "-X main.Version $(VERSION)"
|
||||||
|
|
||||||
include Makefile.COMMON
|
include Makefile.COMMON
|
||||||
|
|
|
@ -22,6 +22,9 @@ import (
|
||||||
const subsystem = "exporter"
|
const subsystem = "exporter"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// set at build time
|
||||||
|
Version = "0.0.0.dev"
|
||||||
|
|
||||||
configFile = flag.String("config.file", "", "Path to config file.")
|
configFile = flag.String("config.file", "", "Path to config file.")
|
||||||
memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.")
|
memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.")
|
||||||
listenAddress = flag.String("web.listen-address", ":9100", "Address on which to expose metrics and web interface.")
|
listenAddress = flag.String("web.listen-address", ":9100", "Address on which to expose metrics and web interface.")
|
||||||
|
@ -137,6 +140,7 @@ func loadCollectors(file string) (map[string]collector.Collector, error) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *printCollectors {
|
if *printCollectors {
|
||||||
fmt.Printf("Available collectors:\n")
|
fmt.Printf("Available collectors:\n")
|
||||||
for n, _ := range collector.Factories {
|
for n, _ := range collector.Factories {
|
||||||
|
@ -182,6 +186,8 @@ func main() {
|
||||||
</body>
|
</body>
|
||||||
</html>`))
|
</html>`))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
glog.Infof("Starting node_exporter v%s at %s", Version, *listenAddress)
|
||||||
err = http.ListenAndServe(*listenAddress, nil)
|
err = http.ListenAndServe(*listenAddress, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatal(err)
|
glog.Fatal(err)
|
||||||
|
|
Loading…
Reference in a new issue