Status

    The health status value is determined by aggregating the success or failure of the event of a task detecting changes in Consul services and then updating network infrastructure. Currently, only the 5 most recent events are stored in Consul-Terraform-Sync (CTS). For more information on the hierarchy of status information and how it is collected, see Status Information.

    This endpoint currently returns the overall status information for all tasks.

    Currently no request parameters are offered for the overall status API.

    Response Statuses

    StatusReason
    200Successfully retrieved the status

    Response Fields

    1. $ curl localhost:8558/v1/status

    Response:

    1. {
    2. "task_summary": {
    3. "status": {
    4. "successful": 28,
    5. "errored": 5,
    6. "critical": 1,
    7. "unknown": 0
    8. },
    9. "enabled": {
    10. "true": 32,
    11. "false": 2
    12. }
    13. }
    14. }
    1. {
    2. "task_summary": {
    3. "status": {
    4. "successful": 28,
    5. "errored": 5,
    6. "critical": 1,
    7. "unknown": 0
    8. },
    9. "enabled": {
    10. "true": 32,
    11. "false": 2
    12. }
    13. }
    14. }

    Task Status

    This endpoint returns the individual task status information for a single specified task or for all tasks.

    Task health status value is determined by the success or failure of all stored event data on the process of updating network infrastructure for a task. Currently only the 5 most recent events are stored per task.

    • Successful: The most recent stored event is successful.
    • Errored: The most recent stored event is not successful but all previous stored events are successful.
    • Critical: The most recent stored event is not successful and one or more previous stored events are also not successful.
    • Unknown: No event data is stored for the task.
    MethodPathProduces
    GET/status/tasks/:task_nameapplication/json

    Request Parameters

    Response Statuses

    StatusReason
    200Successfully retrieved the task status
    404Task with the given name not found

    Event

    Event represents the process of updating network infrastructure of a task. The data is captured in a JSON structure. For more details on the scope of an event, see Event.

    NameTypeDescription
    idstringUUID to uniquely identify the event.
    successbooleanIndication of whether the event was successful or not.
    start_timetimeTime when the event started.
    end_timetimeTime when the event ended.
    task_namestringName that task is configured with in CTS.
    errorobjectInformation when the event fails. Null when successful.
    error.messagestringError message that is returned on failure.
    configobjectDeprecated in CTS 0.5.0 and will be removed in v0.8.0. Configuration values for the task when it was run.
    config.serviceslist[string]Deprecated in CTS 0.5.0 and will be removed in v0.8.0. List of the services configured for the task.
    stringDeprecated in CTS 0.5.0 and will be removed in v0.8.0. Module configured for the task.
    config.providerslist[string]Deprecated in CTS 0.5.0 and will be removed in v0.8.0. List of the providers configured for the task.

    Example: All Task Statuses

    Request:

    1. $ curl localhost:8558/v1/status/tasks

    Response:

    1. {
    2. "task_a": {
    3. "task_name": "task_a",
    4. "status": "successful",
    5. "enabled": true,
    6. "providers": [
    7. "local"
    8. ],
    9. "services": [
    10. "api"
    11. ],
    12. "events_url": "/v1/status/tasks/task_a?include=events"
    13. },
    14. "task_b": {
    15. "task_name": "task_b",
    16. "status": "errored",
    17. "enabled": false,
    18. "providers": [
    19. "null"
    20. ],
    21. "services": [
    22. ],
    23. "events_url": "/v1/status/tasks/task_b?include=events"
    24. }
    25. }
    1. {
    2. "task_a": {
    3. "task_name": "task_a",
    4. "status": "successful",
    5. "enabled": true,
    6. "providers": [
    7. "local"
    8. ],
    9. "services": [
    10. "api"
    11. ],
    12. "events_url": "/v1/status/tasks/task_a?include=events"
    13. },
    14. "task_b": {
    15. "task_name": "task_b",
    16. "status": "errored",
    17. "enabled": false,
    18. "providers": [
    19. "null"
    20. ],
    21. "services": [
    22. "web"
    23. ],
    24. "events_url": "/v1/status/tasks/task_b?include=events"
    25. }
    26. }

    Example: Individual Task Status with Events

    1. $ curl localhost:8558/v1/status/tasks/task_b?include=events

    Response:

    1. {
    2. "task_b": {
    3. "task_name": "task_b",
    4. "status": "errored",
    5. "enabled": false,
    6. "providers": [
    7. "null"
    8. ],
    9. "services": [
    10. "web",
    11. ],
    12. "events_url": "/v1/status/tasks/task_b?include=events",
    13. "events": [
    14. {
    15. "id": "44137ba2-8fc9-6cbe-0e0e-e9305ee4f7f9",
    16. "success": false,
    17. "start_time": "2020-11-24T12:06:51.858292-05:00",
    18. "end_time": "2020-11-24T12:06:52.770165-05:00",
    19. "task_name": "task_b",
    20. "error": {
    21. "message": "example error: terraform-apply error"
    22. },
    23. "config": {
    24. "null"
    25. ],
    26. "services": [
    27. "web"
    28. ],
    29. "module": "../modules/test_task"
    30. }
    31. },
    32. {
    33. "id": "ef202675-502f-431f-b133-ed64d15b0e0e",
    34. "success": true,
    35. "start_time": "2020-11-24T12:04:18.651231-05:00",
    36. "task_name": "task_b",
    37. "error": null,
    38. "config": {
    39. "providers": [
    40. "null"
    41. ],
    42. "services": [
    43. "web",
    44. ],
    45. "module": "../modules/test_task"
    46. }
    47. }
    48. ]
    49. }
    50. }
    1. {
    2. "task_b": {
    3. "task_name": "task_b",
    4. "status": "errored",
    5. "enabled": false,
    6. "providers": [
    7. "null"
    8. ],
    9. "services": [
    10. "web",
    11. ],
    12. "events_url": "/v1/status/tasks/task_b?include=events",
    13. "events": [
    14. {
    15. "id": "44137ba2-8fc9-6cbe-0e0e-e9305ee4f7f9",
    16. "success": false,
    17. "start_time": "2020-11-24T12:06:51.858292-05:00",
    18. "end_time": "2020-11-24T12:06:52.770165-05:00",
    19. "task_name": "task_b",
    20. "error": {
    21. "message": "example error: terraform-apply error"
    22. },
    23. "config": {
    24. "providers": [
    25. "null"
    26. ],
    27. "services": [
    28. "web"
    29. ],
    30. "module": "../modules/test_task"
    31. }
    32. },
    33. {
    34. "id": "ef202675-502f-431f-b133-ed64d15b0e0e",
    35. "success": true,
    36. "start_time": "2020-11-24T12:04:18.651231-05:00",
    37. "end_time": "2020-11-24T12:04:20.900115-05:00",
    38. "task_name": "task_b",
    39. "error": null,
    40. "config": {
    41. "providers": [
    42. "null"
    43. ],
    44. "services": [
    45. "web",
    46. ],
    47. "module": "../modules/test_task"
    48. }
    49. }
    50. ]
    51. }