-
Notifications
You must be signed in to change notification settings - Fork 15
pfioh command: hello
Rudolph Pienaar edited this page Jul 23, 2019
·
4 revisions
This page describes the hello
command to pfioh
. It is used to simply test if a pfioh
service is running and responding to requests.
- This page assumes that
pfioh
is listening on:${HOST_IP}:5055
where
export HOST_IP=$(ip route |\
grep -v docker |\
awk '{if(NF==11) print $9}') | awk '{print $1}'
- Make sure that
pfioh
has been started (see here for more info):
pfioh --forever --httpResponse --storeBase=/tmp --createDirsAsNeeded
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 pfioh
. It will echo back some facts about the machine on which is it running.
pfurl --verb POST --raw --http ${HOST_IP}:5055/api/v1/cmd \
--httpResponseBodyParse --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--