{"id":20541044,"url":"https://github.com/netways/go-check","last_synced_at":"2026-03-01T04:09:51.887Z","repository":{"id":38095636,"uuid":"263356522","full_name":"NETWAYS/go-check","owner":"NETWAYS","description":"A Golang library to create monitoring plugins for Icinga","archived":false,"fork":false,"pushed_at":"2026-02-18T15:13:28.000Z","size":249,"stargazers_count":15,"open_issues_count":6,"forks_count":4,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-02-18T16:56:42.252Z","etag":null,"topics":["golang","icinga","monitoring","plugin"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/NETWAYS/go-check","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NETWAYS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-05-12T14:12:57.000Z","updated_at":"2026-01-01T18:08:25.000Z","dependencies_parsed_at":"2024-06-03T07:55:51.479Z","dependency_job_id":"d668f405-de03-4307-ab0d-5d6025ba6d6c","html_url":"https://github.com/NETWAYS/go-check","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/NETWAYS/go-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fgo-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fgo-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fgo-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fgo-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NETWAYS","download_url":"https://codeload.github.com/NETWAYS/go-check/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fgo-check/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["golang","icinga","monitoring","plugin"],"created_at":"2024-11-16T01:19:00.134Z","updated_at":"2026-03-01T04:09:51.869Z","avatar_url":"https://github.com/NETWAYS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-check\n========\n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/NETWAYS/go-check?label=version)](https://github.com/NETWAYS/go-check/releases)\n[![GoDoc](https://img.shields.io/static/v1?label=godoc\u0026message=reference\u0026color=blue)](https://pkg.go.dev/github.com/NETWAYS/go-check)\n[![Test Status](https://github.com/NETWAYS/go-check/workflows/Go/badge.svg)](https://github.com/NETWAYS/go-check/actions?query=workflow%3AGo)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/NETWAYS/go-check)\n![GitHub](https://img.shields.io/github/license/NETWAYS/go-check?color=green)\n\ngo-check is a library to help with development of monitoring plugins for tools like Icinga.\n\nSee the [documentation on pkg.go.dev](https://pkg.go.dev/github.com/NETWAYS/go-check) for more details and examples.\n\n# Usage\n\n## Simple Example\n\n```go\npackage main\n\nimport (\n\t\"github.com/NETWAYS/go-check\"\n)\n\nfunc main() {\n\tconfig := check.NewConfig()\n\tconfig.Name = \"check_test\"\n\tconfig.Readme = `Test Plugin`\n\tconfig.Version = \"1.0.0\"\n\n\t_ = config.FlagSet.StringP(\"hostname\", \"H\", \"localhost\", \"Hostname to check\")\n\n\tconfig.ParseArguments()\n\n\t// Some checking should be done here, when --help is not passed\n\tcheck.Exitf(check.OK, \"Everything is fine - answer=%d\", 42)\n\t// Output:\n\t// OK - Everything is fine - answer=42\n}\n```\n\n## Exit Codes\n\n```\ncheck.Exitf(OK, \"Everything is fine - value=%d\", 42) // OK, 0\n\ncheck.ExitRaw(check.Critical, \"CRITICAL\", \"|\", \"percent_packet_loss=100\") // CRITICAL, 2\n\nerr := fmt.Errorf(\"connection to %s has been timed out\", \"localhost:12345\")\n\ncheck.ExitError(err) // UNKNOWN, 3\n```\n\n## Timeout Handling\n\n```\ncheckPluginTimeoutInSeconds := 10\ngo check.HandleTimeout(checkPluginTimeoutInSeconds)\n```\n\n## Thresholds\n\nThreshold objects represent monitoring plugin thresholds that have methods to evaluate if a given input is within the range.\n\nThey can be created with the ParseThreshold parser.\n\nhttps://github.com/monitoring-plugins/monitoring-plugin-guidelines/blob/main/definitions/01.range_expressions.md\n\n```\nwarnThreshold, err := check.ParseThreshold(\"~:3\")\n\nif err != nil {\n    return t, err\n}\n\nif warnThreshold.DoesViolate(3.6) {\n    fmt.Println(\"Not great, not terrible.\")\n}\n```\n\n## Perfdata\n\nThe Perfdata object represents monitoring plugin performance data that relates to the actual execution of a host or service check.\n\nhttps://github.com/monitoring-plugins/monitoring-plugin-guidelines/blob/main/monitoring_plugins_interface/03.Output.md#performance-data\n\n```\nvar pl perfdata.PerfdataList\n\npl.Add(\u0026perfdata.Perfdata{\n    Label: \"process.cpu.percent\",\n    Value: 25,\n    Uom:   \"%\",\n    Warn:  50,\n    Crit:  90,\n    Min:   0,\n    Max:   100})\n\nfmt.Println(pl.String())\n```\n\n## Results\n\n```\nallStates = []int{0,2,3,0,1,2}\n\nswitch result.WorstState(allStates...) {\ncase 0:\n    rc = check.OK\ncase 1:\n    rc = check.Warning\ncase 2:\n    rc = check.Critical\ndefault:\n    rc = check.Unknown\n}\n```\n\n## Partial Results\n\n```\no := Overall{}\no.Add(0, \"Something is OK\")\n\npr := PartialResult{\n    Output: \"My Subcheck\",\n}\n\nif err := pr.SetState(check.OK); err != nil {\n  fmt.Printf(%s, err)\n}\n\no.AddSubcheck(pr)\n\nfmt.Println(o.GetOutput())\n\n// states: ok=1\n// [OK] Something is OK\n// \\_ [OK] My Subcheck\n```\n\n\n# Examples\n\nA few plugins using go-check:\n\n* [check_cloud_aws](https://github.com/NETWAYS/check_cloud_aws)\n* [check_logstash](https://github.com/NETWAYS/check_logstash)\n* [check_sentinelone](https://github.com/NETWAYS/check_sentinelone)\n* [check_sophos_central](https://github.com/NETWAYS/check_sophos_central)\n\n# License\n\nCopyright (c) 2020 [NETWAYS GmbH](mailto:info@netways.de)\n\nThis library is distributed under the GPL-2.0 or newer license found in the [COPYING](./COPYING)\nfile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fgo-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetways%2Fgo-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fgo-check/lists"}