{"id":18464954,"url":"https://github.com/shadowy-pycoder/go-node-collector","last_synced_at":"2025-09-10T00:33:18.041Z","repository":{"id":251015069,"uuid":"836142319","full_name":"shadowy-pycoder/go-node-collector","owner":"shadowy-pycoder","description":"Prometheus collector for  hardware and OS metrics exposed by *NIX kernels.","archived":false,"fork":false,"pushed_at":"2024-08-02T03:29:04.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-08T12:07:28.055Z","etag":null,"topics":["collector","golang","kernel","linux","metrics","observability","prometheus","prometheus-collector","stats"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/shadowy-pycoder/go-node-collector/collector","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/shadowy-pycoder.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":"2024-07-31T08:33:57.000Z","updated_at":"2025-05-20T17:02:34.000Z","dependencies_parsed_at":"2024-07-31T10:03:30.062Z","dependency_job_id":"e7394b76-fed2-4f2d-83ef-40fce51d368a","html_url":"https://github.com/shadowy-pycoder/go-node-collector","commit_stats":null,"previous_names":["shadowy-pycoder/go-node-collector"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/shadowy-pycoder/go-node-collector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowy-pycoder%2Fgo-node-collector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowy-pycoder%2Fgo-node-collector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowy-pycoder%2Fgo-node-collector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowy-pycoder%2Fgo-node-collector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shadowy-pycoder","download_url":"https://codeload.github.com/shadowy-pycoder/go-node-collector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shadowy-pycoder%2Fgo-node-collector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267914774,"owners_count":24164791,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":["collector","golang","kernel","linux","metrics","observability","prometheus","prometheus-collector","stats"],"created_at":"2024-11-06T09:11:37.422Z","updated_at":"2025-07-30T18:10:01.600Z","avatar_url":"https://github.com/shadowy-pycoder.png","language":"Go","readme":"# Prometheus Node Collector\n\nPrometheus collector for [prometheus golang client](https://github.com/prometheus/client_golang) \nthat collects hardware and OS metrics exposed by \\*NIX kernels.\n\nThis library is a modification heavily based on [Prometheus Node Exporter](https://github.com/prometheus/node_exporter)\n\nFor now, only Ubuntu-based distributions are supported.\n\n# Supported Collectors\n\n- cpu | Exposes CPU statistics\n- cpufreq | Exposes CPU frequency statistics\n- diskstats | Exposes disk I/O statistics\n- filesystem | Exposes filesystem statistics, such as disk space used\n- meminfo | Exposes memory statistics\n- systemd | Exposes systemd statistics\n- thermal_zone | Exposes thermal zone \u0026 cooling device statistics from `/sys/class/thermal`\n\n# Usage\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/signal\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"github.com/prometheus/client_golang/prometheus\"\n\t\"github.com/prometheus/client_golang/prometheus/promhttp\"\n\t\"github.com/shadowy-pycoder/go-node-collector/collector\"\n)\n\nfunc main() {\n\tnc, err := collector.NewNodeCollector()\n\t// By default, it gathers all metrics, but specific collectors can be selected \n\t// Example: nc, err := collector.NewNodeCollector(\"cpu\", \"systemd\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tprometheus.DefaultRegisterer.MustRegister(nc)\n\tport := 9100\n\tsm := http.NewServeMux()\n\tsm.Handle(\"/metrics\", promhttp.Handler())\n\tbindAddress := fmt.Sprintf(\":%d\", port)\n\ts := http.Server{\n\t\tAddr:         bindAddress,       // configure the bind address\n\t\tHandler:      sm,                // set the default handler\n\t\tReadTimeout:  5 * time.Second,   // max time to read request from the client\n\t\tWriteTimeout: 10 * time.Second,  // max time to write response to the client\n\t\tIdleTimeout:  120 * time.Second, // max time for connections using TCP Keep-Alive\n\t}\n\n\tgo func() {\n\t\tlog.Printf(\"Starting server on port %d\", port)\n\n\t\terr := s.ListenAndServe()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}()\n\t// trap sigterm or interupt and gracefully shutdown the server\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGINT, syscall.SIGTERM)\n\n\t// Block until a signal is received.\n\tsig := \u003c-c\n\tlog.Println(\"Got signal:\", sig)\n\n\t// gracefully shutdown the server, waiting max 30 seconds for current operations to complete\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\ts.Shutdown(ctx)\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowy-pycoder%2Fgo-node-collector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowy-pycoder%2Fgo-node-collector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowy-pycoder%2Fgo-node-collector/lists"}