atsd_client Package

atsd_client Package

connection Module

Copyright 2015 Axibase Corporation or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the “License”). You may not use this file except in compliance with the License. A copy of the License is located at

https://www.axibase.com/atsd/axibase-apache-2.0.pdf

or in the “license” file accompanying this file. This file is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

atsd_client.connection.connect(file_name=None)

connect to ATSD using parameters specified in file (default connection.properties)

Parameters:file_namestr
atsd_client.connection.connect_url(base_url, username, password, verify=True, timeout=None)

connect to ATSD using specified parameters

Parameters:
  • base_url – ATSD url, for example http://atsd_server:8088
  • username – user name
  • password – user password
  • verify – verify ssl certificate (default True)
  • timeout – request timeout in seconds (default None - no timeout)
Returns:

new client instance

exceptions Module

Copyright 2015 Axibase Corporation or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the “License”). You may not use this file except in compliance with the License. A copy of the License is located at

https://www.axibase.com/atsd/axibase-apache-2.0.pdf

or in the “license” file accompanying this file. This file is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

exception atsd_client.exceptions.DataParseException(field, clazz, msg='')

Bases: exceptions.Exception

exception atsd_client.exceptions.SQLException(status_code, content, query='')

Bases: atsd_client.exceptions.ServerException

classmethod extract_reason(content)
exception atsd_client.exceptions.ServerException(status_code, content, msg='')

Bases: exceptions.Exception

services Module

Copyright 2015 Axibase Corporation or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the “License”). You may not use this file except in compliance with the License. A copy of the License is located at

https://www.axibase.com/atsd/axibase-apache-2.0.pdf

or in the “license” file accompanying this file. This file is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class atsd_client.services.AlertsService(conn)

Bases: atsd_client.services._Service

delete(*ids)

Retrieve alert for each query

Parameters:idint
Returns:True if success
history_query(*queries)

Retrieve history for each query

Parameters:queriesAlertHistoryQuery
Returns:get of AlertHistory objects
query(*queries)

Retrieve alert for each query

Parameters:queriesAlertsQuery
Returns:get of Alert objects
update(*updates)

Change acknowledgement status of the specified open alerts.

Parameters:updatesdict
Returns:True if success
class atsd_client.services.CommandsService(conn)

Bases: atsd_client.services._Service

send_commands(commands)

Send a command or a batch of commands in Network API syntax via /api/v1/command

Parameters:commandsstr | list
Returns:True if success
class atsd_client.services.EntitiesService(conn)

Bases: atsd_client.services._Service

create_or_replace(entity)

Create an entity with specified fields and tags or replace the fields and tags of an existing entity.

Parameters:entityEntity
Returns:True if success
delete(entity)

Delete the specified entity and delete it as member from any entity groups that it belongs to.

Parameters:entityEntity
Returns:True if success
get(entity_name)

Retrieve information about the specified entity including its tags.

Parameters:entity_namestr entity name
Returns:Entity
list(expression=None, minInsertDate=None, maxInsertDate=None, tags=None, limit=None)

Retrieve a list of entities matching the specified filter conditions.

Parameters:
  • expressionstr
  • minInsertDatestr | int | datetime
  • maxInsertDatestr | int | datetime
  • tagsdict
  • limitint
Returns:

Entity objects

update(entity)

Update fields and tags of the specified entity.

Parameters:entityEntity
Returns:True if success
class atsd_client.services.EntityGroupsService(conn)

Bases: atsd_client.services._Service

add_entities(group_name, entities, createEntities=None)

Add entities as members to the specified entity group.

Parameters:
  • group_namestr
  • entitieslist of Entity objects | list of str entity names
  • createEntitiesbool flag indicating if new entities from the submitted list will be created if such entities don’t exist
Returns:

True if success

create_or_replace(group)

Create an entity group with specified fields and tags or replace the fields and tags of an existing entity group.

Parameters:groupEntityGroup
Returns:True if success
delete(group)

Delete the specified entity group. Member entities and their data is not affected by this operation.

Parameters:groupEntityGroup
Returns:True if success
delete_entities(group_name, entities)

Remove specified entities from members of the specified entity group. To delete all entities, submit an empty list [] with set_entities method.

Parameters:
  • group_namestr
  • entitieslist of Entity objects | list of str entity names
Returns:

True if success

get(group_name)

