Skip to content

Commit

Permalink
add a version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sofixa committed Jan 7, 2018
1 parent 59e2e1d commit 076f633
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vsphere-influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ type EntityQuery struct {
Metrics []int32
}

var debug, test bool
var getversion, debug, test bool
var stdlog, errlog *log.Logger
var version = "master"


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

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

if getversion {
stdlong.Println("Version:",version)
os.Exit(0)
}

stdlog.Println("Starting", baseName, "with config file", *cfgFile)

// read the configuration
Expand Down

0 comments on commit 076f633

Please sign in to comment.