zabgrab.services.collect¶
Working out which items to fetch: the server, the items, and download jobs.
- zabgrab.services.collect.SelectServer¶
Picks the server for a query’s server reference (asking if needed).
- Type:
- zabgrab.services.collect.PICKER_LIMIT¶
The most search results offered when picking items.
- Type:
Functions
|
Resolve the query's server and each request's items into download jobs. |
|
Ask the user to search for and pick items. |
Classes
|
The items to fetch, and connections to their servers. |
- class zabgrab.services.collect.Plan(jobs=<factory>, clients=<factory>)[source]¶
Bases:
objectThe items to fetch, and connections to their servers.
- Parameters:
clients (dict[Server, ZabbixClient])
- async zabgrab.services.collect.collect(query, ui, *, select_server, connect, yes=False)[source]¶
Resolve the query’s server and each request’s items into download jobs.
Items matched by several requests are fetched once. The connection is kept in the plan for downloading; close it when done. Answers given along the way (the server, items picked) are recorded in
query.answers.- Parameters:
query (Query) – What to fetch.
ui (UI) – Asks for items when none are given, and about more than
max_items.select_server (callable) – Picks the server for the query’s server reference.
connect (callable) – Returns a logged-in client for a server.
yes (bool, optional) – Fetch however many items match (
--yes).
- Returns:
Plan – The jobs and the open connection.
- Return type:
- async zabgrab.services.collect.pick_items(client, ui)[source]¶
Ask the user to search for and pick items.
- Parameters:
client (ZabbixClient) – The server to search.
ui (UI) – Asks for the search and the choice.
- Returns:
list of Item – The items picked.
tuple of ItemSpec – Specs that select them: the search pattern if every match was picked, otherwise the picked items’ IDs.
- Raises:
InputRequired – If the session isn’t interactive.
- Return type: