Hello, I hope you can help.
I’m trying to run the command on page 241 to make a config file. I’ve redacted information that might not be ideal to share but have added where I found the information (as I think I’m putting it in wrong somewhere), the source of the information is in between the <> signs
influx config create –config-name influx-config –host-url
http:// <copied from the command “hostname -I”> :8086 –org <Typed into influxDB when setting up and confirmed it is spelt correctly as per the “Organisation Name” in the InfluxDB dashboard> —
token <copied from the instructions on page 240> –active
I believe this is all what I needed to input as per the instructions on page 241 but when I run the command above, I get this error message
Any help would be appreciated. Error message as follows;
Incorrect Usage: flag needs an argument: -host-url
NAME:
influx config create – Create config
USAGE:
influx config create [command options] [arguments…]
DESCRIPTION:
The influx config create command creates a new InfluxDB connection configuration
and stores it in the configs file (by default, stored at ~/.influxdbv2/configs).
Authentication:
Authentication can be provided by either an api token or username/password, but not both.
When setting the username and password, the password is saved unencrypted in your local config file.
Optionally, you can omit the password and only provide the username.
You will then be prompted for the password each time.
Examples:
# create a config and set it active
influx config create -a -n $CFG_NAME -u $HOST_URL -t $TOKEN -o $ORG_NAME
# create a config and without setting it active
influx config create -n $CFG_NAME -u $HOST_URL -t $TOKEN -o $ORG_NAME
For information about the config command, see
https://docs.influxdata.com/influxdb/latest/reference/cli/influx/config/
and
https://docs.influxdata.com/influxdb/latest/reference/cli/influx/config/create/
COMMON OPTIONS:
–configs-path value Path to the influx CLI configurations [$INFLUX_CONFIGS_PATH]
–json Output data as JSON [$INFLUX_OUTPUT_JSON]
–hide-headers Hide the table headers in output data [$INFLUX_HIDE_HEADERS]
OPTIONS:
–config-name value, -n value Name for the new config
–host-url value, -u value Base URL of the InfluxDB server the new config should target
–token value, -t value Auth token to use when communicating with the InfluxDB server
–username-password value, -p value Username (and optionally password) to use for authentication. Only supported in OSS
–org value, -o value Default organization name to use in the new config
–active, -a Set the new config as active
Error: flag needs an argument: -host-url
-bash: http://REDACTED:8086: No such file or directory
-bash: token: command not found
Hi.
You probably copied the command wrong from the PDF, or the formatting got messed up during copy paste:
This is the command you need to run:
influx config create --config-name influx-config --host-url http://YOUR_RASPBERRY_PI_IP_ADDRESS:8086 --org <your-org> --token <your-auth-token> --active
For example:
influx config create --config-name influx-config --host-url http://192.168.1.106:8086 --org RNT --token v_od_mG--9_srf_OnaaODihPDX34suToP7XEH47v6x77CMxakZaoYHzF7Ec9mLTCuXXXXXXXXXXXXXXXXXvQCSSw== --active
I hope this helps
Regards,
Sara
Quick update.
I think (though I’m dumb so I can’t be sure haha) I may have solved it by following the link given in the error message (https://docs.influxdata.com/influxdb/v2/reference/cli/influx/config/create/), It suggested an alternative command
influx config create \
-n config-name \
-u http://localhost:8086 \
-t mySuP3rS3cr3tT0keN \
-o example-org
So I tried this format, I didn’t realise the org name needed to be separated by dashes (-) instead of spaces. The-Name-Looks-Like-This for example.
It looked like it created the file, I’m not experienced enough to know that this was a solution but maybe it is a workaround for anyone else.
Went on to the next command, immediately it refused it. I don’t know where I am going wrong.
The command is at the bottom of page 241.
influx apply -f
https://raw.githubusercontent.com/influxdata/communitytemplates/
master/raspberry-pi/raspberry-pi-system.yml
Here’s the error. Too much information for me to process why it didn’t accept the command, any ideas?
Incorrect Usage: flag needs an argument: -f NAME: apply - Apply a template to manage resources USAGE: apply [command options] [arguments...] DESCRIPTION: The apply command applies InfluxDB template(s). Use the command to create new resources via a declarative template. The apply command can consume templates via file(s), url(s), stdin, or any combination of the 3. Each run of the apply command ensures that all templates applied are applied in unison as a transaction. If any unexpected errors are discovered then all side effects are rolled back. Examples: # Apply a template via a file influx apply -f $PATH_TO_TEMPLATE/template.json # Apply a stack that has associated templates. In this example the stack has a remote # template associated with it. influx apply --stack-id $STACK_ID # Apply a template associated with a stack. Stacks make template application idempotent. influx apply -f $PATH_TO_TEMPLATE/template.json --stack-id $STACK_ID # Apply multiple template files together (mix of yaml and json) influx apply \ -f $PATH_TO_TEMPLATE/template_1.json \ -f $PATH_TO_TEMPLATE/template_2.yml # Apply a template from a url influx apply -u https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml # Apply a template from STDIN cat $TEMPLATE.json | influx apply --encoding json # Applying a directory of templates, takes everything from provided directory influx apply -f $PATH_TO_TEMPLATE_DIR # Applying a directory of templates, recursively descending into child directories influx apply -R -f $PATH_TO_TEMPLATE_DIR # Applying directories from many sources, file and URL influx apply -f $PATH_TO_TEMPLATE/template.yml -f $URL_TO_TEMPLATE # Applying a template with actions to skip resources applied. The # following example skips all buckets and the dashboard whose # metadata.name field matches the provided $DASHBOARD_TMPL_NAME. # format for filters: # --filter=kind=Bucket # --filter=resource=Label:$Label_TMPL_NAME influx apply \ -f $PATH_TO_TEMPLATE/template.yml \ --filter kind=Bucket \ --filter resource=Dashboard:$DASHBOARD_TMPL_NAME For information about finding and using InfluxDB templates, see https://docs.influxdata.com/influxdb/latest/reference/cli/influx/apply/. For more templates created by the community, see https://github.com/influxdata/community-templates. COMMON OPTIONS: --host value HTTP address of InfluxDB [$INFLUX_HOST] --skip-verify Skip TLS certificate chain and host name verification [$INFLUX_SKIP_VERIFY] --configs-path value Path to the influx CLI configurations [$INFLUX_CONFIGS_PATH] --active-config value, -c value Config name to use for command [$INFLUX_ACTIVE_CONFIG] --http-debug --json Output data as JSON [$INFLUX_OUTPUT_JSON] --hide-headers Hide the table headers in output data [$INFLUX_HIDE_HEADERS] --token value, -t value Token to authenticate request [$INFLUX_TOKEN] OPTIONS: --org-id value The ID of the organization [$INFLUX_ORG_ID] --org value, -o value The name of the organization [$INFLUX_ORG] --stack-id value Stack ID to associate with template application --file value, -f value Path to template file; Supports file paths or (deprecated) HTTP(S) URLs --template-url value, -u value HTTP(S) URL to template file --recurse, -R Process the directory used in -f, --file recursively. Useful when you want to manage related templates organized within the same directory. --encoding value, -e value Encoding for the input stream. If a file is provided will gather encoding type from file extension. If extension provided will override. (default: unknown) --disable-color Disable color in output --disable-table-borders Disable table borders --quiet, -q Disable output printing --force value Set to 'yes' to skip confirmation before applying changes (recommended for non-interactive scripts). --secret value Secrets to provide alongside the template; format --secret SECRET_KEY=SECRET_VALUE --secret SECRET_KEY_2=SECRET_VALUE_2 --env-ref value Environment references to provide alongside the template; format --env-ref REF_KEY=REF_VALUE --env-ref REF_KEY_2=REF_VALUE_2 --filter kind Resources to skip when applying the template. Filter out by kind or by `resource` Error: flag needs an argument: -f -bash: https://raw.githubusercontent.com/influxdata/communitytemplates/: No such file or directory -bash: master/raspberry-pi/raspberry-pi-system.yml: No such file or directory
Yes, I actually figured this out afterwards, I think this has been causing all my issues. On the PDF if the command is too long for a single line so it starts a new one, when I copy and paste into the console, it treats that text wrapping as a new line.
Unfortunately on the next command instruction on the next page, that didn’t work for me either, so it’s not over yet, haha. I’m going to start the module again now I know I’ve been copy pasting incorrectly and see if I can get back on track.
It seems to be having an issue with my organisation name now, I will make a new post if I can’t solve myself.
Thanks again for your help
Hi.
What command are you referring to and which error do you get?
Is it this one?
influx apply -f https://raw.githubusercontent.com/influxdata/communitytemplates/master/raspberry-pi/raspberry-pi-system.yml
When the commands are inside a single box in the pdf, they should be a single line.
Copy the command to notepad, for example, and then put them on the same line. After that, copy the command from notepad and paste it on the terminal line.
If you’re hacing trouble with the instructions to install telegraf, please check page 242 that provides a link to copy the instructions from the official source, which usually doesn’t break the commands.
I hope this helps.
Regards,
Sara