{"id":22066090,"url":"https://github.com/pcpratheesh/go-healthwatch","last_synced_at":"2026-05-06T21:31:56.017Z","repository":{"id":183434290,"uuid":"670017249","full_name":"pcpratheesh/go-healthwatch","owner":"pcpratheesh","description":"Go-HealthWatch is a lightweight Golang package that can be used to monitor the health of applications/services.","archived":false,"fork":false,"pushed_at":"2023-07-24T18:12:28.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T00:41:38.228Z","etag":null,"topics":["docker","docker-compose","golang","health-check","healthcheck"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/pcpratheesh/go-healthwatch","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcpratheesh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-24T05:43:34.000Z","updated_at":"2023-07-24T12:43:35.000Z","dependencies_parsed_at":"2024-11-30T19:27:53.552Z","dependency_job_id":"38e88cde-bab4-4197-a921-d77e09c2b0b4","html_url":"https://github.com/pcpratheesh/go-healthwatch","commit_stats":null,"previous_names":["pcpratheesh/go-healthwatch"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pcpratheesh/go-healthwatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-healthwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-healthwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-healthwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-healthwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcpratheesh","download_url":"https://codeload.github.com/pcpratheesh/go-healthwatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcpratheesh%2Fgo-healthwatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32712669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T19:35:05.142Z","status":"ssl_error","status_checked_at":"2026-05-06T19:35:03.996Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","docker-compose","golang","health-check","healthcheck"],"created_at":"2024-11-30T19:25:39.812Z","updated_at":"2026-05-06T21:31:56.002Z","avatar_url":"https://github.com/pcpratheesh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-healthwatch\nGo-HealthWatch is a lightweight Golang package that provides health check functionality for applications and services. It allows you to monitor the health of various components, such as external APIs, databases, caches, and more. With GoHealthWatch, you can easily set up health checks and receive notifications when any issues arise.\n\n## Installation\nTo install GoHealthWatch, use the following command:\n```\ngo get github.com/pcpratheesh/go-healthwatch\n```\n\n## Usage\n### Creating a Health Check\n\nTo create a health check, you can use the `NewChecker` function and provide the necessary options. You can specify the health checks to be performed and configure a service status notification webhook.\n\n```go\nhealthchecker := gohealthwatch.NewChecker(\n    gohealthwatch.WithIntegrations([]gohealthwatch.HealthCheckConfig{\n        {\n            Name:       \"public-entries\",\n            URL:        \"https://api.publicapis.org/entries\",\n            Type:       constants.External,\n            StatusCode: http.StatusOK,\n            Interval:   time.Second * 1,\n        },\n    }),\n)\n```\n\n### HealthCheckConfig\n\nThis is a configuration struct used to hold the settings for a health check. It contains the following fields: \n\nField | Description | required\n--- | --- | --- \nName | The unique name of the health check | True\nURL | The URL to check. This can be anything like an external API URL, database URL, cache URL, etc | True\nType | The type of the health check, which can be one of the constants defined in the constants.Kind enum | True\nInterval | The interval duration for the health check in seconds | False\nHTTPHeader | An array of HTTP headers to include in the health check request | False\nStatusCode | The expected HTTP status code for the health check response | True\n\n### Run your own Checks for individual checklist\n\nYou can also override the checks to the health check configuration using the `AddCheck` method. This allows you to override checks based on your specific requirements.\n\nThe first argument in the checker.AddCheck() function should be the name of the health check. The second argument is a callback function that takes a `HealthCheckConfig` object as input and returns an `errors.Error` object.\n\n```go\nchecker.AddCheck(\"public-entries\", func(check gohealthwatch.HealthCheckConfig) errors.Error {\n    return errors.New(\"trigger-failure\", \"\")\n})\n```\n\n\n### Performing Health Checks\n\nTo perform the health checks, simply call the `Check` method on the `HealthCheck` instance.\n```go\nchecker.Check()\n```\n\n\n### Service Status Notification WebHook\n\nThe `WithServiceStatusWebHook` function is used to configure a service status notification webhook for the `HealthCheck` struct. It takes a callback function as an argument, which is invoked when a health check status changes.\n\n```go\ngohealthwatch.WithServiceStatusWebHook(func(check gohealthwatch.HealthCheckConfig, statusCode constants.HealthCheckStatus, err errors.Error) {\n    switch statusCode {\n    case constants.Success:\n        logrus.Infof(\"Custom Handler [%v] health check success\\n\", check.GetName())\n    case constants.Failure:\n        logrus.Errorf(\"Custom Handler  [%v] service check failing due to : %v\", check.GetName(), err.Reason())\n    }\n})\n```\n\nThis allows you to customize the behavior when a health check status changes. You can perform actions such as logging, sending notifications, or triggering other processes based on the status and error information.\n\n\n## Example\nSee more samples at [here](/example/)\n\n## Contributing\nContributions to GoHealthWatch are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.\n\n## License\nGoHealthWatch is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcpratheesh%2Fgo-healthwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcpratheesh%2Fgo-healthwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcpratheesh%2Fgo-healthwatch/lists"}