-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSendInfo.py
41 lines (29 loc) · 832 Bytes
/
SendInfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python
import criotdm
import ciotdm
import psutil
import threading
# Set varibles
httphost = "10.195.70.69"
httpuser = "admin"
httppass = "admin"
rt_ae = 2
rt_container = 3
rt_contentInstance = 4
rt_subscription = 23
connection1 = criotdm.connect_to_iotdm(httphost, httpuser, httppass, "http")
cntattr = '"mni"'
def sendCnt():
threading.Timer(1.0,sendCnt).start()
cpu = psutil.cpu_percent(interval=None)
attr = cntattr + ":" + '\"%s\"' %(cpu)
print cntattr
container_resp = criotdm.create_resource(connection1,"ODL-oneM2M-Cse",rt_container,attr, "Container1")
print container_resp
'''
# Create Container
attr = '"mni":30'
container_resp = criotdm.create_resource(connection1,"ODL-oneM2M-Cse",rt_container,attr, "Container1")
print(container_resp.text)
'''
sendCnt()