Áú»¢¶Ä²©

§¿§ä§à §á§Ö§â§Ö§Ó§à§Õ §ã§ä§â§Ñ§ß§Ú§è§í §Õ§à§Ü§å§Þ§Ö§ß§ä§Ñ§è§Ú§Ú §ã §Ñ§ß§Ô§Ý§Ú§Û§ã§Ü§à§Ô§à §ñ§Ù§í§Ü§Ñ. §±§à§Þ§à§Ô§Ú§ä§Ö §ß§Ñ§Þ §ã§Õ§Ö§Ý§Ñ§ä§î §Ö§Ô§à §Ý§å§é§ê§Ö.

hanode.get

§°§á§Ú§ã§Ñ§ß§Ú§Ö

integer/array hanode.get(§á§Ñ§â§Ñ§Þ§Ö§ä§â§í §à§Ò§ì§Ö§Ü§ä§Ñ)

§®§Ö§ä§à§Õ §á§à§Ù§Ó§à§Ý§ñ§Ö§ä §á§à§Ý§å§é§Ú§ä§î §ã§á§Ú§ã§à§Ü §å§Ù§Ý§à§Ó §Ü§Ý§Ñ§ã§ä§Ö§â§Ñ §Ó§í§ã§à§Ü§à§Û §Õ§à§ã§ä§å§á§ß§à§ã§ä§Ú §á§à §Ù§Ñ§Õ§Ñ§ß§ß§í§Þ §á§Ñ§â§Ñ§Þ§Ö§ä§â§Ñ§Þ.

§¿§ä§à§ä §Þ§Ö§ä§à§Õ §Õ§à§ã§ä§å§á§Ö§ß §ä§à§Ý§î§Ü§à §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ð §ã §ä§Ú§á§à§Þ §Õ§à§ã§ä§å§á§Ñ §³§å§á§Ö§â-§Ñ§Õ§Þ§Ú§ß§Ú§ã§ä§â§Ñ§ä§à§â. §²§Ñ§Ù§â§Ö§ê§Ö§ß§Ú§ñ §ß§Ñ §Ó§í§Ù§à§Ó §Þ§Ö§ä§à§Õ§Ñ §Þ§à§Ø§ß§à §à§ä§à§Ù§Ó§Ñ§ä§î §Ó §ß§Ñ§ã§ä§â§à§Û§Ü§Ñ§ç §â§à§Ý§Ö§Û §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§ñ. §¥§à§á§à§Ý§ß§Ú§ä§Ö§Ý§î§ß§å§ð §Ú§ß§æ§à§â§Þ§Ñ§è§Ú§ð §ã§Þ. §Ó §â§Ñ§Ù§Õ§Ö§Ý§Ö §²§à§Ý§Ú §á§à§Ý§î§Ù§à§Ó§Ñ§ä§Ö§Ý§Ö§Û.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
ha_nodeids string/array Return only nodes with the given node IDs.
filter object Return only those results that exactly match the given filter.

Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against.

Allows filtering by the node properties: name, address, status.
sortfield string/array Sort the result by the given properties.

Possible values are: name, lastaccess, status.
countOutput flag These parameters being common for all get methods are described in detail in the reference commentary.
limit integer
output query
preservekeys boolean
sortorder string/array

§£§à§Ù§Ó§â§Ñ§ë§Ñ§Ö§Þ§í§Ö §Ù§ß§Ñ§é§Ö§ß§Ú§ñ

(§è§Ö§Ý§à§Ö §é§Ú§ã§Ý§à/§Þ§Ñ§ã§ã§Ú§Ó) §£§à§Ù§Ó§â§Ñ§ë§Ñ§Ö§ä §Ý§Ú§Ò§à:

  • ¡¤ §Þ§Ñ§ã§ã§Ú§Ó §à§Ò§ì§Ö§Ü§ä§à§Ó;
  • ¡¤ §Ü§à§Ý§Ú§é§Ö§ã§ä§Ó§à §Ú§Ù§Ó§Ý§Ö§é§Ö§ß§ß§í§ç §à§Ò§ì§Ö§Ü§ä§à§Ó, §Ö§ã§Ý§Ú §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§Ý§ã§ñ §á§Ñ§â§Ñ§Þ§Ö§ä§â countOutput.

