zabgrab.services.discover

Finding hosts and items.

Functions

find_items(client, specs, ui, *[, limit])

Find the items matching any of a list of item specs.

on_servers(servers, connect, action)

Run an action on each server, closing connections afterwards.

async zabgrab.services.discover.on_servers(servers, connect, action)[source]

Run an action on each server, closing connections afterwards.

Parameters:
  • servers (sequence of Server) – The servers.

  • connect (callable) – Returns a logged-in client for a server.

  • action (callable) – What to do with each client.

Returns:

list of (Server, T) – Each server with its action’s result.

Return type:

list[tuple[Server, T]]

async zabgrab.services.discover.find_items(client, specs, ui, *, limit=None)[source]

Find the items matching any of a list of item specs.

Parameters:
  • client (ZabbixClient) – The server to search.

  • specs (sequence of ItemSpec) – The item specs (all items if empty).

  • ui (UI) – Warns about IDs and hosts that match nothing, and asks about host choices.

  • limit (int, optional) – The most items to return per spec.

Returns:

list of Item – The items, each once even if several specs matched it.

Return type:

list[Item]