Group Creation -- list of hostnames

A site can be created base on a list of hostnames, but I would like to create an asset group based on a list of hostnames. How can this be done?

Hey @bill_endraske, if you want to create an group based on hostnames you will need to define criteria when creating the group. This can be done through the UI like the screenshot below.

If you wanted to create the group with the API, it is also possible with this endpoint: Keep in mind that with asset groups the devices must already be known to InsightVM for them to be populated within the group.

1 Like

I have figured out in python how to add an asset to an asset group using the asset_id, but don’t know how to do the same with the hostname.

What you could potentially do is use the Asset Search endpoint (/api/3/assets/search) to retrieve the assets you’re looking for based on hostname. You have to pass in a payload with your search criteria, so maybe something like:

  "match": "all",
  "filters": [
     { "field": "hostname", "operator": "contains", "value": "your-hostname" }

Then once you have a list of assets from that search based on hostname, you could loop through them and add them to the asset group by ID.

In addition to what Holly mentioned, you can actually use that same Search Criteria when creating the asset group with the API:

You can also define whether you want this to be a static or dynamic group based on the criteria provided.

1 Like