Retrieve information about the specified entity group including its tags. Membership in entity groups with non-empty expression is managed by the server. Adding/removing members of expression-based groups is not supported.

Parameters:group_namestr entity group name
Returns:EntityGroup
get_entities(group_name, expression=None, minInsertDate=None, maxInsertDate=None, tags=None, limit=None)

Retrieve a list of entities that are members of the specified entity group and are matching the specified filter conditions.

Parameters:
  • group_namestr
  • expressionstr
  • minInsertDatestr | int | datetime
  • maxInsertDatestr | int | datetime
  • tagsdict
  • limitint
Returns:

list of Entity objects

list(expression=None, tags=None, limit=None)

Retrieve a list of entity groups. Membership in entity groups with non-empty expression is managed by the server. Adding/removing members of expression-based groups is not supported.

Parameters:
  • expressionstr
  • tagsdict
  • limitint
Returns:

EntityGroup objects

set_entities(group_name, entities, createEntities=None)

Set members of the entity group from the specified entity list. All existing members that are not included in the request will be removed from members. If the array in the request is empty, all entities are removed from the group and are replaced with an empty list.

Parameters:
  • group_namestr
  • entitieslist of Entity objects | list of str entity names
  • createEntitiesbool flag indicating if new entities from the submitted list will be created if such entities don’t exist
Returns:

True if success

update(group)

Update fields and tags of the specified entity group. Unlike the replace method, fields and tags that are not specified in the request are left unchanged.

Parameters:groupEntityGroup
Returns:True if success
class atsd_client.services.MessageService(conn)

Bases: atsd_client.services._Service

insert(*messages)

Insert specified messages

Parameters:messagesMessage
Returns:True if success
query(*queries)

Retrieve alerts for each query

Parameters:queriesAlertsQuery
Returns:list of Alert objects
statistics(*params)

Unimplemented

class atsd_client.services.MetricsService(conn)

Bases: atsd_client.services._Service

create_or_replace(metric)

Create a metric with specified fields and tags or replace the fields and tags of an existing metric.

Parameters:metricMetric
Returns:True if success
delete(metric_name)

Delete the specified metric.

Parameters:metric_nameMetric
Returns:True if success
get(name)

Retrieve properties and tags for the specified metric.

Parameters:namestr metric name
Returns:Metric
list(expression=None, minInsertDate=None, maxInsertDate=None, tags=None, limit=None)

Retrieve a list of metrics matching the specified filter conditions.

Parameters:
  • expressionstr
  • minInsertDateint | str | None | datetime
  • maxInsertDateint | str | None | datetime
  • tagsstr
  • limitint
Returns:

Metric objects

update(metric)

Update fields and tags of the specified metric.

Parameters:metricMetric
Returns:True if success
class atsd_client.services.PropertiesService(conn)

Bases: atsd_client.services._Service

delete(*filters)

Delete properties for each query

Parameters:filtersPropertyDeleteFilter
Returns:True if success
insert(*properties)

Insert given properties

Parameters:propertiesProperty
Returns:True if success
query(*queries)

Retrieves property for each query

Parameters:queriesPropertiesQuery
Returns:list of Property objects
type_query(entity)

Returns an array of property types for the entity.

Parameters:entityEntity
Returns:returns list of property types for the entity.
url_query(*queries)

Unimplemented

class atsd_client.services.SQLService(conn)

Bases: atsd_client.services._Service

cancel_query(query_id)

Cancel the specified sql query.

Parameters:query_idstr
Returns:True if success
query(sql_query)

Execute sql query.

Parameters:sql_querystr
Returns:DataFrame object
query_with_params(sql_query, params={'outputFormat': 'csv'})

Execute sql query with api parameters.

Parameters:
  • sql_querystr
  • paramsdict
Returns:

Content of the response

class atsd_client.services.SeriesService(conn)

Bases: atsd_client.services._Service

csv_insert(*csvs)

Unimplemented

insert(*series_objects)

Insert an array of samples for a given series identified by metric, entity, and series tags

Parameters:series_objectsSeries objects
Returns:True if success
query(*queries)

Retrieve series for each query

Parameters:queriesSeriesQuery objects
Returns:list of Series objects
url_query(*queries)

Unimplemented

Table Of Contents

Previous topic

ATSD API client for Python

Next topic

atsd_client.models

This Page