MonitorClient
class MonitorClient(lightctl.client.base_client.BaseClient)
| Helper functions for acessing monitors
|
| Example:
| mc = MetricClient()
| wc = WorkspaceClient()
| rc = MonitorClient()
| workspace_list = wc.list_workspaces()
| for workspace in workspace_list:
| workspace_id = workspace["uuid"]
| metric_list = mc.list_metrics(workspace_id)
| for metric in metric_list:
| metric_id = metric["metadata"]["uuid"]
| monitor_list = rc.get_monitors_by_metric(workspace_id, metric_id)
| for monitor in monitor_list:
| print("Workspace {workspace["name"]} Metric {metric["metatdata"]["name"]} Monitor {monitor["metadata"]["name"]}
|
| Methods defined here:
|
| create_monitor(self, workspace_id: str, data: Dict) -> Dict
| Create a monitor
|
| Args:
| workspace_id (str): Workspace id
| data (dict) attributes of monitor
|
| Returns:
| dict: the monitor created
|
| delete_monitor(self, workspace_id: str, id: uuid.UUID)
| Delete a monitor
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): id of monitor to update
|
| get_monitor(self, workspace_id: str, id: uuid.UUID) -> Dict
| Get a monitor by its uuid
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): monitor id to return
|
| Returns:
| dict: a monnitor
|
| get_monitor_by_name(self, workspace_id: str, name: str) -> List[Dict]
| Get a monitor by its name
|
| Args:
| workspace_id (str): Workspace id
| name (str): monitor name to return
|
| Returns:
| dict: a monitor
|
| get_monitors_by_metric(self, workspace_id: str, metric_uuid: uuid.UUID) -> List[Dict]
| Get all monitors on a metric
|
| Args:
| workspace_id (str): Workspace id
| metric_uuid (UUID): Metric id
|
| Returns:
| list: a list of monitors
|
| last_processed_timestamp(self, workspace_id: str, id: uuid.UUID) -> Union[float, NoneType]
| Get the timestamp of the last processed datapoint for a monitor
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): Monitor id
|
| Returns:
| float: timestamp of last processed datapointlist: a list of monitors
|
| list_monitors(self, workspace_id: str) -> List[Dict]
| Get all monitors in the workspace
|
| Args:
| workspace_id (str): Workspace id
|
| Returns:
| list: a list of monitors
|
| monitors_url(self, workspace_id: str) -> str
| Returns:
| str: The monitors endpoint, used for getting and modifying monitors
|
| update_monitor(self, workspace_id: str, id: uuid.UUID, data: Dict) -> Dict
| Update a monnitor
|
| Args:
| workspace_id (str): Workspace id
| id (UUID): id of metric to update
| data (dict) new attributes of the monitor
|
| Returns:
| dict: the monitor updated
|
Updated 10 months ago