Datacenter awareness #1

Closed
opened 2019-08-03 16:14:28 +02:00 by Solvik · 0 comments
Solvik commented 2019-08-03 16:14:28 +02:00 (Migrated from github.com)

I think it's mandatory to create the Device (chassis / blade / server) within a datacenter and if possible within a rack.

The problem is that there's no generic way to get these infos because it's not a standard like dmidecode. Each company has its own nomenclature and from what I can see, the info can be in:

  • a hostname (ie: web-42.nyc)
  • a file (ie: /etc/server_infos)
  • a saltstack grain (ie: salt-call grains.get datacenter)
  • another webservice (ie: curl https://other-api.internal.company.com/server?service_tag=XXX | jq -r .datacenter)

Since netbox_agent needs to be as generic as possible, we cannot put this kind of code in the project.

We may need a configuration file for the agent (http proxy, netbox URL, api_key and so on), so we could do something like:

DATACENTER_LOCATION = '<driver>:<location>'

Some examples could be:

DATACENTER_LOCATION = 'file:/etc/server_infos'
DATACENTER_LOCATION = 'url:https://other-api.internal.company.com/server?service_tag={{ service_tag }}'
DATACENTER_LOCATION = 'cmd:hostname'
DATACENTER_LOCATION = 'cmd:lldpctl'

and a DATACENTER_LOCATION_REGEX that would extract the slug/name of the datacenter within the output.

People could add a new "driver" if needed.

Ideas?

I think it's mandatory to create the `Device` (chassis / blade / server) within a datacenter and if possible within a rack. The problem is that there's no generic way to get these infos because it's not a standard like `dmidecode`. Each company has its own nomenclature and from what I can see, the info can be in: - a hostname (ie: `web-42.nyc`) - a file (ie: `/etc/server_infos`) - a saltstack grain (ie: `salt-call grains.get datacenter`) - another webservice (ie: `curl https://other-api.internal.company.com/server?service_tag=XXX | jq -r .datacenter`) Since netbox_agent needs to be as generic as possible, we cannot put this kind of code in the project. We may need a configuration file for the agent (http proxy, netbox URL, api_key and so on), so we could do something like: ```DATACENTER_LOCATION = '<driver>:<location>'``` Some examples could be: ``` DATACENTER_LOCATION = 'file:/etc/server_infos' DATACENTER_LOCATION = 'url:https://other-api.internal.company.com/server?service_tag={{ service_tag }}' DATACENTER_LOCATION = 'cmd:hostname' DATACENTER_LOCATION = 'cmd:lldpctl' ``` and a `DATACENTER_LOCATION_REGEX` that would extract the slug/name of the datacenter within the output. People could add a new "driver" if needed. Ideas?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DGNum/netbox-agent#1
No description provided.