ServiceMonitoringServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
managing and querying aspects of a workspace's services. These include
the Service
's monitored resources, its Service-Level Objectives, and
a taxonomy of categorized Health Metrics.
Methods
ServiceMonitoringServiceClient
ServiceMonitoringServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters | |
---|---|
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
create_service
create_service(parent, service, service_id=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Create a Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
parent = client.project_path('[PROJECT]')
TODO: Initialize
service
:service = {}
response = client.create_service(parent, service)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the parent workspace. The format is: :: projects/[PROJECT_ID_OR_NUMBER] |
service |
Union[dict, Service]
Required. The |
service_id |
str
Optional. The Service id to use for this Service. If omitted, an id will be generated instead. Must match the pattern |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
create_service_level_objective
create_service_level_objective(parent, service_level_objective, service_level_objective_id=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Create a ServiceLevelObjective
for the given Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
parent = client.service_path('[PROJECT]', '[SERVICE]')
TODO: Initialize
service_level_objective
:service_level_objective = {}
response = client.create_service_level_objective(parent, service_level_objective)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the parent |
service_level_objective |
Union[dict, ServiceLevelObjective]
Required. The |
service_level_objective_id |
str
Optional. The ServiceLevelObjective id to use for this ServiceLevelObjective. If omitted, an id will be generated instead. Must match the pattern |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_service
delete_service(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Soft delete this Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
name = client.service_path('[PROJECT]', '[SERVICE]')
client.delete_service(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Resource name of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_service_level_objective
delete_service_level_objective(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Delete the given ServiceLevelObjective
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
name = client.service_level_objective_path('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]')
client.delete_service_level_objective(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Resource name of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
ServiceMonitoringServiceClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
ServiceMonitoringServiceClient | The constructed client. |
get_service
get_service(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Get the named Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
name = client.service_path('[PROJECT]', '[SERVICE]')
response = client.get_service(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Resource name of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_service_level_objective
get_service_level_objective(name, view=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Get a ServiceLevelObjective
by name.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
name = client.service_level_objective_path('[PROJECT]', '[SERVICE]', '[SERVICE_LEVEL_OBJECTIVE]')
response = client.get_service_level_objective(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Resource name of the |
view |
View
View of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_service_level_objectives
list_service_level_objectives(parent, filter_=None, page_size=None, view=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
List the ServiceLevelObjective
\ s for the given Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
parent = client.service_path('[PROJECT]', '[SERVICE]')
Iterate over all results
for element in client.list_service_level_objectives(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_service_level_objectives(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the parent containing the listed SLOs, either a project or a Monitoring Workspace. The formats are: :: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- |
filter_ |
str
A filter specifying what |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
view |
View
View of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_services
list_services(parent, filter_=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
List Service
\ s for this workspace.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
parent = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_services(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_services(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the parent containing the listed services, either a project or a Monitoring Workspace. The formats are: :: projects/[PROJECT_ID_OR_NUMBER] workspaces/[HOST_PROJECT_ID_OR_NUMBER] |
filter_ |
str
A filter specifying what |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
project_path
project_path(project)
Return a fully-qualified project string.
service_level_objective_path
service_level_objective_path(project, service, service_level_objective)
Return a fully-qualified service_level_objective string.
service_path
service_path(project, service)
Return a fully-qualified service string.
update_service
update_service(service, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Update this Service
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
TODO: Initialize
service
:service = {}
response = client.update_service(service)
Parameters | |
---|---|
Name | Description |
service |
Union[dict, Service]
Required. The |
update_mask |
Union[dict, FieldMask]
A set of field paths defining which fields to use for the update. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_service_level_objective
update_service_level_objective(service_level_objective, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Update the given ServiceLevelObjective
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.ServiceMonitoringServiceClient()
TODO: Initialize
service_level_objective
:service_level_objective = {}
response = client.update_service_level_objective(service_level_objective)
Parameters | |
---|---|
Name | Description |
service_level_objective |
Union[dict, ServiceLevelObjective]
Required. The |
update_mask |
Union[dict, FieldMask]
A set of field paths defining which fields to use for the update. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |