Agent Groups¶
The following methods allow for interaction into the Tenable Vulnerability Management agent groups API endpoints.
Methods available on tio.agent_groups
:
- class AgentGroupsAPI(api: APISession)[source]¶
- add_agent(group_id, *agent_ids, **kw)[source]¶
Adds an agent or multiple agents to the agent group specified.
- Parameters:
- Returns:
If adding a singular agent, a
None
response will be returned. If adding multiple agents, adict
response will be returned with a task record.- Return type:
Examples
Adding a singular agent:
>>> tio.agent_groups.add_agent(1, 1)
Adding multiple agents:
>>> tio.agent_groups.add_agent(1, 1, 2, 3)
Adding multiple agents by uuid:
>>> tio.agent_groups.add_agent(1, 'uuid-1', 'uuid-2', 'uuid-3')
- configure(group_id, name, scanner_id=1)[source]¶
Renames an existing agent group.
- Parameters:
- Returns:
Examples
>>> tio.agent_groups.configure(1, 'New Name')
- create(name, scanner_id=1)[source]¶
Creates a new agent group.
- Parameters:
- Returns:
The dictionary object representing the newly minted agent group
- Return type:
Examples
>>> group = tio.agent_groups.create('New Agent Group')
- delete(group_id, scanner_id=1)[source]¶
Delete an agent group.
- Parameters:
- Returns:
Examples
>>> tio.agent_groups.delete(1)
- delete_agent(group_id, *agent_ids, **kw)[source]¶
Delete one or many agents from an agent group.
- Parameters:
- Returns:
If deleting a singular agent, a
None
response will be returned. If deleting multiple agents, adict
response will be returned with a Job resource record.- Return type:
Examples
Delete a singular agent from an agent group:
>>> tio.agent_groups.delete_agent(1, 1)
Delete multiple agents from an agent group:
>>> tio.agent_groups.delete_agent(1, 1, 2, 3)
- details(group_id, *filters, **kw)[source]¶
Retrieve the details about the specified agent group.
- Parameters:
group_id (int) – The id of the agent group.
*filters (tuple, optional) –
Filters are tuples in the form of (‘NAME’, ‘OPERATOR’, ‘VALUE’). Multiple filters can be used and will filter down the data being returned from the API.
Examples
('distro', 'match', 'win')
('name', 'nmatch', 'home')
As the filters may change and sortable fields may change over time, it’s highly recommended that you look at the output of the filters:agents-filters endpoint to get more details.
filter_type (str, optional) – The filter_type operator determines how the filters are combined together.
and
will inform the API that all the filter conditions must be met for an agent to be returned, whereasor
would mean that if any of the conditions are met, the agent record will be returned.limit (int, optional) – The number of records to retrieve. Default is 50
offset (int, optional) – The starting record to retrieve. Default is 0.
scanner_id (int, optional) – The identifier the scanner that the agent communicates to.
sort (tuple, optional) – A tuple of tuples identifying the field and sort order of the field.
wildcard (str, optional) – A string to pattern match against all available fields returned.
wildcard_fields (list, optional) – A list of fields to optionally restrict the wild-card matching to.
- Returns:
The dictionary object representing the requested agent group
- Return type:
Examples
>>> group = tio.agent_groups.details(1) >>> pprint(group)
- list(scanner_id=1)[source]¶
Retrieves the list of agent groups configured
- Parameters:
scanner_id (int, optional) – The id of the scanner
- Returns:
Listing of agent group resource records
- Return type:
Examples
>>>> for agent_group in tio.agent_groups.list(): … pprint(agent_group)
- task_status(group_id, task_uuid, scanner_id=1)[source]¶
Retrieves the current status of a bulk task.
bulk-operations: bulk-agent-group-status
- Parameters:
- Returns:
Task resource
- Return type:
Examples
>>> item = tio.agent_groups.add_agent(1, 21, 22, 23) >>> task = tio.agent_groups.task_status(item['task_uuid']) >>> pprint(task)