1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.curoverse.com/arvados.git/sdk/go/arvados"
13 "git.curoverse.com/arvados.git/sdk/go/health"
14 "git.curoverse.com/arvados.git/sdk/go/httpserver"
15 log "github.com/Sirupsen/logrus"
21 configFile := flag.String("config", arvados.DefaultConfigFile, "`path` to arvados configuration file")
22 getVersion := flag.Bool("version", false, "Print version information and exit.")
25 // Print version information if requested
27 fmt.Printf("arvados-health %s\n", version)
31 log.SetFormatter(&log.JSONFormatter{
32 TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
34 log.Printf("arvados-health %s started", version)
36 cfg, err := arvados.GetConfig(*configFile)
40 clusterCfg, err := cfg.GetCluster("")
44 nodeCfg, err := clusterCfg.GetNodeProfile("")
49 log := log.WithField("Service", "Health")
50 srv := &httpserver.Server{
51 Addr: nodeCfg.Health.Listen,
53 Handler: &health.Aggregator{
55 Log: func(req *http.Request, err error) {
56 log.WithField("RemoteAddr", req.RemoteAddr).
57 WithField("Path", req.URL.Path).
64 if err := srv.Start(); err != nil {
67 log.WithField("Listen", srv.Addr).Info("listening")
68 if err := srv.Wait(); err != nil {