diff --git a/README.md b/README.md index 1f52cb8..6c79415 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,11 @@ If you are a prometheus user, then also check out [bigip_exporter](https://githu ## Installation -Use docker and docker-compose to build. +You can download the latest build for Mac, Linux or Windows from the [releases](https://github.com/pr8kerl/f5er/releases) page. + +### Build + +Use docker and docker-compose to build it yourself. ``` docker-compose run make [linux|windows|darwin] @@ -33,6 +37,7 @@ make ## Configuration **f5er** looks for configuration in the current environment, or if not found in a config file. +You must provide config for the device (ip address or hostname), as well as username and password. ### Environment variables @@ -57,7 +62,7 @@ Below is a full example of all current configurables. "device": "192.168.0.100", "username": "admin", "passwd": "superSecretSquirrel", - "token": true, + "token": false, "stats_path_prefix": "prd.f5.bigip01", "stats_show_zero_values": false } @@ -72,11 +77,11 @@ The **stats_** configuration options (used for displaying statistics) are only a ### Authentication Big-IP devices allow authentication to the REST API using basic http authentication or using a proprietary token authentication. The default is to use -the token auth method. To use only basic auth, you can set the token flag to false on the command line, in the config file, or using the F5_TOKEN environment variable. +basic auth method. To use token auth, you can set the token flag to true on the command line, in the config file, or using the F5_TOKEN environment variable. ``` -f5er --token=false show pool -F5_TOKEN=fale f5er show pool +f5er --token=true show pool +F5_TOKEN=true f5er show pool ``` ## Usage diff --git a/commands.go b/commands.go index 57ae12e..9322c12 100644 --- a/commands.go +++ b/commands.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "log" + "os" "path/filepath" "github.com/pr8kerl/f5er/f5" @@ -16,6 +17,10 @@ var f5Cmd = &cobra.Command{ Short: "tickle an F5 load balancer using REST", Long: "A utility to manage F5 configuration objects", Run: func(cmd *cobra.Command, args []string) { + if len(args) < 1 { + cmd.Help() + os.Exit(1) + } }, PersistentPreRun: func(cmd *cobra.Command, args []string) { checkFlags(cmd) diff --git a/f5/f5.go b/f5/f5.go index ee39bc8..1553922 100644 --- a/f5/f5.go +++ b/f5/f5.go @@ -139,7 +139,6 @@ func (f *Device) SetTokenAuth(t bool) { } if debug { fmt.Printf("authentication mode: %s\n", debugout) - } } diff --git a/main.go b/main.go index 93e851c..0f2ce3c 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,7 @@ func initialiseConfig() { viper.AddConfigPath(".") viper.SetDefault("username", "admin") viper.SetDefault("debug", false) - viper.SetDefault("token", true) + viper.SetDefault("token", false) viper.SetDefault("force", false) viper.SetDefault("statsPathPrefix", "f5") viper.SetDefault("statsShowZeroValues", false) @@ -91,7 +91,7 @@ func checkFlags(cmd *cobra.Command) { // this has to be done here inside cobraCommand.Execute() inc case cmd line args are passed. // args are only parsed after cobraCommand.Run() - urgh - appliance = f5.New(f5Host, username, passwd, f5.TOKEN) + appliance = f5.New(f5Host, username, passwd, f5.BASIC_AUTH) appliance.SetDebug(debug) appliance.SetTokenAuth(token) appliance.SetStatsPathPrefix(statsPathPrefix) @@ -110,7 +110,7 @@ func init() { f5Cmd.PersistentFlags().StringVarP(&f5Host, "f5", "f", "", "IP or hostname of F5 to poke") f5Cmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "debug output") - f5Cmd.PersistentFlags().BoolVarP(&token, "token", "t", true, "use token auth") + f5Cmd.PersistentFlags().BoolVarP(&token, "token", "t", false, "use token auth") f5Cmd.PersistentFlags().StringVarP(&f5Input, "input", "i", "", "input json f5 configuration") offlinePoolMemberCmd.Flags().StringVarP(&f5Pool, "pool", "p", "", "F5 pool name") offlinePoolMemberCmd.Flags().BoolVarP(&now, "now", "n", false, "force member offline immediately")