1 Server-proxy data exchange protocol

    Overview

    Request and response messages must begin with .

    Passive proxy

    Proxy config request

    The request is sent by server to provide proxy configuration data. This request is sent every ProxyConfigFrequency (server configuration parameter) seconds.

    Example:

    server→proxy:

    proxy→server:

    1. {
    2. "response": "success",
    3. "version": "5.4.0"
    4. }
    Proxy request

    The proxy data request is used to obtain host interface availability, historical, discovery and autoregistration data from proxy. This request is sent every ProxyDataFrequency (server configuration parameter) seconds.

    server→proxy:

    1. {
    2. "request": "proxy data"
    3. }

    proxy→server:

    1. {
    2. "session": "12345678901234567890123456789012"
    3. "interface availability": [
    4. {
    5. "interfaceid": 1,
    6. "available": 1,
    7. "error": ""
    8. },
    9. {
    10. "interfaceid": 2,
    11. "available": 2,
    12. "error": "Get value from agent failed: cannot connect to [[127.0.0.1]:10049]: [111] Connection refused"
    13. },
    14. {
    15. "interfaceid": 3,
    16. "available": 1,
    17. "error": ""
    18. },
    19. {
    20. "interfaceid": 4,
    21. "available": 1,
    22. "error": ""
    23. }
    24. ],
    25. "history data":[
    26. {
    27. "itemid":"12345",
    28. "clock":1478609647,
    29. "ns":332510044,
    30. "value":"52956612",
    31. "id": 1
    32. },
    33. {
    34. "itemid":"12346",
    35. "clock":1478609647,
    36. "ns":330690279,
    37. "state":1,
    38. "value":"Cannot find information for this network interface in /proc/net/dev.",
    39. "id": 2
    40. }
    41. ],
    42. "discovery data":[
    43. {
    44. "clock":1478608764,
    45. "drule":2,
    46. "dcheck":3,
    47. "type":12,
    48. "ip":"10.3.0.10",
    49. "dns":"vdebian",
    50. "status":1
    51. },
    52. {
    53. "clock":1478608764,
    54. "drule":2,
    55. "dcheck":null,
    56. "type":-1,
    57. "ip":"10.3.0.10",
    58. "dns":"vdebian",
    59. "status":1
    60. }
    61. ],
    62. "auto registration":[
    63. {
    64. "clock":1478608371,
    65. "host":"Logger1",
    66. "ip":"10.3.0.1",
    67. "dns":"localhost",
    68. "port":"10050"
    69. },
    70. {
    71. "clock":1478608381,
    72. "host":"Logger2",
    73. "ip":"10.3.0.2",
    74. "dns":"localhost",
    75. "port":"10050"
    76. }
    77. ],
    78. "tasks":[
    79. {
    80. "status": 0,
    81. "parent_taskid": 10
    82. },
    83. {
    84. "type": 0,
    85. "error": "No permissions to execute task.",
    86. "parent_taskid": 20
    87. }
    88. ],
    89. "version":"5.4.0"
    90. }

    server→proxy:

    Active proxy

    Proxy heartbeat request

    The proxy heartbeat request is sent by proxy to report that proxy is running. This request is sent every HeartbeatFrequency (proxy configuration parameter) seconds.

    proxy→server:

    1. {
    2. "request": "proxy heartbeat",
    3. "host": "Proxy #12",
    4. "version": "5.4.0"
    5. }

    server→proxy:

    1. {
    2. "response": "success"
    3. }
    Proxy config request

    Example:

    proxy→server:

    1. {
    2. "request": "proxy config",
    3. "host": "Proxy #12",
    4. "version":"5.4.0"
    5. }

    server→proxy:

    proxy→server:

    1. {
    2. "response": "success"
    3. }
    Proxy data request

    The proxy data request is sent by proxy to provide host interface availability, history, discovery and autoregistration data. This request is sent every DataSenderFrequency (proxy configuration parameter) seconds.

    Example:

    1. {
    2. "request": "proxy data",
    3. "host": "Proxy #12",
    4. "session": "12345678901234567890123456789012",
    5. "interface availability": [
    6. {
    7. "interfaceid": 1,
    8. "available": 1,
    9. "error": ""
    10. },
    11. {
    12. "interfaceid": 2,
    13. "available": 2,
    14. "error": "Get value from agent failed: cannot connect to [[127.0.0.1]:10049]: [111] Connection refused"
    15. },
    16. {
    17. "interfaceid": 3,
    18. "available": 1,
    19. "error": ""
    20. },
    21. {
    22. "interfaceid": 4,
    23. "available": 1,
    24. "error": ""
    25. }
    26. ],
    27. "history data":[
    28. {
    29. "itemid":"12345",
    30. "clock":1478609647,
    31. "ns":332510044,
    32. "value":"52956612",
    33. "id": 1
    34. },
    35. {
    36. "itemid":"12346",
    37. "clock":1478609647,
    38. "ns":330690279,
    39. "state":1,
    40. "value":"Cannot find information for this network interface in /proc/net/dev.",
    41. "id": 2
    42. }
    43. ],
    44. "discovery data":[
    45. {
    46. "clock":1478608764,
    47. "drule":2,
    48. "dcheck":3,
    49. "type":12,
    50. "ip":"10.3.0.10",
    51. "dns":"vdebian",
    52. "status":1
    53. },
    54. {
    55. "clock":1478608764,
    56. "drule":2,
    57. "dcheck":null,
    58. "type":-1,
    59. "ip":"10.3.0.10",
    60. "dns":"vdebian",
    61. "status":1
    62. }
    63. ],
    64. "auto registration":[
    65. {
    66. "clock":1478608371,
    67. "dns":"localhost",
    68. "port":"10050"
    69. },
    70. {
    71. "clock":1478608381,
    72. "host":"Logger2",
    73. "ip":"10.3.0.2",
    74. "dns":"localhost",
    75. "port":"10050"
    76. }
    77. ],
    78. "tasks":[
    79. {
    80. "type": 2,
    81. "clock":1478608371,
    82. "ttl": 600,
    83. "commandtype": 2,
    84. "command": "restart_service1.sh",
    85. "execute_on": 2,
    86. "port": 80,
    87. "authtype": 0,
    88. "username": "userA",
    89. "password": "password1",
    90. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
    91. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
    92. "parent_taskid": 10,
    93. "hostid": 10070
    94. },
    95. {
    96. "type": 2,
    97. "clock":1478608381,
    98. "ttl": 600,
    99. "commandtype": 1,
    100. "command": "restart_service2.sh",
    101. "execute_on": 0,
    102. "authtype": 0,
    103. "username": "",
    104. "password": "",
    105. "publickey": "",
    106. "privatekey": "",
    107. "parent_taskid": 20,
    108. "hostid": 10084
    109. }
    110. ],
    111. "tasks":[
    112. {
    113. "type": 0,
    114. "status": 0,
    115. "parent_taskid": 10
    116. },
    117. {
    118. "type": 0,
    119. "status": 1,
    120. "error": "No permissions to execute task.",
    121. "parent_taskid": 20
    122. }
    123. ],
    124. "version":"5.4.0"
    125. }

    server→proxy:

    1. {
    2. "response": "success",
    3. "tasks":[
    4. {
    5. "type": 1,
    6. "clock": 1478608371,
    7. "ttl": 600,
    8. "commandtype": 2,
    9. "command": "restart_service1.sh",
    10. "execute_on": 2,
    11. "port": 80,
    12. "authtype": 0,
    13. "username": "userA",
    14. "password": "password1",
    15. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
    16. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
    17. "parent_taskid": 10,
    18. "hostid": 10070
    19. },
    20. {
    21. "type": 1,
    22. "clock": 1478608381,
    23. "ttl": 600,
    24. "commandtype": 1,
    25. "command": "restart_service2.sh",
    26. "execute_on": 0,
    27. "authtype": 0,
    28. "username": "",
    29. "password": "",
    30. "publickey": "",
    31. "privatekey": "",
    32. "parent_taskid": 20,
    33. "hostid": 10084
    34. }
    35. }