Skip to content

pman command: hello

Rudolph Pienaar edited this page Mar 8, 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

  • Make sure that pman has been started (see here.

msg summary

The msg payload of the REST interaction with pman is:

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

hello

Transmit the above msg payload using purl:

purl --content-type application/vnd.collection+json \                                                
 --content-type application/vnd.collection+json \
 --verb POST \
 --raw \
 --http 172.17.0.2:5010/api/v1/cmd \
 --jsonwrapper 'payload' \
 --msg \
 '{  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 }' 

In the terminal running purl you'll see a considerable amount of traffic. To only show a final JSON string output, append a --quiet to the command to turn off all logging noise and only show the final payload and to pretty print the JSON string add --jsonpprintindent 4.

In such a case the command becomes

purl --content-type application/vnd.collection+json \                                                
 --content-type application/vnd.collection+json \
 --verb POST \
 --raw \
 --http 172.17.0.2:5010/api/v1/cmd \
 --jsonwrapper 'payload' \
 --msg \
 '{  "action": "hello",
         "meta": {
                 "askAbout":     "sysinfo",
                 "echoBack":     "Hi there!"
         }
 }' --quite --jsonpprintindent 4

and results in

{
    "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"
        }
    }
}
Clone this wiki locally