0 vote
NetBox is a popular open source DCIM and IPAM management tool designed to be the "source of truth" for your network. It has a GraphQL API that can be used to retrieve information about devices and virtual machines. RDM could use this information to automatically create sessions, create a link to documentation, and populate asset data.
The following PowerShell script will retrieve a device's asset data from NetBox:
function Get-NetboxDevice {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$NetboxGraphQlUri,
[Parameter(Mandatory = $true)]
[string]$Token,
[Parameter(Mandatory = $true)]
[string]$DeviceName
)
begin {
$headers = @{
"Authorization" = "Token $($token)"
"Content-Type" = "application/json"
"Accept" = "application/json"
}
}
process {
$graphqlQuery = @'
query get_device_list($device_name: [String]) {
device_list(name: $device_name) {
id
name
device_type{
manufacturer{name}
model
}
site{name}
rack{name}
platform{name}
primary_ip4{address}
}
}
'@ | ForEach-Object { ([String]::Join(" ", ($_.Split("`n")))).Trim() }
$query = @{
query = $graphqlQuery
variables = @{
device_name = $DeviceName
}
} | ConvertTo-Json -Depth 100
$response = Invoke-RestMethod -Uri $netboxGraphQlUri -Body $query -Headers $headers
$response.data.device_list
}
end {}
}
id : 161
name : server01
device_type : @{manufacturer=Dell; model=PowerEdge R720}
site : @{name=Main Office}
rack : @{name=Server Rack}
platform : @{name=VMware}
primary_ip4 : @{address=172.21.1.14/24}Hello,
Thank you for the suggestion and providing the API and a method to retrieve the information. The engineering team will have a look at it once they return from the Holiday break.
Best regards,
Richard Boisvert
Hello,
Just to let you know, we have opened an internal feature request ticket for this.
Regards,
Hubert Mireault
Hello,
Do have some news about integration of Netbox to automatically create sessions in RDM?
Thanks
Hello,
Nothing new for now.
Regards,
Hubert Mireault