--- title: "http/rest collector examples" slug: "http-collector" updated: 2021-10-07T07:02:28Z published: 2021-10-07T07:02:28Z canonical: "kb.secomea.com/http-collector" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.secomea.com/llms.txt > Use this file to discover all available pages before exploring further. # http/rest collector examples ## Summary: The purpose of this article is to give a some examples of how to use the http/rest collector ## A full config with different http/rest colletors: This section will be dedicated to a thorough explanation of the topic. ```json { "ConfigName" : "SDCC_SIM", "ConfigDescription" : "Example configuration w/http collector", "CheckpointInterval" : 600, "WaitForNTP" : true, "Collectors" : [ { "comment": "Collecting from JSON formatted webserver", "CollectorDescription": "Production simulation", "CollectorName": "production1", "ConnectRetryMax": 240, "ConnectRetryMin": 20, "HTTPGETAccess": { "HTTPGETTimeout": 4000, "HTTPGETs": [ { "HTTPGETFormat": "json", "HTTPGETID": 1, "HTTPGETSampleInterval": 10, "HTTPGETUrl": "http://10.0.0.249/index.php" } ] }, "Protocol": "Http/GET", "SamplePoints": [ { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/batch_id" }, "SampleDBPriority": 99, "SampleDataType": "string", "SampleDescription": "The batch ID", "SampleName": "batch_number", "SamplesSaved":2, "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/temp_sensor1" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Sensor 1 temperature", "SampleName": "temp_sensor1", "SamplesSaved":2, "SampleUnit": "C" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/rounds" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Number of cycles", "SampleName": "cycles", "SamplesSaved":2, "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/pressure" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Pressure in valve1", "SampleName": "pressure_valve1", "SamplesSaved":2, "SampleUnit": "Pa" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/strokes" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Number of strokes", "SampleName": "strokes_min", "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/power_consumption" }, "SampleDBPriority": 99, "SampleDataType": "double", "SampleDescription": "Power consumption", "SampleName": "power_consumption", "SampleUnit": "A" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/status" }, "SampleDBPriority": 99, "SampleDataType": "string", "SampleDescription": "Status", "SampleName": "status", "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/total_count" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Total units", "SampleName": "total_count", "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/failures" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Number of unit failures", "SampleName": "failures", "SampleUnit": "" }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/runtime" }, "SampleDBPriority": 99, "SampleDataType": "int16", "SampleDescription": "Runtime", "SampleName": "runtime", "SampleUnit": "" } ] }, { "comment": "Collecting from a simple JSON formatted webserver", "CollectorDescription": "Production simulation", "CollectorName": "fake", "ConnectRetryMax": 240, "ConnectRetryMin": 20, "HTTPGETAccess": { "HTTPGETTimeout": 2000, "HTTPGETs": [ { "HTTPGETFormat": "json", "HTTPGETID": 1, "HTTPGETSampleInterval": 2, "HTTPGETUrl": "http://10.0.0.249/fake.html" } ] }, "Protocol": "Http/GET", "SamplePoints": [ { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/status" }, "SampleDataType": "string", "SampleDescription": "PLC status", "SampleName": "PLCStatus", "SamplesSaved": 30 } ] }, { "comment": "Collecting from a simple JSON formatted webserver", "CollectorDescription": "Production simulation 2", "CollectorName": "fake2", "ConnectRetryMax": 240, "ConnectRetryMin": 20, "HTTPGETAccess": { "HTTPGETTimeout": 2000, "HTTPGETs": [ { "HTTPGETFormat": "raw", "HTTPGETID": 1, "HTTPGETSampleInterval": 2, "HTTPGETUrl": "http://10.0.0.249/fake2.html" } ] }, "Protocol": "Http/GET", "SamplePoints": [ { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/Heading" }, "SampleDataType": "string", "SampleDescription": "PLC status", "SampleName": "PLCStatusSTRING", "SamplesSaved": 30 }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/Heading" }, "SampleDataType": "data", "SampleDescription": "PLC status", "SampleName": "PLCStatusDATA", "SamplesSaved": 30 } ] }, { "CollectorDescription": "Production simulation", "CollectorName": "fakeGPS1", "ConnectRetryMax": 240, "ConnectRetryMin": 20, "HTTPGETAccess": { "HTTPGETTimeout": 2000, "HTTPGETs": [ { "HTTPGETFormat": "json", "HTTPGETID": 1, "HTTPGETSampleInterval": 2, "HTTPGETUrl": "http://10.0.0.249/fakeGPS.html" } ] }, "Protocol": "Http/GET", "SamplePoints": [ { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/lat" }, "SampleDataType": "double", "SampleDescription": "PLC status", "SampleName": "LAT", "SamplesSaved": 30 }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/lon" }, "SampleDataType": "double", "SampleDescription": "PLC status", "SampleName": "LONG", "SamplesSaved": 30 } ] }, { "comment": "Collecting from a XML formatted webserver", "CollectorDescription": "Production simulation", "CollectorName": "fakeXML", "ConnectRetryMax": 240, "ConnectRetryMin": 20, "HTTPGETAccess": { "HTTPGETTimeout": 2000, "HTTPGETs": [ { "HTTPGETFormat": "xml", "HTTPGETID": 1, "HTTPGETSampleInterval": 2, "HTTPGETUrl": "http://10.0.0.249/fakeXML.html" } ] }, "Protocol": "Http/GET", "SamplePoints": [ { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/value1" }, "SampleDataType": "string", "SampleDescription": "version", "SampleName": "version", "SamplesSaved": 30 }, { "HTTPGETValue": { "HTTPGETREF": 1, "Select": "/value2" }, "SampleDataType": "string", "SampleDescription": "number", "SampleName": "number", "SamplesSaved": 30 } ] } ], "DataServers" : [ { "ConnectRetryMax": 12, "ConnectRetryMin": 2, "DatasrvName": "DCC", "DatasrvProtocol": "SCI/SPD", "SCISPDParams": { "PushInterval": 1, "SCIServerAddr": "dcm-dcc.secomea.com", "SPDPort": 443, "Security": "TLS1.2", "RootCAName": "DCC CA Certificate", "DevCertName": "DCC Certificate", "DevPkeyName": "DCC Private Key" } } ] } ``` ###