-
Notifications
You must be signed in to change notification settings - Fork 33
pman command: hello
Rudolph Pienaar edited this page Dec 7, 2019
·
21 revisions
- A HOST_IP environment variable that denotes the IP of the host housing the service. In Linux, you can do:
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
- Make sure that
pman
has been started (see here for more info):
pman --rawmode 1 --http --port 5010 --listeners 12
The msg
payload of the REST interaction with pman
is:
{ "action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!"
}
}
Assuming satisfied preconditions, let's say hello
to pman
. It will echo back some facts about the machine on which is it running.
pfurl --verb POST --raw --http ${HOST_IP}:5010/api/v1/cmd \
--jsonwrapper 'payload' --msg \
'{ "action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!"
}
}' --quiet --jsonpprintindent 4
The returned JSON string from the call:
{
"payloadsize": 90,
"RESTverb": "POST",
"action": "hello",
"meta": {
"askAbout": "sysinfo",
"echoBack": "Hi there!"
},
"RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
"path": "/api/v1/cmd",
"status": true,
"receivedByServer": [
"POST /api/v1/cmd HTTP/1.1\r",
"Host: 172.17.0.2:5010\r",
"User-Agent: PycURL/7.43.0 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3\r",
"Accept: */*\r",
"Content-type: application/vnd.collection+json\r",
"Content-Length: 90\r",
"\r",
"{\"payload\": {\"action\": \"hello\", \"meta\": {\"askAbout\": \"sysinfo\", \"echoBack\": \"Hi there!\"}}}"
],
"d_ret": {
"sysinfo": {
"memory": [
67422126080,
55895048192,
17.1,
10516230144,
48169099264,
14141243392,
3601956864,
808980480,
7927816192,
461950976
],
"platform": "Linux-4.4.0-64-generic-x86_64-with-Ubuntu-16.04-xenial",
"hostname": "ab570dec6043",
"cpu_percent": 5.6,
"loadavg": [
1.37,
1.11,
0.99
],
"uname": [
"Linux",
"ab570dec6043",
"4.4.0-64-generic",
"#85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017",
"x86_64",
"x86_64"
],
"version": "#85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017",
"system": "Linux",
"cpucount": 24,
"machine": "x86_64"
}
}
}
--30--