TraGicCode / Splunk-Add-On-for-Particular-Service-Control

0 stars 0 forks source link

Documented API Endpoints #1

Open TraGicCode opened 5 years ago

TraGicCode commented 5 years ago

The first thing that needs to happen before i can begin working on this addon is to perform some reconnaissance. I need to figure out what http endpoints can be used and what type of data can be collected.

Endpoint:

curl http://<baseurl>:33333/api | python -m json.tool

Description:

The endpoint that describes all other endpoints. This should be the complete master list of apis available.

{
    "configuration": "http://<baseurl>:33333/api/configuration",
    "description": "The management backend for the Particular Service Platform",
    "endpoints_error_url": "http://<baseurl>:33333/api/endpoints/{name}/errors/{?page,per_page,direction,sort}",
    "endpoints_message_search_url": "http://<baseurl>:33333/api/endpoints/{name}/messages/search/{keyword}/{?page,per_page,direction,sort}",
    "endpoints_messages_url": "http://<baseurl>:33333/api/endpoints/{name}/messages/{?page,per_page,direction,sort}",
    "endpoints_url": "http://<baseurl>:33333/api/endpoints",
    "errors_url": "http://<baseurl>:33333/api/errors/{?page,per_page,direction,sort}",
    "known_endpoints_url": "/endpoints/known",
    "license_details": "http://<baseurl>:33333/api/license",
    "license_status": "valid",
    "message_search_url": "http://<baseurl>:33333/api/messages/search/{keyword}/{?page,per_page,direction,sort}",
    "name": "ServiceControl",
    "sagas_url": "http://<baseurl>:33333/api/sagas"
}

Endpoint:

curl http://<baseurl>:33333/api/license | python -m json.tool

Description:

The endpoint shows information about your servicecontrol license.

{"trial_license":false,"edition":"Enterprise","registered_to":"My Special Company","upgrade_protection_expiration":"","expiration_date":"2019-05-23T00:00:00.0000000Z","status":"valid"}

Endpoint:

curl http://<baseurl>:33333/api/endpoints | python -m json.tool

Description:

