2016-03-23 00:12:30 +00:00
|
|
|
package fingerprint
|
|
|
|
|
|
|
|
import (
|
2022-03-14 11:42:01 +00:00
|
|
|
"strconv"
|
|
|
|
|
2018-09-16 00:48:59 +00:00
|
|
|
log "github.com/hashicorp/go-hclog"
|
2016-03-23 00:12:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// NomadFingerprint is used to fingerprint the Nomad version
|
|
|
|
type NomadFingerprint struct {
|
|
|
|
StaticFingerprinter
|
2018-09-16 00:48:59 +00:00
|
|
|
logger log.Logger
|
2016-03-23 00:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewNomadFingerprint is used to create a Nomad fingerprint
|
2018-09-16 00:48:59 +00:00
|
|
|
func NewNomadFingerprint(logger log.Logger) Fingerprint {
|
|
|
|
f := &NomadFingerprint{logger: logger.Named("nomad")}
|
2016-03-23 00:12:30 +00:00
|
|
|
return f
|
|
|
|
}
|
|
|
|
|
2018-12-01 16:10:39 +00:00
|
|
|
func (f *NomadFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {
|
2018-06-08 07:44:10 +00:00
|
|
|
resp.AddAttribute("nomad.advertise.address", req.Node.HTTPAddr)
|
2018-01-26 16:21:07 +00:00
|
|
|
resp.AddAttribute("nomad.version", req.Config.Version.VersionNumber())
|
|
|
|
resp.AddAttribute("nomad.revision", req.Config.Version.Revision)
|
2022-03-14 11:42:01 +00:00
|
|
|
resp.AddAttribute("nomad.service_discovery", strconv.FormatBool(req.Config.NomadServiceDiscovery))
|
2018-01-31 22:03:55 +00:00
|
|
|
resp.Detected = true
|
2018-01-24 14:09:53 +00:00
|
|
|
return nil
|
2016-03-23 00:12:30 +00:00
|
|
|
}
|