Skip to content

pman command: hello

Rudolph Pienaar edited this page Mar 23, 2017 · 21 revisions

pman command: hello

Abstract

This page describes the hello command to pman. It is used to simply test if a pman service is running and responding to requests.

Preconditions

  • This page assumes that pman is listening on: 172.17.0.2:5010.
  • Make sure that pman has been started (see here for more info):
pman --rawmode 1 --http  --port 5010 --listeners 12

msg summary

The msg payload of the REST interaction with pman is:

 {  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 } 

hello

purl calling syntax

Assuming satisfied preconditions, let's say hello to pman. It will echo back some facts about the machine on which is it running.

purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
 '{  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 }' --quiet --jsonpprintindent 4 

Using the dockerized version of purl

To use the dockerized version of purl, and assuming a pman on the given IP:

Using the source repo

If you have cloned the source repo, you can cd to the root directory and execute the docker helper scripts in the docker-bin directory.

docker-bin/purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
 '{  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 }' --quiet --jsonpprintindent 4 
calling docker directly
docker run --name pman -v /home:/Users --rm -ti fnndsc/pman purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
 '{  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 }' --quiet --jsonpprintindent 4 

return payload

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--

Clone this wiki locally