Solarcmd

Over the corse of the years, I’ve had to work with Solarwinds IPAM multiple times. It has never been pleasant. I hate IPAM in general for reasons I wont get into, but when you gotta use it, you gotta use it.

While the Solarwinds IPAM has a seemingly greate SDK, the supported client libraries are powershell and python. Both of these have difficulties with cross platform use so I created solarcmd.

It’s an all in one binary written in go, building on the work of https://github.com/mrxinu/gosolar to provide an easier cli experience.

Some examples of when you might use it…

Scenario: I have a network in vcenter, but I need to find an IP address for my system.

The below govc command shows the network name.

$ govc ls /Pasadena/network | grep -i DEVNETWORK
/Pasadena/network/DEVNETWORK

Now I need to find the VLAN, and ultimately an IP address from this network.

$ # I can just list all subnets and relevant information
$ $ solarcmd subnet list | jq '.[] | [ .Address, .CIDR, .DisplayName ]'
{
    "192.168.1.0",
    "24",
    "Foobar Network"
}
$ # I can search for a specific subnet by display name.
$ solarcmd subnet find --name "Foobar Network" | jq .
{
    ...
    "192.168.1.0",
    "24",
    "DisplayName": "Foobar Network"
    "VLAN": "1"
}

Now that I know some subnet information, I can use the API to find and reserve an IP Address

$ # Show available IPs
$ solarcmd ip get 192.168.1.0 --cidr 24
{"IpNodeID": 0, "IPAddress": "192.168.1.34", "Status": 0, "StatusString": "", "Comments","" }
$ # Reserve the IP
$ solarcmd ip reserve 192.168.1.34
{"IpNodeID": 0, "IPAddress": "192.168.1.34", "Status": 0, "StatusString": "", "Comments","" }

This code was also used to create my terraform provider which I’ll discuss in detail at a later post.

Go check it out at my github - installation details can be found there. Comments/suggestions/issues welcome!