Skip to content

Commit 076f633

Browse files
committed
add a version flag
1 parent 59e2e1d commit 076f633

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

vsphere-influxdb.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ type EntityQuery struct {
9999
Metrics []int32
100100
}
101101

102-
var debug, test bool
102+
var getversion, debug, test bool
103103
var stdlog, errlog *log.Logger
104+
var version = "master"
105+
104106

105107
// Connect to the actual vCenter connection used to query data
106108
func (vcenter *VCenter) Connect() error {
@@ -805,10 +807,16 @@ func main() {
805807

806808
flag.BoolVar(&debug, "debug", false, "Debug mode")
807809
flag.BoolVar(&test, "test", false, "Test mode, data will be collected from vCenters, but nothing will be written to InfluxDB, only printed to stdout")
810+
flag.BoolVar(&getversion, "version", false, "Get version and exit")
808811
workerCount := flag.Int("workers", 4, "Number of concurrent workers to query vcenters")
809812
cfgFile := flag.String("config", "/etc/"+baseName+".json", "Config file to use")
810813
flag.Parse()
811814

815+
if getversion {
816+
stdlong.Println("Version:",version)
817+
os.Exit(0)
818+
}
819+
812820
stdlog.Println("Starting", baseName, "with config file", *cfgFile)
813821

814822
// read the configuration

0 commit comments

Comments
 (0)