Skip to content
Snippets Groups Projects
Commit 74573f16 authored by John-Paul Robinson's avatar John-Paul Robinson
Browse files

Notebook that attempts connection to cmdaemon

parent bff532a7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
The following code blocks are the required modules and initial example from the developers manual for working with the RPC-based client library for programatic control of cmd.
The example is not yet working, possibly due to python version differences. In 8.2 the library is build for python 2.7.5.
```
!pip install pyOpenSSL==17.5.0 ply lxml tabulate monotonic humanfriendly six
```
%% Cell type:code id: tags:
```
from pythoncm.cluster import Cluster
from pythoncm.settings import Settings
```
%% Cell type:code id: tags:
```
settings = Settings(host='master',
port=8081,
cert_file='~/.cm/cert.pem',
key_file='~/.cm/cert.key',
ca_file='pythoncm/etc/cacert.pem')
```
%% Cell type:code id: tags:
```
cluster = Cluster(settings) #, check_api=False)
```
%% Cell type:markdown id: tags:
use rest api for now to avoid RPC issues with library.
convert curl command for currnet power to rest query
https://curl.trillworks.com/
```curl --cert ~/.cm/cert.pem --key ~/.cm/cert.key --cacert pythoncm/etc/cacert.pem "https://master:8081/rest/v1/monitoring/latest?measurable=Pwr_Consumption&indent=1"```
the sum on the commandline, dealing with weird outlier data from one node is:
```curl --cert ~/.cm/cert.pem --key ~/.cm/cert.key -k "https://master:8081/rest/v1/monitoring/latest?measurable=Pwr_Consumption&indent=1" | jq '.data[] | select(.raw < 10000) .raw' | awk '{sum=$1+sum} END {print sum}'```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment