{"id":15625725,"url":"https://github.com/daniel15/prometheus-net.systemmetrics","last_synced_at":"2025-04-14T00:00:30.399Z","repository":{"id":48071464,"uuid":"264114521","full_name":"Daniel15/prometheus-net.SystemMetrics","owner":"Daniel15","description":"Export system metrics (CPU usage, disk usage, etc) to Prometheus from your .NET app","archived":false,"fork":false,"pushed_at":"2024-05-16T16:47:02.000Z","size":87,"stargazers_count":36,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T19:21:42.903Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/Daniel15.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":"2020-05-15T06:29:03.000Z","updated_at":"2025-04-05T14:37:44.000Z","dependencies_parsed_at":"2024-06-11T18:55:40.463Z","dependency_job_id":null,"html_url":"https://github.com/Daniel15/prometheus-net.SystemMetrics","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":"0.19999999999999996","last_synced_commit":"6caea5a5561b1999b49d96d69b79df893c0aca98"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Fprometheus-net.SystemMetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Fprometheus-net.SystemMetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Fprometheus-net.SystemMetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2Fprometheus-net.SystemMetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daniel15","download_url":"https://codeload.github.com/Daniel15/prometheus-net.SystemMetrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799931,"owners_count":21163403,"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-03T10:02:19.514Z","updated_at":"2025-04-14T00:00:30.246Z","avatar_url":"https://github.com/Daniel15.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prometheus-net SystemMetrics\n\n[![NuGet version](http://img.shields.io/nuget/v/prometheus-net.SystemMetrics.svg)](https://www.nuget.org/packages/prometheus-net.SystemMetrics/)\u0026nbsp;\n![Build Status](https://img.shields.io/github/workflow/status/Daniel15/prometheus-net.SystemMetrics/Build)\n\nprometheus-net SystemMetrics allows you to export various system metrics (such as CPU usage, disk usage, etc) from your .NET application to Prometheus. It is designed to be a very lightweight alternative to `node_exporter`, only containing essential metrics. This is useful on systems with limited RAM or where it is easier to add this library to your app instead of deploying a totally separate service.\n\n# Usage\n\nInstall the `prometheus-net.SystemMetrics` library using NuGet.\n\nAdd the services to your `Startup.cs`:\n\n```csharp\nusing Prometheus.SystemMetrics;\n\npublic void ConfigureServices(IServiceCollection services)\n{\n    // ...\n    services.AddSystemMetrics();\n}\n```\n\nIf you have not already done so, you will also need to expose the Prometheus metrics endpoint by calling `MapMetrics` in `Configure`:\n\n```csharp\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n    // ...\n    app.UseRouting();\n    app.UseEndpoints(endpoints =\u003e\n    {\n        endpoints.MapMetrics();\n        // ...\n    });\n}\n```\n\nAfter doing this, going to `/metrics` should return the new metrics.\n\n## Customization\n\nBy default, this will add all the collectors. To only add some collectors, you can instead only render the collectors you want to use:\n\n```csharp\nservices.AddSystemMetrics(registerDefaultCollectors: false);\nservices.AddSystemMetricCollector\u003cCpuUsageCollector\u003e();\n```\n\n# Metrics\n\nWhere possible, metrics have the same name and format as `node_exporter`.\n\n## CPU\n\nThe number of seconds the CPU has spent in each mode (system, user, idle, etc). Available on **Linux** and **Windows**. Example data:\n\n```\nnode_cpu_seconds_total{cpu=\"0\",mode=\"system\"} 172.35\nnode_cpu_seconds_total{cpu=\"0\",mode=\"user\"} 292.27\nnode_cpu_seconds_total{cpu=\"0\",mode=\"idle\"} 30760.4\n```\n\n## Disk\n\nThe amount of free disk space on all mounts. Available on **all platforms**. Example data:\n\n```\n# Linux\nnode_filesystem_avail_bytes{mountpoint=\"/\",fstype=\"ext4\"} 57061916672\n\n# Windows\nnode_filesystem_avail_bytes{mountpoint=\"C:\\\\\",fstype=\"NTFS\"} 101531594752\n```\n\n## Load Average\n\nAvailable on **Linux**. Example data:\n\n```\nnode_load1 0.06\nnode_load5 0.03\nnode_load15 0.26\n```\n\n## Memory\n\nStats such as available RAM, RAM used by caches, etc. Available on **Linux** and **Windows**. Example data:\n\n```\nnode_memory_MemAvailable_bytes 1527701504\nnode_memory_Cached_bytes 572964864\nnode_memory_MemFree_bytes 961966080\nnode_memory_MemTotal_bytes 2085904384\n```\n\n## Network\n\nTotal amount of data sent and received over the network. Available on **all platforms**. Example data:\n\n```\nnode_network_transmit_bytes_total{device=\"eth0\"} 3053723\nnode_network_receive_bytes_total{device=\"eth0\"} 5822231\n```\n\n# Changelog\n\n## 3.0.0 - 30th November 2023\n\n* Bumped to .NET 8.0.\n* Bumped prometheus-net dependency to version 8.\n* Wrapped metric collector creation in try-catch so that one collector failing doesn't break the whole app.\n* Updated Windows memory counters so their names more closely match the Linux version. Notably, `node_memory_MemFree` is now `node_memory_MemAvailable_bytes`, and `node_memory_MemTotal` is now `node_memory_MemTotal_bytes`. Currently, both the old and new counters exist (for backwards compatibility), but the old ones will be removed in the next major version.\n\n## 2.0.0 - 8th October 2021\n\n* Added memory and CPU collectors for Windows (thanks to @masterworgen for the initial implementation in PR #3).\n* Added .NET Framework 4.6.2 builds, since prometheus-net itself supports this framework version.\n\n## 1.0.1 - 17th May 2020\n\n* Added memory stats for Linux.\n* Added total file size to disk collector.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Fprometheus-net.systemmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel15%2Fprometheus-net.systemmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Fprometheus-net.systemmetrics/lists"}