Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netbox_agent: error: Problems parsing config :: while parsing a block mapping #299

Open
mariano-daniel opened this issue Jul 10, 2024 · 2 comments

Comments

@mariano-daniel
Copy link

mariano-daniel commented Jul 10, 2024

Describe the bug

netbox_agent: error: Problems parsing config :: while parsing a block mapping
  in "<unicode string>", line 2, column 1:
    netbox:
    ^
expected <block end>, but found '<block mapping start>'
  in "<unicode string>", line 4, column 2:
     token: 'secrettoken'
     ^

Expected behavior
Start netbox_agent

Configuration file

# Netbox configuration
netbox:
  url: 'http://192.168.0.86'
 token: 'secrettoken'
 # uncomment to disable ssl verification
 # ssl_verify: false
 # uncomment to use the system's CA certificates
 # ssl_ca_certs_file: /etc/ssl/certs/ca-certificates.crt

# Network configuration
network:
  # Regex to ignore interfaces
  ignore_interfaces: "(dummy.*|docker.*)"
  # Regex to ignore IP addresses
  ignore_ips: (127\.0\.0\..*)
  # enable auto-cabling by parsing LLDP answers
  lldp: true

#
# You can use these to change the Netbox roles.
# These are the defaults.
#
#device:
# chassis_role: "Server Chassis"
# blade_role: "Blade"
# server_role: "Server"
# tags: server, blade, ,just a comma,delimited,list
# custom_fields: field1=value1,field2=value2#
#
# Can use this to set the tenant
#
#tenant:
# driver: "file:/tmp/tenant"
# regex: "(.*)"

## Enable virtual machine support
# virtual:
#   # not mandatory, can be guessed
#   enabled: True
#   # see https://netbox.company.com/virtualization/clusters/
#   cluster_name: my_vm_cluster

# Enable datacenter location feature in Netbox
datacenter_location:
 driver: "cmd:cat /etc/qualification | tr [A-Z] [a-z]"
 regex: "datacenter: (?P<datacenter>[A-Za-z0-9]+)"
# driver: 'cmd:lldpctl'
# regex: 'SysName: .*\.([A-Za-z0-9]+)'
#
# driver: "file:/tmp/datacenter"
# regex: "(.*)"

# Enable rack location feature in Netbox
rack_location:
# driver: 'cmd:lldpctl'
# match SysName: sw-dist-a1.dc42
# regex: 'SysName:[ ]+[A-Za-z]+-[A-Za-z]+-([A-Za-z0-9]+)'
#
# driver: "file:/tmp/datacenter"
# regex: "(.*)"

# Enable local inventory reporting
inventory: true

Environment:

  • Debian GNU/Linux 12 (bookworm)
  • Netbox agent version : Netbox agent does not allow for --version or -v

Additional context
I've also added Netbox API token as "token" value, since the instructions do not really explain where to get this token frm, nevertheless that did not work either.

@ribetm
Copy link
Collaborator

ribetm commented Jul 30, 2024

Your file has an indentation error : token is at 1 space while url is at 2. You need to adjust either one of them to match.

You can compare with the exemple config file netbox_agent.yaml.example.

@mariano-daniel
Copy link
Author

Thank you so much @ribetm ! I haven't noticed the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants