Skip to content

Commit f76f4fc

Browse files
Added simple example and corrected the doc
1 parent be69465 commit f76f4fc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ DataPoint
132132
:members:
133133

134134

135-
ResonseInterface
135+
ResponseInterface
136136
==================
137137
.. automodule:: logicmonitor_data_sdk.api.response_interface
138138
:members:

example/simple_example.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import time
2+
from random import seed, random
3+
4+
import logicmonitor_data_sdk
5+
from logicmonitor_data_sdk.api.metrics import Metrics
6+
from logicmonitor_data_sdk.models import DataSource, \
7+
Resource, DataSourceInstance, DataPoint
8+
9+
# Configure API key authorization: LMv1
10+
configuration = logicmonitor_data_sdk.Configuration(company='COMPANY',
11+
id='ACCESS_ID',
12+
key='ACCESS_KEY')
13+
# create an instance of the API class
14+
metric_api = Metrics(batch=True)
15+
seed(1)
16+
while True:
17+
metric_api.send_metrics(resource=Resource(
18+
ids={"system.hostname": "SampleDevice"}, create=True, name="SampleDevice",
19+
properties={"using.sdk": "true"}), datasource=DataSource(
20+
name="PusMetricsDS"), instance=DataSourceInstance(name="instance"),
21+
datapoint=DataPoint(name="dataPoint"),
22+
values={str(int(time.time())): str(random())})
23+
time.sleep(10)

0 commit comments

Comments
 (0)