§±§â§Ú§Þ§Ö§â§í

§±§à§Ý§å§é§Ö§ß§Ú§Ö §ã§á§Ú§ã§Ü§Ñ §å§Ù§Ý§à§Ó, §å§á§à§â§ñ§Õ§à§é§Ö§ß§ß§í§ç §á§à §ã§ä§Ñ§ä§å§ã§å

§©§Ñ§á§â§à§ã:

{
           "jsonrpc": "2.0",
           "method": "hanode.get",
           "params": {
               "preservekeys": true,
               "sortfield": "status",
               "sortorder": "DESC"
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

§°§ä§Ó§Ö§ä:

{
         "jsonrpc": "2.0",
         "result": {
           "ckuo7i1nw000h0sajj3l3hh8u": {
             "ha_nodeid": "ckuo7i1nw000h0sajj3l3hh8u",
             "name": "node-active",
             "address": "192.168.1.13",
             "port": "10051",
             "lastaccess": "1635335704",
             "status": "3"
           },
           "ckuo7i1nw000e0sajwfttc1mp": {
             "ha_nodeid": "ckuo7i1nw000e0sajwfttc1mp",
             "name": "node6",
             "address": "192.168.1.10",
             "port": "10053",
             "lastaccess": "1635332902",
             "status": "2"
           },
           "ckuo7i1nv000c0sajz85xcrtt": {
             "ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
             "name": "node4",
             "address": "192.168.1.8",
             "port": "10052",
             "lastaccess": "1635334214",
             "status": "1"
           },
           "ckuo7i1nv000a0saj1fcdkeu4": {
             "ha_nodeid": "ckuo7i1nv000a0saj1fcdkeu4",
             "name": "node2",
             "address": "192.168.1.6",
             "port": "10051",
             "lastaccess": "1635335705",
             "status": "0"
           }
         },
         "id": 1
       }

Get a list of specific nodes by their IDs

Request:

{
           "jsonrpc": "2.0",
           "method": "hanode.get",
           "params": {
               "ha_nodeids": ["ckuo7i1nw000e0sajwfttc1mp", "ckuo7i1nv000c0sajz85xcrtt"]
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
                   "name": "node4",
                   "address": "192.168.1.8",
                   "port": "10052",
                   "lastaccess": "1635334214",
                   "status": "1"
               },
               {
                   "ha_nodeid": "ckuo7i1nw000e0sajwfttc1mp",
                   "name": "node6",
                   "address": "192.168.1.10",
                   "port": "10053",
                   "lastaccess": "1635332902",
                   "status": "2"
               }
           ],
           "id": 1
       }

Get a list of stopped nodes

Request:

{
           "jsonrpc": "2.0",
           "method": "hanode.get",
           "params": {
               "output": ["ha_nodeid", "address", "port"],
               "filter": {
                   "status": 1
               }
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "ha_nodeid": "ckuo7i1nw000g0sajjsjre7e3",
                   "address": "192.168.1.12",
                   "port": "10051"
               },
               {
                   "ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
                   "address": "192.168.1.8",
                   "port": "10052"
               },
               {
                   "ha_nodeid": "ckuo7i1nv000d0sajd95y1b6x",
                   "address": "192.168.1.9",
                   "port": "10053"
               }
           ],
           "id": 1
       }

Get a count of standby nodes

Request:

{
           "jsonrpc": "2.0",
           "method": "hanode.get",
           "params": {
               "countOutput": true,
               "filter": {
                   "status": 0
               }
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": "3",
           "id": 1
       }

Check status of nodes at specific IP addresses

Request:

{
           "jsonrpc": "2.0",
           "method": "hanode.get",
           "params": {
               "output": ["name", "status"],
               "filter": {
                   "address": ["192.168.1.7", "192.168.1.13"]
               }
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "name": "node3",
                   "status": "0"
               },
               {
                   "name": "node-active",
                   "status": "3"
               }
           ],
           "id": 1
       }

§ª§ã§ä§à§é§ß§Ú§Ü

CHaNode::get() §Ó ui/include/classes/api/services/CHaNode.php.