{"id":17543206,"url":"https://github.com/shonenada/prober-server","last_synced_at":"2025-04-24T00:01:35.905Z","repository":{"id":54304984,"uuid":"306547077","full_name":"shonenada/prober-server","owner":"shonenada","description":"Prober Server","archived":false,"fork":false,"pushed_at":"2021-03-12T17:28:28.000Z","size":35,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T04:51:12.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shonenada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-23T06:22:20.000Z","updated_at":"2022-01-21T06:22:43.000Z","dependencies_parsed_at":"2022-08-13T11:30:57.815Z","dependency_job_id":null,"html_url":"https://github.com/shonenada/prober-server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shonenada%2Fprober-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shonenada%2Fprober-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shonenada%2Fprober-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shonenada%2Fprober-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shonenada","download_url":"https://codeload.github.com/shonenada/prober-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535030,"owners_count":21446506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-21T00:23:16.581Z","updated_at":"2025-04-24T00:01:35.035Z","avatar_url":"https://github.com/shonenada.png","language":"Go","readme":"# Prober Server\n\nProber Server probe your services deploy in kubernetes as a sidecar.\n\n## Run in your host\n\n```sh\n$ export PROBER_SERVER_PORT=\"9078\"\n$ export PROBER_DURATION=\"5s\"\n$ export PROBER_RETRY=\"5\"\n$ export PROBER_TYPE=\"HTTP\"\n$ export PROBER_HTTP_URL=\"http://example.com/healthcheck\"\n$ go run main.go\n2020/10/23 14:34:56 Env `PROBER_HTTP_TIMEOUT` is not set, using default value 30\n2020/10/23 14:34:56 Prober server running in `HTTP` type; Probe Duration: 5s\n2020/10/23 14:34:56 HTTP URL: http://example.com:5000/healthcheck; HTTP Timeout: 30\n2020/10/23 14:35:26 STATUS: RETRYING - 2020-10-23 06:35:26.304173 +0000 UTC\n2020/10/23 14:36:01 STATUS: RETRYING - 2020-10-23 06:36:01.312028 +0000 UTC\n2020/10/23 14:36:36 STATUS: RETRYING - 2020-10-23 06:36:36.31496 +0000 UTC\n2020/10/23 14:37:11 STATUS: FAILED - 2020-10-23 06:37:11.320504 +0000 UTC\n```\n\nThen you can get the status by HTTP API:\n\n```sh\n$ curl http://localhost:9078\n{\"code\":0,\"status\":\"SUCCESS\",\"last_status\":\"PENDING\",\"message\":\"\",\"retry_time\":0,\"last_updated\":\"2020-10-23T06:32:49.779909Z\"}\n\n$ curl http://localhost:9078\n{\"code\":1,\"status\":\"RETRYING\",\"last_status\":\"SUCCESS\",\"message\":\"Get \\\"http://example.com:5000/healthcheck\\\": dial tcp 93.184.216.34:5000: i/o timeout\",\"retry_time\":1,\"last_updated\":\"2020-10-23T06:35:26.304172Z\"}\n\n$ curl http://localhost:9078\n{\"code\":2,\"status\":\"FAILED\",\"last_status\":\"RETRYING\",\"message\":\"Get \\\"http://example.com:5000/healthcheck\\\": dial tcp 93.184.216.34:5000: i/o timeout\",\"retry_time\":4,\"last_updated\":\"2020-10-23T06:39:17.679375Z\"}\n```\n\n## Using docker\n\n```sh\n$ docker build --tag prober-server:latest .\n$ docker run -tid --name prober-server -p 9078:9078 \\\n  -e PROBER_TYPE=http \\\n  -e PROBER_DURATION=5s \\\n  -e PROBER_RETRY=5 \\\n  -e PROBER_HTTP_URL=\"http://example.com/healthcheck\" \\\n  prober-server:latest\n```\n\n## TCP and UDP\n\nYou can also probe TCP service by set `PROBER_TYPE` environment variables:\n\n```sh\n$ export PROBER_SERVER_PORT=\"9078\"\n$ export PROBER_DURATION=\"5s\"\n$ export PROBER_RETRY=\"5\"\n$ export PROBER_TYPE=\"TCP\"    # this changed\n$ export PROBER_TCP_HOST=\"example.com\"\n$ export PROBER_TCP_PORT=\"8080\"\n$ go run main.go\n```\n\nAnd UDP service by:\n\n```sh\n$ export PROBER_SERVER_PORT=\"9078\"\n$ export PROBER_DURATION=\"5s\"\n$ export PROBER_RETRY=\"5\"\n$ export PROBER_TYPE=\"UDP\"    # this changed\n$ export PROBER_UDP_HOST=\"example.com\"\n$ export PROBER_UDP_PORT=\"4093\"\n$ go run main.go\n```\n\n## Adding Webhook\n\nYou can setup webhook URL for recieving result of prober. To achieve webhook\njust setup `PROBER_NAME` and `PROBER_WEBHOOK` environment variables.\n\nNOTE: `PROBER_NAME` is set for identity your service.\n\n\n```sh\n$ export PROBER_NAME=\"YOUR_SERVER\"\n$ export PROBER_WEBHOOK=\"http://your-webhook.com\"\n```\n\nThen you will recieve a POST Request with following payload:\n\n```json\n{\n  \"code\": 1,\n  \"last_updated\": \"2020-10-23T10:21:05.312644Z\",\n  \"message\": \"Get \\\"http://localhost:80\\\": dial tcp [::1]:80: connect: connection refused\",\n  \"name\": \"NGINX\",\n  \"retry_times\": 1,\n  \"status\": \"RETRYING\",\n  \"last_status\": \"PENDING\"\n}\n```\n\n## Custom HTTP headers and body\n\nBy setting `PROBER_CONFIG`, you can setup custom headers and body\n\n```sh\n$ cat \u003c\u003c EOF \u003e /tmp/config.yaml\nversion: \"1\"\nheaders:\n  Content-Type: application/json;charset=utf-8\n  User-Agent: My-Prober\nbody:\n  template: |\n    {\n      \"text\": \"{{ .Name }} change to {{ .Status }} from {{ .LastStatus }}at {{ .LastUpdated }}\"\n    }\nEOF\n\n$ export PROBER_CONFIG=/tmp/config.yaml\n$ go run main.go\n```\n\nThen you will recieve a HTTP POST Request like:\n\n```\nPOST / HTTP/1.1\nHost: example.com:8080\nUser-Agent: My-Prober\nContent-Length: 73\nContent-Type: application/json;charset=utf-7\nAccept-Encoding: gzip\n\n{\n  \"text\": \"SomeService change to RETRYING from PENDING at 2021-02-20 09:39:12.002609 +0000 UTC\"\n}\n```\n\n## Only trigger webhook on status changes\n\nSet `PROBER_TRIGGER_ON_STATUS_CHANGE` to be `\"true\"` may make prober-server\nPOST to webhook only when status changed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonenada%2Fprober-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshonenada%2Fprober-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonenada%2Fprober-server/lists"}