[
    {
        "heartbeat_information": {
            "last_report_at": "2018-11-26T17:07:03.2265556Z",
            "reported_status": "beating"
        },
        "host_display_name": "AZ-XXX-AP003",
        "id": "9a4af91c-6c9c-94b7-48f8-a20c2284dfc5",
        "is_sending_heartbeats": true,
        "monitor_heartbeat": true,
        "monitored": true,
        "name": "SuperHuman.Host"
    },
    {
        "heartbeat_information": {
            "last_report_at": "2018-11-26T17:06:57.585094Z",
            "reported_status": "beating"
        },
        "host_display_name": "AZ-XXX-AP002",
        "id": "d3ca21ab-ab17-8487-bea1-1cde4f2fef37",
        "is_sending_heartbeats": true,
        "monitor_heartbeat": true,
        "monitored": true,
        "name": "Football.Host"
    },
    {
        "heartbeat_information": {
            "last_report_at": "2018-11-26T11:44:06.0285735Z",
            "reported_status": "dead"
        },
        "host_display_name": "AZ-XXX-AP003",
        "id": "7824abdb-02b4-980a-ef18-00bd569ec366",
        "is_sending_heartbeats": false,
        "monitor_heartbeat": true,
        "monitored": true,
        "name": "Soccerball.host"
    },

Valid Values for Attributes: reporting_status = beating/dead

Endpoint:

curl http://<baseurl>:33333/api/license | python -m json.tool

Description:

Need to find out the exact purpose of this compared to endpoints endpoint!

[
    {
        "endpoint_details": {
            "host": "AZ-xxx-AP003",
            "host_id": "8d6c0bd5-5d94-c75d-316f-9a1c23678c0f",
            "name": "magicman.host"
        },
        "host_display_name": "AZ-xxx-AP003",
        "id": "9a4af91c-6c9c-94b7-48f8-a20c2284dfc5"
    },
    {
        "endpoint_details": {
            "host": "AZ-XXX-AP002",
            "host_id": "91342421-627c-0889-ff33-8222862eea09",
            "name": "something.Host"
        },
        "host_display_name": "AZ-XXX-AP002",
        "id": "d3ca21ab-ab17-8487-bea1-1cde4f2fef37"
    },
    {
        "endpoint_details": {
            "host": "AZ-XXX-AP003",
            "host_id": "f5ac6c4b-fc24-1d7c-c89c-632fa040ef01",
            "name": "baseball.host"
        },
        "host_display_name": "AZ-BCP01-AP003",
        "id": "7824abdb-02b4-980a-ef18-00bd569ec366"
    },
    {
        "endpoint_details": {
            "host": "AZ-XXX-AP001",
            "host_id": "38d877b5-b1b1-e821-4da3-70054217447d",
            "name": "racket.host"
        },
        "host_display_name": "AZ-XXX-AP001",
        "id": "36454dbc-8c11-f9c7-ccbf-ab856e983c86"
    },
    {
        "endpoint_details": {
            "host": "AZ-XXX-AP001",
            "host_id": "535559d2-a057-c324-60c0-34ea1ebb9ed1",
            "name": "Football.Host"
        },
        "host_display_name": "AZ-XXX-AP001",
        "id": "2aa36404-887b-28e4-5289-1bc3eb15c37f"
    },
    {
        "endpoint_details": {
            "host": "2-P1-XXX-CA",
            "host_id": "2fb7f111-996f-afd0-f24c-c102a3b44aa8",
            "name": "Soccer.Host"
        },
        "host_display_name": "2-P1-XXX-CA",
        "id": "df817a61-07f1-b113-0954-59615e94bdf8"
    },
TraGicCode commented 5 years ago

EndPoint:

curl http://<baseurl>:33333/api/messages/search/CreateOrder?page=1&per_page=20 | python -m json.tool

Description:

Ability to query for messages that contain a certain keyword like Order or CreateOrder etc.

http://<baseurl>:33333/api/messages/search/CreateOrder?page=1&per_page=20
TraGicCode commented 5 years ago

Endpoint:

curl http://<baseurl>:33333/api/errors?page=1&per_page=1000 | python -m json.tool

Description:

Ability to query error messages i think waiting to be handled??? not really sure it might actually be all error messages that have happened and will eventually be purged off.

Get Example Data later

Valid Values for Attributes: status = unresolved/archived/retryissued sort = time_of_failure

TraGicCode commented 5 years ago

Endpoint:

curl http://<baseurl>:33333/api/configuration | python -m json.tool

Description:

Ability to get servicecontrol configuration

{
    "data_retention": {
        "audit_retention_period": "30.00:00:00",
        "error_retention_period": "15.00:00:00"
    },
    "host": {
        "logging": {
            "log_path": "C:\\ProgramData\\Particular\\ServiceControl\\Particular.ServiceControl.prod\\Logs",
            "logging_level": "Warn",
            "raven_db_log_level": "Warn"
        },
        "raven_db_path": "C:\\ProgramData\\Particular\\ServiceControl\\Particular.ServiceControl.prod\\DB",
        "service_name": "Particular.ServiceControl.prod"
    },
    "performance_tunning": {
        "expiration_process_batch_size": 65512,
        "expiration_process_timer_in_seconds": 600,
        "external_integrations_dispatching_batch_size": 100,
        "http_default_connection_limit": 100,
        "max_body_size_to_store": 102400
    },
    "plugins": {
        "heartbeat_grace_period": "00:00:40"
    },
    "transport": {
        "audit_log_queue": "audit.forwarding.prod",
        "audit_queue": "audit",
        "error_log_queue": "error.forwarding.prod",
        "error_queue": "error",
        "forward_audit_messages": true,
        "forward_error_messages": false,
        "transport_type": "NServiceBus.RabbitMQTransport, NServiceBus.Transports.RabbitMQ"
    }
}
TraGicCode commented 5 years ago

Endpoint:

curl http://<baseurl>:33333/api/endpoints/{name}/messages/{?page,per_page,direction,sort}

Description:

Contains all messages for an endpoint along with headers, link to the body of the message, and way more. Also indicates if the message was successful

[
    {
        "body_size": 2343,
        "body_url": "/messages/f9038263-51ee-42cb-8c93-a9a500336bad/body?instance_id=aHR0cDovL3NlcnZpY2Vjb250cm9sLXByb2QuYmxpbmRzLmNvbTozMzMzMy9hcGk.",
        "conversation_id": "949a86ca-2bb2-46a8-8186-a9a400336b24",
        "critical_time": "00:00:00.2744240",
        "delivery_time": "00:00:00.2744240",
        "headers": [
            {
                "key": "NServiceBus.MessageId",
                "value": "f9038263-51ee-42cb-8c93-a9a500336bad"
            },
            {
                "key": "NServiceBus.CorrelationId",
                "value": "f9038263-51ee-42cb-8c93-a9a500336bad"
            },
            {
                "key": "NServiceBus.MessageIntent",
                "value": "Publish"
            },
            {
                "key": "NServiceBus.Version",
                "value": "5.2.14"
            },
            {
                "key": "NServiceBus.TimeSent",
                "value": "2018-11-27 03:07:13:002654 Z"
            },
            {
                "key": "NServiceBus.ContentType",
                "value": "application/json"
            },
            {
                "key": "NServiceBus.EnclosedMessageTypes",
                "value": "xx.Ordering.Contracts.Events.xx, xx.xx.Contracts.Events, Version=67.2018.10.29183, Culture=neutral, PublicKeyToken=null;xx.Ordering.xx.Events.V3.xx, xx.xx.Contracts.Events, Version=67.2018.10.29183, Culture=neutral, PublicKeyToken=null;xx.Ordering.Contracts.Events.V2.IPurchaseOrderCreated, xx.Ordering.Contracts.Events, Version=67.2018.10.29183, Culture=neutral, PublicKeyToken=null"
            },
            {
                "key": "WinIdName",
                "value": "tragiccode\\svc-user"
            },
            {
                "key": "NServiceBus.RelatedTo",
                "value": "9fb074ae-064a-49f6-9bb3-a9a400336e35"
            },
            {
                "key": "NServiceBus.ConversationId",
                "value": "949a86ca-2bb2-46a8-8186-a9a400336b24"
            },
            {
                "key": "NServiceBus.RabbitMQ.CallbackQueue",
                "value": "Soccer.Host.2-XX-ZM01"
            },
            {
                "key": "NServiceBus.OriginatingMachine",
                "value": "2-XX-ZM01"
            },
            {
                "key": "NServiceBus.OriginatingEndpoint",
                "value": "Baseball.Host"
            },
            {
                "key": "NServiceBus.ReplyToAddress",
                "value": "Soccer.Host"
            },
            {
                "key": "NServiceBus.ProcessingStarted",
                "value": "2018-11-27 03:07:13:277078 Z"
            },
            {
                "key": "NServiceBus.ProcessingEnded",
                "value": "2018-11-27 03:07:13:277078 Z"
            },
            {
                "key": "NServiceBus.ProcessingMachine",
                "value": "2-XX-ZM01"
            },
            {
                "key": "NServiceBus.ProcessingEndpoint",
                "value": "Soccer.Host"
            },
            {
                "key": "NServiceBus.OriginatingAddress",
                "value": "Baseball.Host@2-XX-ZM01"
            }
        ],
        "id": "b843006a-3997-b114-0735-6b56670b004f",
        "instance_id": "aHR0cDovL3NlcnZpY2Vjb250cm9sLXByb2QuYmxpbmRzLmNvbTozMzMzMy9hcGk.",
        "is_system_message": false,
        "message_id": "f9038263-51ee-42cb-8c93-a9a500336bad",
        "message_intent": "publish",
        "message_type": "XX.FFF.Contracts.Events.XXX",
        "processed_at": "2018-11-27T03:07:13.277078Z",
        "processing_time": "00:00:00",
        "receiving_endpoint": {
            "host": "2-XX-ZM01",
            "host_id": "0f3a0d10-1ff6-b850-17c8-1951c6ea24e7",
            "name": "Baseball.Host"
        },
        "sending_endpoint": {
            "host": "2-P1-APP01",
            "host_id": "a753ed04-9212-624d-229f-8fa480a367da",
            "name": "GG.FFF.Host"
        },
        "status": "successful",
        "time_sent": "2018-11-27T03:07:13.002654Z"
    },
TraGicCode commented 5 years ago

EndPoint:

curl http://<baseurl>:33333/api/endpoints/Soccer.Host/errors

Description:

Error messages for a given host

Get data later
TraGicCode commented 5 years ago

Endpoint:

curl http://<baseurl>:33333/api/customchecks?status=fail

Description:

View information on custom checks such as failures and passes etc.

    {
        "category": "ServiceControl Health",
        "custom_check_id": "Audit Message Ingestion",
        "failure_reason": "One or more audit messages have failed to import properly into ServiceControl and have been stored in the ServiceControl database.\r\nThe import of these messages could have failed for a number of reasons and ServiceControl is not able to automatically reimport them. For guidance on how to resolve this see https://docs.particular.net/servicecontrol/import-failed-audit-messages",
        "id": "436b127d-1b79-339d-ea9c-8f5ec2fa47af",
        "originating_endpoint": {
            "host": "XXX-01",
            "host_id": "c22a13b0-989a-0c81-625a-d7feac53a1b1",
            "name": "Particular.ServiceControl.prod"
        },
        "reported_at": "2018-11-27T03:13:55.7986642Z",
        "status": "fail"
    },
    {
        "category": "ServiceControl Health",
        "custom_check_id": "Error Message Ingestion",
        "failure_reason": "One or more error messages have failed to import properly into ServiceControl and have been stored in the ServiceControl database.\r\nThe import of these messages could have failed for a number of reasons and ServiceControl is not able to automatically reimport them. For guidance on how to resolve this see https://docs.particular.net/servicecontrol/import-failed-audit-messages",
        "id": "20e42db3-f204-1a5a-01ec-a71058eddf56",
        "originating_endpoint": {
            "host": "XXX-001",
            "host_id": "c22a13b0-989a-0c81-625a-d7feac53a1b1",
            "name": "Particular.ServiceControl.prod"
        },
        "reported_at": "2018-11-27T03:13:55.7986642Z",
        "status": "fail"
    },
    {
        "category": "3rd Party",
        "custom_check_id": "EmailPeriodicCheck",
        "id": "d5c9aa61-13f9-3f19-5c55-74819b464f98",
        "originating_endpoint": {
            "host": "AZ-XXX-AP002",
            "host_id": "2b9ede3f-4fb9-5bde-35d6-578eb209ecbb",
            "name": "XX.Soccer.Host"
        },
        "reported_at": "2018-11-27T03:17:31.6755793Z",
        "status": "pass"
    },

Valid Values for attributes:

status=fail/pass