VOOZH about

URL: https://www.nuget.org/packages/prometheus-net.SystemMetrics/

⇱ NuGet Gallery | prometheus-net.SystemMetrics 3.1.0




👁 Image
prometheus-net.SystemMetrics 3.1.0

dotnet add package prometheus-net.SystemMetrics --version 3.1.0
 
 
NuGet\Install-Package prometheus-net.SystemMetrics -Version 3.1.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="prometheus-net.SystemMetrics" Version="3.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="prometheus-net.SystemMetrics" Version="3.1.0" />
 
Directory.Packages.props
<PackageReference Include="prometheus-net.SystemMetrics" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add prometheus-net.SystemMetrics --version 3.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: prometheus-net.SystemMetrics, 3.1.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package prometheus-net.SystemMetrics@3.1.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=prometheus-net.SystemMetrics&version=3.1.0
 
Install as a Cake Addin
#tool nuget:?package=prometheus-net.SystemMetrics&version=3.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

prometheus-net SystemMetrics

👁 NuGet version
  👁 Build Status

prometheus-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.

Usage

Install the prometheus-net.SystemMetrics library using NuGet.

Add the services to your Startup.cs:

using Prometheus.SystemMetrics;

public void ConfigureServices(IServiceCollection services)
{
 // ...
 services.AddSystemMetrics();
}

If you have not already done so, you will also need to expose the Prometheus metrics endpoint by calling MapMetrics in Configure:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
 // ...
 app.UseRouting();
 app.UseEndpoints(endpoints =>
 {
 endpoints.MapMetrics();
 // ...
 });
}

After doing this, going to /metrics should return the new metrics.

Customization

By default, this will add all the collectors. To only add some collectors, you can instead only render the collectors you want to use:

services.AddSystemMetrics(registerDefaultCollectors: false);
services.AddSystemMetricCollector<CpuUsageCollector>();

Metrics

Where possible, metrics have the same name and format as node_exporter.

CPU

The number of seconds the CPU has spent in each mode (system, user, idle, etc). Available on Linux and Windows. Example data:

node_cpu_seconds_total{cpu="0",mode="system"} 172.35
node_cpu_seconds_total{cpu="0",mode="user"} 292.27
node_cpu_seconds_total{cpu="0",mode="idle"} 30760.4

Disk

The amount of free disk space on all mounts. Available on all platforms. Example data:

# Linux
node_filesystem_avail_bytes{mountpoint="/",fstype="ext4"} 57061916672

# Windows
node_filesystem_avail_bytes{mountpoint="C:\\",fstype="NTFS"} 101531594752

Load Average

Available on Linux. Example data:

node_load1 0.06
node_load5 0.03
node_load15 0.26

Memory

Stats such as available RAM, RAM used by caches, etc. Available on Linux and Windows. Example data:

node_memory_MemAvailable_bytes 1527701504
node_memory_Cached_bytes 572964864
node_memory_MemFree_bytes 961966080
node_memory_MemTotal_bytes 2085904384

Network

Total amount of data sent and received over the network. Available on all platforms. Example data:

node_network_transmit_bytes_total{device="eth0"} 3053723
node_network_receive_bytes_total{device="eth0"} 5822231

Changelog

3.0.0 - 30th November 2023

  • Bumped to .NET 8.0.
  • Bumped prometheus-net dependency to version 8.
  • Wrapped metric collector creation in try-catch so that one collector failing doesn't break the whole app.
  • 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.

2.0.0 - 8th October 2021

  • Added memory and CPU collectors for Windows (thanks to @masterworgen for the initial implementation in PR #3).
  • Added .NET Framework 4.6.2 builds, since prometheus-net itself supports this framework version.

1.0.1 - 17th May 2020

  • Added memory stats for Linux.
  • Added total file size to disk collector.
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 is compatible.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (14)

Showing the top 5 NuGet packages that depend on prometheus-net.SystemMetrics:

Package Downloads
Oms.Framework

Update page result

Genocs.Metrics

Metrics abstractions and instrumentation contracts for Genocs applications.

Convey.Metrics.Prometheus

Convey.Metrics.Prometheus

NPitaya

A full implementation of pitaya backend framework for .NET

Jakar.Database

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on prometheus-net.SystemMetrics:

Repository Stars
slskd/slskd
A modern client-server application for the Soulseek file sharing network.
snatch-dev/Convey
A simple recipe for .NET Core microservices.
Version Downloads Last Updated
3.1.0 1,431,023 1/22/2024
3.0.0 102,465 12/1/2023
2.0.0 2,435,725 8/9/2021
1.0.1 629,805 5/17/2020
1.0.0 4,134 5/15/2020